Search in sources :

Example 36 with RewriteRuleSubtreeStream

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

the class JavaParser method genericTypeArgumentListSimplified.

// $ANTLR start "genericTypeArgumentListSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:711:1: genericTypeArgumentListSimplified : LESS_THAN genericTypeArgumentSimplified ( COMMA genericTypeArgumentSimplified )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ ) ;
public final JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified() throws RecognitionException {
    JavaParser.genericTypeArgumentListSimplified_return retval = new JavaParser.genericTypeArgumentListSimplified_return();
    retval.start = input.LT(1);
    int genericTypeArgumentListSimplified_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LESS_THAN195 = null;
    Token COMMA197 = null;
    JavaParser.genericTypeArgumentSimplified_return genericTypeArgumentSimplified196 = null;
    JavaParser.genericTypeArgumentSimplified_return genericTypeArgumentSimplified198 = null;
    JavaParser.genericTypeListClosing_return genericTypeListClosing199 = null;
    CommonTree LESS_THAN195_tree = null;
    CommonTree COMMA197_tree = null;
    RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
    RewriteRuleTokenStream stream_LESS_THAN = new RewriteRuleTokenStream(adaptor, "token LESS_THAN");
    RewriteRuleSubtreeStream stream_genericTypeArgumentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentSimplified");
    RewriteRuleSubtreeStream stream_genericTypeListClosing = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeListClosing");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 53)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:712:5: ( LESS_THAN genericTypeArgumentSimplified ( COMMA genericTypeArgumentSimplified )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:712:9: LESS_THAN genericTypeArgumentSimplified ( COMMA genericTypeArgumentSimplified )* genericTypeListClosing
        {
            LESS_THAN195 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_genericTypeArgumentListSimplified7351);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LESS_THAN.add(LESS_THAN195);
            }
            pushFollow(FOLLOW_genericTypeArgumentSimplified_in_genericTypeArgumentListSimplified7353);
            genericTypeArgumentSimplified196 = genericTypeArgumentSimplified();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_genericTypeArgumentSimplified.add(genericTypeArgumentSimplified196.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:712:49: ( COMMA genericTypeArgumentSimplified )*
            loop69: do {
                int alt69 = 2;
                int LA69_0 = input.LA(1);
                if ((LA69_0 == COMMA)) {
                    alt69 = 1;
                }
                switch(alt69) {
                    case 1:
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:712:50: COMMA genericTypeArgumentSimplified
                        {
                            COMMA197 = (Token) match(input, COMMA, FOLLOW_COMMA_in_genericTypeArgumentListSimplified7356);
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_COMMA.add(COMMA197);
                            }
                            pushFollow(FOLLOW_genericTypeArgumentSimplified_in_genericTypeArgumentListSimplified7358);
                            genericTypeArgumentSimplified198 = genericTypeArgumentSimplified();
                            state._fsp--;
                            if (state.failed) {
                                return retval;
                            }
                            if (state.backtracking == 0) {
                                stream_genericTypeArgumentSimplified.add(genericTypeArgumentSimplified198.getTree());
                            }
                        }
                        break;
                    default:
                        break loop69;
                }
            } while (true);
            pushFollow(FOLLOW_genericTypeListClosing_in_genericTypeArgumentListSimplified7362);
            genericTypeListClosing199 = genericTypeListClosing();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_genericTypeListClosing.add(genericTypeListClosing199.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();
                // 713:9: -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:713:13: ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(GENERIC_TYPE_ARG_LIST, LESS_THAN195, "GENERIC_TYPE_ARG_LIST"), root_1);
                        if (!(stream_genericTypeArgumentSimplified.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_genericTypeArgumentSimplified.hasNext()) {
                            adaptor.addChild(root_1, stream_genericTypeArgumentSimplified.nextTree());
                        }
                        stream_genericTypeArgumentSimplified.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, 53, genericTypeArgumentListSimplified_StartIndex);
        }
    }
    return retval;
}
Also used : RewriteRuleTokenStream(org.antlr.runtime.tree.RewriteRuleTokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 37 with RewriteRuleSubtreeStream

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

the class JavaParser method arguments.

// $ANTLR start "arguments"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1151:1: arguments : LPAREN ( expressionList )? RPAREN -> ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? ) ;
public final JavaParser.arguments_return arguments() throws RecognitionException {
    JavaParser.arguments_return retval = new JavaParser.arguments_return();
    retval.start = input.LT(1);
    int arguments_StartIndex = input.index();
    CommonTree root_0 = null;
    Token LPAREN531 = null;
    Token RPAREN533 = null;
    JavaParser.expressionList_return expressionList532 = null;
    CommonTree LPAREN531_tree = null;
    CommonTree RPAREN533_tree = null;
    RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
    RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
    RewriteRuleSubtreeStream stream_expressionList = new RewriteRuleSubtreeStream(adaptor, "rule expressionList");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 110)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1152:5: ( LPAREN ( expressionList )? RPAREN -> ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1152:9: LPAREN ( expressionList )? RPAREN
        {
            LPAREN531 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_arguments14389);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_LPAREN.add(LPAREN531);
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:1152:16: ( expressionList )?
            int alt154 = 2;
            int LA154_0 = input.LA(1);
            if ((LA154_0 == DEC || LA154_0 == INC || LA154_0 == LESS_THAN || LA154_0 == LOGICAL_NOT || (LA154_0 >= LPAREN && LA154_0 <= MINUS) || LA154_0 == NOT || LA154_0 == PLUS || LA154_0 == BOOLEAN || LA154_0 == BYTE || LA154_0 == CHAR || LA154_0 == DOUBLE || LA154_0 == FALSE || LA154_0 == FLOAT || (LA154_0 >= INT && LA154_0 <= LONG) || (LA154_0 >= NEW && LA154_0 <= NULL) || LA154_0 == SHORT || LA154_0 == SUPER || LA154_0 == THIS || LA154_0 == TRUE || LA154_0 == VOID || (LA154_0 >= IDENT && LA154_0 <= STRING_LITERAL))) {
                alt154 = 1;
            }
            switch(alt154) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: expressionList
                    {
                        pushFollow(FOLLOW_expressionList_in_arguments14391);
                        expressionList532 = expressionList();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_expressionList.add(expressionList532.getTree());
                        }
                    }
                    break;
            }
            RPAREN533 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_arguments14394);
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_RPAREN.add(RPAREN533);
            }
            // 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();
                // 1153:9: -> ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:1153:13: ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARGUMENT_LIST, LPAREN531, "ARGUMENT_LIST"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:1153:55: ( expressionList )?
                        if (stream_expressionList.hasNext()) {
                            adaptor.addChild(root_1, stream_expressionList.nextTree());
                        }
                        stream_expressionList.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, 110, arguments_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 38 with RewriteRuleSubtreeStream

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

