//--------------------------------------------------------------------- public T Parse(LineReader reader) { Require.ArgumentNotNull(reader); this.reader = reader; this.inputLine = new InputLine(reader); SetCurrentVar(null); try { return(Parse()); } catch (InputValueException valueExc) { if (currentVar == null) { throw new LineReaderException(reader, valueExc); } else { string message = string.Format("Error with the input value for {0}", currentVar.Name); InputVariableException varExc = new InputVariableException(currentVar, message, valueExc); throw new LineReaderException(new FixedLineReader(reader, currentVarLineNum), varExc); } } catch (InputVariableException varExc) { if (varExc.Variable == currentVar) { throw new LineReaderException(new FixedLineReader(reader, currentVarLineNum), varExc); } else { throw new LineReaderException(reader, varExc); } } }
//--------------------------------------------------------------------- /// <summary> /// Initializes a new instance of TextParser. /// </summary> public TextParser() { reader = null; inputLine = null; SetCurrentVar(null); }