Search in sources :

Example 61 with RewriteRuleTokenStream

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

the class JavaParser method bound.

// $ANTLR start "bound"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:484:1: bound : EXTENDS type ( AND type )* -> ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ ) ;
public final JavaParser.bound_return bound() throws RecognitionException {
    JavaParser.bound_return retval = new JavaParser.bound_return();
    retval.start = input.LT(1);
    int bound_StartIndex = input.index();
    CommonTree root_0 = null;
    Token EXTENDS43 = null;
    Token AND45 = null;
    JavaParser.type_return type44 = null;
    JavaParser.type_return type46 = null;
    CommonTree EXTENDS43_tree = null;
    CommonTree AND45_tree = null;
    RewriteRuleTokenStream stream_AND = new RewriteRuleTokenStream(adaptor, "token AND");
    RewriteRuleTokenStream stream_EXTENDS = new RewriteRuleTokenStream(adaptor, "token EXTENDS");
    RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 14)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:485:5: ( EXTENDS type ( AND type )* -> ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:485:9: EXTENDS type ( AND type )*
        {
            EXTENDS43 = (Token) match(input, EXTENDS, FOLLOW_EXTENDS_in_bound5148);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_EXTENDS.add(EXTENDS43);
            }
            pushFollow(FOLLOW_type_in_bound5150);
            type44 = type();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_type.add(type44.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:485:22: ( AND type )*
            loop14: do {
                int alt14 = 2;
                int LA14_0 = input.LA(1);
                if ((LA14_0 == AND)) {
                    alt14 = 1;
                }
                switch(alt14) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:485:23: AND type
                        {
                            AND45 = (Token) match(input, AND, FOLLOW_AND_in_bound5153);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_AND.add(AND45);
                            }
                            pushFollow(FOLLOW_type_in_bound5155);
                            type46 = type();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_type.add(type46.getTree());
                            }
                        }
                        break;
                    default:
                        break loop14;
                }
            } 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();
                // 486:9: -> ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:486:13: ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXTENDS_BOUND_LIST, EXTENDS43, "EXTENDS_BOUND_LIST"), root_1);
                        if (!(stream_type.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_type.hasNext()) {
                            adaptor.addChild(root_1, stream_type.nextTree());
                        }
                        stream_type.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 14, bound_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 62 with RewriteRuleTokenStream

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

the class CssParser method function.

// $ANTLR start "function"
// /home/langera/dev/freud/src/grammar/Css.g:123:1: function : IDENT '(' ( args )? ')' -> IDENT '(' ( args )* ')' ;
public final CssParser.function_return function() throws RecognitionException {
    CssParser.function_return retval = new CssParser.function_return();
    retval.start = input.LT(1);
    CommonTree root_0 = null;
    Token IDENT69 = null;
    Token char_literal70 = null;
    Token char_literal72 = null;
    CssParser.args_return args71 = null;
    CommonTree IDENT69_tree = null;
    CommonTree char_literal70_tree = null;
    CommonTree char_literal72_tree = null;
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_62 = new RewriteRuleTokenStream(adaptor, "token 62");
    RewriteRuleTokenStream stream_61 = new RewriteRuleTokenStream(adaptor, "token 61");
    RewriteRuleSubtreeStream stream_args = new RewriteRuleSubtreeStream(adaptor, "rule args");
    try {
        // /home/langera/dev/freud/src/grammar/Css.g:124:2: ( IDENT '(' ( args )? ')' -> IDENT '(' ( args )* ')' )
        // /home/langera/dev/freud/src/grammar/Css.g:124:4: IDENT '(' ( args )? ')'
        {
            IDENT69 = (Token) match(input, IDENT, FOLLOW_IDENT_in_function767);
            stream_IDENT.add(IDENT69);
            char_literal70 = (Token) match(input, 61, FOLLOW_61_in_function769);
            stream_61.add(char_literal70);
            // /home/langera/dev/freud/src/grammar/Css.g:124:14: ( args )?
            int alt26 = 2;
            int LA26_0 = input.LA(1);
            if ((LA26_0 == IDENT || (LA26_0 >= 36 && LA26_0 <= 37))) {
                alt26 = 1;
            }
            switch(alt26) {
                case 1:
                    // /home/langera/dev/freud/src/grammar/Css.g:124:14: args
                    {
                        pushFollow(FOLLOW_args_in_function771);
                        args71 = args();
                        state._fsp--;
                        stream_args.add(args71.getTree());
                    }
                    break;
            }
            char_literal72 = (Token) match(input, 62, FOLLOW_62_in_function774);
            stream_62.add(char_literal72);
            // AST REWRITE
            // elements: 62, args, 61, IDENT
            // token labels:
            // rule labels: retval
            // token list labels:
            // rule list labels:
            // wildcard labels:
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
            root_0 = (CommonTree) adaptor.nil();
            // 124:24: -> IDENT '(' ( args )* ')'
            {
                adaptor.addChild(root_0, stream_IDENT.nextNode());
                adaptor.addChild(root_0, stream_61.nextNode());
                // /home/langera/dev/freud/src/grammar/Css.g:124:37: ( args )*
                while (stream_args.hasNext()) {
                    adaptor.addChild(root_0, stream_args.nextTree());
                }
                stream_args.reset();
                adaptor.addChild(root_0, stream_62.nextNode());
            }
            retval.tree = root_0;
        }
        retval.stop = input.LT(-1);
        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 {
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 63 with RewriteRuleTokenStream

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

the class JavaParser method annotationElementValueArrayInitializer.

// $ANTLR start "annotationElementValueArrayInitializer"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:794:1: annotationElementValueArrayInitializer : LCURLY ( annotationElementValue ( COMMA annotationElementValue )* )? ( COMMA )? RCURLY -> ^( ANNOTATION_INIT_ARRAY_ELEMENT[$LCURLY, \"ANNOTATION_ELEM_VALUE_ARRAY_INIT\"] ( annotationElementValue )* ) ;
public final JavaParser.annotationElementValueArrayInitializer_return annotationElementValueArrayInitializer() throws RecognitionException {
    JavaParser.annotationElementValueArrayInitializer_return retval = new JavaParser.annotationElementValueArrayInitializer_return();
    retval.start = input.LT(1);
    int annotationElementValueArrayInitializer_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LCURLY240 = null;
    Token COMMA242 = null;
    Token COMMA244 = null;
    Token RCURLY245 = null;
    JavaParser.annotationElementValue_return annotationElementValue241 = null;
    JavaParser.annotationElementValue_return annotationElementValue243 = null;
    CommonTree LCURLY240_tree = null;
    CommonTree COMMA242_tree = null;
    CommonTree COMMA244_tree = null;
    CommonTree RCURLY245_tree = null;
    RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
    RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
    RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
    RewriteRuleSubtreeStream stream_annotationElementValue = new RewriteRuleSubtreeStream(adaptor, "rule annotationElementValue");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 67)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:5: ( LCURLY ( annotationElementValue ( COMMA annotationElementValue )* )? ( COMMA )? RCURLY -> ^( ANNOTATION_INIT_ARRAY_ELEMENT[$LCURLY, \"ANNOTATION_ELEM_VALUE_ARRAY_INIT\"] ( annotationElementValue )* ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:9: LCURLY ( annotationElementValue ( COMMA annotationElementValue )* )? ( COMMA )? RCURLY
        {
            LCURLY240 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_annotationElementValueArrayInitializer8110);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LCURLY.add(LCURLY240);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:16: ( annotationElementValue ( COMMA annotationElementValue )* )?
            int alt82 = 2;
            int LA82_0 = input.LA(1);
            if ((LA82_0 == AT || LA82_0 == DEC || LA82_0 == INC || LA82_0 == LCURLY || LA82_0 == LESS_THAN || LA82_0 == LOGICAL_NOT || (LA82_0 >= LPAREN && LA82_0 <= MINUS) || LA82_0 == NOT || LA82_0 == PLUS || LA82_0 == BOOLEAN || LA82_0 == BYTE || LA82_0 == CHAR || LA82_0 == DOUBLE || LA82_0 == FALSE || LA82_0 == FLOAT || (LA82_0 >= INT && LA82_0 <= LONG) || (LA82_0 >= NEW && LA82_0 <= NULL) || LA82_0 == SHORT || LA82_0 == SUPER || LA82_0 == THIS || LA82_0 == TRUE || LA82_0 == VOID || (LA82_0 >= IDENT && LA82_0 <= STRING_LITERAL))) {
                alt82 = 1;
            }
            switch(alt82) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:17: annotationElementValue ( COMMA annotationElementValue )*
                    {
                        pushFollow(FOLLOW_annotationElementValue_in_annotationElementValueArrayInitializer8113);
                        annotationElementValue241 = annotationElementValue();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_annotationElementValue.add(annotationElementValue241.getTree());
                        }
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:40: ( COMMA annotationElementValue )*
                        loop81: do {
                            int alt81 = 2;
                            int LA81_0 = input.LA(1);
                            if ((LA81_0 == COMMA)) {
                                int LA81_1 = input.LA(2);
                                if ((LA81_1 == AT || LA81_1 == DEC || LA81_1 == INC || LA81_1 == LCURLY || LA81_1 == LESS_THAN || LA81_1 == LOGICAL_NOT || (LA81_1 >= LPAREN && LA81_1 <= MINUS) || LA81_1 == NOT || LA81_1 == PLUS || LA81_1 == BOOLEAN || LA81_1 == BYTE || LA81_1 == CHAR || LA81_1 == DOUBLE || LA81_1 == FALSE || LA81_1 == FLOAT || (LA81_1 >= INT && LA81_1 <= LONG) || (LA81_1 >= NEW && LA81_1 <= NULL) || LA81_1 == SHORT || LA81_1 == SUPER || LA81_1 == THIS || LA81_1 == TRUE || LA81_1 == VOID || (LA81_1 >= IDENT && LA81_1 <= STRING_LITERAL))) {
                                    alt81 = 1;
                                }
                            }
                            switch(alt81) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:41: COMMA annotationElementValue
                                    {
                                        COMMA242 = (Token) match(input, COMMA, FOLLOW_COMMA_in_annotationElementValueArrayInitializer8116);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_COMMA.add(COMMA242);
                                        }
                                        pushFollow(FOLLOW_annotationElementValue_in_annotationElementValueArrayInitializer8118);
                                        annotationElementValue243 = annotationElementValue();
                                        state._fsp--;
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            stream_annotationElementValue.add(annotationElementValue243.getTree());
                                        }
                                    }
                                    break;
                                default:
                                    break loop81;
                            }
                        } while (true);
                    }
                    break;
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:74: ( COMMA )?
            int alt83 = 2;
            int LA83_0 = input.LA(1);
            if ((LA83_0 == COMMA)) {
                alt83 = 1;
            }
            switch(alt83) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:795:75: COMMA
                    {
                        COMMA244 = (Token) match(input, COMMA, FOLLOW_COMMA_in_annotationElementValueArrayInitializer8125);
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_COMMA.add(COMMA244);
                        }
                    }
                    break;
            }
            RCURLY245 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_annotationElementValueArrayInitializer8129);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RCURLY.add(RCURLY245);
            }
            // 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();
                // 796:9: -> ^( ANNOTATION_INIT_ARRAY_ELEMENT[$LCURLY, \"ANNOTATION_ELEM_VALUE_ARRAY_INIT\"] ( annotationElementValue )* )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:796:13: ^( ANNOTATION_INIT_ARRAY_ELEMENT[$LCURLY, \"ANNOTATION_ELEM_VALUE_ARRAY_INIT\"] ( annotationElementValue )* )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_INIT_ARRAY_ELEMENT, LCURLY240, "ANNOTATION_ELEM_VALUE_ARRAY_INIT"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:796:90: ( annotationElementValue )*
                        while (stream_annotationElementValue.hasNext()) {
                            adaptor.addChild(root_1, stream_annotationElementValue.nextTree());
                        }
                        stream_annotationElementValue.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 67, annotationElementValueArrayInitializer_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 64 with RewriteRuleTokenStream

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

