Search in sources :

Example 41 with RewriteRuleSubtreeStream

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

the class DSLMapParser method meta_section.

// $ANTLR start "meta_section"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:144:1: meta_section : LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) ;
public final DSLMapParser.meta_section_return meta_section() throws RecognitionException {
    DSLMapParser.meta_section_return retval = new DSLMapParser.meta_section_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token LEFT_SQUARE13 = null;
    Token LITERAL14 = null;
    Token RIGHT_SQUARE15 = null;
    Object LEFT_SQUARE13_tree = null;
    Object LITERAL14_tree = null;
    Object RIGHT_SQUARE15_tree = null;
    RewriteRuleTokenStream stream_RIGHT_SQUARE = new RewriteRuleTokenStream(adaptor, "token RIGHT_SQUARE");
    RewriteRuleTokenStream stream_LITERAL = new RewriteRuleTokenStream(adaptor, "token LITERAL");
    RewriteRuleTokenStream stream_LEFT_SQUARE = new RewriteRuleTokenStream(adaptor, "token LEFT_SQUARE");
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:5: ( LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:7: LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE
        {
            LEFT_SQUARE13 = (Token) match(input, LEFT_SQUARE, FOLLOW_LEFT_SQUARE_in_meta_section530);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_LEFT_SQUARE.add(LEFT_SQUARE13);
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: ( LITERAL )?
            int alt7 = 2;
            int LA7_0 = input.LA(1);
            if ((LA7_0 == LITERAL)) {
                alt7 = 1;
            }
            switch(alt7) {
                case 1:
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: LITERAL
                    {
                        LITERAL14 = (Token) match(input, LITERAL, FOLLOW_LITERAL_in_meta_section532);
                        if (state.failed)
                            return retval;
                        if (state.backtracking == 0)
                            stream_LITERAL.add(LITERAL14);
                    }
                    break;
            }
            RIGHT_SQUARE15 = (Token) match(input, RIGHT_SQUARE, FOLLOW_RIGHT_SQUARE_in_meta_section535);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_RIGHT_SQUARE.add(RIGHT_SQUARE15);
            // 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();
                // 146:5: -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? )
                {
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:8: ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_META, LEFT_SQUARE13, "META SECTION"), root_1);
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:48: ( LITERAL )?
                        if (stream_LITERAL.hasNext()) {
                            adaptor.addChild(root_1, stream_LITERAL.nextNode());
                        }
                        stream_LITERAL.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) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) CommonToken(org.antlr.runtime.CommonToken) RecognitionException(org.antlr.runtime.RecognitionException)

Example 42 with RewriteRuleSubtreeStream

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

the class DSLMapParser method value_section.

// $ANTLR start "value_section"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:167:1: value_section : ( value_sentence )+ -> ^( VT_ENTRY_VAL ( value_sentence )+ ) ;
public final DSLMapParser.value_section_return value_section() throws RecognitionException {
    DSLMapParser.value_section_return retval = new DSLMapParser.value_section_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    ParserRuleReturnScope value_sentence18 = null;
    RewriteRuleSubtreeStream stream_value_sentence = new RewriteRuleSubtreeStream(adaptor, "rule value_sentence");
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:168:5: ( ( value_sentence )+ -> ^( VT_ENTRY_VAL ( value_sentence )+ ) )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:168:7: ( value_sentence )+
        {
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:168:7: ( value_sentence )+
            int cnt11 = 0;
            loop11: while (true) {
                int alt11 = 2;
                int LA11_0 = input.LA(1);
                if (((LA11_0 >= COLON && LA11_0 <= DOT) || LA11_0 == EQUALS || (LA11_0 >= LEFT_CURLY && LA11_0 <= LITERAL) || LA11_0 == RIGHT_SQUARE)) {
                    alt11 = 1;
                }
                switch(alt11) {
                    case 1:
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:168:7: value_sentence
                        {
                            pushFollow(FOLLOW_value_sentence_in_value_section664);
                            value_sentence18 = value_sentence();
                            state._fsp--;
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0)
                                stream_value_sentence.add(value_sentence18.getTree());
                        }
                        break;
                    default:
                        if (cnt11 >= 1)
                            break loop11;
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return retval;
                        }
                        EarlyExitException eee = new EarlyExitException(11, input);
                        throw eee;
                }
                cnt11++;
            }
            // 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();
                // 169:5: -> ^( VT_ENTRY_VAL ( value_sentence )+ )
                {
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:169:8: ^( VT_ENTRY_VAL ( value_sentence )+ )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_ENTRY_VAL, "VT_ENTRY_VAL"), root_1);
                        if (!(stream_value_sentence.hasNext())) {
                            throw new RewriteEarlyExitException();
                        }
                        while (stream_value_sentence.hasNext()) {
                            adaptor.addChild(root_1, stream_value_sentence.nextTree());
                        }
                        stream_value_sentence.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 : RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) EarlyExitException(org.antlr.runtime.EarlyExitException) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) ParserRuleReturnScope(org.antlr.runtime.ParserRuleReturnScope) RecognitionException(org.antlr.runtime.RecognitionException)

