Search in sources :

Example 1 with NoViableAltException

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

the class JavaParser method postfixedExpression.

// $ANTLR start "postfixedExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1045:1: postfixedExpression : ( primaryExpression -> primaryExpression ) (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )* ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )? ;
public final JavaParser.postfixedExpression_return postfixedExpression() throws RecognitionException {
    JavaParser.postfixedExpression_return retval = new JavaParser.postfixedExpression_return();
    retval.start = input.LT(1);
    int postfixedExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token outerDot = null;
    Token Super = null;
    Token innerDot = null;
    Token IDENT451 = null;
    Token THIS453 = null;
    Token SUPER455 = null;
    Token IDENT456 = null;
    Token LBRACK459 = null;
    Token RBRACK461 = null;
    Token INC462 = null;
    Token DEC463 = null;
    JavaParser.primaryExpression_return primaryExpression449 = null;
    JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified450 = null;
    JavaParser.arguments_return arguments452 = null;
    JavaParser.arguments_return arguments454 = null;
    JavaParser.arguments_return arguments457 = null;
    JavaParser.innerNewExpression_return innerNewExpression458 = null;
    JavaParser.expression_return expression460 = null;
    CommonTree outerDot_tree = null;
    CommonTree Super_tree = null;
    CommonTree innerDot_tree = null;
    CommonTree IDENT451_tree = null;
    CommonTree THIS453_tree = null;
    CommonTree SUPER455_tree = null;
    CommonTree IDENT456_tree = null;
    CommonTree LBRACK459_tree = null;
    CommonTree RBRACK461_tree = null;
    CommonTree INC462_tree = null;
    CommonTree DEC463_tree = null;
    RewriteRuleTokenStream stream_RBRACK = new RewriteRuleTokenStream(adaptor, "token RBRACK");
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_INC = new RewriteRuleTokenStream(adaptor, "token INC");
    RewriteRuleTokenStream stream_DEC = new RewriteRuleTokenStream(adaptor, "token DEC");
    RewriteRuleTokenStream stream_LBRACK = new RewriteRuleTokenStream(adaptor, "token LBRACK");
    RewriteRuleTokenStream stream_SUPER = new RewriteRuleTokenStream(adaptor, "token SUPER");
    RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
    RewriteRuleTokenStream stream_THIS = new RewriteRuleTokenStream(adaptor, "token THIS");
    RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
    RewriteRuleSubtreeStream stream_arguments = new RewriteRuleSubtreeStream(adaptor, "rule arguments");
    RewriteRuleSubtreeStream stream_primaryExpression = new RewriteRuleSubtreeStream(adaptor, "rule primaryExpression");
    RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
    RewriteRuleSubtreeStream stream_innerNewExpression = new RewriteRuleSubtreeStream(adaptor, "rule innerNewExpression");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 104)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:5: ( ( primaryExpression -> primaryExpression ) (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )* ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )? )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:9: ( primaryExpression -> primaryExpression ) (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )* ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )?
        {
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:9: ( primaryExpression -> primaryExpression )
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:13: primaryExpression
            {
                pushFollow(FOLLOW_primaryExpression_in_postfixedExpression11572);
                primaryExpression449 = primaryExpression();
                state._fsp--;
                if (state.failed) {
                    return retval;
                }
                if (state.backtracking == 0) {
                    stream_primaryExpression.add(primaryExpression449.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();
                    // 1047:53: -> primaryExpression
                    {
                        adaptor.addChild(root_0, stream_primaryExpression.nextTree());
                    }
                    retval.tree = root_0;
                }
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1050:9: (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )*
            loop133: do {
                int alt133 = 3;
                int LA133_0 = input.LA(1);
                if ((LA133_0 == DOT)) {
                    alt133 = 1;
                } else if ((LA133_0 == LBRACK)) {
                    alt133 = 2;
                }
                switch(alt133) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1050:13: outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) )
                        {
                            outerDot = (Token) match(input, DOT, FOLLOW_DOT_in_postfixedExpression11634);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_DOT.add(outerDot);
                            }
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:13: ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) )
                            int alt132 = 5;
                            switch(input.LA(1)) {
                                case LESS_THAN:
                                case IDENT:
                                    {
                                        alt132 = 1;
                                    }
                                    break;
                                case THIS:
                                    {
                                        alt132 = 2;
                                    }
                                    break;
                                case SUPER:
                                    {
                                        int LA132_3 = input.LA(2);
                                        if ((LA132_3 == DOT)) {
                                            alt132 = 4;
                                        } else if ((LA132_3 == LPAREN)) {
                                            alt132 = 3;
                                        } else {
                                            if (state.backtracking > 0) {
                                                state.failed = true;
                                                return retval;
                                            }
                                            NoViableAltException nvae = new NoViableAltException("", 132, 3, input);
                                            throw nvae;
                                        }
                                    }
                                    break;
                                case NEW:
                                    {
                                        alt132 = 5;
                                    }
                                    break;
                                default:
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 132, 0, input);
                                    throw nvae;
                            }
                            switch(alt132) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:17: ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )?
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:17: ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) )
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:21: ( genericTypeArgumentListSimplified )? IDENT
                                        {
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:21: ( genericTypeArgumentListSimplified )?
                                            int alt129 = 2;
                                            int LA129_0 = input.LA(1);
                                            if ((LA129_0 == LESS_THAN)) {
                                                alt129 = 1;
                                            }
                                            switch(alt129) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeArgumentListSimplified
                                                    {
                                                        pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_postfixedExpression11656);
                                                        genericTypeArgumentListSimplified450 = genericTypeArgumentListSimplified();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified450.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            IDENT451 = (Token) match(input, IDENT, FOLLOW_IDENT_in_postfixedExpression11738);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT451);
                                            }
                                            // 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();
                                                // 1053:53: -> ^( DOT $postfixedExpression IDENT )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1053:57: ^( DOT $postfixedExpression IDENT )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
                                                        adaptor.addChild(root_1, stream_retval.nextTree());
                                                        adaptor.addChild(root_1, stream_IDENT.nextNode());
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:17: ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )?
                                        int alt130 = 2;
                                        int LA130_0 = input.LA(1);
                                        if ((LA130_0 == LPAREN)) {
                                            alt130 = 1;
                                        }
                                        switch(alt130) {
                                            case 1:
                                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:21: arguments
                                                {
                                                    pushFollow(FOLLOW_arguments_in_postfixedExpression11816);
                                                    arguments452 = arguments();
                                                    state._fsp--;
                                                    if (state.failed) {
                                                        return retval;
                                                    }
                                                    if (state.backtracking == 0) {
                                                        stream_arguments.add(arguments452.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();
                                                        // 1055:53: -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments )
                                                        {
                                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:57: ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments )
                                                            {
                                                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
                                                                adaptor.addChild(root_1, stream_retval.nextTree());
                                                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:92: ( genericTypeArgumentListSimplified )?
                                                                if (stream_genericTypeArgumentListSimplified.hasNext()) {
                                                                    adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
                                                                }
                                                                stream_genericTypeArgumentListSimplified.reset();
                                                                adaptor.addChild(root_1, stream_arguments.nextTree());
                                                                adaptor.addChild(root_0, root_1);
                                                            }
                                                        }
                                                        retval.tree = root_0;
                                                    }
                                                }
                                                break;
                                        }
                                    }
                                    break;
                                case 2:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1057:17: THIS
                                    {
                                        THIS453 = (Token) match(input, THIS, FOLLOW_THIS_in_postfixedExpression11890);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_THIS.add(THIS453);
                                        }
                                        // 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();
                                            // 1057:53: -> ^( DOT $postfixedExpression THIS )
                                            {
                                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1057:57: ^( DOT $postfixedExpression THIS )
                                                {
                                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                                    root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
                                                    adaptor.addChild(root_1, stream_retval.nextTree());
                                                    adaptor.addChild(root_1, stream_THIS.nextNode());
                                                    adaptor.addChild(root_0, root_1);
                                                }
                                            }
                                            retval.tree = root_0;
                                        }
                                    }
                                    break;
                                case 3:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1058:17: Super= SUPER arguments
                                    {
                                        Super = (Token) match(input, SUPER, FOLLOW_SUPER_in_postfixedExpression11953);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_SUPER.add(Super);
                                        }
                                        pushFollow(FOLLOW_arguments_in_postfixedExpression11955);
                                        arguments454 = arguments();
                                        state._fsp--;
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_arguments.add(arguments454.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();
                                            // 1058:57: -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments )
                                            {
                                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1058:61: ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments )
                                                {
                                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, Super, "SUPER_CONSTRUCTOR_CALL"), root_1);
                                                    adaptor.addChild(root_1, stream_retval.nextTree());
                                                    adaptor.addChild(root_1, stream_arguments.nextTree());
                                                    adaptor.addChild(root_0, root_1);
                                                }
                                            }
                                            retval.tree = root_0;
                                        }
                                    }
                                    break;
                                case 4:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:17: ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )?
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:17: ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) )
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:21: SUPER innerDot= DOT IDENT
                                        {
                                            SUPER455 = (Token) match(input, SUPER, FOLLOW_SUPER_in_postfixedExpression12008);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_SUPER.add(SUPER455);
                                            }
                                            innerDot = (Token) match(input, DOT, FOLLOW_DOT_in_postfixedExpression12012);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_DOT.add(innerDot);
                                            }
                                            IDENT456 = (Token) match(input, IDENT, FOLLOW_IDENT_in_postfixedExpression12014);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT456);
                                            }
                                            // wildcard labels:
                                            if (state.backtracking == 0) {
                                                retval.tree = root_0;
                                                RewriteRuleTokenStream stream_outerDot = new RewriteRuleTokenStream(adaptor, "token outerDot", outerDot);
                                                RewriteRuleTokenStream stream_innerDot = new RewriteRuleTokenStream(adaptor, "token innerDot", innerDot);
                                                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                                                root_0 = (CommonTree) adaptor.nil();
                                                // 1059:53: -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:57: ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT )
                                                    {
                                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                                        root_1 = (CommonTree) adaptor.becomeRoot(stream_innerDot.nextNode(), root_1);
                                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:69: ^( $outerDot $postfixedExpression SUPER )
                                                        {
                                                            CommonTree root_2 = (CommonTree) adaptor.nil();
                                                            root_2 = (CommonTree) adaptor.becomeRoot(stream_outerDot.nextNode(), root_2);
                                                            adaptor.addChild(root_2, stream_retval.nextTree());
                                                            adaptor.addChild(root_2, stream_SUPER.nextNode());
                                                            adaptor.addChild(root_1, root_2);
                                                        }
                                                        adaptor.addChild(root_1, stream_IDENT.nextNode());
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1061:17: ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )?
                                        int alt131 = 2;
                                        int LA131_0 = input.LA(1);
                                        if ((LA131_0 == LPAREN)) {
                                            alt131 = 1;
                                        }
                                        switch(alt131) {
                                            case 1:
                                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1061:21: arguments
                                                {
                                                    pushFollow(FOLLOW_arguments_in_postfixedExpression12081);
                                                    arguments457 = arguments();
                                                    state._fsp--;
                                                    if (state.failed) {
                                                        return retval;
                                                    }
                                                    if (state.backtracking == 0) {
                                                        stream_arguments.add(arguments457.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();
                                                        // 1061:53: -> ^( METHOD_CALL $postfixedExpression arguments )
                                                        {
                                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1061:57: ^( METHOD_CALL $postfixedExpression arguments )
                                                            {
                                                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
                                                                adaptor.addChild(root_1, stream_retval.nextTree());
                                                                adaptor.addChild(root_1, stream_arguments.nextTree());
                                                                adaptor.addChild(root_0, root_1);
                                                            }
                                                        }
                                                        retval.tree = root_0;
                                                    }
                                                }
                                                break;
                                        }
                                    }
                                    break;
                                case 5:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1063:17: innerNewExpression
                                    {
                                        pushFollow(FOLLOW_innerNewExpression_in_postfixedExpression12152);
                                        innerNewExpression458 = innerNewExpression();
                                        state._fsp--;
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_innerNewExpression.add(innerNewExpression458.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();
                                            // 1063:53: -> ^( DOT $postfixedExpression innerNewExpression )
                                            {
                                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1063:57: ^( DOT $postfixedExpression innerNewExpression )
                                                {
                                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                                    root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
                                                    adaptor.addChild(root_1, stream_retval.nextTree());
                                                    adaptor.addChild(root_1, stream_innerNewExpression.nextTree());
                                                    adaptor.addChild(root_0, root_1);
                                                }
                                            }
                                            retval.tree = root_0;
                                        }
                                    }
                                    break;
                            }
                        }
                        break;
                    case 2:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1065:13: LBRACK expression RBRACK
                        {
                            LBRACK459 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_postfixedExpression12209);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_LBRACK.add(LBRACK459);
                            }
                            pushFollow(FOLLOW_expression_in_postfixedExpression12211);
                            expression460 = expression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_expression.add(expression460.getTree());
                            }
                            RBRACK461 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_postfixedExpression12213);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_RBRACK.add(RBRACK461);
                            }
                            // 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();
                                // 1065:53: -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression )
                                {
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1065:57: ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression )
                                    {
                                        CommonTree root_1 = (CommonTree) adaptor.nil();
                                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_ELEMENT_ACCESS, "ARRAY_ELEMENT_ACCESS"), root_1);
                                        adaptor.addChild(root_1, stream_retval.nextTree());
                                        adaptor.addChild(root_1, stream_expression.nextTree());
                                        adaptor.addChild(root_0, root_1);
                                    }
                                }
                                retval.tree = root_0;
                            }
                        }
                        break;
                    default:
                        break loop133;
                }
            } while (true);
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1068:9: ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )?
            int alt134 = 3;
            int LA134_0 = input.LA(1);
            if ((LA134_0 == INC)) {
                alt134 = 1;
            } else if ((LA134_0 == DEC)) {
                alt134 = 2;
            }
            switch(alt134) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1068:13: INC
                    {
                        INC462 = (Token) match(input, INC, FOLLOW_INC_in_postfixedExpression12274);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_INC.add(INC462);
                        }
                        // 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();
                            // 1068:17: -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression)
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1068:20: ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression)
                                {
                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(POST_INC, INC462, "POST_INC"), root_1);
                                    adaptor.addChild(root_1, stream_retval.nextTree());
                                    adaptor.addChild(root_0, root_1);
                                }
                            }
                            retval.tree = root_0;
                        }
                    }
                    break;
                case 2:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1069:13: DEC
                    {
                        DEC463 = (Token) match(input, DEC, FOLLOW_DEC_in_postfixedExpression12298);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_DEC.add(DEC463);
                        }
                        // 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();
                            // 1069:17: -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression)
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:1069:20: ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression)
                                {
                                    CommonTree root_1 = (CommonTree) adaptor.nil();
                                    root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(POST_DEC, DEC463, "POST_DEC"), root_1);
                                    adaptor.addChild(root_1, stream_retval.nextTree());
                                    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, 104, postfixedExpression_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 2 with NoViableAltException

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