the class JavaParser method switchBlockLabels.

// $ANTLR start "switchBlockLabels"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:885:1: switchBlockLabels : preCases= switchCaseLabels ( switchDefaultLabel )? postCases= switchCaseLabels -> ^( SWITCH_BLOCK_LABEL_LIST ( $preCases)? ( switchDefaultLabel )? ( $postCases)? ) ;
public final JavaParser.switchBlockLabels_return switchBlockLabels() throws RecognitionException {
    JavaParser.switchBlockLabels_return retval = new JavaParser.switchBlockLabels_return();
    retval.start = input.LT(1);
    int switchBlockLabels_StartIndex = input.index();
    CommonTree root_0 = null;
    JavaParser.switchCaseLabels_return preCases = null;
    JavaParser.switchCaseLabels_return postCases = null;
    JavaParser.switchDefaultLabel_return switchDefaultLabel346 = null;
    RewriteRuleSubtreeStream stream_switchDefaultLabel = new RewriteRuleSubtreeStream(adaptor, "rule switchDefaultLabel");
    RewriteRuleSubtreeStream stream_switchCaseLabels = new RewriteRuleSubtreeStream(adaptor, "rule switchCaseLabels");
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 79)) {
            return retval;
        }
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:886:5: (preCases= switchCaseLabels ( switchDefaultLabel )? postCases= switchCaseLabels -> ^( SWITCH_BLOCK_LABEL_LIST ( $preCases)? ( switchDefaultLabel )? ( $postCases)? ) )
        // /home/langera/dev/freud/trunk/src/grammar/Java.g:886:9: preCases= switchCaseLabels ( switchDefaultLabel )? postCases= switchCaseLabels
        {
            pushFollow(FOLLOW_switchCaseLabels_in_switchBlockLabels9838);
            preCases = switchCaseLabels();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_switchCaseLabels.add(preCases.getTree());
            }
            // /home/langera/dev/freud/trunk/src/grammar/Java.g:886:35: ( switchDefaultLabel )?
            int alt100 = 2;
            int LA100_0 = input.LA(1);
            if ((LA100_0 == DEFAULT)) {
                alt100 = 1;
            }
            switch(alt100) {
                case 1:
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: switchDefaultLabel
                    {
                        pushFollow(FOLLOW_switchDefaultLabel_in_switchBlockLabels9840);
                        switchDefaultLabel346 = switchDefaultLabel();
                        state._fsp--;
                        if (state.failed) {
                            return retval;
                        }
                        if (state.backtracking == 0) {
                            stream_switchDefaultLabel.add(switchDefaultLabel346.getTree());
                        }
                    }
                    break;
            }
            pushFollow(FOLLOW_switchCaseLabels_in_switchBlockLabels9845);
            postCases = switchCaseLabels();
            state._fsp--;
            if (state.failed) {
                return retval;
            }
            if (state.backtracking == 0) {
                stream_switchCaseLabels.add(postCases.getTree());
            }
            // wildcard labels:
            if (state.backtracking == 0) {
                retval.tree = root_0;
                RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                RewriteRuleSubtreeStream stream_preCases = new RewriteRuleSubtreeStream(adaptor, "rule preCases", preCases != null ? preCases.tree : null);
                RewriteRuleSubtreeStream stream_postCases = new RewriteRuleSubtreeStream(adaptor, "rule postCases", postCases != null ? postCases.tree : null);
                root_0 = (CommonTree) adaptor.nil();
                // 887:9: -> ^( SWITCH_BLOCK_LABEL_LIST ( $preCases)? ( switchDefaultLabel )? ( $postCases)? )
                {
                    // /home/langera/dev/freud/trunk/src/grammar/Java.g:887:13: ^( SWITCH_BLOCK_LABEL_LIST ( $preCases)? ( switchDefaultLabel )? ( $postCases)? )
                    {
                        CommonTree root_1 = (CommonTree) adaptor.nil();
                        root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SWITCH_BLOCK_LABEL_LIST, "SWITCH_BLOCK_LABEL_LIST"), root_1);
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:887:39: ( $preCases)?
                        if (stream_preCases.hasNext()) {
                            adaptor.addChild(root_1, stream_preCases.nextTree());
                        }
                        stream_preCases.reset();
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:887:50: ( switchDefaultLabel )?
                        if (stream_switchDefaultLabel.hasNext()) {
                            adaptor.addChild(root_1, stream_switchDefaultLabel.nextTree());
                        }
                        stream_switchDefaultLabel.reset();
                        // /home/langera/dev/freud/trunk/src/grammar/Java.g:887:70: ( $postCases)?
                        if (stream_postCases.hasNext()) {
                            adaptor.addChild(root_1, stream_postCases.nextTree());
                        }
                        stream_postCases.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, 79, switchBlockLabels_StartIndex);
        }
    }
    return retval;
}
Also used : CommonTree(org.antlr.runtime.tree.CommonTree) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) RecognitionException(org.antlr.runtime.RecognitionException)

