Search in sources :

Example 81 with RewriteRuleSubtreeStream

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

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

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

Example 84 with RewriteRuleSubtreeStream

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

the class JavaParser method annotationInit.

// $ANTLR start "annotationInit"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:767:1: annotationInit : LPAREN annotationInitializers RPAREN -> ^( ANNOTATION_INIT_BLOCK[$LPAREN, \"ANNOTATION_INIT_BLOCK\"] annotationInitializers ) ;
public final JavaParser.annotationInit_return annotationInit() throws RecognitionException {
    JavaParser.annotationInit_return retval = new JavaParser.annotationInit_return();
    retval.start = input.LT(1);
    int annotationInit_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LPAREN226 = null;
    Token RPAREN228 = null;
    JavaParser.annotationInitializers_return annotationInitializers227 = null;
    CommonTree LPAREN226_tree = null;
    CommonTree RPAREN228_tree = null;
    RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
    RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
    RewriteRuleSubtreeStream stream_annotationInitializers = new RewriteRuleSubtreeStream(adaptor, "rule annotationInitializers");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 62)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:768:5: ( LPAREN annotationInitializers RPAREN -> ^( ANNOTATION_INIT_BLOCK[$LPAREN, \"ANNOTATION_INIT_BLOCK\"] annotationInitializers ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:768:9: LPAREN annotationInitializers RPAREN
        {
            LPAREN226 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_annotationInit7897);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LPAREN.add(LPAREN226);
            }
            pushFollow(FOLLOW_annotationInitializers_in_annotationInit7899);
            annotationInitializers227 = annotationInitializers();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_annotationInitializers.add(annotationInitializers227.getTree());
            }
            RPAREN228 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_annotationInit7901);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RPAREN.add(RPAREN228);
            }
            // 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();
                // 769:9: -> ^( ANNOTATION_INIT_BLOCK[$LPAREN, \"ANNOTATION_INIT_BLOCK\"] annotationInitializers )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:769:13: ^( ANNOTATION_INIT_BLOCK[$LPAREN, \"ANNOTATION_INIT_BLOCK\"] annotationInitializers )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_INIT_BLOCK, LPAREN226, "ANNOTATION_INIT_BLOCK"), root_1);
                        adaptor.addChild(root_1, stream_annotationInitializers.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, 62, annotationInit_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 85 with RewriteRuleSubtreeStream

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

the class JavaParser method arrayDeclaratorList.

// $ANTLR start "arrayDeclaratorList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:603:1: arrayDeclaratorList : ( arrayDeclarator )+ -> ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ ) ;
public final JavaParser.arrayDeclaratorList_return arrayDeclaratorList() throws RecognitionException {
    JavaParser.arrayDeclaratorList_return retval = new JavaParser.arrayDeclaratorList_return();
    retval.start = input.LT(1);
    int arrayDeclaratorList_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.arrayDeclarator_return arrayDeclarator142 = null;
    RewriteRuleSubtreeStream stream_arrayDeclarator = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclarator");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 34)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:604:5: ( ( arrayDeclarator )+ -> ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:604:9: ( arrayDeclarator )+
        {
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:604:9: ( arrayDeclarator )+
            int cnt50 = 0;
            loop50: do {
                int alt50 = 2;
                int LA50_0 = input.LA(1);
                if ((LA50_0 == LBRACK)) {
                    int LA50_2 = input.LA(2);
                    if ((synpred59_Java())) {
                        alt50 = 1;
                    }
                }
                switch(alt50) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclarator
                        {
                            pushFollow(FOLLOW_arrayDeclarator_in_arrayDeclaratorList6489);
                            arrayDeclarator142 = arrayDeclarator();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_arrayDeclarator.add(arrayDeclarator142.getTree());
                            }
                        }
                        break;
                    default:
                        if (cnt50 >= 1) {
                            break loop50;
                        }
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return retval;
                        }
                        EarlyExitException eee = new EarlyExitException(50, input);
                        throw eee;
                }
                cnt50++;
            } 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();
                // 605:9: -> ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:605:13: ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_DECLARATOR_LIST, "ARRAY_DECLARATOR_LIST"), root_1);
                        if (!(stream_arrayDeclarator.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_arrayDeclarator.hasNext()) {
                            adaptor.addChild(root_1, stream_arrayDeclarator.nextTree());
                        }
                        stream_arrayDeclarator.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, 34, arrayDeclaratorList_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) EarlyExitException(org.antlr.runtime.EarlyExitException) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RecognitionException(org.antlr.runtime.RecognitionException)

Aggregations

RecognitionException (org.antlr.runtime.RecognitionException)98 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)98 CommonTree (org.antlr.runtime.tree.CommonTree)81 Token (org.antlr.runtime.Token)74 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)74 NoViableAltException (org.antlr.runtime.NoViableAltException)24 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)16 CommonToken (org.antlr.runtime.CommonToken)9 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)9 EarlyExitException (org.antlr.runtime.EarlyExitException)5 FailedPredicateException (org.antlr.runtime.FailedPredicateException)4 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)1