Search in sources :

Example 1 with UnorderedGroupState

use of org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState in project xtext-core by eclipse.

the class InternalBacktrackingBug325745TestLanguageParser method entryRuleExpression.

// $ANTLR end "ruleDataType"
// $ANTLR start "entryRuleExpression"
// InternalBacktrackingBug325745TestLanguage.g:259:1: entryRuleExpression returns [EObject current=null] : iv_ruleExpression= ruleExpression EOF ;
public final EObject entryRuleExpression() throws RecognitionException {
    EObject current = null;
    EObject iv_ruleExpression = null;
    UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), grammarAccess.getExpressionAccess().getUnorderedGroup_3());
    try {
        // InternalBacktrackingBug325745TestLanguage.g:264:2: (iv_ruleExpression= ruleExpression EOF )
        // InternalBacktrackingBug325745TestLanguage.g:265:2: iv_ruleExpression= ruleExpression EOF
        {
            if (state.backtracking == 0) {
                newCompositeNode(grammarAccess.getExpressionRule());
            }
            pushFollow(FollowSets000.FOLLOW_1);
            iv_ruleExpression = ruleExpression();
            state._fsp--;
            if (state.failed)
                return current;
            if (state.backtracking == 0) {
                current = iv_ruleExpression;
            }
            match(input, EOF, FollowSets000.FOLLOW_2);
            if (state.failed)
                return current;
        }
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
        myUnorderedGroupState.restore();
    }
    return current;
}
Also used : UnorderedGroupState(org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with UnorderedGroupState

use of org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState in project xtext-core by eclipse.

the class InternalBacktrackingBug325745TestLanguageParser method ruleExpression.

// $ANTLR end "entryRuleExpression"
// $ANTLR start "ruleExpression"
// InternalBacktrackingBug325745TestLanguage.g:274:1: ruleExpression returns [EObject current=null] : ( () ( ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) ) ) ( (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )? )* ( ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) ) ) ) ;
public final EObject ruleExpression() throws RecognitionException {
    EObject current = null;
    Token otherlv_2 = null;
    Token lv_prefix_3_0 = null;
    Token otherlv_4 = null;
    Token otherlv_6 = null;
    Token otherlv_8 = null;
    Token lv_postfix_9_0 = null;
    EObject lv_terms_5_0 = null;
    enterRule();
    UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), grammarAccess.getExpressionAccess().getUnorderedGroup_3());
    try {
        // InternalBacktrackingBug325745TestLanguage.g:284:2: ( ( () ( ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) ) ) ( (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )? )* ( ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) ) ) ) )
        // InternalBacktrackingBug325745TestLanguage.g:285:2: ( () ( ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) ) ) ( (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )? )* ( ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) ) ) )
        {
            // InternalBacktrackingBug325745TestLanguage.g:285:2: ( () ( ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) ) ) ( (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )? )* ( ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) ) ) )
            // InternalBacktrackingBug325745TestLanguage.g:286:3: () ( ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) ) ) ( (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )? )* ( ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) ) )
            {
                // InternalBacktrackingBug325745TestLanguage.g:286:3: ()
                // InternalBacktrackingBug325745TestLanguage.g:287:4:
                {
                    if (state.backtracking == 0) {
                    /* */
                    }
                    if (state.backtracking == 0) {
                        current = forceCreateModelElement(grammarAccess.getExpressionAccess().getExpressionAction_0(), current);
                    }
                }
                // InternalBacktrackingBug325745TestLanguage.g:296:3: ( ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) ) )
                // InternalBacktrackingBug325745TestLanguage.g:297:4: ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) )
                {
                    // InternalBacktrackingBug325745TestLanguage.g:297:4: ( ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* ) )
                    // InternalBacktrackingBug325745TestLanguage.g:298:5: ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* )
                    {
                        getUnorderedGroupHelper().enter(grammarAccess.getExpressionAccess().getUnorderedGroup_1());
                        // InternalBacktrackingBug325745TestLanguage.g:301:5: ( ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )* )
                        // InternalBacktrackingBug325745TestLanguage.g:302:6: ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )*
                        {
                            // InternalBacktrackingBug325745TestLanguage.g:302:6: ( ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) ) )*
                            loop4: do {
                                int alt4 = 3;
                                int LA4_0 = input.LA(1);
                                if ((LA4_0 == 13)) {
                                    int LA4_1 = input.LA(2);
                                    if (synpred4_InternalBacktrackingBug325745TestLanguage() && getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 0)) {
                                        alt4 = 1;
                                    }
                                } else if ((LA4_0 == RULE_STRING)) {
                                    int LA4_3 = input.LA(2);
                                    if (synpred5_InternalBacktrackingBug325745TestLanguage() && getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 1)) {
                                        alt4 = 2;
                                    }
                                }
                                switch(alt4) {
                                    case 1:
                                        // InternalBacktrackingBug325745TestLanguage.g:303:4: ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) )
                                        {
                                            // InternalBacktrackingBug325745TestLanguage.g:303:4: ({...}? => ( ({...}? => (otherlv_2= '[' ) ) ) )
                                            // InternalBacktrackingBug325745TestLanguage.g:304:5: {...}? => ( ({...}? => (otherlv_2= '[' ) ) )
                                            {
                                                if (!getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 0)) {
                                                    if (state.backtracking > 0) {
                                                        state.failed = true;
                                                        return current;
                                                    }
                                                    throw new FailedPredicateException(input, "ruleExpression", "getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 0)");
                                                }
                                                // InternalBacktrackingBug325745TestLanguage.g:304:107: ( ({...}? => (otherlv_2= '[' ) ) )
                                                // InternalBacktrackingBug325745TestLanguage.g:305:6: ({...}? => (otherlv_2= '[' ) )
                                                {
                                                    getUnorderedGroupHelper().select(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 0);
                                                    // InternalBacktrackingBug325745TestLanguage.g:308:9: ({...}? => (otherlv_2= '[' ) )
                                                    // InternalBacktrackingBug325745TestLanguage.g:308:10: {...}? => (otherlv_2= '[' )
                                                    {
                                                        if (!((true))) {
                                                            if (state.backtracking > 0) {
                                                                state.failed = true;
                                                                return current;
                                                            }
                                                            throw new FailedPredicateException(input, "ruleExpression", "true");
                                                        }
                                                        // InternalBacktrackingBug325745TestLanguage.g:308:19: (otherlv_2= '[' )
                                                        // InternalBacktrackingBug325745TestLanguage.g:308:20: otherlv_2= '['
                                                        {
                                                            otherlv_2 = (Token) match(input, 13, FollowSets000.FOLLOW_8);
                                                            if (state.failed)
                                                                return current;
                                                            if (state.backtracking == 0) {
                                                                newLeafNode(otherlv_2, grammarAccess.getExpressionAccess().getLeftSquareBracketKeyword_1_0());
                                                            }
                                                        }
                                                    }
                                                    getUnorderedGroupHelper().returnFromSelection(grammarAccess.getExpressionAccess().getUnorderedGroup_1());
                                                }
                                            }
                                        }
                                        break;
                                    case 2:
                                        // InternalBacktrackingBug325745TestLanguage.g:318:4: ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) )
                                        {
                                            // InternalBacktrackingBug325745TestLanguage.g:318:4: ({...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) ) )
                                            // InternalBacktrackingBug325745TestLanguage.g:319:5: {...}? => ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) )
                                            {
                                                if (!getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 1)) {
                                                    if (state.backtracking > 0) {
                                                        state.failed = true;
                                                        return current;
                                                    }
                                                    throw new FailedPredicateException(input, "ruleExpression", "getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 1)");
                                                }
                                                // InternalBacktrackingBug325745TestLanguage.g:319:107: ( ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) ) )
                                                // InternalBacktrackingBug325745TestLanguage.g:320:6: ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) )
                                                {
                                                    getUnorderedGroupHelper().select(grammarAccess.getExpressionAccess().getUnorderedGroup_1(), 1);
                                                    // InternalBacktrackingBug325745TestLanguage.g:323:9: ({...}? => ( (lv_prefix_3_0= RULE_STRING ) ) )
                                                    // InternalBacktrackingBug325745TestLanguage.g:323:10: {...}? => ( (lv_prefix_3_0= RULE_STRING ) )
                                                    {
                                                        if (!((true))) {
                                                            if (state.backtracking > 0) {
                                                                state.failed = true;
                                                                return current;
                                                            }
                                                            throw new FailedPredicateException(input, "ruleExpression", "true");
                                                        }
                                                        // InternalBacktrackingBug325745TestLanguage.g:323:19: ( (lv_prefix_3_0= RULE_STRING ) )
                                                        // InternalBacktrackingBug325745TestLanguage.g:323:20: (lv_prefix_3_0= RULE_STRING )
                                                        {
                                                            // InternalBacktrackingBug325745TestLanguage.g:323:20: (lv_prefix_3_0= RULE_STRING )
                                                            // InternalBacktrackingBug325745TestLanguage.g:324:10: lv_prefix_3_0= RULE_STRING
                                                            {
                                                                lv_prefix_3_0 = (Token) match(input, RULE_STRING, FollowSets000.FOLLOW_8);
                                                                if (state.failed)
                                                                    return current;
                                                                if (state.backtracking == 0) {
                                                                    newLeafNode(lv_prefix_3_0, grammarAccess.getExpressionAccess().getPrefixSTRINGTerminalRuleCall_1_1_0());
                                                                }
                                                                if (state.backtracking == 0) {
                                                                    if (current == null) {
                                                                        current = createModelElement(grammarAccess.getExpressionRule());
                                                                    }
                                                                    setWithLastConsumed(current, "prefix", lv_prefix_3_0, "org.eclipse.xtext.common.Terminals.STRING");
                                                                }
                                                            }
                                                        }
                                                    }
                                                    getUnorderedGroupHelper().returnFromSelection(grammarAccess.getExpressionAccess().getUnorderedGroup_1());
                                                }
                                            }
                                        }
                                        break;
                                    default:
                                        break loop4;
                                }
                            } while (true);
                        }
                    }
                    getUnorderedGroupHelper().leave(grammarAccess.getExpressionAccess().getUnorderedGroup_1());
                }
                // InternalBacktrackingBug325745TestLanguage.g:352:3: ( (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )? )*
                loop7: do {
                    int alt7 = 2;
                    int LA7_0 = input.LA(1);
                    if ((LA7_0 == RULE_ID || LA7_0 == RULE_INT || LA7_0 == 13)) {
                        alt7 = 1;
                    }
                    switch(alt7) {
                        case 1:
                            // InternalBacktrackingBug325745TestLanguage.g:353:4: (otherlv_4= '[' )? ( (lv_terms_5_0= ruleSimpleTerm ) ) (otherlv_6= ']' )?
                            {
                                // InternalBacktrackingBug325745TestLanguage.g:353:4: (otherlv_4= '[' )?
                                int alt5 = 2;
                                int LA5_0 = input.LA(1);
                                if ((LA5_0 == 13)) {
                                    alt5 = 1;
                                }
                                switch(alt5) {
                                    case 1:
                                        // InternalBacktrackingBug325745TestLanguage.g:354:5: otherlv_4= '['
                                        {
                                            otherlv_4 = (Token) match(input, 13, FollowSets000.FOLLOW_9);
                                            if (state.failed)
                                                return current;
                                            if (state.backtracking == 0) {
                                                newLeafNode(otherlv_4, grammarAccess.getExpressionAccess().getLeftSquareBracketKeyword_2_0());
                                            }
                                        }
                                        break;
                                }
                                // InternalBacktrackingBug325745TestLanguage.g:359:4: ( (lv_terms_5_0= ruleSimpleTerm ) )
                                // InternalBacktrackingBug325745TestLanguage.g:360:5: (lv_terms_5_0= ruleSimpleTerm )
                                {
                                    // InternalBacktrackingBug325745TestLanguage.g:360:5: (lv_terms_5_0= ruleSimpleTerm )
                                    // InternalBacktrackingBug325745TestLanguage.g:361:6: lv_terms_5_0= ruleSimpleTerm
                                    {
                                        if (state.backtracking == 0) {
                                            newCompositeNode(grammarAccess.getExpressionAccess().getTermsSimpleTermParserRuleCall_2_1_0());
                                        }
                                        pushFollow(FollowSets000.FOLLOW_8);
                                        lv_terms_5_0 = ruleSimpleTerm();
                                        state._fsp--;
                                        if (state.failed)
                                            return current;
                                        if (state.backtracking == 0) {
                                            if (current == null) {
                                                current = createModelElementForParent(grammarAccess.getExpressionRule());
                                            }
                                            add(current, "terms", lv_terms_5_0, "org.eclipse.xtext.parser.unorderedGroups.BacktrackingBug325745TestLanguage.SimpleTerm");
                                            afterParserOrEnumRuleCall();
                                        }
                                    }
                                }
                                // InternalBacktrackingBug325745TestLanguage.g:378:4: (otherlv_6= ']' )?
                                int alt6 = 2;
                                int LA6_0 = input.LA(1);
                                if ((LA6_0 == 14)) {
                                    int LA6_1 = input.LA(2);
                                    if ((synpred7_InternalBacktrackingBug325745TestLanguage())) {
                                        alt6 = 1;
                                    }
                                }
                                switch(alt6) {
                                    case 1:
                                        // InternalBacktrackingBug325745TestLanguage.g:379:5: otherlv_6= ']'
                                        {
                                            otherlv_6 = (Token) match(input, 14, FollowSets000.FOLLOW_8);
                                            if (state.failed)
                                                return current;
                                            if (state.backtracking == 0) {
                                                newLeafNode(otherlv_6, grammarAccess.getExpressionAccess().getRightSquareBracketKeyword_2_2());
                                            }
                                        }
                                        break;
                                }
                            }
                            break;
                        default:
                            break loop7;
                    }
                } while (true);
                // InternalBacktrackingBug325745TestLanguage.g:385:3: ( ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) ) )
                // InternalBacktrackingBug325745TestLanguage.g:386:4: ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) )
                {
                    // InternalBacktrackingBug325745TestLanguage.g:386:4: ( ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* ) )
                    // InternalBacktrackingBug325745TestLanguage.g:387:5: ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* )
                    {
                        getUnorderedGroupHelper().enter(grammarAccess.getExpressionAccess().getUnorderedGroup_3());
                        // InternalBacktrackingBug325745TestLanguage.g:390:5: ( ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )* )
                        // InternalBacktrackingBug325745TestLanguage.g:391:6: ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )*
                        {
                            // InternalBacktrackingBug325745TestLanguage.g:391:6: ( ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) ) | ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) ) )*
                            loop8: do {
                                int alt8 = 3;
                                int LA8_0 = input.LA(1);
                                if (LA8_0 == 14 && getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 0)) {
                                    alt8 = 1;
                                } else if (LA8_0 == RULE_STRING && getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 1)) {
                                    alt8 = 2;
                                }
                                switch(alt8) {
                                    case 1:
                                        // InternalBacktrackingBug325745TestLanguage.g:392:4: ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) )
                                        {
                                            // InternalBacktrackingBug325745TestLanguage.g:392:4: ({...}? => ( ({...}? => (otherlv_8= ']' ) ) ) )
                                            // InternalBacktrackingBug325745TestLanguage.g:393:5: {...}? => ( ({...}? => (otherlv_8= ']' ) ) )
                                            {
                                                if (!getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 0)) {
                                                    if (state.backtracking > 0) {
                                                        state.failed = true;
                                                        return current;
                                                    }
                                                    throw new FailedPredicateException(input, "ruleExpression", "getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 0)");
                                                }
                                                // InternalBacktrackingBug325745TestLanguage.g:393:107: ( ({...}? => (otherlv_8= ']' ) ) )
                                                // InternalBacktrackingBug325745TestLanguage.g:394:6: ({...}? => (otherlv_8= ']' ) )
                                                {
                                                    getUnorderedGroupHelper().select(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 0);
                                                    // InternalBacktrackingBug325745TestLanguage.g:397:9: ({...}? => (otherlv_8= ']' ) )
                                                    // InternalBacktrackingBug325745TestLanguage.g:397:10: {...}? => (otherlv_8= ']' )
                                                    {
                                                        if (!((true))) {
                                                            if (state.backtracking > 0) {
                                                                state.failed = true;
                                                                return current;
                                                            }
                                                            throw new FailedPredicateException(input, "ruleExpression", "true");
                                                        }
                                                        // InternalBacktrackingBug325745TestLanguage.g:397:19: (otherlv_8= ']' )
                                                        // InternalBacktrackingBug325745TestLanguage.g:397:20: otherlv_8= ']'
                                                        {
                                                            otherlv_8 = (Token) match(input, 14, FollowSets000.FOLLOW_10);
                                                            if (state.failed)
                                                                return current;
                                                            if (state.backtracking == 0) {
                                                                newLeafNode(otherlv_8, grammarAccess.getExpressionAccess().getRightSquareBracketKeyword_3_0());
                                                            }
                                                        }
                                                    }
                                                    getUnorderedGroupHelper().returnFromSelection(grammarAccess.getExpressionAccess().getUnorderedGroup_3());
                                                }
                                            }
                                        }
                                        break;
                                    case 2:
                                        // InternalBacktrackingBug325745TestLanguage.g:407:4: ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) )
                                        {
                                            // InternalBacktrackingBug325745TestLanguage.g:407:4: ({...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) ) )
                                            // InternalBacktrackingBug325745TestLanguage.g:408:5: {...}? => ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) )
                                            {
                                                if (!getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 1)) {
                                                    if (state.backtracking > 0) {
                                                        state.failed = true;
                                                        return current;
                                                    }
                                                    throw new FailedPredicateException(input, "ruleExpression", "getUnorderedGroupHelper().canSelect(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 1)");
                                                }
                                                // InternalBacktrackingBug325745TestLanguage.g:408:107: ( ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) ) )
                                                // InternalBacktrackingBug325745TestLanguage.g:409:6: ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) )
                                                {
                                                    getUnorderedGroupHelper().select(grammarAccess.getExpressionAccess().getUnorderedGroup_3(), 1);
                                                    // InternalBacktrackingBug325745TestLanguage.g:412:9: ({...}? => ( (lv_postfix_9_0= RULE_STRING ) ) )
                                                    // InternalBacktrackingBug325745TestLanguage.g:412:10: {...}? => ( (lv_postfix_9_0= RULE_STRING ) )
                                                    {
                                                        if (!((true))) {
                                                            if (state.backtracking > 0) {
                                                                state.failed = true;
                                                                return current;
                                                            }
                                                            throw new FailedPredicateException(input, "ruleExpression", "true");
                                                        }
                                                        // InternalBacktrackingBug325745TestLanguage.g:412:19: ( (lv_postfix_9_0= RULE_STRING ) )
                                                        // InternalBacktrackingBug325745TestLanguage.g:412:20: (lv_postfix_9_0= RULE_STRING )
                                                        {
                                                            // InternalBacktrackingBug325745TestLanguage.g:412:20: (lv_postfix_9_0= RULE_STRING )
                                                            // InternalBacktrackingBug325745TestLanguage.g:413:10: lv_postfix_9_0= RULE_STRING
                                                            {
                                                                lv_postfix_9_0 = (Token) match(input, RULE_STRING, FollowSets000.FOLLOW_10);
                                                                if (state.failed)
                                                                    return current;
                                                                if (state.backtracking == 0) {
                                                                    newLeafNode(lv_postfix_9_0, grammarAccess.getExpressionAccess().getPostfixSTRINGTerminalRuleCall_3_1_0());
                                                                }
                                                                if (state.backtracking == 0) {
                                                                    if (current == null) {
                                                                        current = createModelElement(grammarAccess.getExpressionRule());
                                                                    }
                                                                    setWithLastConsumed(current, "postfix", lv_postfix_9_0, "org.eclipse.xtext.common.Terminals.STRING");
                                                                }
                                                            }
                                                        }
                                                    }
                                                    getUnorderedGroupHelper().returnFromSelection(grammarAccess.getExpressionAccess().getUnorderedGroup_3());
                                                }
                                            }
                                        }
                                        break;
                                    default:
                                        break loop8;
                                }
                            } while (true);
                        }
                    }
                    getUnorderedGroupHelper().leave(grammarAccess.getExpressionAccess().getUnorderedGroup_3());
                }
            }
        }
        if (state.backtracking == 0) {
            leaveRule();
        }
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
        myUnorderedGroupState.restore();
    }
    return current;
}
Also used : UnorderedGroupState(org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState) EObject(org.eclipse.emf.ecore.EObject) AntlrDatatypeRuleToken(org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken)

