//caller should not change input after it is passed in. internal ParserState(Tok[] input, int at, string module, PositionMap pmap, int end_index, string eof_str, ShowToken show) : base(at, module, pmap) { this.input = input; this.sys_unexpected = new ParsecError[input.Length]; this.show = show; this.end_index = end_index; this.eof_unexpected = ParsecError.raiseSysUnexpected( end_index, eof_str); }
private ParsecError getSysUnexpected(int i) { if (i >= sys_unexpected.Length) { return(eof_unexpected); } ParsecError r = sys_unexpected[i]; if (r == null) { Tok ptok = input[i]; r = ParsecError.raiseSysUnexpected(ptok.Index, show(ptok.Token)); sys_unexpected[i] = r; } return(r); }
internal override ParsecError getSysUnexpected() { string msg = (len == at) ? "EOF" : ("" + src[at]); return(ParsecError.raiseSysUnexpected(getIndex(), msg)); }