Example 39 with RewriteRuleSubtreeStream

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

the class DSLMapParser method any_key.

// $ANTLR start "any_key"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:266:1: any_key :{...}?value= LITERAL -> VT_ANY[$value] ;
public final DSLMapParser.any_key_return any_key() throws RecognitionException {
    DSLMapParser.any_key_return retval = new DSLMapParser.any_key_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token value = null;
    Object value_tree = null;
    RewriteRuleTokenStream stream_LITERAL = new RewriteRuleTokenStream(adaptor, "token LITERAL");
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:267:5: ({...}?value= LITERAL -> VT_ANY[$value] )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:267:7: {...}?value= LITERAL
        {
            if (!((validateIdentifierKey("*")))) {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                throw new FailedPredicateException(input, "any_key", "validateIdentifierKey(\"*\")");
            }
            value = (Token) match(input, LITERAL, FOLLOW_LITERAL_in_any_key1695);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_LITERAL.add(value);
            // 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();
                // 268:5: -> VT_ANY[$value]
                {
                    adaptor.addChild(root_0, (Object) adaptor.create(VT_ANY, value));
                }
                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) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) CommonToken(org.antlr.runtime.CommonToken) FailedPredicateException(org.antlr.runtime.FailedPredicateException) RecognitionException(org.antlr.runtime.RecognitionException)

