Exemple #1
0
        Token Consume(TokenKind kind)
        {
            Token old = current;
            current = lexer.Next();

            if (old.TokenKind != kind)
            {
                string msg = string.Format("行{0}列{1}发生模版语法错误: " + current.TokenKind.ToString() + ". 预计为: " + kind, current.Line, current.Col);
                throw new ParseException(msg , current.Line, current.Col);
            }

            return old;
        }
Exemple #2
0
 Token Consume()
 {
     Token old = current;
     current = lexer.Next();
     return old;
 }