Search in sources :

Example 66 with RewriteRuleTokenStream

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

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

the class JavaParser method interfaceBody.

// $ANTLR start "interfaceBody"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:530:1: interfaceBody : LCURLY ( interfaceScopeDeclarations )* RCURLY -> ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* ) ;
public final JavaParser.interfaceBody_return interfaceBody() throws RecognitionException {
    JavaParser.interfaceBody_return retval = new JavaParser.interfaceBody_return();
    retval.start = input.LT(1);
    int interfaceBody_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LCURLY77 = null;
    Token RCURLY79 = null;
    JavaParser.interfaceScopeDeclarations_return interfaceScopeDeclarations78 = null;
    CommonTree LCURLY77_tree = null;
    CommonTree RCURLY79_tree = null;
    RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
    RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
    RewriteRuleSubtreeStream stream_interfaceScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule interfaceScopeDeclarations");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 24)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:531:5: ( LCURLY ( interfaceScopeDeclarations )* RCURLY -> ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:531:9: LCURLY ( interfaceScopeDeclarations )* RCURLY
        {
            LCURLY77 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_interfaceBody5539);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LCURLY.add(LCURLY77);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:531:16: ( interfaceScopeDeclarations )*
            loop27: do {
                int alt27 = 2;
                int LA27_0 = input.LA(1);
                if ((LA27_0 == AT || LA27_0 == LESS_THAN || LA27_0 == SEMI || LA27_0 == ABSTRACT || LA27_0 == BOOLEAN || LA27_0 == BYTE || (LA27_0 >= CHAR && LA27_0 <= CLASS) || LA27_0 == DOUBLE || LA27_0 == ENUM || LA27_0 == FINAL || LA27_0 == FLOAT || LA27_0 == INTERFACE || (LA27_0 >= INT && LA27_0 <= NATIVE) || (LA27_0 >= PRIVATE && LA27_0 <= PUBLIC) || (LA27_0 >= SHORT && LA27_0 <= STRICTFP) || LA27_0 == SYNCHRONIZED || LA27_0 == TRANSIENT || (LA27_0 >= VOID && LA27_0 <= VOLATILE) || LA27_0 == IDENT)) {
                    alt27 = 1;
                }
                switch(alt27) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: interfaceScopeDeclarations
                        {
                            pushFollow(FOLLOW_interfaceScopeDeclarations_in_interfaceBody5541);
                            interfaceScopeDeclarations78 = interfaceScopeDeclarations();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_interfaceScopeDeclarations.add(interfaceScopeDeclarations78.getTree());
                            }
                        }
                        break;
                    default:
                        break loop27;
                }
            } while (true);
            RCURLY79 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_interfaceBody5544);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RCURLY.add(RCURLY79);
            }
            // 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();
                // 532:9: -> ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:532:13: ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(INTERFACE_TOP_LEVEL_SCOPE, LCURLY77, "CLASS_TOP_LEVEL_SCOPE"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:532:75: ( interfaceScopeDeclarations )*
                        while (stream_interfaceScopeDeclarations.hasNext()) {
                            adaptor.addChild(root_1, stream_interfaceScopeDeclarations.nextTree());
                        }
                        stream_interfaceScopeDeclarations.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, 24, interfaceBody_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 68 with RewriteRuleTokenStream

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

the class JavaParser method parenthesizedExpression.

