Search in sources :

Example 11 with EarlyExitException

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

the class DSLMapParser method value_chunk.

// $ANTLR start "value_chunk"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:181:1: value_chunk : ( literal | EQUALS | COMMA | DOT )+ ;
public final DSLMapParser.value_chunk_return value_chunk() throws RecognitionException {
    DSLMapParser.value_chunk_return retval = new DSLMapParser.value_chunk_return();
    retval.start = input.LT(1);
    Object root_0 = null;
    Token EQUALS21 = null;
    Token COMMA22 = null;
    Token DOT23 = null;
    ParserRuleReturnScope literal20 = null;
    Object EQUALS21_tree = null;
    Object COMMA22_tree = null;
    Object DOT23_tree = null;
    try {
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:5: ( ( literal | EQUALS | COMMA | DOT )+ )
        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:7: ( literal | EQUALS | COMMA | DOT )+
        {
            root_0 = (Object) adaptor.nil();
            // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:7: ( literal | EQUALS | COMMA | DOT )+
            int cnt13 = 0;
            loop13: while (true) {
                int alt13 = 5;
                switch(input.LA(1)) {
                    case COLON:
                    case LEFT_SQUARE:
                    case LITERAL:
                    case RIGHT_SQUARE:
                        {
                            int LA13_2 = input.LA(2);
                            if ((synpred15_DSLMap())) {
                                alt13 = 1;
                            }
                        }
                        break;
                    case EQUALS:
                        {
                            int LA13_3 = input.LA(2);
                            if ((synpred16_DSLMap())) {
                                alt13 = 2;
                            }
                        }
                        break;
                    case COMMA:
                        {
                            int LA13_4 = input.LA(2);
                            if ((synpred17_DSLMap())) {
                                alt13 = 3;
                            }
                        }
                        break;
                    case DOT:
                        {
                            int LA13_5 = input.LA(2);
                            if ((synpred18_DSLMap())) {
                                alt13 = 4;
                            }
                        }
                        break;
                }
                switch(alt13) {
                    case 1:
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:8: literal
                        {
                            pushFollow(FOLLOW_literal_in_value_chunk742);
                            literal20 = literal();
                            state._fsp--;
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0)
                                adaptor.addChild(root_0, literal20.getTree());
                        }
                        break;
                    case 2:
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:16: EQUALS
                        {
                            EQUALS21 = (Token) match(input, EQUALS, FOLLOW_EQUALS_in_value_chunk744);
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0) {
                                EQUALS21_tree = (Object) adaptor.create(EQUALS21);
                                adaptor.addChild(root_0, EQUALS21_tree);
                            }
                        }
                        break;
                    case 3:
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:23: COMMA
                        {
                            COMMA22 = (Token) match(input, COMMA, FOLLOW_COMMA_in_value_chunk746);
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0) {
                                COMMA22_tree = (Object) adaptor.create(COMMA22);
                                adaptor.addChild(root_0, COMMA22_tree);
                            }
                        }
                        break;
                    case 4:
                        // src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:182:29: DOT
                        {
                            DOT23 = (Token) match(input, DOT, FOLLOW_DOT_in_value_chunk748);
                            if (state.failed)
                                return retval;
                            if (state.backtracking == 0) {
                                DOT23_tree = (Object) adaptor.create(DOT23);
                                adaptor.addChild(root_0, DOT23_tree);
                            }
                        }
                        break;
                    default:
                        if (cnt13 >= 1)
                            break loop13;
                        if (state.backtracking > 0) {
                            state.failed = true;
                            return retval;
                        }
                        EarlyExitException eee = new EarlyExitException(13, input);
                        throw eee;
                }
                cnt13++;
            }
        }
        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 : Token(org.antlr.runtime.Token) CommonToken(org.antlr.runtime.CommonToken) EarlyExitException(org.antlr.runtime.EarlyExitException) RewriteEarlyExitException(org.antlr.runtime.tree.RewriteEarlyExitException) ParserRuleReturnScope(org.antlr.runtime.ParserRuleReturnScope) RecognitionException(org.antlr.runtime.RecognitionException)

Example 12 with EarlyExitException

use of org.antlr.runtime.EarlyExitException in project binnavi by google.

