Search in sources :

Example 86 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream in project cuba by cuba-platform.

the class JPA2Parser method subquery_from_clause.

// $ANTLR start "subquery_from_clause"
// JPA2.g:223:1: subquery_from_clause : fr= 'FROM' subselect_identification_variable_declaration ( ',' subselect_identification_variable_declaration )* -> ^( T_SOURCES[$fr] ( ^( T_SOURCE subselect_identification_variable_declaration ) )* ) ;
public final JPA2Parser.subquery_from_clause_return subquery_from_clause() throws RecognitionException {
    JPA2Parser.subquery_from_clause_return retval = new JPA2Parser.subquery_from_clause_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token fr = null;
    Token char_literal167 = null;
    ParserRuleReturnScope subselect_identification_variable_declaration166 = null;
    ParserRuleReturnScope subselect_identification_variable_declaration168 = null;
    Object fr_tree = null;
    Object char_literal167_tree = null;
    RewriteRuleTokenStream stream_66 = new RewriteRuleTokenStream(adaptor, "token 66");
    RewriteRuleTokenStream stream_103 = new RewriteRuleTokenStream(adaptor, "token 103");
    RewriteRuleSubtreeStream stream_subselect_identification_variable_declaration = new RewriteRuleSubtreeStream(adaptor, "rule subselect_identification_variable_declaration");
    try {
        // JPA2.g:224:5: (fr= 'FROM' subselect_identification_variable_declaration ( ',' subselect_identification_variable_declaration )* -> ^( T_SOURCES[$fr] ( ^( T_SOURCE subselect_identification_variable_declaration ) )* ) )
        // JPA2.g:224:7: fr= 'FROM' subselect_identification_variable_declaration ( ',' subselect_identification_variable_declaration )*
        {
            fr = (Token) match(input, 103, FOLLOW_103_in_subquery_from_clause2030);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_103.add(fr);
            pushFollow(FOLLOW_subselect_identification_variable_declaration_in_subquery_from_clause2032);
            subselect_identification_variable_declaration166 = subselect_identification_variable_declaration();
            state._fsp--;
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_subselect_identification_variable_declaration.add(subselect_identification_variable_declaration166.getTree());
            // JPA2.g:224:63: ( ',' subselect_identification_variable_declaration )*
            loop52: while (true) {
                int alt52 = 2;
                int LA52_0 = input.LA(1);
                if ((LA52_0 == 66)) {
                    alt52 = 1;
                }
                switch(alt52) {
                    case 1:
                        // JPA2.g:224:64: ',' subselect_identification_variable_declaration
                        {
                            char_literal167 = (Token) match(input, 66, FOLLOW_66_in_subquery_from_clause2035);
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0)
                                stream_66.add(char_literal167);
                            pushFollow(FOLLOW_subselect_identification_variable_declaration_in_subquery_from_clause2037);
                            subselect_identification_variable_declaration168 = subselect_identification_variable_declaration();
                            state._fsp--;
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0)
                                stream_subselect_identification_variable_declaration.add(subselect_identification_variable_declaration168.getTree());
                        }
                        break;
                    default:
                        break loop52;
                }
            }
            // wildcard labels:
            if (state.backtracking == 0) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.getTree() : null);
                root_0 = (Object) adaptor.nil();
                // 225:5: -> ^( T_SOURCES[$fr] ( ^( T_SOURCE subselect_identification_variable_declaration ) )* )
                {
                    // JPA2.g:225:8: ^( T_SOURCES[$fr] ( ^( T_SOURCE subselect_identification_variable_declaration ) )* )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot(new FromNode(T_SOURCES, fr), root_1);
                        // JPA2.g:225:35: ( ^( T_SOURCE subselect_identification_variable_declaration ) )*
                        while (stream_subselect_identification_variable_declaration.hasNext()) {
                            // JPA2.g:225:35: ^( T_SOURCE subselect_identification_variable_declaration )
                            {
                                Object root_2 = (Object) adaptor.nil();
                                root_2 = (Object) adaptor.becomeRoot(new SelectionSourceNode(T_SOURCE), root_2);
                                adaptor.addChild(root_2, stream_subselect_identification_variable_declaration.nextTree());
                                adaptor.addChild(root_1, root_2);
                            }
                        }
                        stream_subselect_identification_variable_declaration.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (Object) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    // do for sure before leaving
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream)

Example 87 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream in project binnavi by google.

the class MemoryExpressionParser method primaryExpression.

