Search in sources :

Example 51 with NoViableAltException

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

the class JavaParser method shiftExpression.

// $ANTLR start "shiftExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1000:1: shiftExpression : additiveExpression ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )* ;
public final JavaParser.shiftExpression_return shiftExpression() throws RecognitionException {
    JavaParser.shiftExpression_return retval = new JavaParser.shiftExpression_return();
    retval.start = input.LT(1);
    int shiftExpression_StartIndex = input.index();
    CommonTree root_0 = null;
    Token BIT_SHIFT_RIGHT414 = null;
    Token SHIFT_RIGHT415 = null;
    Token SHIFT_LEFT416 = null;
    JavaParser.additiveExpression_return additiveExpression413 = null;
    JavaParser.additiveExpression_return additiveExpression417 = null;
    CommonTree BIT_SHIFT_RIGHT414_tree = null;
    CommonTree SHIFT_RIGHT415_tree = null;
    CommonTree SHIFT_LEFT416_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 99)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1001:5: ( additiveExpression ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )* )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1001:9: additiveExpression ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )*
        {
            root_0 = (CommonTree) adaptor.nil();
            pushFollow(FOLLOW_additiveExpression_in_shiftExpression10945);
            additiveExpression413 = additiveExpression();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                adaptor.addChild(root_0, additiveExpression413.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:9: ( ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression )*
            loop122: do {
                int alt122 = 2;
                int LA122_0 = input.LA(1);
                if ((LA122_0 == BIT_SHIFT_RIGHT || LA122_0 == SHIFT_LEFT || LA122_0 == SHIFT_RIGHT)) {
                    alt122 = 1;
                }
                switch(alt122) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:13: ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT ) additiveExpression
                        {
                            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:13: ( BIT_SHIFT_RIGHT | SHIFT_RIGHT | SHIFT_LEFT )
                            int alt121 = 3;
                            switch(input.LA(1)) {
                                case BIT_SHIFT_RIGHT:
                                    {
                                        alt121 = 1;
                                    }
                                    break;
                                case SHIFT_RIGHT:
                                    {
                                        alt121 = 2;
                                    }
                                    break;
                                case SHIFT_LEFT:
                                    {
                                        alt121 = 3;
                                    }
                                    break;
                                default:
                                    if (state.backtracking > 0) {
                                        state.failed = true;
                                        return retval;
                                    }
                                    NoViableAltException nvae = new NoViableAltException("", 121, 0, input);
                                    throw nvae;
                            }
                            switch(alt121) {
                                case 1:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1002:17: BIT_SHIFT_RIGHT
                                    {
                                        BIT_SHIFT_RIGHT414 = (Token) match(input, BIT_SHIFT_RIGHT, FOLLOW_BIT_SHIFT_RIGHT_in_shiftExpression10963);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            BIT_SHIFT_RIGHT414_tree = (CommonTree) adaptor.create(BIT_SHIFT_RIGHT414);
                                            root_0 = (CommonTree) adaptor.becomeRoot(BIT_SHIFT_RIGHT414_tree, root_0);
                                        }
                                    }
                                    break;
                                case 2:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1003:17: SHIFT_RIGHT
                                    {
                                        SHIFT_RIGHT415 = (Token) match(input, SHIFT_RIGHT, FOLLOW_SHIFT_RIGHT_in_shiftExpression10982);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            SHIFT_RIGHT415_tree = (CommonTree) adaptor.create(SHIFT_RIGHT415);
                                            root_0 = (CommonTree) adaptor.becomeRoot(SHIFT_RIGHT415_tree, root_0);
                                        }
                                    }
                                    break;
                                case 3:
                                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1004:17: SHIFT_LEFT
                                    {
                                        SHIFT_LEFT416 = (Token) match(input, SHIFT_LEFT, FOLLOW_SHIFT_LEFT_in_shiftExpression11001);
                                        if (state.failed) {
                                            return retval;
                                        }
                                        if (state.backtracking == 0) {
                                            SHIFT_LEFT416_tree = (CommonTree) adaptor.create(SHIFT_LEFT416);
                                            root_0 = (CommonTree) adaptor.becomeRoot(SHIFT_LEFT416_tree, root_0);
                                        }
                                    }
                                    break;
                            }
                            pushFollow(FOLLOW_additiveExpression_in_shiftExpression11030);
                            additiveExpression417 = additiveExpression();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                adaptor.addChild(root_0, additiveExpression417.getTree());
                            }
                        }
                        break;
                    default:
                        break loop122;
                }
            } while (true);
        }
        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, 99, shiftExpression_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 52 with NoViableAltException

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

