Search in sources :

Example 61 with CommonTree

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

the class JavaParser method classScopeDeclarations.

// $ANTLR start "classScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:535:1: classScopeDeclarations : ( block -> ^( CLASS_INSTANCE_INITIALIZER block ) | STATIC block -> ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block ) | modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration | SEMI );
public final JavaParser.classScopeDeclarations_return classScopeDeclarations() throws RecognitionException {
    JavaParser.classScopeDeclarations_return retval = new JavaParser.classScopeDeclarations_return();
    retval.start = input.LT(1);
    int classScopeDeclarations_StartIndex = input.index();
    CommonTree root_0 = null;
    Token ident = null;
    Token STATIC81 = null;
    Token IDENT86 = null;
    Token SEMI91 = null;
    Token VOID92 = null;
    Token IDENT93 = null;
    Token SEMI97 = null;
    Token SEMI103 = null;
    Token SEMI105 = null;
    JavaParser.block_return block80 = null;
    JavaParser.block_return block82 = null;
    JavaParser.modifierList_return modifierList83 = null;
    JavaParser.genericTypeParameterList_return genericTypeParameterList84 = null;
    JavaParser.type_return type85 = null;
    JavaParser.formalParameterList_return formalParameterList87 = null;
    JavaParser.arrayDeclaratorList_return arrayDeclaratorList88 = null;
    JavaParser.throwsClause_return throwsClause89 = null;
    JavaParser.block_return block90 = null;
    JavaParser.formalParameterList_return formalParameterList94 = null;
    JavaParser.throwsClause_return throwsClause95 = null;
    JavaParser.block_return block96 = null;
    JavaParser.formalParameterList_return formalParameterList98 = null;
    JavaParser.throwsClause_return throwsClause99 = null;
    JavaParser.block_return block100 = null;
    JavaParser.type_return type101 = null;
    JavaParser.classFieldDeclaratorList_return classFieldDeclaratorList102 = null;
    JavaParser.typeDeclaration_return typeDeclaration104 = null;
    CommonTree ident_tree = null;
    CommonTree STATIC81_tree = null;
    CommonTree IDENT86_tree = null;
    CommonTree SEMI91_tree = null;
    CommonTree VOID92_tree = null;
    CommonTree IDENT93_tree = null;
    CommonTree SEMI97_tree = null;
    CommonTree SEMI103_tree = null;
    CommonTree SEMI105_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_VOID = new RewriteRuleTokenStream(adaptor, "token VOID");
    RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
    RewriteRuleTokenStream stream_STATIC = new RewriteRuleTokenStream(adaptor, "token STATIC");
    RewriteRuleSubtreeStream stream_arrayDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclaratorList");
    RewriteRuleSubtreeStream stream_throwsClause = new RewriteRuleSubtreeStream(adaptor, "rule throwsClause");
    RewriteRuleSubtreeStream stream_modifierList = new RewriteRuleSubtreeStream(adaptor, "rule modifierList");
    RewriteRuleSubtreeStream stream_genericTypeParameterList = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeParameterList");
    RewriteRuleSubtreeStream stream_block = new RewriteRuleSubtreeStream(adaptor, "rule block");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    RewriteRuleSubtreeStream stream_classFieldDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule classFieldDeclaratorList");
    RewriteRuleSubtreeStream stream_formalParameterList = new RewriteRuleSubtreeStream(adaptor, "rule formalParameterList");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 25)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:536:5: ( block -> ^( CLASS_INSTANCE_INITIALIZER block ) | STATIC block -> ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block ) | modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration | SEMI )
        int alt37 = 5;
        alt37 = dfa37.predict(input);
        switch(alt37) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:536:9: block
                {
                    pushFollow(FOLLOW_block_in_classScopeDeclarations5582);
                    block80 = block();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_block.add(block80.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();
                        // 536:25: -> ^( CLASS_INSTANCE_INITIALIZER block )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:536:29: ^( CLASS_INSTANCE_INITIALIZER block )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_INSTANCE_INITIALIZER, "CLASS_INSTANCE_INITIALIZER"), root_1);
                                adaptor.addChild(root_1, stream_block.nextTree());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:537:9: STATIC block
                {
                    STATIC81 = (Token) match(input, STATIC, FOLLOW_STATIC_in_classScopeDeclarations5611);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_STATIC.add(STATIC81);
                    }
                    pushFollow(FOLLOW_block_in_classScopeDeclarations5613);
                    block82 = block();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_block.add(block82.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();
                        // 537:25: -> ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:537:29: ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_STATIC_INITIALIZER, STATIC81, "CLASS_STATIC_INITIALIZER"), root_1);
                                adaptor.addChild(root_1, stream_block.nextTree());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:538:9: modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
                {
                    pushFollow(FOLLOW_modifierList_in_classScopeDeclarations5636);
                    modifierList83 = modifierList();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_modifierList.add(modifierList83.getTree());
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:539:9: ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
                    int alt36 = 2;
                    switch(input.LA(1)) {
                        case LESS_THAN:
                        case VOID:
                            {
                                alt36 = 1;
                            }
                            break;
                        case BOOLEAN:
                        case BYTE:
                        case CHAR:
                        case DOUBLE:
                        case FLOAT:
                        case INT:
                        case LONG:
                        case SHORT:
                            {
                                int LA36_2 = input.LA(2);
                                if ((synpred43_Java())) {
                                    alt36 = 1;
                                } else if ((true)) {
                                    alt36 = 2;
                                } else {
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 36, 2, input);
                                    throw nvae;
                                }
                            }
                            break;
                        case IDENT:
                            {
                                int LA36_3 = input.LA(2);
                                if ((synpred43_Java())) {
                                    alt36 = 1;
                                } else if ((true)) {
                                    alt36 = 2;
                                } else {
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 36, 3, input);
                                    throw nvae;
                                }
                            }
                            break;
                        default:
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 36, 0, input);
                            throw nvae;
                    }
                    switch(alt36) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) )
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( genericTypeParameterList )?
                                int alt28 = 2;
                                int LA28_0 = input.LA(1);
                                if ((LA28_0 == LESS_THAN)) {
                                    alt28 = 1;
                                }
                                switch(alt28) {
                                    case 1:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeParameterList
                                        {
                                            pushFollow(FOLLOW_genericTypeParameterList_in_classScopeDeclarations5650);
                                            genericTypeParameterList84 = genericTypeParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_genericTypeParameterList.add(genericTypeParameterList84.getTree());
                                            }
                                        }
                                        break;
                                }
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:13: ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) )
                                int alt35 = 3;
                                switch(input.LA(1)) {
                                    case BOOLEAN:
                                    case BYTE:
                                    case CHAR:
                                    case DOUBLE:
                                    case FLOAT:
                                    case INT:
                                    case LONG:
                                    case SHORT:
                                        {
                                            alt35 = 1;
                                        }
                                        break;
                                    case IDENT:
                                        {
                                            int LA35_2 = input.LA(2);
                                            if ((LA35_2 == LPAREN)) {
                                                alt35 = 3;
                                            } else if ((LA35_2 == DOT || LA35_2 == LBRACK || LA35_2 == LESS_THAN || LA35_2 == IDENT)) {
                                                alt35 = 1;
                                            } else {
                                                if (state.backtracking > 0) {
                                                    state.failed = true;
                                                    return retval;
                                                }
                                                NoViableAltException nvae = new NoViableAltException("", 35, 2, input);
                                                throw nvae;
                                            }
                                        }
                                        break;
                                    case VOID:
                                        {
                                            alt35 = 2;
                                        }
                                        break;
                                    default:
                                        if (state.backtracking > 0) {
                                            state.failed = true;
                                            return retval;
                                        }
                                        NoViableAltException nvae = new NoViableAltException("", 35, 0, input);
                                        throw nvae;
                                }
                                switch(alt35) {
                                    case 1:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:17: type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI )
                                        {
                                            pushFollow(FOLLOW_type_in_classScopeDeclarations5669);
                                            type85 = type();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_type.add(type85.getTree());
                                            }
                                            IDENT86 = (Token) match(input, IDENT, FOLLOW_IDENT_in_classScopeDeclarations5671);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT86);
                                            }
                                            pushFollow(FOLLOW_formalParameterList_in_classScopeDeclarations5673);
                                            formalParameterList87 = formalParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_formalParameterList.add(formalParameterList87.getTree());
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:48: ( arrayDeclaratorList )?
                                            int alt29 = 2;
                                            int LA29_0 = input.LA(1);
                                            if ((LA29_0 == LBRACK)) {
                                                alt29 = 1;
                                            }
                                            switch(alt29) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                                                    {
                                                        pushFollow(FOLLOW_arrayDeclaratorList_in_classScopeDeclarations5675);
                                                        arrayDeclaratorList88 = arrayDeclaratorList();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_arrayDeclaratorList.add(arrayDeclaratorList88.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:69: ( throwsClause )?
                                            int alt30 = 2;
                                            int LA30_0 = input.LA(1);
                                            if ((LA30_0 == THROWS)) {
                                                alt30 = 1;
                                            }
                                            switch(alt30) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                                                    {
                                                        pushFollow(FOLLOW_throwsClause_in_classScopeDeclarations5678);
                                                        throwsClause89 = throwsClause();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_throwsClause.add(throwsClause89.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:83: ( block | SEMI )
                                            int alt31 = 2;
                                            int LA31_0 = input.LA(1);
                                            if ((LA31_0 == LCURLY)) {
                                                alt31 = 1;
                                            } else if ((LA31_0 == SEMI)) {
                                                alt31 = 2;
                                            } else {
                                                if (state.backtracking > 0) {
                                                    state.failed = true;
                                                    return retval;
                                                }
                                                NoViableAltException nvae = new NoViableAltException("", 31, 0, input);
                                                throw nvae;
                                            }
                                            switch(alt31) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:84: block
                                                    {
                                                        pushFollow(FOLLOW_block_in_classScopeDeclarations5682);
                                                        block90 = block();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_block.add(block90.getTree());
                                                        }
                                                    }
                                                    break;
                                                case 2:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:540:92: SEMI
                                                    {
                                                        SEMI91 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5686);
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_SEMI.add(SEMI91);
                                                        }
                                                    }
                                                    break;
                                            }
                                            // 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();
                                                // 541:17: -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:541:21: ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FUNCTION_METHOD_DECL, "FUNCTION_METHOD_DECL"), root_1);
                                                        adaptor.addChild(root_1, stream_modifierList.nextTree());
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:541:57: ( genericTypeParameterList )?
                                                        if (stream_genericTypeParameterList.hasNext()) {
                                                            adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
                                                        }
                                                        stream_genericTypeParameterList.reset();
                                                        adaptor.addChild(root_1, stream_type.nextTree());
                                                        adaptor.addChild(root_1, stream_IDENT.nextNode());
                                                        adaptor.addChild(root_1, stream_formalParameterList.nextTree());
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:541:114: ( arrayDeclaratorList )?
                                                        if (stream_arrayDeclaratorList.hasNext()) {
                                                            adaptor.addChild(root_1, stream_arrayDeclaratorList.nextTree());
                                                        }
                                                        stream_arrayDeclaratorList.reset();
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:541:135: ( throwsClause )?
                                                        if (stream_throwsClause.hasNext()) {
                                                            adaptor.addChild(root_1, stream_throwsClause.nextTree());
                                                        }
                                                        stream_throwsClause.reset();
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:541:149: ( block )?
                                                        if (stream_block.hasNext()) {
                                                            adaptor.addChild(root_1, stream_block.nextTree());
                                                        }
                                                        stream_block.reset();
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                    case 2:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:17: VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI )
                                        {
                                            VOID92 = (Token) match(input, VOID, FOLLOW_VOID_in_classScopeDeclarations5748);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_VOID.add(VOID92);
                                            }
                                            IDENT93 = (Token) match(input, IDENT, FOLLOW_IDENT_in_classScopeDeclarations5750);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT93);
                                            }
                                            pushFollow(FOLLOW_formalParameterList_in_classScopeDeclarations5752);
                                            formalParameterList94 = formalParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_formalParameterList.add(formalParameterList94.getTree());
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:48: ( throwsClause )?
                                            int alt32 = 2;
                                            int LA32_0 = input.LA(1);
                                            if ((LA32_0 == THROWS)) {
                                                alt32 = 1;
                                            }
                                            switch(alt32) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                                                    {
                                                        pushFollow(FOLLOW_throwsClause_in_classScopeDeclarations5754);
                                                        throwsClause95 = throwsClause();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_throwsClause.add(throwsClause95.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:62: ( block | SEMI )
                                            int alt33 = 2;
                                            int LA33_0 = input.LA(1);
                                            if ((LA33_0 == LCURLY)) {
                                                alt33 = 1;
                                            } else if ((LA33_0 == SEMI)) {
                                                alt33 = 2;
                                            } else {
                                                if (state.backtracking > 0) {
                                                    state.failed = true;
                                                    return retval;
                                                }
                                                NoViableAltException nvae = new NoViableAltException("", 33, 0, input);
                                                throw nvae;
                                            }
                                            switch(alt33) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:63: block
                                                    {
                                                        pushFollow(FOLLOW_block_in_classScopeDeclarations5758);
                                                        block96 = block();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_block.add(block96.getTree());
                                                        }
                                                    }
                                                    break;
                                                case 2:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:542:71: SEMI
                                                    {
                                                        SEMI97 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5762);
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_SEMI.add(SEMI97);
                                                        }
                                                    }
                                                    break;
                                            }
                                            // 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();
                                                // 543:17: -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:543:21: ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VOID_METHOD_DECL, "VOID_METHOD_DECL"), root_1);
                                                        adaptor.addChild(root_1, stream_modifierList.nextTree());
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:543:53: ( genericTypeParameterList )?
                                                        if (stream_genericTypeParameterList.hasNext()) {
                                                            adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
                                                        }
                                                        stream_genericTypeParameterList.reset();
                                                        adaptor.addChild(root_1, stream_IDENT.nextNode());
                                                        adaptor.addChild(root_1, stream_formalParameterList.nextTree());
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:543:105: ( throwsClause )?
                                                        if (stream_throwsClause.hasNext()) {
                                                            adaptor.addChild(root_1, stream_throwsClause.nextTree());
                                                        }
                                                        stream_throwsClause.reset();
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:543:119: ( block )?
                                                        if (stream_block.hasNext()) {
                                                            adaptor.addChild(root_1, stream_block.nextTree());
                                                        }
                                                        stream_block.reset();
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                    case 3:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:544:17: ident= IDENT formalParameterList ( throwsClause )? block
                                        {
                                            ident = (Token) match(input, IDENT, FOLLOW_IDENT_in_classScopeDeclarations5821);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(ident);
                                            }
                                            pushFollow(FOLLOW_formalParameterList_in_classScopeDeclarations5823);
                                            formalParameterList98 = formalParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_formalParameterList.add(formalParameterList98.getTree());
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:544:49: ( throwsClause )?
                                            int alt34 = 2;
                                            int LA34_0 = input.LA(1);
                                            if ((LA34_0 == THROWS)) {
                                                alt34 = 1;
                                            }
                                            switch(alt34) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                                                    {
                                                        pushFollow(FOLLOW_throwsClause_in_classScopeDeclarations5825);
                                                        throwsClause99 = throwsClause();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_throwsClause.add(throwsClause99.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            pushFollow(FOLLOW_block_in_classScopeDeclarations5828);
                                            block100 = block();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_block.add(block100.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();
                                                // 545:17: -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:545:21: ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CONSTRUCTOR_DECL, ident, "CONSTRUCTOR_DECL"), root_1);
                                                        adaptor.addChild(root_1, stream_modifierList.nextTree());
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:545:81: ( genericTypeParameterList )?
                                                        if (stream_genericTypeParameterList.hasNext()) {
                                                            adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
                                                        }
                                                        stream_genericTypeParameterList.reset();
                                                        adaptor.addChild(root_1, stream_formalParameterList.nextTree());
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:545:127: ( throwsClause )?
                                                        if (stream_throwsClause.hasNext()) {
                                                            adaptor.addChild(root_1, stream_throwsClause.nextTree());
                                                        }
                                                        stream_throwsClause.reset();
                                                        adaptor.addChild(root_1, stream_block.nextTree());
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:547:13: type classFieldDeclaratorList SEMI
                            {
                                pushFollow(FOLLOW_type_in_classScopeDeclarations5892);
                                type101 = type();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_type.add(type101.getTree());
                                }
                                pushFollow(FOLLOW_classFieldDeclaratorList_in_classScopeDeclarations5894);
                                classFieldDeclaratorList102 = classFieldDeclaratorList();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_classFieldDeclaratorList.add(classFieldDeclaratorList102.getTree());
                                }
                                SEMI103 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5896);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_SEMI.add(SEMI103);
                                }
                                // 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();
                                    // 548:13: -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:548:17: ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
                                        {
                                            CommonTree root_1 = (CommonTree) adaptor.nil();
                                            root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATION, "VAR_DECLARATION"), root_1);
                                            adaptor.addChild(root_1, stream_modifierList.nextTree());
                                            adaptor.addChild(root_1, stream_type.nextTree());
                                            adaptor.addChild(root_1, stream_classFieldDeclaratorList.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                    }
                }
                break;
            case 4:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:550:9: typeDeclaration
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_typeDeclaration_in_classScopeDeclarations5941);
                    typeDeclaration104 = typeDeclaration();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, typeDeclaration104.getTree());
                    }
                }
                break;
            case 5:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:551:9: SEMI
                {
                    root_0 = (CommonTree) adaptor.nil();
                    SEMI105 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5951);
                    if (state.failed) {
                        return retval;
                    }
                }
                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, 25, classScopeDeclarations_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)