Example 3 with UnorderedGroupState

use of org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState in project xtext-core by eclipse.

the class InternalSimpleBeeLangTestLanguageParser method entryRuleRequiredCapability.

// $ANTLR end "ruleAliasedRequiredCapability"
// $ANTLR start "entryRuleRequiredCapability"
// InternalSimpleBeeLangTestLanguage.g:1111:1: entryRuleRequiredCapability returns [EObject current=null] : iv_ruleRequiredCapability= ruleRequiredCapability EOF ;
public final EObject entryRuleRequiredCapability() throws RecognitionException {
    EObject current = null;
    int entryRuleRequiredCapability_StartIndex = input.index();
    EObject iv_ruleRequiredCapability = null;
    UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(grammarAccess.getRequiredCapabilityAccess().getUnorderedGroup_3_1());
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 11)) {
            return current;
        }
        // InternalSimpleBeeLangTestLanguage.g:1115:2: (iv_ruleRequiredCapability= ruleRequiredCapability EOF )
        // InternalSimpleBeeLangTestLanguage.g:1116:2: iv_ruleRequiredCapability= ruleRequiredCapability EOF
        {
            if (state.backtracking == 0) {
                newCompositeNode(grammarAccess.getRequiredCapabilityRule());
            }
            pushFollow(FollowSets000.FOLLOW_1);
            iv_ruleRequiredCapability = ruleRequiredCapability();
            state._fsp--;
            if (state.failed)
                return current;
            if (state.backtracking == 0) {
                current = iv_ruleRequiredCapability;
            }
            match(input, EOF, FollowSets000.FOLLOW_2);
            if (state.failed)
                return current;
        }
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 11, entryRuleRequiredCapability_StartIndex);
        }
        myUnorderedGroupState.restore();
    }
    return current;
}
Also used : UnorderedGroupState(org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState) EObject(org.eclipse.emf.ecore.EObject)

