Example #1
0
 //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);
 }
Example #2
0
        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);
        }
Example #3
0
        internal override ParsecError getSysUnexpected()
        {
            string msg = (len == at) ? "EOF" : ("" + src[at]);

            return(ParsecError.raiseSysUnexpected(getIndex(), msg));
        }