Example 62 with CommonTree

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

the class JavaParser method exclusiveOrExpression.

// $ANTLR start "exclusiveOrExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:968:1: exclusiveOrExpression : andExpression ( XOR andExpression )* ;
public final JavaParser.exclusiveOrExpression_return exclusiveOrExpression() throws RecognitionException {
    JavaParser.exclusiveOrExpression_return retval = new JavaParser.exclusiveOrExpression_return();
    retval.start = input.LT(1);
    int exclusiveOrExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token XOR395 = null;
    JavaParser.andExpression_return andExpression394 = null;
    JavaParser.andExpression_return andExpression396 = null;
    CommonTree XOR395_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 94)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:969:5: ( andExpression ( XOR andExpression )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:969:9: andExpression ( XOR andExpression )*
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression10634);
            andExpression394 = andExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, andExpression394.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:969:23: ( XOR andExpression )*
            loop114: do {
                int alt114 = 2;
                int LA114_0 = input.LA(1);
                if ((LA114_0 == XOR)) {
                    alt114 = 1;
                }
                switch(alt114) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:969:24: XOR andExpression
                        {
                            XOR395 = (Token) match(input, XOR, FOLLOW_XOR_in_exclusiveOrExpression10637);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                XOR395_tree = (CommonTree) adaptor.create(XOR395);
                                root_0 = (CommonTree) adaptor.becomeRoot(XOR395_tree, root_0);
                            }
                            pushFollow(FOLLOW_andExpression_in_exclusiveOrExpression10640);
                            andExpression396 = andExpression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, andExpression396.getTree());
                            }
                        }
                        break;
                    default:
                        break loop114;
                }
            } while (true);
        }
        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, 94, exclusiveOrExpression_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 63 with CommonTree

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