the class JavaParser method localModifier.

// $ANTLR start "localModifier"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:642:1: localModifier : ( FINAL | annotation );
public final JavaParser.localModifier_return localModifier() throws RecognitionException {
    JavaParser.localModifier_return retval = new JavaParser.localModifier_return();
    retval.start = input.LT(1);
    int localModifier_StartIndex = input.index();
    CommonTree root_0 = null;
    Token FINAL164 = null;
    JavaParser.annotation_return annotation165 = null;
    CommonTree FINAL164_tree = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 40)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:643:5: ( FINAL | annotation )
        int alt57 = 2;
        int LA57_0 = input.LA(1);
        if ((LA57_0 == FINAL)) {
            alt57 = 1;
        } else if ((LA57_0 == AT)) {
            alt57 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 57, 0, input);
            throw nvae;
        }
        switch(alt57) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:643:9: FINAL
                {
                    root_0 = (CommonTree) adaptor.nil();
                    FINAL164 = (Token) match(input, FINAL, FOLLOW_FINAL_in_localModifier6815);
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        FINAL164_tree = (CommonTree) adaptor.create(FINAL164);
                        adaptor.addChild(root_0, FINAL164_tree);
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:644:9: annotation
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_annotation_in_localModifier6825);
                    annotation165 = annotation();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, annotation165.getTree());
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 40, localModifier_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) Token(org.antlr.runtime.Token) RecognitionException(org.antlr.runtime.RecognitionException)

Example 53 with NoViableAltException

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

the class JavaParser method variableInitializer.