the class JavaParser method modifier.

// $ANTLR start "modifier"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:623:1: modifier : ( PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | STRICTFP | localModifier );
public final JavaParser.modifier_return modifier() throws RecognitionException {
    JavaParser.modifier_return retval = new JavaParser.modifier_return();
    retval.start = input.LT(1);
    int modifier_StartIndex = input.index();
    CommonTree root_0 = null;
    Token PUBLIC152 = null;
    Token PROTECTED153 = null;
    Token PRIVATE154 = null;
    Token STATIC155 = null;
    Token ABSTRACT156 = null;
    Token NATIVE157 = null;
    Token SYNCHRONIZED158 = null;
    Token TRANSIENT159 = null;
    Token VOLATILE160 = null;
    Token STRICTFP161 = null;
    JavaParser.localModifier_return localModifier162 = null;
    CommonTree PUBLIC152_tree = null;
    CommonTree PROTECTED153_tree = null;
    CommonTree PRIVATE154_tree = null;
    CommonTree STATIC155_tree = null;
    CommonTree ABSTRACT156_tree = null;
    CommonTree NATIVE157_tree = null;
    CommonTree SYNCHRONIZED158_tree = null;
    CommonTree TRANSIENT159_tree = null;
    CommonTree VOLATILE160_tree = null;
    CommonTree STRICTFP161_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 38)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:624:5: ( PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | STRICTFP | localModifier )
        int alt55 = 11;
        switch(input.LA(1)) {
            case PUBLIC:
                {
                    alt55 = 1;
                }
                break;
            case PROTECTED:
                {
                    alt55 = 2;
                }
                break;
            case PRIVATE:
                {
                    alt55 = 3;
                }
                break;
            case STATIC:
                {
                    alt55 = 4;
                }
                break;
            case ABSTRACT:
                {
                    alt55 = 5;
                }
                break;
            case NATIVE:
                {
                    alt55 = 6;
                }
                break;
            case SYNCHRONIZED:
                {
                    alt55 = 7;
                }
                break;
            case TRANSIENT:
                {
                    alt55 = 8;
                }
                break;
            case VOLATILE:
                {
                    alt55 = 9;
                }
                break;
            case STRICTFP:
                {
                    alt55 = 10;
                }
                break;
            case AT:
            case FINAL:
                {
                    alt55 = 11;
                }
                break;
            default:
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                NoViableAltException nvae = new NoViableAltException("", 55, 0, input);
                throw nvae;
        }
        switch(alt55) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:624:9: PUBLIC
                {
                    root_0 = (CommonTree) adaptor.nil();
                    PUBLIC152 = (Token) match(input, PUBLIC, FOLLOW_PUBLIC_in_modifier6659);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        PUBLIC152_tree = (CommonTree) adaptor.create(PUBLIC152);
                        adaptor.addChild(root_0, PUBLIC152_tree);
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:625:9: PROTECTED
                {
                    root_0 = (CommonTree) adaptor.nil();
                    PROTECTED153 = (Token) match(input, PROTECTED, FOLLOW_PROTECTED_in_modifier6669);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        PROTECTED153_tree = (CommonTree) adaptor.create(PROTECTED153);
                        adaptor.addChild(root_0, PROTECTED153_tree);
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:626:9: PRIVATE
                {
                    root_0 = (CommonTree) adaptor.nil();
                    PRIVATE154 = (Token) match(input, PRIVATE, FOLLOW_PRIVATE_in_modifier6679);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        PRIVATE154_tree = (CommonTree) adaptor.create(PRIVATE154);
                        adaptor.addChild(root_0, PRIVATE154_tree);
                    }
                }
                break;
            case 4:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:627:9: STATIC
                {
                    root_0 = (CommonTree) adaptor.nil();
                    STATIC155 = (Token) match(input, STATIC, FOLLOW_STATIC_in_modifier6689);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        STATIC155_tree = (CommonTree) adaptor.create(STATIC155);
                        adaptor.addChild(root_0, STATIC155_tree);
                    }
                }
                break;
            case 5:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:628:9: ABSTRACT
                {
                    root_0 = (CommonTree) adaptor.nil();
                    ABSTRACT156 = (Token) match(input, ABSTRACT, FOLLOW_ABSTRACT_in_modifier6699);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        ABSTRACT156_tree = (CommonTree) adaptor.create(ABSTRACT156);
                        adaptor.addChild(root_0, ABSTRACT156_tree);
                    }
                }
                break;
            case 6:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:629:9: NATIVE
                {
                    root_0 = (CommonTree) adaptor.nil();
                    NATIVE157 = (Token) match(input, NATIVE, FOLLOW_NATIVE_in_modifier6709);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        NATIVE157_tree = (CommonTree) adaptor.create(NATIVE157);
                        adaptor.addChild(root_0, NATIVE157_tree);
                    }
                }
                break;
            case 7:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:630:9: SYNCHRONIZED
                {
                    root_0 = (CommonTree) adaptor.nil();
                    SYNCHRONIZED158 = (Token) match(input, SYNCHRONIZED, FOLLOW_SYNCHRONIZED_in_modifier6719);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        SYNCHRONIZED158_tree = (CommonTree) adaptor.create(SYNCHRONIZED158);
                        adaptor.addChild(root_0, SYNCHRONIZED158_tree);
                    }
                }
                break;
            case 8:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:631:9: TRANSIENT
                {
                    root_0 = (CommonTree) adaptor.nil();
                    TRANSIENT159 = (Token) match(input, TRANSIENT, FOLLOW_TRANSIENT_in_modifier6729);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        TRANSIENT159_tree = (CommonTree) adaptor.create(TRANSIENT159);
                        adaptor.addChild(root_0, TRANSIENT159_tree);
                    }
                }
                break;
            case 9:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:632:9: VOLATILE
                {
                    root_0 = (CommonTree) adaptor.nil();
                    VOLATILE160 = (Token) match(input, VOLATILE, FOLLOW_VOLATILE_in_modifier6739);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        VOLATILE160_tree = (CommonTree) adaptor.create(VOLATILE160);
                        adaptor.addChild(root_0, VOLATILE160_tree);
                    }
                }
                break;
            case 10:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:633:9: STRICTFP
                {
                    root_0 = (CommonTree) adaptor.nil();
                    STRICTFP161 = (Token) match(input, STRICTFP, FOLLOW_STRICTFP_in_modifier6749);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        STRICTFP161_tree = (CommonTree) adaptor.create(STRICTFP161);
                        adaptor.addChild(root_0, STRICTFP161_tree);
                    }
                }
                break;
            case 11:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:634:9: localModifier
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_localModifier_in_modifier6759);
                    localModifier162 = localModifier();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, localModifier162.getTree());
                    }
                }
                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, 38, modifier_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 3 with NoViableAltException

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