Example 40 with RewriteRuleSubtreeStream

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

the class DSLMapParser method value_sentence.

// $ANTLR start "value_sentence"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:172:1: value_sentence : ( variable_reference |vc= value_chunk -> VT_LITERAL[$vc.start, text] );
public final DSLMapParser.value_sentence_return value_sentence() throws RecognitionException {
    DSLMapParser.value_sentence_return retval = new DSLMapParser.value_sentence_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    ParserRuleReturnScope vc = null;
    ParserRuleReturnScope variable_reference19 = null;
    RewriteRuleSubtreeStream stream_value_chunk = new RewriteRuleSubtreeStream(adaptor, "rule value_chunk");
    String text = "";
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:176:5: ( variable_reference |vc= value_chunk -> VT_LITERAL[$vc.start, text] )
        int alt12 = 2;
        int LA12_0 = input.LA(1);
        if ((LA12_0 == LEFT_CURLY)) {
            alt12 = 1;
        } else if (((LA12_0 >= COLON && LA12_0 <= DOT) || LA12_0 == EQUALS || (LA12_0 >= LEFT_SQUARE && LA12_0 <= LITERAL) || LA12_0 == RIGHT_SQUARE)) {
            alt12 = 2;
        } else {
            if (state.backtracking > 0) {
                state.failed = true;
                return retval;
            }
            NoViableAltException nvae = new NoViableAltException("", 12, 0, input);
            throw nvae;
        }
        switch(alt12) {
            case 1:
                // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:176:7: variable_reference
                {
                    root_0 = (Object) adaptor.nil();
                    pushFollow(FOLLOW_variable_reference_in_value_sentence703);
                    variable_reference19 = variable_reference();
                    state._fsp--;
                    if (state.failed)
                        return retval;
                    if (state.backtracking == 0)
                        adaptor.addChild(root_0, variable_reference19.getTree());
                }
                break;
            case 2:
                // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:177:7: vc= value_chunk
                {
                    pushFollow(FOLLOW_value_chunk_in_value_sentence713);
                    vc = value_chunk();
                    state._fsp--;
                    if (state.failed)
                        return retval;
                    if (state.backtracking == 0)
                        stream_value_chunk.add(vc.getTree());
                    if (state.backtracking == 0) {
                        text = (vc != null ? input.toString(vc.start, vc.stop) : null);
                    }
                    // 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();
                        // 178:5: -> VT_LITERAL[$vc.start, text]
                        {
                            adaptor.addChild(root_0, (Object) adaptor.create(VT_LITERAL, (vc != null ? (vc.start) : null), text));
                        }
                        retval.tree = root_0;
                    }
                }
                break;
        }
        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 : NoViableAltException(org.antlr.runtime.NoViableAltException) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) ParserRuleReturnScope(org.antlr.runtime.ParserRuleReturnScope) 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