// $ANTLR end "multExpression"
// $ANTLR start "primaryExpression"
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:46:1:
// primaryExpression : ( REGISTER | NUMBER | HEX_NUMBER | '[' expression ']' -> ^( MEM_EXPRESSION
// expression ) | '(' expression ')' -> ^( SUB_EXPRESSION expression ) );
public final MemoryExpressionParser.primaryExpression_return primaryExpression() throws RecognitionException {
    final MemoryExpressionParser.primaryExpression_return retval = new MemoryExpressionParser.primaryExpression_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token REGISTER11 = null;
    Token NUMBER12 = null;
    Token HEX_NUMBER13 = null;
    Token char_literal14 = null;
    Token char_literal16 = null;
    Token char_literal17 = null;
    Token char_literal19 = null;
    MemoryExpressionParser.expression_return expression15 = null;
    MemoryExpressionParser.expression_return expression18 = null;
    Object REGISTER11_tree = null;
    Object NUMBER12_tree = null;
    Object HEX_NUMBER13_tree = null;
    final Object char_literal14_tree = null;
    final Object char_literal16_tree = null;
    final Object char_literal17_tree = null;
    final Object char_literal19_tree = null;
    final RewriteRuleTokenStream stream_21 = new RewriteRuleTokenStream(adaptor, "token 21");
    final RewriteRuleTokenStream stream_20 = new RewriteRuleTokenStream(adaptor, "token 20");
    final RewriteRuleTokenStream stream_19 = new RewriteRuleTokenStream(adaptor, "token 19");
    final RewriteRuleTokenStream stream_18 = new RewriteRuleTokenStream(adaptor, "token 18");
    final RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
    try {
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:47:3:
        // ( REGISTER | NUMBER | HEX_NUMBER | '[' expression ']' -> ^( MEM_EXPRESSION expression ) |
        // '(' expression ')' -> ^( SUB_EXPRESSION expression ) )
        int alt4 = 5;
        switch(input.LA(1)) {
            case REGISTER:
                {
                    alt4 = 1;
                }
                break;
            case NUMBER:
                {
                    alt4 = 2;
                }
                break;
            case HEX_NUMBER:
                {
                    alt4 = 3;
                }
                break;
            case 18:
                {
                    alt4 = 4;
                }
                break;
            case 20:
                {
                    alt4 = 5;
                }
                break;
            default:
                final NoViableAltException nvae = new NoViableAltException("", 4, 0, input);
                throw nvae;
        }
        switch(alt4) {
            case 1:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:47:5:
                // REGISTER
                {
                    root_0 = (Object) adaptor.nil();
                    REGISTER11 = (Token) match(input, REGISTER, FOLLOW_REGISTER_in_primaryExpression260);
                    REGISTER11_tree = (Object) adaptor.create(REGISTER11);
                    adaptor.addChild(root_0, REGISTER11_tree);
                }
                break;
            case 2:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:48:5:
                // NUMBER
                {
                    root_0 = (Object) adaptor.nil();
                    NUMBER12 = (Token) match(input, NUMBER, FOLLOW_NUMBER_in_primaryExpression266);
                    NUMBER12_tree = (Object) adaptor.create(NUMBER12);
                    adaptor.addChild(root_0, NUMBER12_tree);
                }
                break;
            case 3:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:49:5:
                // HEX_NUMBER
                {
                    root_0 = (Object) adaptor.nil();
                    HEX_NUMBER13 = (Token) match(input, HEX_NUMBER, FOLLOW_HEX_NUMBER_in_primaryExpression272);
                    HEX_NUMBER13_tree = (Object) adaptor.create(HEX_NUMBER13);
                    adaptor.addChild(root_0, HEX_NUMBER13_tree);
                }
                break;
            case 4:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:50:5:
                // '[' expression ']'
                {
                    char_literal14 = (Token) match(input, 18, FOLLOW_18_in_primaryExpression278);
                    stream_18.add(char_literal14);
                    pushFollow(FOLLOW_expression_in_primaryExpression280);
                    expression15 = expression();
                    state._fsp--;
                    stream_expression.add(expression15.getTree());
                    char_literal16 = (Token) match(input, 19, FOLLOW_19_in_primaryExpression282);
                    stream_19.add(char_literal16);
                    // AST REWRITE
                    // elements: expression
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (Object) adaptor.nil();
                    // 50:24: -> ^( MEM_EXPRESSION expression )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:50:27:
                        // ^( MEM_EXPRESSION expression )
                        {
                            Object root_1 = (Object) adaptor.nil();
                            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(MEM_EXPRESSION, "MEM_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_expression.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
            case 5:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:51:5:
                // '(' expression ')'
                {
                    char_literal17 = (Token) match(input, 20, FOLLOW_20_in_primaryExpression296);
                    stream_20.add(char_literal17);
                    pushFollow(FOLLOW_expression_in_primaryExpression298);
                    expression18 = expression();
                    state._fsp--;
                    stream_expression.add(expression18.getTree());
                    char_literal19 = (Token) match(input, 21, FOLLOW_21_in_primaryExpression300);
                    stream_21.add(char_literal19);
                    // AST REWRITE
                    // elements: expression
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (Object) adaptor.nil();
                    // 51:24: -> ^( SUB_EXPRESSION expression )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:51:27:
                        // ^( SUB_EXPRESSION expression )
                        {
                            Object root_1 = (Object) adaptor.nil();
                            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(SUB_EXPRESSION, "SUB_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_expression.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
        }
        retval.stop = input.LT(-1);
        retval.tree = (Object) adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
    } catch (final RecognitionException e) {
        throw e;
    } finally {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 88 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream in project binnavi by google.

the class ConditionParser method primaryExpression.

// $ANTLR end "multExpression"
// $ANTLR start "primaryExpression"
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:92:1:
// primaryExpression : ( IDENTIFIER | NUMBER | HEX_NUMBER | '[' formula ']' -> ^(
// MEMORY_EXPRESSION formula ) | '(' formula ')' -> ^( SUB_EXPRESSION formula ) );
public final ConditionParser.primaryExpression_return primaryExpression() throws RecognitionException {
    final ConditionParser.primaryExpression_return retval = new ConditionParser.primaryExpression_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token IDENTIFIER30 = null;
    Token NUMBER31 = null;
    Token HEX_NUMBER32 = null;
    Token char_literal33 = null;
    Token char_literal35 = null;
    Token char_literal36 = null;
    Token char_literal38 = null;
    ConditionParser.formula_return formula34 = null;
    ConditionParser.formula_return formula37 = null;
    Object IDENTIFIER30_tree = null;
    Object NUMBER31_tree = null;
    Object HEX_NUMBER32_tree = null;
    final Object char_literal33_tree = null;
    final Object char_literal35_tree = null;
    final Object char_literal36_tree = null;
    final Object char_literal38_tree = null;
    final RewriteRuleTokenStream stream_32 = new RewriteRuleTokenStream(adaptor, "token 32");
    final RewriteRuleTokenStream stream_31 = new RewriteRuleTokenStream(adaptor, "token 31");
    final RewriteRuleTokenStream stream_33 = new RewriteRuleTokenStream(adaptor, "token 33");
    final RewriteRuleTokenStream stream_34 = new RewriteRuleTokenStream(adaptor, "token 34");
    final RewriteRuleSubtreeStream stream_formula = new RewriteRuleSubtreeStream(adaptor, "rule formula");
    try {
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:93:3:
        // ( IDENTIFIER | NUMBER | HEX_NUMBER | '[' formula ']' -> ^( MEMORY_EXPRESSION formula ) |
        // '(' formula ')' -> ^( SUB_EXPRESSION formula ) )
        int alt9 = 5;
        switch(input.LA(1)) {
            case IDENTIFIER:
                {
                    alt9 = 1;
                }
                break;
            case NUMBER:
                {
                    alt9 = 2;
                }
                break;
            case HEX_NUMBER:
                {
                    alt9 = 3;
                }
                break;
            case 31:
                {
                    alt9 = 4;
                }
                break;
            case 33:
                {
                    alt9 = 5;
                }
                break;
            default:
                final NoViableAltException nvae = new NoViableAltException("", 9, 0, input);
                throw nvae;
        }
        switch(alt9) {
            case 1:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:93:5:
                // IDENTIFIER
                {
                    root_0 = (Object) adaptor.nil();
                    IDENTIFIER30 = (Token) match(input, IDENTIFIER, FOLLOW_IDENTIFIER_in_primaryExpression558);
                    IDENTIFIER30_tree = (Object) adaptor.create(IDENTIFIER30);
                    adaptor.addChild(root_0, IDENTIFIER30_tree);
                }
                break;
            case 2:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:94:5:
                // NUMBER
                {
                    root_0 = (Object) adaptor.nil();
                    NUMBER31 = (Token) match(input, NUMBER, FOLLOW_NUMBER_in_primaryExpression564);
                    NUMBER31_tree = (Object) adaptor.create(NUMBER31);
                    adaptor.addChild(root_0, NUMBER31_tree);
                }
                break;
            case 3:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:95:5:
                // HEX_NUMBER
                {
                    root_0 = (Object) adaptor.nil();
                    HEX_NUMBER32 = (Token) match(input, HEX_NUMBER, FOLLOW_HEX_NUMBER_in_primaryExpression570);
                    HEX_NUMBER32_tree = (Object) adaptor.create(HEX_NUMBER32);
                    adaptor.addChild(root_0, HEX_NUMBER32_tree);
                }
                break;
            case 4:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:96:5:
                // '[' formula ']'
                {
                    char_literal33 = (Token) match(input, 31, FOLLOW_31_in_primaryExpression576);
                    stream_31.add(char_literal33);
                    pushFollow(FOLLOW_formula_in_primaryExpression578);
                    formula34 = formula();
                    state._fsp--;
                    stream_formula.add(formula34.getTree());
                    char_literal35 = (Token) match(input, 32, FOLLOW_32_in_primaryExpression580);
                    stream_32.add(char_literal35);
                    // AST REWRITE
                    // elements: formula
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (Object) adaptor.nil();
                    // 96:21: -> ^( MEMORY_EXPRESSION formula )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:96:24:
                        // ^( MEMORY_EXPRESSION formula )
                        {
                            Object root_1 = (Object) adaptor.nil();
                            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(MEMORY_EXPRESSION, "MEMORY_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_formula.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
            case 5:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:97:5:
                // '(' formula ')'
                {
                    char_literal36 = (Token) match(input, 33, FOLLOW_33_in_primaryExpression594);
                    stream_33.add(char_literal36);
                    pushFollow(FOLLOW_formula_in_primaryExpression596);
                    formula37 = formula();
                    state._fsp--;
                    stream_formula.add(formula37.getTree());
                    char_literal38 = (Token) match(input, 34, FOLLOW_34_in_primaryExpression598);
                    stream_34.add(char_literal38);
                    // AST REWRITE
                    // elements: formula
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (Object) adaptor.nil();
                    // 97:21: -> ^( SUB_EXPRESSION formula )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:97:24:
                        // ^( SUB_EXPRESSION formula )
                        {
                            Object root_1 = (Object) adaptor.nil();
                            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(SUB_EXPRESSION, "SUB_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_formula.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
        }
        retval.stop = input.LT(-1);
        retval.tree = (Object) adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
    } catch (final RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 89 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream in project binnavi by google.

the class FilterParser method primaryExpression.

// $ANTLR start "primaryExpression"
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:30:1:
// primaryExpression : ( PREDICATE | '(' expression ')' -> ^( SUB_EXPRESSION expression ) );
public final FilterParser.primaryExpression_return primaryExpression() throws RecognitionException {
    final FilterParser.primaryExpression_return retval = new FilterParser.primaryExpression_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token PREDICATE8 = null;
    Token char_literal9 = null;
    Token char_literal11 = null;
    FilterParser.expression_return expression10 = null;
    Object PREDICATE8_tree = null;
    final Object char_literal9_tree = null;
    final Object char_literal11_tree = null;
    final RewriteRuleTokenStream stream_10 = new RewriteRuleTokenStream(adaptor, "token 10");
    final RewriteRuleTokenStream stream_9 = new RewriteRuleTokenStream(adaptor, "token 9");
    final RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
    try {
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:31:3:
        // ( PREDICATE | '(' expression ')' -> ^( SUB_EXPRESSION expression ) )
        int alt3 = 2;
        final int LA3_0 = input.LA(1);
        if ((LA3_0 == PREDICATE)) {
            alt3 = 1;
        } else if ((LA3_0 == 9)) {
            alt3 = 2;
        } else {
            final NoViableAltException nvae = new NoViableAltException("", 3, 0, input);
            throw nvae;
        }
        switch(alt3) {
            case 1:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:31:5:
                // PREDICATE
                {
                    root_0 = adaptor.nil();
                    PREDICATE8 = (Token) match(input, PREDICATE, FOLLOW_PREDICATE_in_primaryExpression183);
                    PREDICATE8_tree = adaptor.create(PREDICATE8);
                    adaptor.addChild(root_0, PREDICATE8_tree);
                }
                break;
            case 2:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:32:5:
                // '(' expression ')'
                {
                    char_literal9 = (Token) match(input, 9, FOLLOW_9_in_primaryExpression189);
                    stream_9.add(char_literal9);
                    pushFollow(FOLLOW_expression_in_primaryExpression191);
                    expression10 = expression();
                    state._fsp--;
                    stream_expression.add(expression10.getTree());
                    char_literal11 = (Token) match(input, 10, FOLLOW_10_in_primaryExpression193);
                    stream_10.add(char_literal11);
                    // AST REWRITE
                    // elements: expression
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = adaptor.nil();
                    // 32:24: -> ^( SUB_EXPRESSION expression )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:32:27:
                        // ^( SUB_EXPRESSION expression )
                        {
                            Object root_1 = adaptor.nil();
                            root_1 = adaptor.becomeRoot(adaptor.create(SUB_EXPRESSION, "SUB_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_expression.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
        }
        retval.stop = input.LT(-1);
        retval.tree = adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
    } catch (final RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 90 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.

the class JavaParser method primaryExpression.

// $ANTLR start "primaryExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1073:1: primaryExpression : ( parenthesizedExpression | literal | newExpression | qualifiedIdentExpression | genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) ) | ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )? | SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments ) | ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) ) | ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS -> ^( DOT $primaryExpression CLASS ) | VOID DOT CLASS -> ^( DOT VOID CLASS ) );
public final JavaParser.primaryExpression_return primaryExpression() throws RecognitionException {
    JavaParser.primaryExpression_return retval = new JavaParser.primaryExpression_return();
    retval.start = input.LT(1);
    int primaryExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token SUPER469 = null;
    Token DOT471 = null;
    Token IDENT472 = null;
    Token IDENT474 = null;
    Token THIS476 = null;
    Token THIS478 = null;
    Token SUPER480 = null;
    Token SUPER482 = null;
    Token DOT483 = null;
    Token IDENT484 = null;
    Token DOT488 = null;
    Token CLASS489 = null;
    Token VOID490 = null;
    Token DOT491 = null;
    Token CLASS492 = null;
    JavaParser.parenthesizedExpression_return parenthesizedExpression464 = null;
    JavaParser.literal_return literal465 = null;
    JavaParser.newExpression_return newExpression466 = null;
    JavaParser.qualifiedIdentExpression_return qualifiedIdentExpression467 = null;
    JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified468 = null;
    JavaParser.arguments_return arguments470 = null;
    JavaParser.arguments_return arguments473 = null;
    JavaParser.arguments_return arguments475 = null;
    JavaParser.arguments_return arguments477 = null;
    JavaParser.arguments_return arguments479 = null;
    JavaParser.arguments_return arguments481 = null;
    JavaParser.arguments_return arguments485 = null;
    JavaParser.primitiveType_return primitiveType486 = null;
    JavaParser.arrayDeclarator_return arrayDeclarator487 = null;
    CommonTree SUPER469_tree = null;
    CommonTree DOT471_tree = null;
    CommonTree IDENT472_tree = null;
    CommonTree IDENT474_tree = null;
    CommonTree THIS476_tree = null;
    CommonTree THIS478_tree = null;
    CommonTree SUPER480_tree = null;
    CommonTree SUPER482_tree = null;
    CommonTree DOT483_tree = null;
    CommonTree IDENT484_tree = null;
    CommonTree DOT488_tree = null;
    CommonTree CLASS489_tree = null;
    CommonTree VOID490_tree = null;
    CommonTree DOT491_tree = null;
    CommonTree CLASS492_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_CLASS = new RewriteRuleTokenStream(adaptor, "token CLASS");
    RewriteRuleTokenStream stream_VOID = new RewriteRuleTokenStream(adaptor, "token VOID");
    RewriteRuleTokenStream stream_SUPER = new RewriteRuleTokenStream(adaptor, "token SUPER");
    RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
    RewriteRuleTokenStream stream_THIS = new RewriteRuleTokenStream(adaptor, "token THIS");
    RewriteRuleSubtreeStream stream_arrayDeclarator = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclarator");
    RewriteRuleSubtreeStream stream_arguments = new RewriteRuleSubtreeStream(adaptor, "rule arguments");
    RewriteRuleSubtreeStream stream_primitiveType = new RewriteRuleSubtreeStream(adaptor, "rule primitiveType");
    RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 105)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1074:5: ( parenthesizedExpression | literal | newExpression | qualifiedIdentExpression | genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) ) | ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )? | SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments ) | ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) ) | ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS -> ^( DOT $primaryExpression CLASS ) | VOID DOT CLASS -> ^( DOT VOID CLASS ) )
        int alt140 = 10;
        alt140 = dfa140.predict(input);
        switch(alt140) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1074:9: parenthesizedExpression
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_parenthesizedExpression_in_primaryExpression12338);
                    parenthesizedExpression464 = parenthesizedExpression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, parenthesizedExpression464.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1075:9: literal
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_literal_in_primaryExpression12348);
                    literal465 = literal();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, literal465.getTree());
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1076:9: newExpression
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_newExpression_in_primaryExpression12358);
                    newExpression466 = newExpression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, newExpression466.getTree());
                    }
                }
                break;
            case 4:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1077:9: qualifiedIdentExpression
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_qualifiedIdentExpression_in_primaryExpression12368);
                    qualifiedIdentExpression467 = qualifiedIdentExpression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, qualifiedIdentExpression467.getTree());
                    }
                }
                break;
            case 5:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1078:9: genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) )
                {
                    pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_primaryExpression12378);
                    genericTypeArgumentListSimplified468 = genericTypeArgumentListSimplified();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified468.getTree());
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1079:9: ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) )
                    int alt136 = 3;
                    switch(input.LA(1)) {
                        case SUPER:
                            {
                                alt136 = 1;
                            }
                            break;
                        case IDENT:
                            {
                                alt136 = 2;
                            }
                            break;
                        case THIS:
                            {
                                alt136 = 3;
                            }
                            break;
                        default:
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 136, 0, input);
                            throw nvae;
                    }
                    switch(alt136) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1079:13: SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) )
                            {
                                SUPER469 = (Token) match(input, SUPER, FOLLOW_SUPER_in_primaryExpression12392);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_SUPER.add(SUPER469);
                                }
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1080:13: ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) )
                                int alt135 = 2;
                                int LA135_0 = input.LA(1);
                                if ((LA135_0 == LPAREN)) {
                                    alt135 = 1;
                                } else if ((LA135_0 == DOT)) {
                                    alt135 = 2;
                                } else {
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 135, 0, input);
                                    throw nvae;
                                }
                                switch(alt135) {
                                    case 1:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1080:17: arguments
                                        {
                                            pushFollow(FOLLOW_arguments_in_primaryExpression12410);
                                            arguments470 = arguments();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_arguments.add(arguments470.getTree());
                                            }
                                            // wildcard labels:
                                            if (state.backtracking == 0) {
                                                retval.tree = root_0;
                                                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                                root_0 = (CommonTree) adaptor.nil();
                                                // 1080:57: -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1080:61: ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, SUPER469, "SUPER_CONSTRUCTOR_CALL"), root_1);
                                                        adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
                                                        adaptor.addChild(root_1, stream_arguments.nextTree());
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                    case 2:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1081:17: DOT IDENT arguments
                                        {
                                            DOT471 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression12470);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_DOT.add(DOT471);
                                            }
                                            IDENT472 = (Token) match(input, IDENT, FOLLOW_IDENT_in_primaryExpression12472);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT472);
                                            }
                                            pushFollow(FOLLOW_arguments_in_primaryExpression12474);
                                            arguments473 = arguments();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_arguments.add(arguments473.getTree());
                                            }
                                            // wildcard labels:
                                            if (state.backtracking == 0) {
                                                retval.tree = root_0;
                                                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                                root_0 = (CommonTree) adaptor.nil();
                                                // 1081:57: -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1081:61: ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1081:75: ^( DOT SUPER IDENT )
                                                        {
                                                            CommonTree root_2 = (CommonTree) adaptor.nil();
                                                            root_2 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_2);
                                                            adaptor.addChild(root_2, stream_SUPER.nextNode());
                                                            adaptor.addChild(root_2, stream_IDENT.nextNode());
                                                            adaptor.addChild(root_1, root_2);
                                                        }
                                                        adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
                                                        adaptor.addChild(root_1, stream_arguments.nextTree());
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1083:13: IDENT arguments
                            {
                                IDENT474 = (Token) match(input, IDENT, FOLLOW_IDENT_in_primaryExpression12541);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_IDENT.add(IDENT474);
                                }
                                pushFollow(FOLLOW_arguments_in_primaryExpression12543);
                                arguments475 = arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_arguments.add(arguments475.getTree());
                                }
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 1083:57: -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1083:61: ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
                                            adaptor.addChild(root_1, stream_IDENT.nextNode());
                                            adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
                                            adaptor.addChild(root_1, stream_arguments.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                        case 3:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1084:13: THIS arguments
                            {
                                THIS476 = (Token) match(input, THIS, FOLLOW_THIS_in_primaryExpression12598);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_THIS.add(THIS476);
                                }
                                pushFollow(FOLLOW_arguments_in_primaryExpression12600);
                                arguments477 = arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_arguments.add(arguments477.getTree());
                                }
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 1084:57: -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1084:61: ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(THIS_CONSTRUCTOR_CALL, THIS476, "THIS_CONSTRUCTOR_CALL"), root_1);
                                            adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
                                            adaptor.addChild(root_1, stream_arguments.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                    }
                }
                break;
            case 6:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1086:9: ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )?
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1086:9: ( THIS -> THIS )
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1086:13: THIS
                    {
                        THIS478 = (Token) match(input, THIS, FOLLOW_THIS_in_primaryExpression12665);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_THIS.add(THIS478);
                        }
                        // wildcard labels:
                        if (state.backtracking == 0) {
                            retval.tree = root_0;
                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                            root_0 = (CommonTree) adaptor.nil();
                            // 1086:57: -> THIS
                            {
                                adaptor.addChild(root_0, stream_THIS.nextNode());
                            }
                            retval.tree = root_0;
                        }
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1088:9: ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )?
                    int alt137 = 2;
                    int LA137_0 = input.LA(1);
                    if ((LA137_0 == LPAREN)) {
                        alt137 = 1;
                    }
                    switch(alt137) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1088:13: arguments
                            {
                                pushFollow(FOLLOW_arguments_in_primaryExpression12733);
                                arguments479 = arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_arguments.add(arguments479.getTree());
                                }
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 1088:57: -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1088:61: ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(THIS_CONSTRUCTOR_CALL, THIS478, "THIS_CONSTRUCTOR_CALL"), root_1);
                                            adaptor.addChild(root_1, stream_arguments.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                    }
                }
                break;
            case 7:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1090:9: SUPER arguments
                {
                    SUPER480 = (Token) match(input, SUPER, FOLLOW_SUPER_in_primaryExpression12798);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_SUPER.add(SUPER480);
                    }
                    pushFollow(FOLLOW_arguments_in_primaryExpression12800);
                    arguments481 = arguments();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_arguments.add(arguments481.getTree());
                    }
                    // wildcard labels:
                    if (state.backtracking == 0) {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                        root_0 = (CommonTree) adaptor.nil();
                        // 1090:57: -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1090:61: ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, SUPER480, "SUPER_CONSTRUCTOR_CALL"), root_1);
                                adaptor.addChild(root_1, stream_arguments.nextTree());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 8:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1091:9: ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1091:9: ( SUPER DOT IDENT )
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1091:13: SUPER DOT IDENT
                    {
                        SUPER482 = (Token) match(input, SUPER, FOLLOW_SUPER_in_primaryExpression12856);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_SUPER.add(SUPER482);
                        }
                        DOT483 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression12858);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_DOT.add(DOT483);
                        }
                        IDENT484 = (Token) match(input, IDENT, FOLLOW_IDENT_in_primaryExpression12860);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_IDENT.add(IDENT484);
                        }
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:9: ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) )
                    int alt138 = 2;
                    int LA138_0 = input.LA(1);
                    if ((LA138_0 == LPAREN)) {
                        alt138 = 1;
                    } else if ((LA138_0 == EOF || (LA138_0 >= AND && LA138_0 <= ASSIGN) || (LA138_0 >= BIT_SHIFT_RIGHT && LA138_0 <= DOT) || (LA138_0 >= EQUAL && LA138_0 <= LBRACK) || (LA138_0 >= LESS_OR_EQUAL && LA138_0 <= LOGICAL_AND) || LA138_0 == LOGICAL_OR || (LA138_0 >= MINUS && LA138_0 <= MOD_ASSIGN) || (LA138_0 >= NOT_EQUAL && LA138_0 <= XOR_ASSIGN) || LA138_0 == INSTANCEOF)) {
                        alt138 = 2;
                    } else {
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return retval;
                        }
                        NoViableAltException nvae = new NoViableAltException("", 138, 0, input);
                        throw nvae;
                    }
                    switch(alt138) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:13: arguments
                            {
                                pushFollow(FOLLOW_arguments_in_primaryExpression12884);
                                arguments485 = arguments();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_arguments.add(arguments485.getTree());
                                }
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 1093:57: -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:61: ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:75: ^( DOT SUPER IDENT )
                                            {
                                                CommonTree root_2 = (CommonTree) adaptor.nil();
                                                root_2 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_2);
                                                adaptor.addChild(root_2, stream_SUPER.nextNode());
                                                adaptor.addChild(root_2, stream_IDENT.nextNode());
                                                adaptor.addChild(root_1, root_2);
                                            }
                                            adaptor.addChild(root_1, stream_arguments.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1094:57:
                            {
                                // wildcard labels:
                                if (state.backtracking == 0) {
                                    retval.tree = root_0;
                                    RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                    root_0 = (CommonTree) adaptor.nil();
                                    // 1094:57: -> ^( DOT SUPER IDENT )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1094:61: ^( DOT SUPER IDENT )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
                                            adaptor.addChild(root_1, stream_SUPER.nextNode());
                                            adaptor.addChild(root_1, stream_IDENT.nextNode());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                    }
                }
                break;
            case 9:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1096:9: ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1096:9: ( primitiveType -> primitiveType )
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1096:13: primitiveType
                    {
                        pushFollow(FOLLOW_primitiveType_in_primaryExpression13026);
                        primitiveType486 = primitiveType();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_primitiveType.add(primitiveType486.getTree());
                        }
                        // wildcard labels:
                        if (state.backtracking == 0) {
                            retval.tree = root_0;
                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                            root_0 = (CommonTree) adaptor.nil();
                            // 1096:57: -> primitiveType
                            {
                                adaptor.addChild(root_0, stream_primitiveType.nextTree());
                            }
                            retval.tree = root_0;
                        }
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1098:9: ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )*
                    loop139: do {
                        int alt139 = 2;
                        int LA139_0 = input.LA(1);
                        if ((LA139_0 == LBRACK)) {
                            alt139 = 1;
                        }
                        switch(alt139) {
                            case 1:
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1098:13: arrayDeclarator
                                {
                                    pushFollow(FOLLOW_arrayDeclarator_in_primaryExpression13085);
                                    arrayDeclarator487 = arrayDeclarator();
                                    state._fsp--;
                                    if (state.failed) {
                                        return retval;
                                    }
                                    if (state.backtracking == 0) {
                                        stream_arrayDeclarator.add(arrayDeclarator487.getTree());
                                    }
                                    // wildcard labels:
                                    if (state.backtracking == 0) {
                                        retval.tree = root_0;
                                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                        root_0 = (CommonTree) adaptor.nil();
                                        // 1098:57: -> ^( arrayDeclarator $primaryExpression)
                                        {
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1098:61: ^( arrayDeclarator $primaryExpression)
                                            {
                                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                                root_1 = (CommonTree) adaptor.becomeRoot(stream_arrayDeclarator.nextNode(), root_1);
                                                adaptor.addChild(root_1, stream_retval.nextTree());
                                                adaptor.addChild(root_0, root_1);
                                            }
                                        }
                                        retval.tree = root_0;
                                    }
                                }
                                break;
                            default:
                                break loop139;
                        }
                    } while (true);
                    DOT488 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression13144);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_DOT.add(DOT488);
                    }
                    CLASS489 = (Token) match(input, CLASS, FOLLOW_CLASS_in_primaryExpression13146);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_CLASS.add(CLASS489);
                    }
                    // wildcard labels:
                    if (state.backtracking == 0) {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                        root_0 = (CommonTree) adaptor.nil();
                        // 1100:57: -> ^( DOT $primaryExpression CLASS )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1100:61: ^( DOT $primaryExpression CLASS )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
                                adaptor.addChild(root_1, stream_retval.nextTree());
                                adaptor.addChild(root_1, stream_CLASS.nextNode());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 10:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1101:9: VOID DOT CLASS
                {
                    VOID490 = (Token) match(input, VOID, FOLLOW_VOID_in_primaryExpression13206);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_VOID.add(VOID490);
                    }
                    DOT491 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression13208);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_DOT.add(DOT491);
                    }
                    CLASS492 = (Token) match(input, CLASS, FOLLOW_CLASS_in_primaryExpression13210);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_CLASS.add(CLASS492);
                    }
                    // wildcard labels:
                    if (state.backtracking == 0) {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                        root_0 = (CommonTree) adaptor.nil();
                        // 1101:57: -> ^( DOT VOID CLASS )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1101:61: ^( DOT VOID CLASS )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
                                adaptor.addChild(root_1, stream_VOID.nextNode());
                                adaptor.addChild(root_1, stream_CLASS.nextNode());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 105, primaryExpression_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)123 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)123 RecognitionException (org.antlr.runtime.RecognitionException)83 Token (org.antlr.runtime.Token)83 CommonTree (org.antlr.runtime.tree.CommonTree)62 NoViableAltException (org.antlr.runtime.NoViableAltException)24 CommonToken (org.antlr.runtime.CommonToken)18 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)12 FailedPredicateException (org.antlr.runtime.FailedPredicateException)8 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)8 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)2 EarlyExitException (org.antlr.runtime.EarlyExitException)1