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

            if (old.Kind != kind)
                throw new ParseException("Unexpected token: " + current.Kind.ToString() + ". Was expecting: " + kind, current.Line,
                                         current.Column);

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