// $ANTLR start "parenthesizedExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:920:1: parenthesizedExpression : LPAREN expression RPAREN -> ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression ) ;
public final JavaParser.parenthesizedExpression_return parenthesizedExpression() throws RecognitionException {
    JavaParser.parenthesizedExpression_return retval = new JavaParser.parenthesizedExpression_return();
    retval.start = input.LT(1);
    int parenthesizedExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LPAREN359 = null;
    Token RPAREN361 = null;
    JavaParser.expression_return expression360 = null;
    CommonTree LPAREN359_tree = null;
    CommonTree RPAREN361_tree = null;
    RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
    RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
    RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 86)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:921:5: ( LPAREN expression RPAREN -> ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:921:9: LPAREN expression RPAREN
        {
            LPAREN359 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_parenthesizedExpression10148);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LPAREN.add(LPAREN359);
            }
            pushFollow(FOLLOW_expression_in_parenthesizedExpression10150);
            expression360 = expression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_expression.add(expression360.getTree());
            }
            RPAREN361 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_parenthesizedExpression10152);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RPAREN.add(RPAREN361);
            }
            // 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();
                // 922:9: -> ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:922:13: ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PARENTESIZED_EXPR, LPAREN359, "PARENTESIZED_EXPR"), root_1);
                        adaptor.addChild(root_1, stream_expression.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, 86, parenthesizedExpression_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 69 with RewriteRuleTokenStream

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

the class JavaParser method annotationTypeDeclaration.

// $ANTLR start "annotationTypeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:799:1: annotationTypeDeclaration[CommonTree modifiers] : AT INTERFACE IDENT annotationBody -> ^( AT IDENT annotationBody ) ;
public final JavaParser.annotationTypeDeclaration_return annotationTypeDeclaration(CommonTree modifiers) throws RecognitionException {
    JavaParser.annotationTypeDeclaration_return retval = new JavaParser.annotationTypeDeclaration_return();
    retval.start = input.LT(1);
    int annotationTypeDeclaration_StartIndex = input.index();
    CommonTree root_0 = null;
    Token AT246 = null;
    Token INTERFACE247 = null;
    Token IDENT248 = null;
    JavaParser.annotationBody_return annotationBody249 = null;
    CommonTree AT246_tree = null;
    CommonTree INTERFACE247_tree = null;
    CommonTree IDENT248_tree = null;
    RewriteRuleTokenStream stream_AT = new RewriteRuleTokenStream(adaptor, "token AT");
    RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
    RewriteRuleTokenStream stream_INTERFACE = new RewriteRuleTokenStream(adaptor, "token INTERFACE");
    RewriteRuleSubtreeStream stream_annotationBody = new RewriteRuleSubtreeStream(adaptor, "rule annotationBody");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 68)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:800:5: ( AT INTERFACE IDENT annotationBody -> ^( AT IDENT annotationBody ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:800:9: AT INTERFACE IDENT annotationBody
        {
            AT246 = (Token) match(input, AT, FOLLOW_AT_in_annotationTypeDeclaration8168);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_AT.add(AT246);
            }
            INTERFACE247 = (Token) match(input, INTERFACE, FOLLOW_INTERFACE_in_annotationTypeDeclaration8170);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_INTERFACE.add(INTERFACE247);
            }
            IDENT248 = (Token) match(input, IDENT, FOLLOW_IDENT_in_annotationTypeDeclaration8172);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_IDENT.add(IDENT248);
            }
            pushFollow(FOLLOW_annotationBody_in_annotationTypeDeclaration8174);
            annotationBody249 = annotationBody();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_annotationBody.add(annotationBody249.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();
                // 801:9: -> ^( AT IDENT annotationBody )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:801:12: ^( AT IDENT annotationBody )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot(stream_AT.nextNode(), root_1);
                        adaptor.addChild(root_1, modifiers);
                        adaptor.addChild(root_1, stream_IDENT.nextNode());
                        adaptor.addChild(root_1, stream_annotationBody.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, 68, annotationTypeDeclaration_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 70 with RewriteRuleTokenStream

use of org.antlr.runtime.tree.RewriteRuleTokenStream in project drools by kiegroup.

the class DSLMapParser method scope_section.

// $ANTLR start "scope_section"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:130:1: scope_section : LEFT_SQUARE (value1= condition_key |value2= consequence_key |value3= keyword_key |value4= any_key ) RIGHT_SQUARE -> ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? ) ;
public final DSLMapParser.scope_section_return scope_section() throws RecognitionException {
    DSLMapParser.scope_section_return retval = new DSLMapParser.scope_section_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token LEFT_SQUARE11 = null;
    Token RIGHT_SQUARE12 = null;
    ParserRuleReturnScope value1 = null;
    ParserRuleReturnScope value2 = null;
    ParserRuleReturnScope value3 = null;
    ParserRuleReturnScope value4 = null;
    Object LEFT_SQUARE11_tree = null;
    Object RIGHT_SQUARE12_tree = null;
    RewriteRuleTokenStream stream_RIGHT_SQUARE = new RewriteRuleTokenStream(adaptor, "token RIGHT_SQUARE");
    RewriteRuleTokenStream stream_LEFT_SQUARE = new RewriteRuleTokenStream(adaptor, "token LEFT_SQUARE");
    RewriteRuleSubtreeStream stream_any_key = new RewriteRuleSubtreeStream(adaptor, "rule any_key");
    RewriteRuleSubtreeStream stream_condition_key = new RewriteRuleSubtreeStream(adaptor, "rule condition_key");
    RewriteRuleSubtreeStream stream_keyword_key = new RewriteRuleSubtreeStream(adaptor, "rule keyword_key");
    RewriteRuleSubtreeStream stream_consequence_key = new RewriteRuleSubtreeStream(adaptor, "rule consequence_key");
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:131:5: ( LEFT_SQUARE (value1= condition_key |value2= consequence_key |value3= keyword_key |value4= any_key ) RIGHT_SQUARE -> ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? ) )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:131:7: LEFT_SQUARE (value1= condition_key |value2= consequence_key |value3= keyword_key |value4= any_key ) RIGHT_SQUARE
        {
            LEFT_SQUARE11 = (Token) match(input, LEFT_SQUARE, FOLLOW_LEFT_SQUARE_in_scope_section412);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_LEFT_SQUARE.add(LEFT_SQUARE11);
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:132:9: (value1= condition_key |value2= consequence_key |value3= keyword_key |value4= any_key )
            int alt6 = 4;
            int LA6_0 = input.LA(1);
            if ((LA6_0 == LITERAL)) {
                int LA6_1 = input.LA(2);
                if ((((validateIdentifierKey("condition") || validateIdentifierKey("when")) && synpred6_DSLMap()))) {
                    alt6 = 1;
                } else if (((synpred7_DSLMap() && (validateIdentifierKey("consequence") || validateIdentifierKey("then"))))) {
                    alt6 = 2;
                } else if (((synpred8_DSLMap() && (validateIdentifierKey("keyword"))))) {
                    alt6 = 3;
                } else if (((validateIdentifierKey("*")))) {
                    alt6 = 4;
                } else {
                    if (state.backtracking > 0) {
                        state.failed = true;
                        return retval;
                    }
                    int nvaeMark = input.mark();
                    try {
                        input.consume();
                        NoViableAltException nvae = new NoViableAltException("", 6, 1, input);
                        throw nvae;
                    } finally {
                        input.rewind(nvaeMark);
                    }
                }
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                NoViableAltException nvae = new NoViableAltException("", 6, 0, input);
                throw nvae;
            }
            switch(alt6) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:132:10: value1= condition_key
                    {
                        pushFollow(FOLLOW_condition_key_in_scope_section425);
                        value1 = condition_key();
                        state._fsp--;
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_condition_key.add(value1.getTree());
                    }
                    break;
                case 2:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:133:11: value2= consequence_key
                    {
                        pushFollow(FOLLOW_consequence_key_in_scope_section439);
                        value2 = consequence_key();
                        state._fsp--;
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_consequence_key.add(value2.getTree());
                    }
                    break;
                case 3:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:134:11: value3= keyword_key
                    {
                        pushFollow(FOLLOW_keyword_key_in_scope_section453);
                        value3 = keyword_key();
                        state._fsp--;
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_keyword_key.add(value3.getTree());
                    }
                    break;
                case 4:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:135:11: value4= any_key
                    {
                        pushFollow(FOLLOW_any_key_in_scope_section467);
                        value4 = any_key();
                        state._fsp--;
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_any_key.add(value4.getTree());
                    }
                    break;
            }
            RIGHT_SQUARE12 = (Token) match(input, RIGHT_SQUARE, FOLLOW_RIGHT_SQUARE_in_scope_section483);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_RIGHT_SQUARE.add(RIGHT_SQUARE12);
            // wildcard labels:
            if (state.backtracking == 0) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.getTree() : null);
                RewriteRuleSubtreeStream stream_value3 = new RewriteRuleSubtreeStream(adaptor, "rule value3", value3 != null ? value3.getTree() : null);
                RewriteRuleSubtreeStream stream_value4 = new RewriteRuleSubtreeStream(adaptor, "rule value4", value4 != null ? value4.getTree() : null);
                RewriteRuleSubtreeStream stream_value1 = new RewriteRuleSubtreeStream(adaptor, "rule value1", value1 != null ? value1.getTree() : null);
                RewriteRuleSubtreeStream stream_value2 = new RewriteRuleSubtreeStream(adaptor, "rule value2", value2 != null ? value2.getTree() : null);
                root_0 = (Object) adaptor.nil();
                // 138:5: -> ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? )
                {
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:138:8: ^( VT_SCOPE[$LEFT_SQUARE, \"SCOPE SECTION\"] ( $value1)? ( $value2)? ( $value3)? ( $value4)? )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_SCOPE, LEFT_SQUARE11, "SCOPE SECTION"), root_1);
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:138:51: ( $value1)?
                        if (stream_value1.hasNext()) {
                            adaptor.addChild(root_1, stream_value1.nextTree());
                        }
                        stream_value1.reset();
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:138:60: ( $value2)?
                        if (stream_value2.hasNext()) {
                            adaptor.addChild(root_1, stream_value2.nextTree());
                        }
                        stream_value2.reset();
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:138:69: ( $value3)?
                        if (stream_value3.hasNext()) {
                            adaptor.addChild(root_1, stream_value3.nextTree());
                        }
                        stream_value3.reset();
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:138:78: ( $value4)?
                        if (stream_value4.hasNext()) {
                            adaptor.addChild(root_1, stream_value4.nextTree());
                        }
                        stream_value4.reset();
                        adaptor.addChild(root_0, root_1);
                    }
                }
                retval.tree = root_0;
            }
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (Object) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    // do for sure before leaving
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) CommonToken(org.antlr.runtime.CommonToken) ParserRuleReturnScope(org.antlr.runtime.ParserRuleReturnScope) 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