the class JavaParser method genericTypeArgument.

// $ANTLR start "genericTypeArgument"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:701:1: genericTypeArgument : ( type | QUESTION ( genericWildcardBoundType )? -> ^( QUESTION ( genericWildcardBoundType )? ) );
public final JavaParser.genericTypeArgument_return genericTypeArgument() throws RecognitionException {
    JavaParser.genericTypeArgument_return retval = new JavaParser.genericTypeArgument_return();
    retval.start = input.LT(1);
    int genericTypeArgument_StartIndex = input.index();
    CommonTree root_0 = null;
    Token QUESTION191 = null;
    JavaParser.type_return type190 = null;
    JavaParser.genericWildcardBoundType_return genericWildcardBoundType192 = null;
    CommonTree QUESTION191_tree = null;
    RewriteRuleTokenStream stream_QUESTION = new RewriteRuleTokenStream(adaptor, "token QUESTION");
    RewriteRuleSubtreeStream stream_genericWildcardBoundType = new RewriteRuleSubtreeStream(adaptor, "rule genericWildcardBoundType");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 51)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:702:5: ( type | QUESTION ( genericWildcardBoundType )? -> ^( QUESTION ( genericWildcardBoundType )? ) )
        int alt68 = 2;
        int LA68_0 = input.LA(1);
        if ((LA68_0 == BOOLEAN || LA68_0 == BYTE || LA68_0 == CHAR || LA68_0 == DOUBLE || LA68_0 == FLOAT || (LA68_0 >= INT && LA68_0 <= LONG) || LA68_0 == SHORT || LA68_0 == IDENT)) {
            alt68 = 1;
        } else if ((LA68_0 == QUESTION)) {
            alt68 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 68, 0, input);
            throw nvae;
        }
        switch(alt68) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:702:9: type
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_type_in_genericTypeArgument7273);
                    type190 = type();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, type190.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:703:9: QUESTION ( genericWildcardBoundType )?
                {
                    QUESTION191 = (Token) match(input, QUESTION, FOLLOW_QUESTION_in_genericTypeArgument7283);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_QUESTION.add(QUESTION191);
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:703:18: ( genericWildcardBoundType )?
                    int alt67 = 2;
                    int LA67_0 = input.LA(1);
                    if ((LA67_0 == EXTENDS)) {
                        int LA67_1 = input.LA(2);
                        if ((LA67_1 == BOOLEAN || LA67_1 == BYTE || LA67_1 == CHAR || LA67_1 == DOUBLE || LA67_1 == FLOAT || (LA67_1 >= INT && LA67_1 <= LONG) || LA67_1 == SHORT)) {
                            int LA67_4 = input.LA(3);
                            if ((synpred93_Java())) {
                                alt67 = 1;
                            }
                        } else if ((LA67_1 == IDENT)) {
                            int LA67_5 = input.LA(3);
                            if ((synpred93_Java())) {
                                alt67 = 1;
                            }
                        }
                    } else if ((LA67_0 == SUPER)) {
                        int LA67_3 = input.LA(2);
                        if ((LA67_3 == BOOLEAN || LA67_3 == BYTE || LA67_3 == CHAR || LA67_3 == DOUBLE || LA67_3 == FLOAT || (LA67_3 >= INT && LA67_3 <= LONG) || LA67_3 == SHORT || LA67_3 == IDENT)) {
                            alt67 = 1;
                        }
                    }
                    switch(alt67) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericWildcardBoundType
                            {
                                pushFollow(FOLLOW_genericWildcardBoundType_in_genericTypeArgument7285);
                                genericWildcardBoundType192 = genericWildcardBoundType();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_genericWildcardBoundType.add(genericWildcardBoundType192.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();
                        // 704:9: -> ^( QUESTION ( genericWildcardBoundType )? )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:704:13: ^( QUESTION ( genericWildcardBoundType )? )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot(stream_QUESTION.nextNode(), root_1);
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:704:24: ( genericWildcardBoundType )?
                                if (stream_genericWildcardBoundType.hasNext()) {
                                    adaptor.addChild(root_1, stream_genericWildcardBoundType.nextTree());
                                }
                                stream_genericWildcardBoundType.reset();
                                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, 51, genericTypeArgument_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 4 with NoViableAltException

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

the class JavaParser method annotationInitializers.

// $ANTLR start "annotationInitializers"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:772:1: annotationInitializers : ( annotationInitializer ( COMMA annotationInitializer )* -> ^( ANNOTATION_INIT_KEY_LIST ( annotationInitializer )+ ) | annotationElementValue -> ^( ANNOTATION_INIT_DEFAULT_KEY annotationElementValue ) );
public final JavaParser.annotationInitializers_return annotationInitializers() throws RecognitionException {
    JavaParser.annotationInitializers_return retval = new JavaParser.annotationInitializers_return();
    retval.start = input.LT(1);
    int annotationInitializers_StartIndex = input.index();
    CommonTree root_0 = null;
    Token COMMA230 = null;
    JavaParser.annotationInitializer_return annotationInitializer229 = null;
    JavaParser.annotationInitializer_return annotationInitializer231 = null;
    JavaParser.annotationElementValue_return annotationElementValue232 = null;
    CommonTree COMMA230_tree = null;
    RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
    RewriteRuleSubtreeStream stream_annotationElementValue = new RewriteRuleSubtreeStream(adaptor, "rule annotationElementValue");
    RewriteRuleSubtreeStream stream_annotationInitializer = new RewriteRuleSubtreeStream(adaptor, "rule annotationInitializer");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 63)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:773:5: ( annotationInitializer ( COMMA annotationInitializer )* -> ^( ANNOTATION_INIT_KEY_LIST ( annotationInitializer )+ ) | annotationElementValue -> ^( ANNOTATION_INIT_DEFAULT_KEY annotationElementValue ) )
        int alt79 = 2;
        int LA79_0 = input.LA(1);
        if ((LA79_0 == IDENT)) {
            int LA79_1 = input.LA(2);
            if ((LA79_1 == ASSIGN)) {
                alt79 = 1;
            } else if ((LA79_1 == AND || LA79_1 == BIT_SHIFT_RIGHT || (LA79_1 >= DEC && LA79_1 <= DIV) || LA79_1 == DOT || (LA79_1 >= EQUAL && LA79_1 <= LBRACK) || (LA79_1 >= LESS_OR_EQUAL && LA79_1 <= LOGICAL_AND) || (LA79_1 >= LOGICAL_OR && LA79_1 <= MINUS) || LA79_1 == MOD || (LA79_1 >= NOT_EQUAL && LA79_1 <= OR) || LA79_1 == PLUS || LA79_1 == QUESTION || LA79_1 == RPAREN || LA79_1 == SHIFT_LEFT || LA79_1 == SHIFT_RIGHT || LA79_1 == STAR || LA79_1 == XOR || LA79_1 == INSTANCEOF)) {
                alt79 = 2;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                NoViableAltException nvae = new NoViableAltException("", 79, 1, input);
                throw nvae;
            }
        } else if ((LA79_0 == AT || LA79_0 == DEC || LA79_0 == INC || LA79_0 == LCURLY || LA79_0 == LESS_THAN || LA79_0 == LOGICAL_NOT || (LA79_0 >= LPAREN && LA79_0 <= MINUS) || LA79_0 == NOT || LA79_0 == PLUS || LA79_0 == BOOLEAN || LA79_0 == BYTE || LA79_0 == CHAR || LA79_0 == DOUBLE || LA79_0 == FALSE || LA79_0 == FLOAT || (LA79_0 >= INT && LA79_0 <= LONG) || (LA79_0 >= NEW && LA79_0 <= NULL) || LA79_0 == SHORT || LA79_0 == SUPER || LA79_0 == THIS || LA79_0 == TRUE || LA79_0 == VOID || (LA79_0 >= HEX_LITERAL && LA79_0 <= STRING_LITERAL))) {
            alt79 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 79, 0, input);
            throw nvae;
        }
        switch(alt79) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:773:9: annotationInitializer ( COMMA annotationInitializer )*
                {
                    pushFollow(FOLLOW_annotationInitializer_in_annotationInitializers7938);
                    annotationInitializer229 = annotationInitializer();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_annotationInitializer.add(annotationInitializer229.getTree());
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:773:31: ( COMMA annotationInitializer )*
                    loop78: do {
                        int alt78 = 2;
                        int LA78_0 = input.LA(1);
                        if ((LA78_0 == COMMA)) {
                            alt78 = 1;
                        }
                        switch(alt78) {
                            case 1:
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:773:32: COMMA annotationInitializer
                                {
                                    COMMA230 = (Token) match(input, COMMA, FOLLOW_COMMA_in_annotationInitializers7941);
                                    if (state.failed) {
                                        return retval;
                                    }
                                    if (state.backtracking == 0) {
                                        stream_COMMA.add(COMMA230);
                                    }
                                    pushFollow(FOLLOW_annotationInitializer_in_annotationInitializers7943);
                                    annotationInitializer231 = annotationInitializer();
                                    state._fsp--;
                                    if (state.failed) {
                                        return retval;
                                    }
                                    if (state.backtracking == 0) {
                                        stream_annotationInitializer.add(annotationInitializer231.getTree());
                                    }
                                }
                                break;
                            default:
                                break loop78;
                        }
                    } 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();
                        // 774:9: -> ^( ANNOTATION_INIT_KEY_LIST ( annotationInitializer )+ )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:774:13: ^( ANNOTATION_INIT_KEY_LIST ( annotationInitializer )+ )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_INIT_KEY_LIST, "ANNOTATION_INIT_KEY_LIST"), root_1);
                                if (!(stream_annotationInitializer.hasNext())) {
                                    throw new RewriteEarlyExitException();
                                }
                                while (stream_annotationInitializer.hasNext()) {
                                    adaptor.addChild(root_1, stream_annotationInitializer.nextTree());
                                }
                                stream_annotationInitializer.reset();
                                adaptor.addChild(root_0, root_1);
                            }
                        }
                        retval.tree = root_0;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:775:9: annotationElementValue
                {
                    pushFollow(FOLLOW_annotationElementValue_in_annotationInitializers7973);
                    annotationElementValue232 = annotationElementValue();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_annotationElementValue.add(annotationElementValue232.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();
                        // 776:9: -> ^( ANNOTATION_INIT_DEFAULT_KEY annotationElementValue )
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:776:13: ^( ANNOTATION_INIT_DEFAULT_KEY annotationElementValue )
                            {
                                CommonTree root_1 = (CommonTree) adaptor.nil();
                                root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_INIT_DEFAULT_KEY, "ANNOTATION_INIT_DEFAULT_KEY"), root_1);
                                adaptor.addChild(root_1, stream_annotationElementValue.nextTree());
                                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, 63, annotationInitializers_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 5 with NoViableAltException

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

the class JavaParser method interfaceScopeDeclarations.

// $ANTLR start "interfaceScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:554:1: interfaceScopeDeclarations : ( modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ) | VOID IDENT formalParameterList ( throwsClause )? SEMI -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ) ) | type interfaceFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type interfaceFieldDeclaratorList ) ) | typeDeclaration | SEMI );
public final JavaParser.interfaceScopeDeclarations_return interfaceScopeDeclarations() throws RecognitionException {
    JavaParser.interfaceScopeDeclarations_return retval = new JavaParser.interfaceScopeDeclarations_return();
    retval.start = input.LT(1);
    int interfaceScopeDeclarations_StartIndex = input.index();
    CommonTree root_0 = null;
    Token IDENT109 = null;
    Token SEMI113 = null;
    Token VOID114 = null;
    Token IDENT115 = null;
    Token SEMI118 = null;
    Token SEMI121 = null;
    Token SEMI123 = null;
    JavaParser.modifierList_return modifierList106 = null;
    JavaParser.genericTypeParameterList_return genericTypeParameterList107 = null;
    JavaParser.type_return type108 = null;
    JavaParser.formalParameterList_return formalParameterList110 = null;
    JavaParser.arrayDeclaratorList_return arrayDeclaratorList111 = null;
    JavaParser.throwsClause_return throwsClause112 = null;
    JavaParser.formalParameterList_return formalParameterList116 = null;
    JavaParser.throwsClause_return throwsClause117 = null;
    JavaParser.type_return type119 = null;
    JavaParser.interfaceFieldDeclaratorList_return interfaceFieldDeclaratorList120 = null;
    JavaParser.typeDeclaration_return typeDeclaration122 = null;
    CommonTree IDENT109_tree = null;
    CommonTree SEMI113_tree = null;
    CommonTree VOID114_tree = null;
    CommonTree IDENT115_tree = null;
    CommonTree SEMI118_tree = null;
    CommonTree SEMI121_tree = null;
    CommonTree SEMI123_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");
    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_interfaceFieldDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule interfaceFieldDeclaratorList");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    RewriteRuleSubtreeStream stream_formalParameterList = new RewriteRuleSubtreeStream(adaptor, "rule formalParameterList");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 26)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:555:5: ( modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ) | VOID IDENT formalParameterList ( throwsClause )? SEMI -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ) ) | type interfaceFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type interfaceFieldDeclaratorList ) ) | typeDeclaration | SEMI )
        int alt44 = 3;
        alt44 = dfa44.predict(input);
        switch(alt44) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:555:9: modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ) | VOID IDENT formalParameterList ( throwsClause )? SEMI -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ) ) | type interfaceFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type interfaceFieldDeclaratorList ) )
                {
                    pushFollow(FOLLOW_modifierList_in_interfaceScopeDeclarations5971);
                    modifierList106 = modifierList();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        stream_modifierList.add(modifierList106.getTree());
                    }
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:556:9: ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ) | VOID IDENT formalParameterList ( throwsClause )? SEMI -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ) ) | type interfaceFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type interfaceFieldDeclaratorList ) )
                    int alt43 = 2;
                    switch(input.LA(1)) {
                        case LESS_THAN:
                        case VOID:
                            {
                                alt43 = 1;
                            }
                            break;
                        case BOOLEAN:
                        case BYTE:
                        case CHAR:
                        case DOUBLE:
                        case FLOAT:
                        case INT:
                        case LONG:
                        case SHORT:
                            {
                                int LA43_2 = input.LA(2);
                                if ((synpred51_Java())) {
                                    alt43 = 1;
                                } else if ((true)) {
                                    alt43 = 2;
                                } else {
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 43, 2, input);
                                    throw nvae;
                                }
                            }
                            break;
                        case IDENT:
                            {
                                int LA43_3 = input.LA(2);
                                if ((synpred51_Java())) {
                                    alt43 = 1;
                                } else if ((true)) {
                                    alt43 = 2;
                                } else {
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 43, 3, input);
                                    throw nvae;
                                }
                            }
                            break;
                        default:
                            if (state.backtracking > 0) {
                                state.failed = true;
                                return retval;
                            }
                            NoViableAltException nvae = new NoViableAltException("", 43, 0, input);
                            throw nvae;
                    }
                    switch(alt43) {
                        case 1:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:556:13: ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ) | VOID IDENT formalParameterList ( throwsClause )? SEMI -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ) )
                            {
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:556:13: ( genericTypeParameterList )?
                                int alt38 = 2;
                                int LA38_0 = input.LA(1);
                                if ((LA38_0 == LESS_THAN)) {
                                    alt38 = 1;
                                }
                                switch(alt38) {
                                    case 1:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeParameterList
                                        {
                                            pushFollow(FOLLOW_genericTypeParameterList_in_interfaceScopeDeclarations5985);
                                            genericTypeParameterList107 = genericTypeParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_genericTypeParameterList.add(genericTypeParameterList107.getTree());
                                            }
                                        }
                                        break;
                                }
                                // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:13: ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ) | VOID IDENT formalParameterList ( throwsClause )? SEMI -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ) )
                                int alt42 = 2;
                                int LA42_0 = input.LA(1);
                                if ((LA42_0 == BOOLEAN || LA42_0 == BYTE || LA42_0 == CHAR || LA42_0 == DOUBLE || LA42_0 == FLOAT || (LA42_0 >= INT && LA42_0 <= LONG) || LA42_0 == SHORT || LA42_0 == IDENT)) {
                                    alt42 = 1;
                                } else if ((LA42_0 == VOID)) {
                                    alt42 = 2;
                                } else {
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 42, 0, input);
                                    throw nvae;
                                }
                                switch(alt42) {
                                    case 1:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:17: type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? SEMI
                                        {
                                            pushFollow(FOLLOW_type_in_interfaceScopeDeclarations6004);
                                            type108 = type();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_type.add(type108.getTree());
                                            }
                                            IDENT109 = (Token) match(input, IDENT, FOLLOW_IDENT_in_interfaceScopeDeclarations6006);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT109);
                                            }
                                            pushFollow(FOLLOW_formalParameterList_in_interfaceScopeDeclarations6008);
                                            formalParameterList110 = formalParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_formalParameterList.add(formalParameterList110.getTree());
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:48: ( arrayDeclaratorList )?
                                            int alt39 = 2;
                                            int LA39_0 = input.LA(1);
                                            if ((LA39_0 == LBRACK)) {
                                                alt39 = 1;
                                            }
                                            switch(alt39) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
                                                    {
                                                        pushFollow(FOLLOW_arrayDeclaratorList_in_interfaceScopeDeclarations6010);
                                                        arrayDeclaratorList111 = arrayDeclaratorList();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_arrayDeclaratorList.add(arrayDeclaratorList111.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:557:69: ( throwsClause )?
                                            int alt40 = 2;
                                            int LA40_0 = input.LA(1);
                                            if ((LA40_0 == THROWS)) {
                                                alt40 = 1;
                                            }
                                            switch(alt40) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                                                    {
                                                        pushFollow(FOLLOW_throwsClause_in_interfaceScopeDeclarations6013);
                                                        throwsClause112 = throwsClause();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_throwsClause.add(throwsClause112.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            SEMI113 = (Token) match(input, SEMI, FOLLOW_SEMI_in_interfaceScopeDeclarations6016);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_SEMI.add(SEMI113);
                                            }
                                            // 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();
                                                // 558:17: -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:558:21: ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? )
                                                    {
                                                        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:558: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:558: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:558:135: ( throwsClause )?
                                                        if (stream_throwsClause.hasNext()) {
                                                            adaptor.addChild(root_1, stream_throwsClause.nextTree());
                                                        }
                                                        stream_throwsClause.reset();
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                    case 2:
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:559:17: VOID IDENT formalParameterList ( throwsClause )? SEMI
                                        {
                                            VOID114 = (Token) match(input, VOID, FOLLOW_VOID_in_interfaceScopeDeclarations6074);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_VOID.add(VOID114);
                                            }
                                            IDENT115 = (Token) match(input, IDENT, FOLLOW_IDENT_in_interfaceScopeDeclarations6076);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_IDENT.add(IDENT115);
                                            }
                                            pushFollow(FOLLOW_formalParameterList_in_interfaceScopeDeclarations6078);
                                            formalParameterList116 = formalParameterList();
                                            state._fsp--;
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_formalParameterList.add(formalParameterList116.getTree());
                                            }
                                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:559:48: ( throwsClause )?
                                            int alt41 = 2;
                                            int LA41_0 = input.LA(1);
                                            if ((LA41_0 == THROWS)) {
                                                alt41 = 1;
                                            }
                                            switch(alt41) {
                                                case 1:
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
                                                    {
                                                        pushFollow(FOLLOW_throwsClause_in_interfaceScopeDeclarations6080);
                                                        throwsClause117 = throwsClause();
                                                        state._fsp--;
                                                        if (state.failed) {
                                                            return retval;
                                                        }
                                                        if (state.backtracking == 0) {
                                                            stream_throwsClause.add(throwsClause117.getTree());
                                                        }
                                                    }
                                                    break;
                                            }
                                            SEMI118 = (Token) match(input, SEMI, FOLLOW_SEMI_in_interfaceScopeDeclarations6083);
                                            if (state.failed) {
                                                return retval;
                                            }
                                            if (state.backtracking == 0) {
                                                stream_SEMI.add(SEMI118);
                                            }
                                            // 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();
                                                // 560:17: -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? )
                                                {
                                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:560:21: ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? )
                                                    {
                                                        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:560: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:560:105: ( throwsClause )?
                                                        if (stream_throwsClause.hasNext()) {
                                                            adaptor.addChild(root_1, stream_throwsClause.nextTree());
                                                        }
                                                        stream_throwsClause.reset();
                                                        adaptor.addChild(root_0, root_1);
                                                    }
                                                }
                                                retval.tree = root_0;
                                            }
                                        }
                                        break;
                                }
                            }
                            break;
                        case 2:
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:562:13: type interfaceFieldDeclaratorList SEMI
                            {
                                pushFollow(FOLLOW_type_in_interfaceScopeDeclarations6146);
                                type119 = type();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_type.add(type119.getTree());
                                }
                                pushFollow(FOLLOW_interfaceFieldDeclaratorList_in_interfaceScopeDeclarations6148);
                                interfaceFieldDeclaratorList120 = interfaceFieldDeclaratorList();
                                state._fsp--;
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_interfaceFieldDeclaratorList.add(interfaceFieldDeclaratorList120.getTree());
                                }
                                SEMI121 = (Token) match(input, SEMI, FOLLOW_SEMI_in_interfaceScopeDeclarations6150);
                                if (state.failed) {
                                    return retval;
                                }
                                if (state.backtracking == 0) {
                                    stream_SEMI.add(SEMI121);
                                }
                                // 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();
                                    // 563:13: -> ^( VAR_DECLARATION modifierList type interfaceFieldDeclaratorList )
                                    {
                                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:563:17: ^( VAR_DECLARATION modifierList type interfaceFieldDeclaratorList )
                                        {
                                            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_interfaceFieldDeclaratorList.nextTree());
                                            adaptor.addChild(root_0, root_1);
                                        }
                                    }
                                    retval.tree = root_0;
                                }
                            }
                            break;
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:565:9: typeDeclaration
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_typeDeclaration_in_interfaceScopeDeclarations6195);
                    typeDeclaration122 = typeDeclaration();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, typeDeclaration122.getTree());
                    }
                }
                break;
            case 3:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:566:9: SEMI
                {
                    root_0 = (CommonTree) adaptor.nil();
                    SEMI123 = (Token) match(input, SEMI, FOLLOW_SEMI_in_interfaceScopeDeclarations6205);
                    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, 26, interfaceScopeDeclarations_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

NoViableAltException (org.antlr.runtime.NoViableAltException)68 RecognitionException (org.antlr.runtime.RecognitionException)50 Token (org.antlr.runtime.Token)43 CommonTree (org.antlr.runtime.tree.CommonTree)33 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)28 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)24 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)10 CommonToken (org.antlr.runtime.CommonToken)7 MismatchedSetException (org.antlr.runtime.MismatchedSetException)6 EarlyExitException (org.antlr.runtime.EarlyExitException)4 FailedPredicateException (org.antlr.runtime.FailedPredicateException)3 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)3 ArrayList (java.util.ArrayList)2 MismatchedNotSetException (org.antlr.runtime.MismatchedNotSetException)2 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)2 MismatchedTreeNodeException (org.antlr.runtime.MismatchedTreeNodeException)2 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)2