// $ANTLR start "variableInitializer"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:593:1: variableInitializer : ( arrayInitializer | expression );
public final JavaParser.variableInitializer_return variableInitializer() throws RecognitionException {
    JavaParser.variableInitializer_return retval = new JavaParser.variableInitializer_return();
    retval.start = input.LT(1);
    int variableInitializer_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.arrayInitializer_return arrayInitializer138 = null;
    JavaParser.expression_return expression139 = null;
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 32)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:594:5: ( arrayInitializer | expression )
        int alt49 = 2;
        int LA49_0 = input.LA(1);
        if ((LA49_0 == LCURLY)) {
            alt49 = 1;
        } else if ((LA49_0 == DEC || LA49_0 == INC || LA49_0 == LESS_THAN || LA49_0 == LOGICAL_NOT || (LA49_0 >= LPAREN && LA49_0 <= MINUS) || LA49_0 == NOT || LA49_0 == PLUS || LA49_0 == BOOLEAN || LA49_0 == BYTE || LA49_0 == CHAR || LA49_0 == DOUBLE || LA49_0 == FALSE || LA49_0 == FLOAT || (LA49_0 >= INT && LA49_0 <= LONG) || (LA49_0 >= NEW && LA49_0 <= NULL) || LA49_0 == SHORT || LA49_0 == SUPER || LA49_0 == THIS || LA49_0 == TRUE || LA49_0 == VOID || (LA49_0 >= IDENT && LA49_0 <= STRING_LITERAL))) {
            alt49 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 49, 0, input);
            throw nvae;
        }
        switch(alt49) {
            case 1:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:594:9: arrayInitializer
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_arrayInitializer_in_variableInitializer6424);
                    arrayInitializer138 = arrayInitializer();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, arrayInitializer138.getTree());
                    }
                }
                break;
            case 2:
                // /home/langera/dev/freud/trunk/src/grammar/Java.g:595:9: expression
                {
                    root_0 = (CommonTree) adaptor.nil();
                    pushFollow(FOLLOW_expression_in_variableInitializer6434);
                    expression139 = expression();
                    state._fsp--;
                    if (state.failed) {
                        return retval;
                    }
                    if (state.backtracking == 0) {
                        adaptor.addChild(root_0, expression139.getTree());
                    }
                }
                break;
        }
        retval.stop = input.LT(-1);
        if (state.backtracking == 0) {
            retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
        }
    } catch (RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 32, variableInitializer_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) NoViableAltException(org.antlr.runtime.NoViableAltException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 54 with NoViableAltException

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

Example 55 with NoViableAltException

use of org.antlr.runtime.NoViableAltException in project drools by kiegroup.

the class DSLMapParser method entry.

// $ANTLR start "entry"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:1: entry : scope_section ( meta_section )? key_section EQUALS ( value_section )? ( EOL | EOF ) -> ^( VT_ENTRY scope_section ( meta_section )? key_section ( value_section )? ) ;
public final DSLMapParser.entry_return entry() throws RecognitionException {
    DSLMapParser.entry_return retval = new DSLMapParser.entry_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token EQUALS7 = null;
    Token EOL9 = null;
    Token EOF10 = null;
    ParserRuleReturnScope scope_section4 = null;
    ParserRuleReturnScope meta_section5 = null;
    ParserRuleReturnScope key_section6 = null;
    ParserRuleReturnScope value_section8 = null;
    Object EQUALS7_tree = null;
    Object EOL9_tree = null;
    Object EOF10_tree = null;
    RewriteRuleTokenStream stream_EQUALS = new RewriteRuleTokenStream(adaptor, "token EQUALS");
    RewriteRuleTokenStream stream_EOL = new RewriteRuleTokenStream(adaptor, "token EOL");
    RewriteRuleTokenStream stream_EOF = new RewriteRuleTokenStream(adaptor, "token EOF");
    RewriteRuleSubtreeStream stream_meta_section = new RewriteRuleSubtreeStream(adaptor, "rule meta_section");
    RewriteRuleSubtreeStream stream_key_section = new RewriteRuleSubtreeStream(adaptor, "rule key_section");
    RewriteRuleSubtreeStream stream_scope_section = new RewriteRuleSubtreeStream(adaptor, "rule scope_section");
    RewriteRuleSubtreeStream stream_value_section = new RewriteRuleSubtreeStream(adaptor, "rule value_section");
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:8: ( scope_section ( meta_section )? key_section EQUALS ( value_section )? ( EOL | EOF ) -> ^( VT_ENTRY scope_section ( meta_section )? key_section ( value_section )? ) )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:10: scope_section ( meta_section )? key_section EQUALS ( value_section )? ( EOL | EOF )
        {
            pushFollow(FOLLOW_scope_section_in_entry336);
            scope_section4 = scope_section();
            state._fsp--;
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_scope_section.add(scope_section4.getTree());
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:24: ( meta_section )?
            int alt3 = 2;
            int LA3_0 = input.LA(1);
            if ((LA3_0 == LEFT_SQUARE)) {
                int LA3_1 = input.LA(2);
                if ((LA3_1 == LITERAL)) {
                    int LA3_3 = input.LA(3);
                    if ((LA3_3 == RIGHT_SQUARE)) {
                        int LA3_5 = input.LA(4);
                        if ((synpred3_DSLMap())) {
                            alt3 = 1;
                        }
                    }
                } else if ((LA3_1 == RIGHT_SQUARE)) {
                    int LA3_4 = input.LA(3);
                    if ((synpred3_DSLMap())) {
                        alt3 = 1;
                    }
                }
            }
            switch(alt3) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:24: meta_section
                    {
                        pushFollow(FOLLOW_meta_section_in_entry338);
                        meta_section5 = meta_section();
                        state._fsp--;
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_meta_section.add(meta_section5.getTree());
                    }
                    break;
            }
            pushFollow(FOLLOW_key_section_in_entry341);
            key_section6 = key_section();
            state._fsp--;
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_key_section.add(key_section6.getTree());
            EQUALS7 = (Token) match(input, EQUALS, FOLLOW_EQUALS_in_entry343);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_EQUALS.add(EQUALS7);
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:57: ( value_section )?
            int alt4 = 2;
            int LA4_0 = input.LA(1);
            if (((LA4_0 >= COLON && LA4_0 <= DOT) || LA4_0 == EQUALS || (LA4_0 >= LEFT_CURLY && LA4_0 <= LITERAL) || LA4_0 == RIGHT_SQUARE)) {
                alt4 = 1;
            }
            switch(alt4) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:57: value_section
                    {
                        pushFollow(FOLLOW_value_section_in_entry345);
                        value_section8 = value_section();
                        state._fsp--;
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_value_section.add(value_section8.getTree());
                    }
                    break;
            }
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:72: ( EOL | EOF )
            int alt5 = 2;
            int LA5_0 = input.LA(1);
            if ((LA5_0 == EOL)) {
                alt5 = 1;
            } else if ((LA5_0 == EOF)) {
                alt5 = 2;
            } else {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                NoViableAltException nvae = new NoViableAltException("", 5, 0, input);
                throw nvae;
            }
            switch(alt5) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:73: EOL
                    {
                        EOL9 = (Token) match(input, EOL, FOLLOW_EOL_in_entry349);
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_EOL.add(EOL9);
                    }
                    break;
                case 2:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:119:77: EOF
                    {
                        EOF10 = (Token) match(input, EOF, FOLLOW_EOF_in_entry351);
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_EOF.add(EOF10);
                    }
                    break;
            }
            // wildcard labels:
            if (state.backtracking == 0) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.getTree() : null);
                root_0 = (Object) adaptor.nil();
                // 120:5: -> ^( VT_ENTRY scope_section ( meta_section )? key_section ( value_section )? )
                {
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:120:8: ^( VT_ENTRY scope_section ( meta_section )? key_section ( value_section )? )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_ENTRY, "VT_ENTRY"), root_1);
                        adaptor.addChild(root_1, stream_scope_section.nextTree());
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:120:33: ( meta_section )?
                        if (stream_meta_section.hasNext()) {
                            adaptor.addChild(root_1, stream_meta_section.nextTree());
                        }
                        stream_meta_section.reset();
                        adaptor.addChild(root_1, stream_key_section.nextTree());
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:120:59: ( value_section )?
                        if (stream_value_section.hasNext()) {
                            adaptor.addChild(root_1, stream_value_section.nextTree());
                        }
                        stream_value_section.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 e) {
        reportError(e);
    } catch (RewriteEmptyStreamException e) {
    } finally {
    // do for sure before leaving
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) RewriteEmptyStreamException(org.antlr.runtime.tree.RewriteEmptyStreamException) 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

NoViableAltException (org.antlr.runtime.NoViableAltException)57 RecognitionException (org.antlr.runtime.RecognitionException)43 Token (org.antlr.runtime.Token)40 CommonTree (org.antlr.runtime.tree.CommonTree)33 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)24 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)22 MismatchedSetException (org.antlr.runtime.MismatchedSetException)5 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)5 CommonToken (org.antlr.runtime.CommonToken)4 EarlyExitException (org.antlr.runtime.EarlyExitException)3 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)3 FailedPredicateException (org.antlr.runtime.FailedPredicateException)2 ArrayList (java.util.ArrayList)1 MismatchedNotSetException (org.antlr.runtime.MismatchedNotSetException)1 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)1 MismatchedTreeNodeException (org.antlr.runtime.MismatchedTreeNodeException)1 RewriteEmptyStreamException (org.antlr.runtime.tree.RewriteEmptyStreamException)1