Example 4 with UnorderedGroupState

use of org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState in project xtext-core by eclipse.

the class InternalSimpleBeeLangTestLanguageParser method ruleProvidedCapability.

// $ANTLR end "entryRuleProvidedCapability"
// $ANTLR start "ruleProvidedCapability"
// InternalSimpleBeeLangTestLanguage.g:592:1: ruleProvidedCapability returns [EObject current=null] : ( () ( ( (lv_nameSpace_1_0= RULE_ID ) ) | otherlv_2= 'unit' ) (otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}' )? ) ;
public final EObject ruleProvidedCapability() throws RecognitionException {
    EObject current = null;
    int ruleProvidedCapability_StartIndex = input.index();
    Token lv_nameSpace_1_0 = null;
    Token otherlv_2 = null;
    Token otherlv_3 = null;
    Token otherlv_5 = null;
    Token otherlv_6 = null;
    Token otherlv_8 = null;
    Token otherlv_9 = null;
    Token otherlv_10 = null;
    Token lv_name_11_0 = null;
    Token otherlv_12 = null;
    Token otherlv_13 = null;
    Token otherlv_14 = null;
    Token lv_version_15_0 = null;
    Token otherlv_16 = null;
    Token otherlv_17 = null;
    EObject lv_condExpr_7_0 = null;
    enterRule();
    UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1());
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 8)) {
            return current;
        }
        // InternalSimpleBeeLangTestLanguage.g:601:2: ( ( () ( ( (lv_nameSpace_1_0= RULE_ID ) ) | otherlv_2= 'unit' ) (otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}' )? ) )
        // InternalSimpleBeeLangTestLanguage.g:602:2: ( () ( ( (lv_nameSpace_1_0= RULE_ID ) ) | otherlv_2= 'unit' ) (otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}' )? )
        {
            // InternalSimpleBeeLangTestLanguage.g:602:2: ( () ( ( (lv_nameSpace_1_0= RULE_ID ) ) | otherlv_2= 'unit' ) (otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}' )? )
            // InternalSimpleBeeLangTestLanguage.g:603:3: () ( ( (lv_nameSpace_1_0= RULE_ID ) ) | otherlv_2= 'unit' ) (otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}' )?
            {
                // InternalSimpleBeeLangTestLanguage.g:603:3: ()
                // InternalSimpleBeeLangTestLanguage.g:604:4:
                {
                    if (state.backtracking == 0) {
                    /* */
                    }
                    if (state.backtracking == 0) {
                        current = forceCreateModelElement(grammarAccess.getProvidedCapabilityAccess().getProvidedCapabilityAction_0(), current);
                    }
                }
                // InternalSimpleBeeLangTestLanguage.g:613:3: ( ( (lv_nameSpace_1_0= RULE_ID ) ) | otherlv_2= 'unit' )
                int alt14 = 2;
                int LA14_0 = input.LA(1);
                if ((LA14_0 == RULE_ID)) {
                    alt14 = 1;
                } else if ((LA14_0 == 13)) {
                    alt14 = 2;
                } else {
                    if (state.backtracking > 0) {
                        state.failed = true;
                        return current;
                    }
                    NoViableAltException nvae = new NoViableAltException("", 14, 0, input);
                    throw nvae;
                }
                switch(alt14) {
                    case 1:
                        // InternalSimpleBeeLangTestLanguage.g:614:4: ( (lv_nameSpace_1_0= RULE_ID ) )
                        {
                            // InternalSimpleBeeLangTestLanguage.g:614:4: ( (lv_nameSpace_1_0= RULE_ID ) )
                            // InternalSimpleBeeLangTestLanguage.g:615:5: (lv_nameSpace_1_0= RULE_ID )
                            {
                                // InternalSimpleBeeLangTestLanguage.g:615:5: (lv_nameSpace_1_0= RULE_ID )
                                // InternalSimpleBeeLangTestLanguage.g:616:6: lv_nameSpace_1_0= RULE_ID
                                {
                                    lv_nameSpace_1_0 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_17);
                                    if (state.failed)
                                        return current;
                                    if (state.backtracking == 0) {
                                        newLeafNode(lv_nameSpace_1_0, grammarAccess.getProvidedCapabilityAccess().getNameSpaceIDTerminalRuleCall_1_0_0());
                                    }
                                    if (state.backtracking == 0) {
                                        if (current == null) {
                                            current = createModelElement(grammarAccess.getProvidedCapabilityRule());
                                        }
                                        setWithLastConsumed(current, "nameSpace", lv_nameSpace_1_0, "org.eclipse.xtext.common.Terminals.ID");
                                    }
                                }
                            }
                        }
                        break;
                    case 2:
                        // InternalSimpleBeeLangTestLanguage.g:633:4: otherlv_2= 'unit'
                        {
                            otherlv_2 = (Token) match(input, 13, FollowSets000.FOLLOW_17);
                            if (state.failed)
                                return current;
                            if (state.backtracking == 0) {
                                newLeafNode(otherlv_2, grammarAccess.getProvidedCapabilityAccess().getUnitKeyword_1_1());
                            }
                        }
                        break;
                }
                // InternalSimpleBeeLangTestLanguage.g:638:3: (otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}' )?
                int alt16 = 2;
                int LA16_0 = input.LA(1);
                if ((LA16_0 == 17)) {
                    alt16 = 1;
                }
                switch(alt16) {
                    case 1:
                        // InternalSimpleBeeLangTestLanguage.g:639:4: otherlv_3= '{' ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) ) otherlv_17= '}'
                        {
                            otherlv_3 = (Token) match(input, 17, FollowSets000.FOLLOW_18);
                            if (state.failed)
                                return current;
                            if (state.backtracking == 0) {
                                newLeafNode(otherlv_3, grammarAccess.getProvidedCapabilityAccess().getLeftCurlyBracketKeyword_2_0());
                            }
                            // InternalSimpleBeeLangTestLanguage.g:643:4: ( ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) ) )
                            // InternalSimpleBeeLangTestLanguage.g:644:5: ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) )
                            {
                                // InternalSimpleBeeLangTestLanguage.g:644:5: ( ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?) )
                                // InternalSimpleBeeLangTestLanguage.g:645:6: ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?)
                                {
                                    getUnorderedGroupHelper().enter(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1());
                                    // InternalSimpleBeeLangTestLanguage.g:648:6: ( ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?)
                                    // InternalSimpleBeeLangTestLanguage.g:649:7: ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+ {...}?
                                    {
                                        // InternalSimpleBeeLangTestLanguage.g:649:7: ( ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) ) | ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) ) )+
                                        int cnt15 = 0;
                                        loop15: do {
                                            int alt15 = 4;
                                            int LA15_0 = input.LA(1);
                                            if (LA15_0 == 26 && getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 0)) {
                                                alt15 = 1;
                                            } else if (LA15_0 == 27 && getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 1)) {
                                                alt15 = 2;
                                            } else if (LA15_0 == 14 && getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 2)) {
                                                alt15 = 3;
                                            }
                                            switch(alt15) {
                                                case 1:
                                                    // InternalSimpleBeeLangTestLanguage.g:650:5: ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) )
                                                    {
                                                        // InternalSimpleBeeLangTestLanguage.g:650:5: ({...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) ) )
                                                        // InternalSimpleBeeLangTestLanguage.g:651:6: {...}? => ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) )
                                                        {
                                                            if (!getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 0)) {
                                                                if (state.backtracking > 0) {
                                                                    state.failed = true;
                                                                    return current;
                                                                }
                                                                throw new FailedPredicateException(input, "ruleProvidedCapability", "getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 0)");
                                                            }
                                                            // InternalSimpleBeeLangTestLanguage.g:651:118: ( ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) ) )
                                                            // InternalSimpleBeeLangTestLanguage.g:652:7: ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) )
                                                            {
                                                                getUnorderedGroupHelper().select(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 0);
                                                                // InternalSimpleBeeLangTestLanguage.g:655:10: ({...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' ) )
                                                                // InternalSimpleBeeLangTestLanguage.g:655:11: {...}? => (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' )
                                                                {
                                                                    if (!((true))) {
                                                                        if (state.backtracking > 0) {
                                                                            state.failed = true;
                                                                            return current;
                                                                        }
                                                                        throw new FailedPredicateException(input, "ruleProvidedCapability", "true");
                                                                    }
                                                                    // InternalSimpleBeeLangTestLanguage.g:655:20: (otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';' )
                                                                    // InternalSimpleBeeLangTestLanguage.g:655:21: otherlv_5= 'when' otherlv_6= ':' ( (lv_condExpr_7_0= ruleExpression ) ) otherlv_8= ';'
                                                                    {
                                                                        otherlv_5 = (Token) match(input, 26, FollowSets000.FOLLOW_12);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_5, grammarAccess.getProvidedCapabilityAccess().getWhenKeyword_2_1_0_0());
                                                                        }
                                                                        otherlv_6 = (Token) match(input, 19, FollowSets000.FOLLOW_19);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_6, grammarAccess.getProvidedCapabilityAccess().getColonKeyword_2_1_0_1());
                                                                        }
                                                                        // InternalSimpleBeeLangTestLanguage.g:663:10: ( (lv_condExpr_7_0= ruleExpression ) )
                                                                        // InternalSimpleBeeLangTestLanguage.g:664:11: (lv_condExpr_7_0= ruleExpression )
                                                                        {
                                                                            // InternalSimpleBeeLangTestLanguage.g:664:11: (lv_condExpr_7_0= ruleExpression )
                                                                            // InternalSimpleBeeLangTestLanguage.g:665:12: lv_condExpr_7_0= ruleExpression
                                                                            {
                                                                                if (state.backtracking == 0) {
                                                                                    newCompositeNode(grammarAccess.getProvidedCapabilityAccess().getCondExprExpressionParserRuleCall_2_1_0_2_0());
                                                                                }
                                                                                pushFollow(FollowSets000.FOLLOW_14);
                                                                                lv_condExpr_7_0 = ruleExpression();
                                                                                state._fsp--;
                                                                                if (state.failed)
                                                                                    return current;
                                                                                if (state.backtracking == 0) {
                                                                                    if (current == null) {
                                                                                        current = createModelElementForParent(grammarAccess.getProvidedCapabilityRule());
                                                                                    }
                                                                                    set(current, "condExpr", lv_condExpr_7_0, "org.eclipse.xtext.testlanguages.backtracking.BeeLangTestLanguage.Expression");
                                                                                    afterParserOrEnumRuleCall();
                                                                                }
                                                                            }
                                                                        }
                                                                        otherlv_8 = (Token) match(input, 20, FollowSets000.FOLLOW_20);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_8, grammarAccess.getProvidedCapabilityAccess().getSemicolonKeyword_2_1_0_3());
                                                                        }
                                                                    }
                                                                }
                                                                getUnorderedGroupHelper().returnFromSelection(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1());
                                                            }
                                                        }
                                                    }
                                                    break;
                                                case 2:
                                                    // InternalSimpleBeeLangTestLanguage.g:692:5: ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) )
                                                    {
                                                        // InternalSimpleBeeLangTestLanguage.g:692:5: ({...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) ) )
                                                        // InternalSimpleBeeLangTestLanguage.g:693:6: {...}? => ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) )
                                                        {
                                                            if (!getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 1)) {
                                                                if (state.backtracking > 0) {
                                                                    state.failed = true;
                                                                    return current;
                                                                }
                                                                throw new FailedPredicateException(input, "ruleProvidedCapability", "getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 1)");
                                                            }
                                                            // InternalSimpleBeeLangTestLanguage.g:693:118: ( ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) ) )
                                                            // InternalSimpleBeeLangTestLanguage.g:694:7: ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) )
                                                            {
                                                                getUnorderedGroupHelper().select(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 1);
                                                                // InternalSimpleBeeLangTestLanguage.g:697:10: ({...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' ) )
                                                                // InternalSimpleBeeLangTestLanguage.g:697:11: {...}? => (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' )
                                                                {
                                                                    if (!((true))) {
                                                                        if (state.backtracking > 0) {
                                                                            state.failed = true;
                                                                            return current;
                                                                        }
                                                                        throw new FailedPredicateException(input, "ruleProvidedCapability", "true");
                                                                    }
                                                                    // InternalSimpleBeeLangTestLanguage.g:697:20: (otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';' )
                                                                    // InternalSimpleBeeLangTestLanguage.g:697:21: otherlv_9= 'name' otherlv_10= ':' ( (lv_name_11_0= RULE_ID ) ) otherlv_12= ';'
                                                                    {
                                                                        otherlv_9 = (Token) match(input, 27, FollowSets000.FOLLOW_12);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_9, grammarAccess.getProvidedCapabilityAccess().getNameKeyword_2_1_1_0());
                                                                        }
                                                                        otherlv_10 = (Token) match(input, 19, FollowSets000.FOLLOW_8);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_10, grammarAccess.getProvidedCapabilityAccess().getColonKeyword_2_1_1_1());
                                                                        }
                                                                        // InternalSimpleBeeLangTestLanguage.g:705:10: ( (lv_name_11_0= RULE_ID ) )
                                                                        // InternalSimpleBeeLangTestLanguage.g:706:11: (lv_name_11_0= RULE_ID )
                                                                        {
                                                                            // InternalSimpleBeeLangTestLanguage.g:706:11: (lv_name_11_0= RULE_ID )
                                                                            // InternalSimpleBeeLangTestLanguage.g:707:12: lv_name_11_0= RULE_ID
                                                                            {
                                                                                lv_name_11_0 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_14);
                                                                                if (state.failed)
                                                                                    return current;
                                                                                if (state.backtracking == 0) {
                                                                                    newLeafNode(lv_name_11_0, grammarAccess.getProvidedCapabilityAccess().getNameIDTerminalRuleCall_2_1_1_2_0());
                                                                                }
                                                                                if (state.backtracking == 0) {
                                                                                    if (current == null) {
                                                                                        current = createModelElement(grammarAccess.getProvidedCapabilityRule());
                                                                                    }
                                                                                    setWithLastConsumed(current, "name", lv_name_11_0, "org.eclipse.xtext.common.Terminals.ID");
                                                                                }
                                                                            }
                                                                        }
                                                                        otherlv_12 = (Token) match(input, 20, FollowSets000.FOLLOW_20);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_12, grammarAccess.getProvidedCapabilityAccess().getSemicolonKeyword_2_1_1_3());
                                                                        }
                                                                    }
                                                                }
                                                                getUnorderedGroupHelper().returnFromSelection(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1());
                                                            }
                                                        }
                                                    }
                                                    break;
                                                case 3:
                                                    // InternalSimpleBeeLangTestLanguage.g:733:5: ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) )
                                                    {
                                                        // InternalSimpleBeeLangTestLanguage.g:733:5: ({...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) ) )
                                                        // InternalSimpleBeeLangTestLanguage.g:734:6: {...}? => ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) )
                                                        {
                                                            if (!getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 2)) {
                                                                if (state.backtracking > 0) {
                                                                    state.failed = true;
                                                                    return current;
                                                                }
                                                                throw new FailedPredicateException(input, "ruleProvidedCapability", "getUnorderedGroupHelper().canSelect(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 2)");
                                                            }
                                                            // InternalSimpleBeeLangTestLanguage.g:734:118: ( ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) ) )
                                                            // InternalSimpleBeeLangTestLanguage.g:735:7: ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) )
                                                            {
                                                                getUnorderedGroupHelper().select(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1(), 2);
                                                                // InternalSimpleBeeLangTestLanguage.g:738:10: ({...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' ) )
                                                                // InternalSimpleBeeLangTestLanguage.g:738:11: {...}? => (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' )
                                                                {
                                                                    if (!((true))) {
                                                                        if (state.backtracking > 0) {
                                                                            state.failed = true;
                                                                            return current;
                                                                        }
                                                                        throw new FailedPredicateException(input, "ruleProvidedCapability", "true");
                                                                    }
                                                                    // InternalSimpleBeeLangTestLanguage.g:738:20: (otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';' )
                                                                    // InternalSimpleBeeLangTestLanguage.g:738:21: otherlv_13= 'version' otherlv_14= ':' ( (lv_version_15_0= RULE_ID ) ) otherlv_16= ';'
                                                                    {
                                                                        otherlv_13 = (Token) match(input, 14, FollowSets000.FOLLOW_12);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_13, grammarAccess.getProvidedCapabilityAccess().getVersionKeyword_2_1_2_0());
                                                                        }
                                                                        otherlv_14 = (Token) match(input, 19, FollowSets000.FOLLOW_8);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_14, grammarAccess.getProvidedCapabilityAccess().getColonKeyword_2_1_2_1());
                                                                        }
                                                                        // InternalSimpleBeeLangTestLanguage.g:746:10: ( (lv_version_15_0= RULE_ID ) )
                                                                        // InternalSimpleBeeLangTestLanguage.g:747:11: (lv_version_15_0= RULE_ID )
                                                                        {
                                                                            // InternalSimpleBeeLangTestLanguage.g:747:11: (lv_version_15_0= RULE_ID )
                                                                            // InternalSimpleBeeLangTestLanguage.g:748:12: lv_version_15_0= RULE_ID
                                                                            {
                                                                                lv_version_15_0 = (Token) match(input, RULE_ID, FollowSets000.FOLLOW_14);
                                                                                if (state.failed)
                                                                                    return current;
                                                                                if (state.backtracking == 0) {
                                                                                    newLeafNode(lv_version_15_0, grammarAccess.getProvidedCapabilityAccess().getVersionIDTerminalRuleCall_2_1_2_2_0());
                                                                                }
                                                                                if (state.backtracking == 0) {
                                                                                    if (current == null) {
                                                                                        current = createModelElement(grammarAccess.getProvidedCapabilityRule());
                                                                                    }
                                                                                    setWithLastConsumed(current, "version", lv_version_15_0, "org.eclipse.xtext.common.Terminals.ID");
                                                                                }
                                                                            }
                                                                        }
                                                                        otherlv_16 = (Token) match(input, 20, FollowSets000.FOLLOW_20);
                                                                        if (state.failed)
                                                                            return current;
                                                                        if (state.backtracking == 0) {
                                                                            newLeafNode(otherlv_16, grammarAccess.getProvidedCapabilityAccess().getSemicolonKeyword_2_1_2_3());
                                                                        }
                                                                    }
                                                                }
                                                                getUnorderedGroupHelper().returnFromSelection(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1());
                                                            }
                                                        }
                                                    }
                                                    break;
                                                default:
                                                    if (cnt15 >= 1)
                                                        break loop15;
                                                    if (state.backtracking > 0) {
                                                        state.failed = true;
                                                        return current;
                                                    }
                                                    EarlyExitException eee = new EarlyExitException(15, input);
                                                    throw eee;
                                            }
                                            cnt15++;
                                        } while (true);
                                        if (!getUnorderedGroupHelper().canLeave(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1())) {
                                            if (state.backtracking > 0) {
                                                state.failed = true;
                                                return current;
                                            }
                                            throw new FailedPredicateException(input, "ruleProvidedCapability", "getUnorderedGroupHelper().canLeave(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1())");
                                        }
                                    }
                                }
                                getUnorderedGroupHelper().leave(grammarAccess.getProvidedCapabilityAccess().getUnorderedGroup_2_1());
                            }
                            otherlv_17 = (Token) match(input, 25, FollowSets000.FOLLOW_2);
                            if (state.failed)
                                return current;
                            if (state.backtracking == 0) {
                                newLeafNode(otherlv_17, grammarAccess.getProvidedCapabilityAccess().getRightCurlyBracketKeyword_2_2());
                            }
                        }
                        break;
                }
            }
        }
        if (state.backtracking == 0) {
            leaveRule();
        }
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 8, ruleProvidedCapability_StartIndex);
        }
        myUnorderedGroupState.restore();
    }
    return current;
}
Also used : UnorderedGroupState(org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState) EObject(org.eclipse.emf.ecore.EObject) AntlrDatatypeRuleToken(org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken)