the class JavaParser method forInit.

// $ANTLR start "forInit"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:902:1: forInit : ( localVariableDeclaration -> ^( FOR_INIT localVariableDeclaration ) | expressionList -> ^( FOR_INIT expressionList ) | -> ^( FOR_INIT ) );
public final JavaParser.forInit_return forInit() throws RecognitionException {
    JavaParser.forInit_return retval = new JavaParser.forInit_return();
    retval.start = input.LT(1);
    int forInit_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.localVariableDeclaration_return localVariableDeclaration355 = null;
    JavaParser.expressionList_return expressionList356 = null;
    RewriteRuleSubtreeStream stream_expressionList = new RewriteRuleSubtreeStream(adaptor, "rule expressionList");
    RewriteRuleSubtreeStream stream_localVariableDeclaration = new RewriteRuleSubtreeStream(adaptor, "rule localVariableDeclaration");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 83)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:903:5: ( localVariableDeclaration -> ^( FOR_INIT localVariableDeclaration ) | expressionList -> ^( FOR_INIT expressionList ) | -> ^( FOR_INIT ) )
        int alt104 = 3;
        alt104 = dfa104.predict(input);
        switch(alt104) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:903:9: localVariableDeclaration
                {
                    pushFollow(FOLLOW_localVariableDeclaration_in_forInit9964);
                    localVariableDeclaration355 = localVariableDeclaration();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_localVariableDeclaration.add(localVariableDeclaration355.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();
                        // 903:37: -> ^( FOR_INIT localVariableDeclaration )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:903:41: ^( FOR_INIT localVariableDeclaration )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FOR_INIT, "FOR_INIT"), root_1);
                                adaptor.addChild(root_1, stream_localVariableDeclaration.nextTree());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:904:9: expressionList
                {
                    pushFollow(FOLLOW_expressionList_in_forInit9986);
                    expressionList356 = expressionList();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_expressionList.add(expressionList356.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();
                        // 904:37: -> ^( FOR_INIT expressionList )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:904:41: ^( FOR_INIT expressionList )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FOR_INIT, "FOR_INIT"), root_1);
                                adaptor.addChild(root_1, stream_expressionList.nextTree());
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:905:37:
                {
                    // 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();
                        // 905:37: -> ^( FOR_INIT )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:905:41: ^( FOR_INIT )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FOR_INIT, "FOR_INIT"), root_1);
                                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, 83, forInit_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) RecognitionException(org.antlr.runtime.RecognitionException)

Example 64 with CommonTree

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

the class JavaParser method genericTypeParameter.

// $ANTLR start "genericTypeParameter"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:479:1: genericTypeParameter : IDENT ( bound )? -> ^( IDENT ( bound )? ) ;
public final JavaParser.genericTypeParameter_return genericTypeParameter() throws RecognitionException {
    JavaParser.genericTypeParameter_return retval = new JavaParser.genericTypeParameter_return();
    retval.start = input.LT(1);
    int genericTypeParameter_StartIndex = input.index();
    CommonTree root_0 = null;
    Token IDENT41 = null;
    JavaParser.bound_return bound42 = null;
    CommonTree IDENT41_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleSubtreeStream stream_bound = new RewriteRuleSubtreeStream(adaptor, "rule bound");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 13)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:480:5: ( IDENT ( bound )? -> ^( IDENT ( bound )? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:480:9: IDENT ( bound )?
        {
            IDENT41 = (Token) match(input, IDENT, FOLLOW_IDENT_in_genericTypeParameter5108);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_IDENT.add(IDENT41);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:480:15: ( bound )?
            int alt13 = 2;
            int LA13_0 = input.LA(1);
            if ((LA13_0 == EXTENDS)) {
                int LA13_1 = input.LA(2);
                if ((LA13_1 == BOOLEAN || LA13_1 == BYTE || LA13_1 == CHAR || LA13_1 == DOUBLE || LA13_1 == FLOAT || (LA13_1 >= INT && LA13_1 <= LONG) || LA13_1 == SHORT)) {
                    int LA13_3 = input.LA(3);
                    if ((synpred17_Java())) {
                        alt13 = 1;
                    }
                } else if ((LA13_1 == IDENT)) {
                    int LA13_4 = input.LA(3);
                    if ((synpred17_Java())) {
                        alt13 = 1;
                    }
                }
            }
            switch(alt13) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: bound
                    {
                        pushFollow(FOLLOW_bound_in_genericTypeParameter5110);
                        bound42 = bound();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_bound.add(bound42.getTree());
                        }
                    }
                    break;
            }
            // 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();
                // 481:9: -> ^( IDENT ( bound )? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:481:13: ^( IDENT ( bound )? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot(stream_IDENT.nextNode(), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:481:21: ( bound )?
                        if (stream_bound.hasNext()) {
                            adaptor.addChild(root_1, stream_bound.nextTree());
                        }
                        stream_bound.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        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, 13, genericTypeParameter_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 65 with CommonTree

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

the class JavaParser method qualifiedTypeIdentSimplified.

// $ANTLR start "qualifiedTypeIdentSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:672:1: qualifiedTypeIdentSimplified : typeIdentSimplified ( DOT typeIdentSimplified )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ ) ;
public final JavaParser.qualifiedTypeIdentSimplified_return qualifiedTypeIdentSimplified() throws RecognitionException {
    JavaParser.qualifiedTypeIdentSimplified_return retval = new JavaParser.qualifiedTypeIdentSimplified_return();
    retval.start = input.LT(1);
    int qualifiedTypeIdentSimplified_StartIndex = input.index();
    CommonTree root_0 = null;
    Token DOT178 = null;
    JavaParser.typeIdentSimplified_return typeIdentSimplified177 = null;
    JavaParser.typeIdentSimplified_return typeIdentSimplified179 = null;
    CommonTree DOT178_tree = null;
    RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
    RewriteRuleSubtreeStream stream_typeIdentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule typeIdentSimplified");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 46)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:673:5: ( typeIdentSimplified ( DOT typeIdentSimplified )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:673:9: typeIdentSimplified ( DOT typeIdentSimplified )*
        {
            pushFollow(FOLLOW_typeIdentSimplified_in_qualifiedTypeIdentSimplified7045);
            typeIdentSimplified177 = typeIdentSimplified();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_typeIdentSimplified.add(typeIdentSimplified177.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:673:29: ( DOT typeIdentSimplified )*
            loop63: do {
                int alt63 = 2;
                int LA63_0 = input.LA(1);
                if ((LA63_0 == DOT)) {
                    alt63 = 1;
                }
                switch(alt63) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:673:30: DOT typeIdentSimplified
                        {
                            DOT178 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedTypeIdentSimplified7048);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_DOT.add(DOT178);
                            }
                            pushFollow(FOLLOW_typeIdentSimplified_in_qualifiedTypeIdentSimplified7050);
                            typeIdentSimplified179 = typeIdentSimplified();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_typeIdentSimplified.add(typeIdentSimplified179.getTree());
                            }
                        }
                        break;
                    default:
                        break loop63;
                }
            } while (true);
            // 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();
                // 674:9: -> ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:674:13: ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(QUALIFIED_TYPE_IDENT, "QUALIFIED_TYPE_IDENT"), root_1);
                        if (!(stream_typeIdentSimplified.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_typeIdentSimplified.hasNext()) {
                            adaptor.addChild(root_1, stream_typeIdentSimplified.nextTree());
                        }
                        stream_typeIdentSimplified.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        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, 46, qualifiedTypeIdentSimplified_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

CommonTree (org.antlr.runtime.tree.CommonTree)155 RecognitionException (org.antlr.runtime.RecognitionException)132 Token (org.antlr.runtime.Token)106 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)81 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)62 NoViableAltException (org.antlr.runtime.NoViableAltException)33 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)15 CommonTokenStream (org.antlr.runtime.CommonTokenStream)12 CommonTreeNodeStream (org.antlr.runtime.tree.CommonTreeNodeStream)8 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)6 EarlyExitException (org.antlr.runtime.EarlyExitException)4 MismatchedSetException (org.antlr.runtime.MismatchedSetException)4 WindowingException (com.sap.hadoop.windowing.WindowingException)3 FileInputStream (java.io.FileInputStream)3 InputStreamReader (java.io.InputStreamReader)3 CharStream (org.antlr.runtime.CharStream)3 Tree (org.antlr.runtime.tree.Tree)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 TokenSource (org.antlr.runtime.TokenSource)2