Example #1
0
        private void ParseFactor()
        {
            var firstSetOfStatement7 = new[]
            {
                TokenKind.LeftParen, TokenKind.Identifier, TokenKind.NumberLiteral, TokenKind.StringLiteral
            };

            MatchOneOf(firstSetOfStatement7);
            switch (_scanner.CurrentToken.TokenKind)
            {
            case TokenKind.LeftParen:
                Match(TokenKind.LeftParen);
                _scanner.Advance();
                ParseExpression();
                Match(TokenKind.RightParen);
                _scanner.Advance();
                break;

            case TokenKind.Identifier:
                _astBuilder.FactIdent(_scanner.CurrentToken);
                Match(TokenKind.Identifier);
                _scanner.Advance();
                break;

            case TokenKind.NumberLiteral:
            case TokenKind.StringLiteral:
                ParseConstantLiteral();
                break;
            }
        }