Search in sources :

Example 21 with RewriteRuleTokenStream

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

the class JavaParser method qualifiedTypeIdent.

// $ANTLR start "qualifiedTypeIdent"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:667:1: qualifiedTypeIdent : typeIdent ( DOT typeIdent )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ ) ;
public final JavaParser.qualifiedTypeIdent_return qualifiedTypeIdent() throws RecognitionException {
    JavaParser.qualifiedTypeIdent_return retval = new JavaParser.qualifiedTypeIdent_return();
    retval.start = input.LT(1);
    int qualifiedTypeIdent_StartIndex = input.index();
    CommonTree root_0 = null;
    Token DOT175 = null;
    JavaParser.typeIdent_return typeIdent174 = null;
    JavaParser.typeIdent_return typeIdent176 = null;
    CommonTree DOT175_tree = null;
    RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
    RewriteRuleSubtreeStream stream_typeIdent = new RewriteRuleSubtreeStream(adaptor, "rule typeIdent");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 45)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:5: ( typeIdent ( DOT typeIdent )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:9: typeIdent ( DOT typeIdent )*
        {
            pushFollow(FOLLOW_typeIdent_in_qualifiedTypeIdent7001);
            typeIdent174 = typeIdent();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_typeIdent.add(typeIdent174.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:19: ( DOT typeIdent )*
            loop62: do {
                int alt62 = 2;
                int LA62_0 = input.LA(1);
                if ((LA62_0 == DOT)) {
                    int LA62_2 = input.LA(2);
                    if ((synpred80_Java())) {
                        alt62 = 1;
                    }
                }
                switch(alt62) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:668:20: DOT typeIdent
                        {
                            DOT175 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedTypeIdent7004);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_DOT.add(DOT175);
                            }
                            pushFollow(FOLLOW_typeIdent_in_qualifiedTypeIdent7006);
                            typeIdent176 = typeIdent();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_typeIdent.add(typeIdent176.getTree());
                            }
                        }
                        break;
                    default:
                        break loop62;
                }
            } 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();
                // 669:9: -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:669:13: ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(QUALIFIED_TYPE_IDENT, "QUALIFIED_TYPE_IDENT"), root_1);
                        if (!(stream_typeIdent.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_typeIdent.hasNext()) {
                            adaptor.addChild(root_1, stream_typeIdent.nextTree());
                        }
                        stream_typeIdent.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, 45, qualifiedTypeIdent_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)

Example 22 with RewriteRuleTokenStream

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

the class JavaParser method classExtendsClause.

// $ANTLR start "classExtendsClause"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:449:1: classExtendsClause : EXTENDS type -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type ) ;
public final JavaParser.classExtendsClause_return classExtendsClause() throws RecognitionException {
    JavaParser.classExtendsClause_return retval = new JavaParser.classExtendsClause_return();
    retval.start = input.LT(1);
    int classExtendsClause_StartIndex = input.index();
    CommonTree root_0 = null;
    Token EXTENDS27 = null;
    JavaParser.type_return type28 = null;
    CommonTree EXTENDS27_tree = null;
    RewriteRuleTokenStream stream_EXTENDS = new RewriteRuleTokenStream(adaptor, "token EXTENDS");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 8)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:450:5: ( EXTENDS type -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:450:9: EXTENDS type
        {
            EXTENDS27 = (Token) match(input, EXTENDS, FOLLOW_EXTENDS_in_classExtendsClause4817);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_EXTENDS.add(EXTENDS27);
            }
            pushFollow(FOLLOW_type_in_classExtendsClause4819);
            type28 = type();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_type.add(type28.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();
                // 451:9: -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:451:13: ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXTENDS_CLAUSE, EXTENDS27, "EXTENDS_CLAUSE"), root_1);
                        adaptor.addChild(root_1, stream_type.nextTree());
                        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, 8, classExtendsClause_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 23 with RewriteRuleTokenStream

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

the class JavaParser method classFieldDeclarator.

// $ANTLR start "classFieldDeclarator"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:574:1: classFieldDeclarator : variableDeclaratorId ( ASSIGN variableInitializer )? -> ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? ) ;
public final JavaParser.classFieldDeclarator_return classFieldDeclarator() throws RecognitionException {
    JavaParser.classFieldDeclarator_return retval = new JavaParser.classFieldDeclarator_return();
    retval.start = input.LT(1);
    int classFieldDeclarator_StartIndex = input.index();
    CommonTree root_0 = null;
    Token ASSIGN128 = null;
    JavaParser.variableDeclaratorId_return variableDeclaratorId127 = null;
    JavaParser.variableInitializer_return variableInitializer129 = null;
    CommonTree ASSIGN128_tree = null;
    RewriteRuleTokenStream stream_ASSIGN = new RewriteRuleTokenStream(adaptor, "token ASSIGN");
    RewriteRuleSubtreeStream stream_variableDeclaratorId = new RewriteRuleSubtreeStream(adaptor, "rule variableDeclaratorId");
    RewriteRuleSubtreeStream stream_variableInitializer = new RewriteRuleSubtreeStream(adaptor, "rule variableInitializer");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 28)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:5: ( variableDeclaratorId ( ASSIGN variableInitializer )? -> ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:9: variableDeclaratorId ( ASSIGN variableInitializer )?
        {
            pushFollow(FOLLOW_variableDeclaratorId_in_classFieldDeclarator6269);
            variableDeclaratorId127 = variableDeclaratorId();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_variableDeclaratorId.add(variableDeclaratorId127.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:30: ( ASSIGN variableInitializer )?
            int alt46 = 2;
            int LA46_0 = input.LA(1);
            if ((LA46_0 == ASSIGN)) {
                alt46 = 1;
            }
            switch(alt46) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:575:31: ASSIGN variableInitializer
                    {
                        ASSIGN128 = (Token) match(input, ASSIGN, FOLLOW_ASSIGN_in_classFieldDeclarator6272);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_ASSIGN.add(ASSIGN128);
                        }
                        pushFollow(FOLLOW_variableInitializer_in_classFieldDeclarator6274);
                        variableInitializer129 = variableInitializer();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_variableInitializer.add(variableInitializer129.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();
                // 576:9: -> ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:576:13: ^( VAR_DECLARATOR variableDeclaratorId ( variableInitializer )? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATOR, "VAR_DECLARATOR"), root_1);
                        adaptor.addChild(root_1, stream_variableDeclaratorId.nextTree());
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:576:51: ( variableInitializer )?
                        if (stream_variableInitializer.hasNext()) {
                            adaptor.addChild(root_1, stream_variableInitializer.nextTree());
                        }
                        stream_variableInitializer.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, 28, classFieldDeclarator_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 24 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream 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 25 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream 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)

Aggregations

RecognitionException (org.antlr.runtime.RecognitionException)74 Token (org.antlr.runtime.Token)74 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)74 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)74 CommonTree (org.antlr.runtime.tree.CommonTree)62 NoViableAltException (org.antlr.runtime.NoViableAltException)22 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)12 CommonToken (org.antlr.runtime.CommonToken)9 FailedPredicateException (org.antlr.runtime.FailedPredicateException)4 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)4 EarlyExitException (org.antlr.runtime.EarlyExitException)1 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)1