the class FilterLexer method mPREDICATE.

// $ANTLR end "OR"
// $ANTLR start "PREDICATE"
public final void mPREDICATE() throws RecognitionException {
    try {
        final int _type = PREDICATE;
        final int _channel = DEFAULT_TOKEN_CHANNEL;
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:11:
        // ( ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '<' | '>' | '=' | '_' | '@' | '!' | WS )+ )
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:13:
        // ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '<' | '>' | '=' | '_' | '@' | '!' | WS )+
        {
            // C:\\Dokumente und
            // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:13:
            // ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '<' | '>' | '=' | '_' | '@' | '!' | WS )+
            int cnt1 = 0;
            loop1: do {
                int alt1 = 11;
                alt1 = dfa1.predict(input);
                switch(alt1) {
                    case 1:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:14:
                        // 'a' .. 'z'
                        {
                            matchRange('a', 'z');
                        }
                        break;
                    case 2:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:25:
                        // 'A' .. 'Z'
                        {
                            matchRange('A', 'Z');
                        }
                        break;
                    case 3:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:36:
                        // '0' .. '9'
                        {
                            matchRange('0', '9');
                        }
                        break;
                    case 4:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:47:
                        // '<'
                        {
                            match('<');
                        }
                        break;
                    case 5:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:53:
                        // '>'
                        {
                            match('>');
                        }
                        break;
                    case 6:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:59:
                        // '='
                        {
                            match('=');
                        }
                        break;
                    case 7:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:65:
                        // '_'
                        {
                            match('_');
                        }
                        break;
                    case 8:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:71:
                        // '@'
                        {
                            match('@');
                        }
                        break;
                    case 9:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:77:
                        // '!'
                        {
                            match('!');
                        }
                        break;
                    case 10:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:16:83:
                        // WS
                        {
                            mWS();
                        }
                        break;
                    default:
                        if (cnt1 >= 1) {
                            break loop1;
                        }
                        final EarlyExitException eee = new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);
        }
        state.type = _type;
        state.channel = _channel;
    } finally {
    }
}
Also used : EarlyExitException(org.antlr.runtime.EarlyExitException)

Example 13 with EarlyExitException

use of org.antlr.runtime.EarlyExitException in project binnavi by google.

the class MemoryExpressionLexer method mHEX_NUMBER.

// $ANTLR end "DIGIT"
// $ANTLR start "HEX_NUMBER"
public final void mHEX_NUMBER() throws RecognitionException {
    try {
        final int _type = HEX_NUMBER;
        final int _channel = DEFAULT_TOKEN_CHANNEL;
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:26:12:
        // ( '0x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ )
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:26:14:
        // '0x' ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
        {
            match("0x");
            // C:\\Dokumente und
            // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:26:19:
            // ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+
            int cnt2 = 0;
            loop2: do {
                int alt2 = 2;
                final int LA2_0 = input.LA(1);
                if (((LA2_0 >= '0' && LA2_0 <= '9') || (LA2_0 >= 'A' && LA2_0 <= 'F') || (LA2_0 >= 'a' && LA2_0 <= 'f'))) {
                    alt2 = 1;
                }
                switch(alt2) {
                    case 1:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:
                        {
                            if ((input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA(1) >= 'A' && input.LA(1) <= 'F') || (input.LA(1) >= 'a' && input.LA(1) <= 'f')) {
                                input.consume();
                            } else {
                                final MismatchedSetException mse = new MismatchedSetException(null, input);
                                recover(mse);
                                throw mse;
                            }
                        }
                        break;
                    default:
                        if (cnt2 >= 1) {
                            break loop2;
                        }
                        final EarlyExitException eee = new EarlyExitException(2, input);
                        throw eee;
                }
                cnt2++;
            } while (true);
        }
        state.type = _type;
        state.channel = _channel;
    } finally {
    }
}
Also used : MismatchedSetException(org.antlr.runtime.MismatchedSetException) EarlyExitException(org.antlr.runtime.EarlyExitException)

Example 14 with EarlyExitException

use of org.antlr.runtime.EarlyExitException in project binnavi by google.

the class ConditionLexer method mNUMBER.

public final void mNUMBER() throws RecognitionException {
    try {
        final int _type = NUMBER;
        final int _channel = DEFAULT_TOKEN_CHANNEL;
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:32:9:
        // ( ( DIGIT )+ )
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:32:11:
        // ( DIGIT )+
        {
            // C:\\Dokumente und
            // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:32:11:
            // ( DIGIT )+
            int cnt1 = 0;
            loop1: do {
                int alt1 = 2;
                final int LA1_0 = input.LA(1);
                if (((LA1_0 >= '0' && LA1_0 <= '9'))) {
                    alt1 = 1;
                }
                switch(alt1) {
                    case 1:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:32:11:
                        // DIGIT
                        {
                            mDIGIT();
                        }
                        break;
                    default:
                        if (cnt1 >= 1) {
                            break loop1;
                        }
                        final EarlyExitException eee = new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);
        }
        state.type = _type;
        state.channel = _channel;
    } finally {
    }
}
Also used : EarlyExitException(org.antlr.runtime.EarlyExitException)

Example 15 with EarlyExitException

use of org.antlr.runtime.EarlyExitException in project binnavi by google.

the class ConditionLexer method mIDENTIFIER.

// $ANTLR end "MOD"
// $ANTLR start "ADD"
public final void mIDENTIFIER() throws RecognitionException {
    try {
        final int _type = IDENTIFIER;
        final int _channel = DEFAULT_TOKEN_CHANNEL;
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:34:12:
        // ( CHARACTER ( CHARACTER | DIGIT )+ )
        // C:\\Dokumente und
        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:34:14:
        // CHARACTER ( CHARACTER | DIGIT )+
        {
            mCHARACTER();
            // C:\\Dokumente und
            // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:34:24:
            // ( CHARACTER | DIGIT )+
            int cnt3 = 0;
            loop3: do {
                int alt3 = 2;
                final int LA3_0 = input.LA(1);
                if (((LA3_0 >= '0' && LA3_0 <= '9') || (LA3_0 >= 'A' && LA3_0 <= 'Z') || (LA3_0 >= 'a' && LA3_0 <= 'z'))) {
                    alt3 = 1;
                }
                switch(alt3) {
                    case 1:
                        // C:\\Dokumente und
                        // Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\BreakpointCondition\\Condition.g:
                        {
                            if ((input.LA(1) >= '0' && input.LA(1) <= '9') || (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) {
                                input.consume();
                            } else {
                                final MismatchedSetException mse = new MismatchedSetException(null, input);
                                recover(mse);
                                throw mse;
                            }
                        }
                        break;
                    default:
                        if (cnt3 >= 1) {
                            break loop3;
                        }
                        final EarlyExitException eee = new EarlyExitException(3, input);
                        throw eee;
                }
                cnt3++;
            } while (true);
        }
        state.type = _type;
        state.channel = _channel;
    } finally {
    }
}
Also used : MismatchedSetException(org.antlr.runtime.MismatchedSetException) EarlyExitException(org.antlr.runtime.EarlyExitException)

Aggregations

EarlyExitException (org.antlr.runtime.EarlyExitException)25 RewriteEarlyExitException (org.antlr.runtime.tree.RewriteEarlyExitException)11 MismatchedSetException (org.antlr.runtime.MismatchedSetException)10 RecognitionException (org.antlr.runtime.RecognitionException)10 ParserRuleReturnScope (org.antlr.runtime.ParserRuleReturnScope)5 RewriteRuleSubtreeStream (org.antlr.runtime.tree.RewriteRuleSubtreeStream)5 Token (org.antlr.runtime.Token)4 CommonTree (org.antlr.runtime.tree.CommonTree)4 CommonToken (org.antlr.runtime.CommonToken)3 NoViableAltException (org.antlr.runtime.NoViableAltException)3 ArrayList (java.util.ArrayList)1 FailedPredicateException (org.antlr.runtime.FailedPredicateException)1 MismatchedNotSetException (org.antlr.runtime.MismatchedNotSetException)1 MismatchedTokenException (org.antlr.runtime.MismatchedTokenException)1 MismatchedTreeNodeException (org.antlr.runtime.MismatchedTreeNodeException)1 RewriteRuleTokenStream (org.antlr.runtime.tree.RewriteRuleTokenStream)1