the class JavaParser method interfaceExtendsClause.

// $ANTLR start "interfaceExtendsClause"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:454:1: interfaceExtendsClause : EXTENDS typeList -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] typeList ) ;
public final JavaParser.interfaceExtendsClause_return interfaceExtendsClause() throws RecognitionException {
    JavaParser.interfaceExtendsClause_return retval = new JavaParser.interfaceExtendsClause_return();
    retval.start = input.LT(1);
    int interfaceExtendsClause_StartIndex = input.index();
    CommonTree root_0 = null;
    Token EXTENDS29 = null;
    JavaParser.typeList_return typeList30 = null;
    CommonTree EXTENDS29_tree = null;
    RewriteRuleTokenStream stream_EXTENDS = new RewriteRuleTokenStream(adaptor, "token EXTENDS");
    RewriteRuleSubtreeStream stream_typeList = new RewriteRuleSubtreeStream(adaptor, "rule typeList");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 9)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:455:5: ( EXTENDS typeList -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] typeList ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:455:9: EXTENDS typeList
        {
            EXTENDS29 = (Token) match(input, EXTENDS, FOLLOW_EXTENDS_in_interfaceExtendsClause4856);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_EXTENDS.add(EXTENDS29);
            }
            pushFollow(FOLLOW_typeList_in_interfaceExtendsClause4858);
            typeList30 = typeList();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_typeList.add(typeList30.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();
                // 456:9: -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] typeList )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:456:13: ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] typeList )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXTENDS_CLAUSE, EXTENDS29, "EXTENDS_CLAUSE"), root_1);
                        adaptor.addChild(root_1, stream_typeList.nextTree());
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 9, interfaceExtendsClause_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 65 with RewriteRuleTokenStream

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

the class JavaParser method annotationBody.

// $ANTLR start "annotationBody"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:804:1: annotationBody : LCURLY ( annotationScopeDeclarations )* RCURLY -> ^( ANNOTATION_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( annotationScopeDeclarations )* ) ;
public final JavaParser.annotationBody_return annotationBody() throws RecognitionException {
    JavaParser.annotationBody_return retval = new JavaParser.annotationBody_return();
    retval.start = input.LT(1);
    int annotationBody_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LCURLY250 = null;
    Token RCURLY252 = null;
    JavaParser.annotationScopeDeclarations_return annotationScopeDeclarations251 = null;
    CommonTree LCURLY250_tree = null;
    CommonTree RCURLY252_tree = null;
    RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
    RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
    RewriteRuleSubtreeStream stream_annotationScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule annotationScopeDeclarations");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 69)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:805:5: ( LCURLY ( annotationScopeDeclarations )* RCURLY -> ^( ANNOTATION_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( annotationScopeDeclarations )* ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:805:9: LCURLY ( annotationScopeDeclarations )* RCURLY
        {
            LCURLY250 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_annotationBody8213);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LCURLY.add(LCURLY250);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:805:16: ( annotationScopeDeclarations )*
            loop84: do {
                int alt84 = 2;
                int LA84_0 = input.LA(1);
                if ((LA84_0 == AT || LA84_0 == LESS_THAN || LA84_0 == ABSTRACT || LA84_0 == BOOLEAN || LA84_0 == BYTE || (LA84_0 >= CHAR && LA84_0 <= CLASS) || LA84_0 == DOUBLE || LA84_0 == ENUM || LA84_0 == FINAL || LA84_0 == FLOAT || LA84_0 == INTERFACE || (LA84_0 >= INT && LA84_0 <= NATIVE) || (LA84_0 >= PRIVATE && LA84_0 <= PUBLIC) || (LA84_0 >= SHORT && LA84_0 <= STRICTFP) || LA84_0 == SYNCHRONIZED || LA84_0 == TRANSIENT || (LA84_0 >= VOID && LA84_0 <= VOLATILE) || LA84_0 == IDENT)) {
                    alt84 = 1;
                }
                switch(alt84) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: annotationScopeDeclarations
                        {
                            pushFollow(FOLLOW_annotationScopeDeclarations_in_annotationBody8215);
                            annotationScopeDeclarations251 = annotationScopeDeclarations();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_annotationScopeDeclarations.add(annotationScopeDeclarations251.getTree());
                            }
                        }
                        break;
                    default:
                        break loop84;
                }
            } while (true);
            RCURLY252 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_annotationBody8218);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RCURLY.add(RCURLY252);
            }
            // 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();
                // 806:9: -> ^( ANNOTATION_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( annotationScopeDeclarations )* )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:806:13: ^( ANNOTATION_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( annotationScopeDeclarations )* )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_TOP_LEVEL_SCOPE, LCURLY250, "CLASS_TOP_LEVEL_SCOPE"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:806:76: ( annotationScopeDeclarations )*
                        while (stream_annotationScopeDeclarations.hasNext()) {
                            adaptor.addChild(root_1, stream_annotationScopeDeclarations.nextTree());
                        }
                        stream_annotationScopeDeclarations.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 69, annotationBody_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

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