Example 5 with UnorderedGroupState

use of org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState in project xtext-core by eclipse.

the class InternalSimpleBeeLangTestLanguageParser method entryRuleAliasedRequiredCapability.

// $ANTLR end "ruleProvidedCapability"
// $ANTLR start "entryRuleAliasedRequiredCapability"
// InternalSimpleBeeLangTestLanguage.g:794:1: entryRuleAliasedRequiredCapability returns [EObject current=null] : iv_ruleAliasedRequiredCapability= ruleAliasedRequiredCapability EOF ;
public final EObject entryRuleAliasedRequiredCapability() throws RecognitionException {
    EObject current = null;
    int entryRuleAliasedRequiredCapability_StartIndex = input.index();
    EObject iv_ruleAliasedRequiredCapability = null;
    UnorderedGroupState myUnorderedGroupState = getUnorderedGroupHelper().snapShot(grammarAccess.getAliasedRequiredCapabilityAccess().getUnorderedGroup_3_1());
    try {
        if (state.backtracking > 0 && alreadyParsedRule(input, 9)) {
            return current;
        }
        // InternalSimpleBeeLangTestLanguage.g:798:2: (iv_ruleAliasedRequiredCapability= ruleAliasedRequiredCapability EOF )
        // InternalSimpleBeeLangTestLanguage.g:799:2: iv_ruleAliasedRequiredCapability= ruleAliasedRequiredCapability EOF
        {
            if (state.backtracking == 0) {
                newCompositeNode(grammarAccess.getAliasedRequiredCapabilityRule());
            }
            pushFollow(FollowSets000.FOLLOW_1);
            iv_ruleAliasedRequiredCapability = ruleAliasedRequiredCapability();
            state._fsp--;
            if (state.failed)
                return current;
            if (state.backtracking == 0) {
                current = iv_ruleAliasedRequiredCapability;
            }
            match(input, EOF, FollowSets000.FOLLOW_2);
            if (state.failed)
                return current;
        }
    } catch (RecognitionException re) {
        recover(input, re);
        appendSkippedTokens();
    } finally {
        if (state.backtracking > 0) {
            memoize(input, 9, entryRuleAliasedRequiredCapability_StartIndex);
        }
        myUnorderedGroupState.restore();
    }
    return current;
}
Also used : UnorderedGroupState(org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState) EObject(org.eclipse.emf.ecore.EObject)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)30 UnorderedGroupState (org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper.UnorderedGroupState)30 AntlrDatatypeRuleToken (org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken)15