Example 43 with RewriteRuleSubtreeStream

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

the class DSLMapParser method condition_key.

// $ANTLR start "condition_key"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:251:1: condition_key :{...}?value= LITERAL -> VT_CONDITION[$value] ;
public final DSLMapParser.condition_key_return condition_key() throws RecognitionException {
    DSLMapParser.condition_key_return retval = new DSLMapParser.condition_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:252:5: ({...}?value= LITERAL -> VT_CONDITION[$value] )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:252:7: {...}?value= LITERAL
        {
            if (!((validateIdentifierKey("condition") || validateIdentifierKey("when")))) {
                if (state.backtracking > 0) {
                    state.failed = true;
                    return retval;
                }
                throw new FailedPredicateException(input, "condition_key", "validateIdentifierKey(\"condition\")||validateIdentifierKey(\"when\")");
            }
            value = (Token) match(input, LITERAL, FOLLOW_LITERAL_in_condition_key1599);
            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();
                // 253:5: -> VT_CONDITION[$value]
                {
                    adaptor.addChild(root_0, (Object) adaptor.create(VT_CONDITION, 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 44 with RewriteRuleSubtreeStream

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

the class DSLMapParser method variable_reference.

// $ANTLR start "variable_reference"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:228:1: variable_reference : lc= LEFT_CURLY name= variable_reference_expr rc= RIGHT_CURLY -> { hasSpaceBefore && hasSpaceAfter}? VT_SPACE ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) VT_SPACE -> { hasSpaceBefore && !hasSpaceAfter}? VT_SPACE ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) -> {!hasSpaceBefore && hasSpaceAfter}? ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) VT_SPACE -> ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) ;
public final DSLMapParser.variable_reference_return variable_reference() throws RecognitionException {
    DSLMapParser.variable_reference_return retval = new DSLMapParser.variable_reference_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token lc = null;
    Token rc = null;
    ParserRuleReturnScope name = null;
    Object lc_tree = null;
    Object rc_tree = null;
    RewriteRuleTokenStream stream_RIGHT_CURLY = new RewriteRuleTokenStream(adaptor, "token RIGHT_CURLY");
    RewriteRuleTokenStream stream_LEFT_CURLY = new RewriteRuleTokenStream(adaptor, "token LEFT_CURLY");
    RewriteRuleSubtreeStream stream_variable_reference_expr = new RewriteRuleSubtreeStream(adaptor, "rule variable_reference_expr");
    boolean hasSpaceBefore = false;
    boolean hasSpaceAfter = false;
    String text = "";
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:234:5: (lc= LEFT_CURLY name= variable_reference_expr rc= RIGHT_CURLY -> { hasSpaceBefore && hasSpaceAfter}? VT_SPACE ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) VT_SPACE -> { hasSpaceBefore && !hasSpaceAfter}? VT_SPACE ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) -> {!hasSpaceBefore && hasSpaceAfter}? ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) VT_SPACE -> ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:234:7: lc= LEFT_CURLY name= variable_reference_expr rc= RIGHT_CURLY
        {
            lc = (Token) match(input, LEFT_CURLY, FOLLOW_LEFT_CURLY_in_variable_reference1389);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_LEFT_CURLY.add(lc);
            if (state.backtracking == 0) {
                CommonToken back2 = (CommonToken) input.LT(-2);
                if (back2 != null && back2.getStopIndex() < ((CommonToken) lc).getStartIndex() - 1)
                    hasSpaceBefore = true;
            }
            pushFollow(FOLLOW_variable_reference_expr_in_variable_reference1409);
            name = variable_reference_expr();
            state._fsp--;
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_variable_reference_expr.add(name.getTree());
            rc = (Token) match(input, RIGHT_CURLY, FOLLOW_RIGHT_CURLY_in_variable_reference1413);
            if (state.failed)
                return retval;
            if (state.backtracking == 0)
                stream_RIGHT_CURLY.add(rc);
            if (state.backtracking == 0) {
                if (((CommonToken) rc).getStopIndex() < ((CommonToken) input.LT(1)).getStartIndex() - 1)
                    hasSpaceAfter = true;
            }
            // 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();
                // 241:5: -> { hasSpaceBefore && hasSpaceAfter}? VT_SPACE ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) VT_SPACE
                if (hasSpaceBefore && hasSpaceAfter) {
                    adaptor.addChild(root_0, (Object) adaptor.create(VT_SPACE, "VT_SPACE"));
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:241:54: ^( VT_VAR_REF LITERAL[$name.start,$name.text] )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
                        adaptor.addChild(root_1, (Object) adaptor.create(LITERAL, (name != null ? (name.start) : null), (name != null ? input.toString(name.start, name.stop) : null)));
                        adaptor.addChild(root_0, root_1);
                    }
                    adaptor.addChild(root_0, (Object) adaptor.create(VT_SPACE, "VT_SPACE"));
                } else // 242:5: -> { hasSpaceBefore && !hasSpaceAfter}? VT_SPACE ^( VT_VAR_REF LITERAL[$name.start,$name.text] )
                if (hasSpaceBefore && !hasSpaceAfter) {
                    adaptor.addChild(root_0, (Object) adaptor.create(VT_SPACE, "VT_SPACE"));
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:242:54: ^( VT_VAR_REF LITERAL[$name.start,$name.text] )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
                        adaptor.addChild(root_1, (Object) adaptor.create(LITERAL, (name != null ? (name.start) : null), (name != null ? input.toString(name.start, name.stop) : null)));
                        adaptor.addChild(root_0, root_1);
                    }
                } else // 243:5: -> {!hasSpaceBefore && hasSpaceAfter}? ^( VT_VAR_REF LITERAL[$name.start,$name.text] ) VT_SPACE
                if (!hasSpaceBefore && hasSpaceAfter) {
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:243:54: ^( VT_VAR_REF LITERAL[$name.start,$name.text] )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
                        adaptor.addChild(root_1, (Object) adaptor.create(LITERAL, (name != null ? (name.start) : null), (name != null ? input.toString(name.start, name.stop) : null)));
                        adaptor.addChild(root_0, root_1);
                    }
                    adaptor.addChild(root_0, (Object) adaptor.create(VT_SPACE, "VT_SPACE"));
                } else // 244:5: -> ^( VT_VAR_REF LITERAL[$name.start,$name.text] )
                {
                    // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:244:54: ^( VT_VAR_REF LITERAL[$name.start,$name.text] )
                    {
                        Object root_1 = (Object) adaptor.nil();
                        root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_VAR_REF, "VT_VAR_REF"), root_1);
                        adaptor.addChild(root_1, (Object) adaptor.create(LITERAL, (name != null ? (name.start) : null), (name != null ? input.toString(name.start, name.stop) : null)));
                        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) RewriteRuleSubtreeStream(org.antlr.runtime.tree.RewriteRuleSubtreeStream) Token(org.antlr.runtime.Token) CommonToken(org.antlr.runtime.CommonToken) ParserRuleReturnScope(org.antlr.runtime.ParserRuleReturnScope) CommonToken(org.antlr.runtime.CommonToken) RecognitionException(org.antlr.runtime.RecognitionException)

Example 45 with RewriteRuleSubtreeStream

use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project binnavi by google.

the class ConditionParser method primaryExpression.

// $ANTLR end "multExpression"
// $ANTLR start "primaryExpression"
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:92:1:
// primaryExpression : ( IDENTIFIER | NUMBER | HEX_NUMBER | '[' formula ']' -> ^(
// MEMORY_EXPRESSION formula ) | '(' formula ')' -> ^( SUB_EXPRESSION formula ) );
public final ConditionParser.primaryExpression_return primaryExpression() throws RecognitionException {
    final ConditionParser.primaryExpression_return retval = new ConditionParser.primaryExpression_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token IDENTIFIER30 = null;
    Token NUMBER31 = null;
    Token HEX_NUMBER32 = null;
    Token char_literal33 = null;
    Token char_literal35 = null;
    Token char_literal36 = null;
    Token char_literal38 = null;
    ConditionParser.formula_return formula34 = null;
    ConditionParser.formula_return formula37 = null;
    Object IDENTIFIER30_tree = null;
    Object NUMBER31_tree = null;
    Object HEX_NUMBER32_tree = null;
    final Object char_literal33_tree = null;
    final Object char_literal35_tree = null;
    final Object char_literal36_tree = null;
    final Object char_literal38_tree = null;
    final RewriteRuleTokenStream stream_32 = new RewriteRuleTokenStream(adaptor, "token 32");
    final RewriteRuleTokenStream stream_31 = new RewriteRuleTokenStream(adaptor, "token 31");
    final RewriteRuleTokenStream stream_33 = new RewriteRuleTokenStream(adaptor, "token 33");
    final RewriteRuleTokenStream stream_34 = new RewriteRuleTokenStream(adaptor, "token 34");
    final RewriteRuleSubtreeStream stream_formula = new RewriteRuleSubtreeStream(adaptor, "rule formula");
    try {
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:93:3:
        // ( IDENTIFIER | NUMBER | HEX_NUMBER | '[' formula ']' -> ^( MEMORY_EXPRESSION formula ) |
        // '(' formula ')' -> ^( SUB_EXPRESSION formula ) )
        int alt9 = 5;
        switch(input.LA(1)) {
            case IDENTIFIER:
                {
                    alt9 = 1;
                }
                break;
            case NUMBER:
                {
                    alt9 = 2;
                }
                break;
            case HEX_NUMBER:
                {
                    alt9 = 3;
                }
                break;
            case 31:
                {
                    alt9 = 4;
                }
                break;
            case 33:
                {
                    alt9 = 5;
                }
                break;
            default:
                final NoViableAltException nvae = new NoViableAltException("", 9, 0, input);
                throw nvae;
        }
        switch(alt9) {
            case 1:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:93:5:
                // IDENTIFIER
                {
                    root_0 = (Object) adaptor.nil();
                    IDENTIFIER30 = (Token) match(input, IDENTIFIER, FOLLOW_IDENTIFIER_in_primaryExpression558);
                    IDENTIFIER30_tree = (Object) adaptor.create(IDENTIFIER30);
                    adaptor.addChild(root_0, IDENTIFIER30_tree);
                }
                break;
            case 2:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:94:5:
                // NUMBER
                {
                    root_0 = (Object) adaptor.nil();
                    NUMBER31 = (Token) match(input, NUMBER, FOLLOW_NUMBER_in_primaryExpression564);
                    NUMBER31_tree = (Object) adaptor.create(NUMBER31);
                    adaptor.addChild(root_0, NUMBER31_tree);
                }
                break;
            case 3:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:95:5:
                // HEX_NUMBER
                {
                    root_0 = (Object) adaptor.nil();
                    HEX_NUMBER32 = (Token) match(input, HEX_NUMBER, FOLLOW_HEX_NUMBER_in_primaryExpression570);
                    HEX_NUMBER32_tree = (Object) adaptor.create(HEX_NUMBER32);
                    adaptor.addChild(root_0, HEX_NUMBER32_tree);
                }
                break;
            case 4:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:96:5:
                // '[' formula ']'
                {
                    char_literal33 = (Token) match(input, 31, FOLLOW_31_in_primaryExpression576);
                    stream_31.add(char_literal33);
                    pushFollow(FOLLOW_formula_in_primaryExpression578);
                    formula34 = formula();
                    state._fsp--;
                    stream_formula.add(formula34.getTree());
                    char_literal35 = (Token) match(input, 32, FOLLOW_32_in_primaryExpression580);
                    stream_32.add(char_literal35);
                    // AST REWRITE
                    // elements: formula
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (Object) adaptor.nil();
                    // 96:21: -> ^( MEMORY_EXPRESSION formula )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:96:24:
                        // ^( MEMORY_EXPRESSION formula )
                        {
                            Object root_1 = (Object) adaptor.nil();
                            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(MEMORY_EXPRESSION, "MEMORY_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_formula.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
            case 5:
                // C:\\Dokumente und
                // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:97:5:
                // '(' formula ')'
                {
                    char_literal36 = (Token) match(input, 33, FOLLOW_33_in_primaryExpression594);
                    stream_33.add(char_literal36);
                    pushFollow(FOLLOW_formula_in_primaryExpression596);
                    formula37 = formula();
                    state._fsp--;
                    stream_formula.add(formula37.getTree());
                    char_literal38 = (Token) match(input, 34, FOLLOW_34_in_primaryExpression598);
                    stream_34.add(char_literal38);
                    // AST REWRITE
                    // elements: formula
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    retval.tree = root_0;
                    final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
                    root_0 = (Object) adaptor.nil();
                    // 97:21: -> ^( SUB_EXPRESSION formula )
                    {
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:97:24:
                        // ^( SUB_EXPRESSION formula )
                        {
                            Object root_1 = (Object) adaptor.nil();
                            root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(SUB_EXPRESSION, "SUB_EXPRESSION"), root_1);
                            adaptor.addChild(root_1, stream_formula.nextTree());
                            adaptor.addChild(root_0, root_1);
                        }
                    }
                    retval.tree = root_0;
                }
                break;
        }
        retval.stop = input.LT(-1);
        retval.tree = (Object) adaptor.rulePostProcessing(root_0);
        adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
    } catch (final RecognitionException re) {
        reportError(re);
        recover(input, re);
        retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);
    } finally {
    }
    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) 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