| author | szarnekow | 2009-01-30 11:11:48 (EST) |
|---|---|---|
| committer | sefftinge | 2009-01-30 11:11:48 (EST) |
| commit | 37cf11fea7e20b8acddd7bdb3d99a2a76af9c61a (patch) (side-by-side diff) | |
| tree | 73bafd5580edbbcbd8c4f7489d15ed0175c0a6f0 | |
| parent | 3ebb773d22936613561612ba7e47a298b50f11e8 (diff) | |
| download | org.eclipse.xtext-37cf11fea7e20b8acddd7bdb3d99a2a76af9c61a.zip org.eclipse.xtext-37cf11fea7e20b8acddd7bdb3d99a2a76af9c61a.tar.gz org.eclipse.xtext-37cf11fea7e20b8acddd7bdb3d99a2a76af9c61a.tar.bz2 | |
WIP: error recovery, prepared parsestack recovery
246 files changed, 17782 insertions, 10663 deletions
diff --git a/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ui/editor/ReferenceGrammarEditor.java b/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ui/editor/ReferenceGrammarEditor.java index 0334dfe..58fc3eb 100644 --- a/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ui/editor/ReferenceGrammarEditor.java +++ b/devtools/org.eclipse.xtext.reference.ui/src-gen/org/eclipse/xtext/reference/ui/editor/ReferenceGrammarEditor.java @@ -1,8 +1,6 @@ package org.eclipse.xtext.reference.ui.editor; -import org.eclipse.xtext.ui.core.editor.XtextEditor; - -public class ReferenceGrammarEditor extends XtextEditor { +public class ReferenceGrammarEditor extends org.eclipse.xtext.ui.core.editor.XtextEditor { }
\ No newline at end of file diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarCustomTypeParserRuleConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarCustomTypeParserRuleConsumer.java index 5d9fa57..f37dd60 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarCustomTypeParserRuleConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarCustomTypeParserRuleConsumer.java @@ -32,40 +32,56 @@ public final class ReferenceGrammarCustomTypeParserRuleConsumer extends NonTermi ruleCall$4$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0KeywordType()); - marker.commit(); - return result; - } - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentName()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0KeywordType()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$2() throws Exception { + protected int consumeKeyword$2(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0KeywordType(), null, false, false, getKeyword$2$Delimiter()); } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele10LexerRuleCallID(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarErwachsenerConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarErwachsenerConsumer.java index f24b888..fe6a8e0 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarErwachsenerConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarErwachsenerConsumer.java @@ -43,76 +43,105 @@ public final class ReferenceGrammarErwachsenerConsumer extends NonTerminalConsum ruleCall$10$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000KeywordErwachsener()); - marker.commit(); - return result; - } - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentAge()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightParenthesis()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000KeywordErwachsener()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentAge()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000KeywordErwachsener(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordLeftParenthesis(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "age", false, false, getRule().ele010LexerRuleCallINT(), getRuleCall$10$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightParenthesis(), null, false, false, getKeyword$11$Delimiter()); } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFamilieConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFamilieConsumer.java index 787daa5..95e6e6e 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFamilieConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFamilieConsumer.java @@ -61,164 +61,240 @@ public final class ReferenceGrammarFamilieConsumer extends NonTerminalConsumer { ruleCall$15$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000000KeywordFamilie()); - marker.commit(); - return result; - } - result = consumeKeyword$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000001KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeAssignment$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000001AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001AssignmentMutter()); - marker.commit(); - return result; - } - result = consumeAssignment$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentVater()); - marker.commit(); - return result; - } - result = consumeAssignment$22(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentKinder()); - marker.commit(); - return result; - } - result = consumeGroup$25(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01Group()); - marker.commit(); - return result; - } - result = consumeKeyword$30(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightParenthesis()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000000KeywordFamilie()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000001KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001AssignmentMutter()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAssignment$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentVater()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeAssignment$22(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentKinder()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 6: + announceNextStep(); + result = consumeGroup$25(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 7: + announceNextStep(); + result = consumeKeyword$30(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000000KeywordFamilie(), null, false, false, getKeyword$8$Delimiter()); } - protected int consumeKeyword$9() throws Exception { + protected int consumeKeyword$9(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000001KeywordLeftParenthesis(), null, false, false, getKeyword$9$Delimiter()); } - protected int consumeAssignment$10() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$10(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); + // TODO use markers in assignments of alternatives to recover + announceNextPath(); + // TODO use markers in assignments of alternatives to recover + announceNextPath(); tempResult = consumeKeyword(getRule().ele000001000KeywordKeyword(), "name", false, false, getKeyword$13$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + announceNextPath(); tempResult = consumeTerminal(stringConsumer, "name", false, false, getRule().ele000001001LexerRuleCallSTRING(), getRuleCall$14$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + + announceNextPath(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00000101LexerRuleCallID(), getRuleCall$15$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + announceLevelFinished(); return result; } - protected int consumeAssignment$16() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$16(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "mutter", false, false, getRule().ele000010CrossReferenceEStringErwachsener(), getCrossReference$17$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$19() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$19(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "vater", false, false, getRule().ele00010CrossReferenceEStringErwachsener(), getCrossReference$20$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$22() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$22(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "kinder", true, false, getRule().ele0010CrossReferenceEStringKind(), getCrossReference$23$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$25() throws Exception { + protected int consumeGroup$25(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$25() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$25(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$25() throws Exception { + protected int doConsumeGroup$25(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$26(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele010KeywordComma()); - marker.commit(); - return result; - } - result = consumeAssignment$27(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele011AssignmentKinder()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$26(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele010KeywordComma()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$27(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele011AssignmentKinder()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$26() throws Exception { + protected int consumeKeyword$26(int entryPoint) throws Exception { return consumeKeyword(getRule().ele010KeywordComma(), null, false, false, getKeyword$26$Delimiter()); } - protected int consumeAssignment$27() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$27(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "kinder", true, false, getRule().ele0110CrossReferenceEStringKind(), getCrossReference$28$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$30() throws Exception { + protected int consumeKeyword$30(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightParenthesis(), null, false, false, getKeyword$30$Delimiter()); } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFarbeConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFarbeConsumer.java index 712ad0c..cd905db 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFarbeConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarFarbeConsumer.java @@ -36,29 +36,54 @@ public final class ReferenceGrammarFarbeConsumer extends NonTerminalConsumer { keyword$8$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); + // TODO use markers in assignments of alternatives to recover + announceNextPath(); + // TODO use markers in assignments of alternatives to recover + announceNextPath(); + // TODO use markers in assignments of alternatives to recover + announceNextPath(); tempResult = consumeKeyword(getRule().ele0000KeywordROT(), "wert", false, false, getKeyword$5$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + announceNextPath(); tempResult = consumeKeyword(getRule().ele0001KeywordBLAU(), "wert", false, false, getKeyword$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + + announceNextPath(); tempResult = consumeKeyword(getRule().ele001KeywordGELB(), "wert", false, false, getKeyword$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + + announceNextPath(); tempResult = consumeKeyword(getRule().ele01KeywordGRÜN(), "wert", false, false, getKeyword$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + + announceLevelFinished(); return result; } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarKindConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarKindConsumer.java index 0980fcf..4ddb0cb 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarKindConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarKindConsumer.java @@ -43,76 +43,105 @@ public final class ReferenceGrammarKindConsumer extends NonTerminalConsumer { ruleCall$10$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000KeywordKind()); - marker.commit(); - return result; - } - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentAge()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightParenthesis()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000KeywordKind()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentAge()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000KeywordKind(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordLeftParenthesis(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "age", false, false, getRule().ele010LexerRuleCallINT(), getRuleCall$10$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightParenthesis(), null, false, false, getKeyword$11$Delimiter()); } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarPersonConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarPersonConsumer.java index a94037d..8bda1c7 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarPersonConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarPersonConsumer.java @@ -28,52 +28,64 @@ public final class ReferenceGrammarPersonConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(kindConsumer, null, false, false, getRule().ele0ParserRuleCallKind()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(erwachsenerConsumer, null, false, false, getRule().ele1ParserRuleCallErwachsener()); } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielplatzConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielplatzConsumer.java index 9d3392f..c96792c 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielplatzConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielplatzConsumer.java @@ -53,13 +53,13 @@ public final class ReferenceGrammarSpielplatzConsumer extends NonTerminalConsume ruleCall$10$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$1(); + int result = doConsumeGroup$1(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -67,66 +67,94 @@ public final class ReferenceGrammarSpielplatzConsumer extends NonTerminalConsume return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$1() throws Exception { + protected int doConsumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000KeywordSpielplatz()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001AssignmentGroesse()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentBeschreibung()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAlternatives$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01Alternatives()); - marker.commit(); - return result; - } - result = consumeKeyword$26(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000KeywordSpielplatz()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001AssignmentGroesse()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentBeschreibung()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAlternatives$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$26(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00000KeywordSpielplatz(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "groesse", false, false, getRule().ele000010LexerRuleCallINT(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$9() throws Exception { + protected int consumeAssignment$9(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$9(); + int result = doConsumeAssignment$9(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -134,159 +162,204 @@ public final class ReferenceGrammarSpielplatzConsumer extends NonTerminalConsume return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "beschreibung", false, false, getRule().ele00010LexerRuleCallSTRING(), getRuleCall$10$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordLeftCurlyBracket(), null, false, false, getKeyword$11$Delimiter()); } - protected int consumeAlternatives$12() throws Exception { + protected int consumeAlternatives$12(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAlternatives$12() == ConsumeResult.SUCCESS) { + while(doConsumeAlternatives$12(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAlternatives$12() throws Exception { + protected int doConsumeAlternatives$12(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$16(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$18(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$16(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$18(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 2: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$20(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 3: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$22(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 4: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$24(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$20(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$22(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$24(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$16() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$16(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(kindConsumer, "kinder", true, false, getRule().ele0100000ParserRuleCallKind()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$18() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$18(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(erwachsenerConsumer, "erzieher", true, false, getRule().ele0100010ParserRuleCallErwachsener()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$20() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$20(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(spielzeugConsumer, "spielzeuge", true, false, getRule().ele010010ParserRuleCallSpielzeug()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$22() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$22(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(familieConsumer, "familie", true, false, getRule().ele01010ParserRuleCallFamilie()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$24() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$24(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(customTypeParserRuleConsumer, "types", true, false, getRule().ele0110ParserRuleCallCustomTypeParserRule()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$26() throws Exception { + protected int consumeKeyword$26(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightCurlyBracket(), null, false, false, getKeyword$26$Delimiter()); } diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielzeugConsumer.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielzeugConsumer.java index 7f74556..8f72c01 100644 --- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielzeugConsumer.java +++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/parser/packrat/consumers/ReferenceGrammarSpielzeugConsumer.java @@ -40,76 +40,105 @@ public final class ReferenceGrammarSpielzeugConsumer extends NonTerminalConsumer ruleCall$8$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000KeywordSpielzeug()); - marker.commit(); - return result; - } - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentFarbe()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightParenthesis()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000KeywordSpielzeug()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentFarbe()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000KeywordSpielzeug(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordLeftParenthesis(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(farbeConsumer, "farbe", false, false, getRule().ele010ParserRuleCallFarbe()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightParenthesis(), null, false, false, getKeyword$11$Delimiter()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel.ui/src-gen/org/eclipse/xtext/example/ui/editor/DomainmodelEditor.java b/examples/org.eclipse.xtext.example.domainmodel.ui/src-gen/org/eclipse/xtext/example/ui/editor/DomainmodelEditor.java index 6123b93..f918180 100644 --- a/examples/org.eclipse.xtext.example.domainmodel.ui/src-gen/org/eclipse/xtext/example/ui/editor/DomainmodelEditor.java +++ b/examples/org.eclipse.xtext.example.domainmodel.ui/src-gen/org/eclipse/xtext/example/ui/editor/DomainmodelEditor.java @@ -1,8 +1,6 @@ package org.eclipse.xtext.example.ui.editor; -import org.eclipse.xtext.ui.core.editor.XtextEditor; - -public class DomainmodelEditor extends XtextEditor { +public class DomainmodelEditor extends org.eclipse.xtext.ui.core.editor.XtextEditor { }
\ No newline at end of file diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore index 6d74b1d..9f2974c 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore @@ -34,10 +34,10 @@ </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="//TypedElement"/> <eClassifiers xsi:type="ecore:EClass" name="TypedElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="TypeRef"> <eStructuralFeatures xsi:type="ecore:EReference" name="referenced" eType="//Type"/> diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelAttributeConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelAttributeConsumer.java index 9af17af..2ad377a 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelAttributeConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelAttributeConsumer.java @@ -37,66 +37,92 @@ public final class DomainmodelAttributeConsumer extends NonTerminalConsumer { ruleCall$6$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordAttr()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordColon()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentType()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordAttr()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentType()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordAttr(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordColon(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(typeRefConsumer, "type", false, false, getRule().ele10ParserRuleCallTypeRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelDataTypeConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelDataTypeConsumer.java index ad17ca7..3b82d7b 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelDataTypeConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelDataTypeConsumer.java @@ -32,40 +32,56 @@ public final class DomainmodelDataTypeConsumer extends NonTerminalConsumer { ruleCall$4$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0KeywordDatatype()); - marker.commit(); - return result; - } - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentName()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0KeywordDatatype()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$2() throws Exception { + protected int consumeKeyword$2(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0KeywordDatatype(), null, false, false, getKeyword$2$Delimiter()); } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele10LexerRuleCallID(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelEntityConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelEntityConsumer.java index 6b76b7e..9e5d0c5 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelEntityConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelEntityConsumer.java @@ -46,70 +46,98 @@ public final class DomainmodelEntityConsumer extends NonTerminalConsumer { ruleCall$8$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000KeywordEntity()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001AssignmentName()); - marker.commit(); - return result; - } - result = consumeGroup$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001Group()); - marker.commit(); - return result; - } - result = consumeKeyword$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentFeatures()); - marker.commit(); - return result; - } - result = consumeKeyword$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000KeywordEntity()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAssignment$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentFeatures()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00000KeywordEntity(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele000010LexerRuleCallID(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$9() throws Exception { + protected int consumeGroup$9(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$9(); + int result = doConsumeGroup$9(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -117,63 +145,83 @@ public final class DomainmodelEntityConsumer extends NonTerminalConsumer { return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$9() throws Exception { + protected int doConsumeGroup$9(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00010KeywordExtends()); - marker.commit(); - return result; - } - result = consumeAssignment$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00011AssignmentSuperType()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00010KeywordExtends()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00011AssignmentSuperType()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$10() throws Exception { + protected int consumeKeyword$10(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00010KeywordExtends(), null, false, false, getKeyword$10$Delimiter()); } - protected int consumeAssignment$11() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$11(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "superType", false, false, getRule().ele000110CrossReferenceEStringEntity(), getCrossReference$12$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$14() throws Exception { + protected int consumeKeyword$14(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordLeftCurlyBracket(), null, false, false, getKeyword$14$Delimiter()); } - protected int consumeAssignment$15() throws Exception { + protected int consumeAssignment$15(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$15() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$15(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$15() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$15(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(featureConsumer, "features", true, false, getRule().ele010ParserRuleCallFeature()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$17() throws Exception { + protected int consumeKeyword$17(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightCurlyBracket(), null, false, false, getKeyword$17$Delimiter()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFeatureConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFeatureConsumer.java index 8bdd4c8..3947924 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFeatureConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFeatureConsumer.java @@ -28,52 +28,64 @@ public final class DomainmodelFeatureConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(structuralFeatureConsumer, null, false, false, getRule().ele0ParserRuleCallStructuralFeature()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(operationConsumer, null, false, false, getRule().ele1ParserRuleCallOperation()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFileConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFileConsumer.java index 3e942d3..9c7fd44 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFileConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelFileConsumer.java @@ -28,64 +28,84 @@ public final class DomainmodelFileConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentImports()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentNamedElements()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentImports()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentNamedElements()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { + protected int consumeAssignment$2(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$2() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$2(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(importConsumer, "imports", true, false, getRule().ele00ParserRuleCallImport()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { + protected int consumeAssignment$4(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$4() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$4(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(namedElementConsumer, "namedElements", true, false, getRule().ele10ParserRuleCallNamedElement()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelImportConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelImportConsumer.java index 406bec4..ae13cd3 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelImportConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelImportConsumer.java @@ -32,40 +32,56 @@ public final class DomainmodelImportConsumer extends NonTerminalConsumer { ruleCall$4$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0KeywordImport()); - marker.commit(); - return result; - } - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentImportURI()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentImportURI()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$2() throws Exception { + protected int consumeKeyword$2(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0KeywordImport(), null, false, false, getKeyword$2$Delimiter()); } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "importURI", false, false, getRule().ele10LexerRuleCallSTRING(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelNamedElementConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelNamedElementConsumer.java index 0840afb..caefe39 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelNamedElementConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelNamedElementConsumer.java @@ -28,52 +28,64 @@ public final class DomainmodelNamedElementConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(packageConsumer, null, false, false, getRule().ele0ParserRuleCallPackage()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(typeConsumer, null, false, false, getRule().ele1ParserRuleCallType()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelOperationConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelOperationConsumer.java index d32da1f..bbb3b98 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelOperationConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelOperationConsumer.java @@ -48,80 +48,111 @@ public final class DomainmodelOperationConsumer extends NonTerminalConsumer { ruleCall$9$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000000KeywordOp()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeGroup$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001Group()); - marker.commit(); - return result; - } - result = consumeKeyword$18(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordRightParenthesis()); - marker.commit(); - return result; - } - result = consumeKeyword$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordColon()); - marker.commit(); - return result; - } - result = consumeAssignment$20(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentType()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000000KeywordOp()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$18(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 6: + announceNextStep(); + result = consumeAssignment$20(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentType()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000000KeywordOp(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0000010LexerRuleCallID(), getRuleCall$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$10() throws Exception { + protected int consumeKeyword$10(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00001KeywordLeftParenthesis(), null, false, false, getKeyword$10$Delimiter()); } - protected int consumeGroup$11() throws Exception { + protected int consumeGroup$11(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$11(); + int result = doConsumeGroup$11(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -129,92 +160,128 @@ public final class DomainmodelOperationConsumer extends NonTerminalConsumer { return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$11() throws Exception { + protected int doConsumeGroup$11(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00010AssignmentParams()); - marker.commit(); - return result; - } - result = consumeGroup$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00010AssignmentParams()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$12() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$12(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(parameterConsumer, "params", true, false, getRule().ele000100ParserRuleCallParameter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$14() throws Exception { + protected int consumeGroup$14(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$14() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$14(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$14() throws Exception { + protected int doConsumeGroup$14(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000110KeywordComma()); - marker.commit(); - return result; - } - result = consumeAssignment$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000111AssignmentParams()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000110KeywordComma()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000111AssignmentParams()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$15() throws Exception { + protected int consumeKeyword$15(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000110KeywordComma(), null, false, false, getKeyword$15$Delimiter()); } - protected int consumeAssignment$16() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$16(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(parameterConsumer, "params", true, false, getRule().ele0001110ParserRuleCallParameter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$18() throws Exception { + protected int consumeKeyword$18(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordRightParenthesis(), null, false, false, getKeyword$18$Delimiter()); } - protected int consumeKeyword$19() throws Exception { + protected int consumeKeyword$19(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordColon(), null, false, false, getKeyword$19$Delimiter()); } - protected int consumeAssignment$20() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$20(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(typeRefConsumer, "type", false, false, getRule().ele10ParserRuleCallTypeRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelPackageConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelPackageConsumer.java index 919073e..829939a 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelPackageConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelPackageConsumer.java @@ -37,85 +37,114 @@ public final class DomainmodelPackageConsumer extends NonTerminalConsumer { keyword$11$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000KeywordPackage()); - marker.commit(); - return result; - } - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentNamedElements()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000KeywordPackage()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentNamedElements()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000KeywordPackage(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(qualifiedNameConsumer, "name", false, true, getRule().ele00010ParserRuleCallQualifiedName()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordLeftCurlyBracket(), null, false, false, getKeyword$8$Delimiter()); } - protected int consumeAssignment$9() throws Exception { + protected int consumeAssignment$9(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$9() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$9(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(namedElementConsumer, "namedElements", true, false, getRule().ele010ParserRuleCallNamedElement()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightCurlyBracket(), null, false, false, getKeyword$11$Delimiter()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelParameterConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelParameterConsumer.java index 747685f..b762fc2 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelParameterConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelParameterConsumer.java @@ -31,46 +31,66 @@ public final class DomainmodelParameterConsumer extends NonTerminalConsumer { ruleCall$3$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentType()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentType()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00LexerRuleCallID(), getRuleCall$3$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(typeRefConsumer, "type", false, false, getRule().ele10ParserRuleCallTypeRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelQualifiedNameConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelQualifiedNameConsumer.java index d336ba5..f195512 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelQualifiedNameConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelQualifiedNameConsumer.java @@ -35,66 +35,90 @@ public final class DomainmodelQualifiedNameConsumer extends NonTerminalConsumer ruleCall$5$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeRuleCall$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0LexerRuleCallID()); - marker.commit(); - return result; - } - result = consumeGroup$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeRuleCall$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0LexerRuleCallID()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeTerminal(idConsumer, null, false, false, getRule().ele0LexerRuleCallID(), getRuleCall$2$Delimiter()); } - protected int consumeGroup$3() throws Exception { + protected int consumeGroup$3(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$3() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$3(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$3() throws Exception { + protected int doConsumeGroup$3(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeRuleCall$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11LexerRuleCallID()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeRuleCall$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11LexerRuleCallID()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10KeywordFullStop(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeTerminal(idConsumer, null, false, false, getRule().ele11LexerRuleCallID(), getRuleCall$5$Delimiter()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelReferenceConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelReferenceConsumer.java index 1ffc38e..39e2ce4 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelReferenceConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelReferenceConsumer.java @@ -43,78 +43,107 @@ public final class DomainmodelReferenceConsumer extends NonTerminalConsumer { ruleCall$7$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000KeywordRef()); - marker.commit(); - return result; - } - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordColon()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentType()); - marker.commit(); - return result; - } - result = consumeGroup$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000KeywordRef()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentType()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeGroup$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000KeywordRef(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00010LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordColon(), null, false, false, getKeyword$8$Delimiter()); } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(typeRefConsumer, "type", false, false, getRule().ele010ParserRuleCallTypeRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$11() throws Exception { + protected int consumeGroup$11(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$11(); + int result = doConsumeGroup$11(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -122,36 +151,52 @@ public final class DomainmodelReferenceConsumer extends NonTerminalConsumer { return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$11() throws Exception { + protected int doConsumeGroup$11(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10KeywordOpposite()); - marker.commit(); - return result; - } - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11AssignmentOpposite()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10KeywordOpposite()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11AssignmentOpposite()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$12() throws Exception { + protected int consumeKeyword$12(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10KeywordOpposite(), null, false, false, getKeyword$12$Delimiter()); } - protected int consumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "opposite", false, false, getRule().ele110CrossReferenceEStringReference(), getCrossReference$14$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelStructuralFeatureConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelStructuralFeatureConsumer.java index b879946..0bb6fb0 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelStructuralFeatureConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelStructuralFeatureConsumer.java @@ -28,52 +28,64 @@ public final class DomainmodelStructuralFeatureConsumer extends NonTerminalConsu super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(attributeConsumer, null, false, false, getRule().ele0ParserRuleCallAttribute()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(referenceConsumer, null, false, false, getRule().ele1ParserRuleCallReference()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeConsumer.java index fc049c0..91eb8dc 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeConsumer.java @@ -28,52 +28,64 @@ public final class DomainmodelTypeConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(entityConsumer, null, false, false, getRule().ele0ParserRuleCallEntity()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(dataTypeConsumer, null, false, false, getRule().ele1ParserRuleCallDataType()); } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeRefConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeRefConsumer.java index 50d86ff..3aedad8 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeRefConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypeRefConsumer.java @@ -29,17 +29,21 @@ public final class DomainmodelTypeRefConsumer extends NonTerminalConsumer { crossReference$2$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "referenced", false, false, getRule().ele0CrossReferenceEStringType(), getCrossReference$2$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypedElementConsumer.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypedElementConsumer.java index 14f0cb8..f3ce332 100644 --- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypedElementConsumer.java +++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/DomainmodelTypedElementConsumer.java @@ -28,52 +28,64 @@ public final class DomainmodelTypedElementConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(featureConsumer, null, false, false, getRule().ele0ParserRuleCallFeature()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(parameterConsumer, null, false, false, getRule().ele1ParserRuleCallParameter()); } diff --git a/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/ui/editor/FowlerDslEditor.java b/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/ui/editor/FowlerDslEditor.java index 586a11f..8658f42 100644 --- a/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/ui/editor/FowlerDslEditor.java +++ b/examples/org.eclipse.xtext.example.fowlerdsl.ui/src-gen/org/eclipse/xtext/example/ui/editor/FowlerDslEditor.java @@ -1,8 +1,6 @@ package org.eclipse.xtext.example.ui.editor; -import org.eclipse.xtext.ui.core.editor.XtextEditor; - -public class FowlerDslEditor extends XtextEditor { +public class FowlerDslEditor extends org.eclipse.xtext.ui.core.editor.XtextEditor { }
\ No newline at end of file diff --git a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslCommandConsumer.java b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslCommandConsumer.java index 4cfd661..5704bba 100644 --- a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslCommandConsumer.java +++ b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslCommandConsumer.java @@ -32,46 +32,66 @@ public final class FowlerDslCommandConsumer extends NonTerminalConsumer { ruleCall$5$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentCode()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentCode()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00LexerRuleCallID(), getRuleCall$3$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "code", false, false, getRule().ele10LexerRuleCallID(), getRuleCall$5$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslEventConsumer.java b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslEventConsumer.java index b2dc7c5..edc32d8 100644 --- a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslEventConsumer.java +++ b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslEventConsumer.java @@ -35,38 +35,53 @@ public final class FowlerDslEventConsumer extends NonTerminalConsumer { ruleCall$8$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00AssignmentResetting()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentCode()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00AssignmentResetting()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentCode()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$3() throws Exception { + protected int consumeAssignment$3(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$3(); + int result = doConsumeAssignment$3(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -74,33 +89,45 @@ public final class FowlerDslEventConsumer extends NonTerminalConsumer { return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeKeyword(getRule().ele000KeywordResetting(), "resetting", false, true, getKeyword$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "code", false, false, getRule().ele10LexerRuleCallID(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStateConsumer.java b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStateConsumer.java index 90e7fcb..76aaccf 100644 --- a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStateConsumer.java +++ b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStateConsumer.java @@ -49,64 +49,89 @@ public final class FowlerDslStateConsumer extends NonTerminalConsumer { ruleCall$7$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000KeywordState()); - marker.commit(); - return result; - } - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentName()); - marker.commit(); - return result; - } - result = consumeGroup$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001Group()); - marker.commit(); - return result; - } - result = consumeAssignment$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentTransitions()); - marker.commit(); - return result; - } - result = consumeKeyword$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordEnd()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000KeywordState()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentTransitions()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordEnd()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000KeywordState(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00010LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$8() throws Exception { + protected int consumeGroup$8(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$8(); + int result = doConsumeGroup$8(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -114,96 +139,134 @@ public final class FowlerDslStateConsumer extends NonTerminalConsumer { return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$8() throws Exception { + protected int doConsumeGroup$8(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001000KeywordActions()); - marker.commit(); - return result; - } - result = consumeKeyword$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001001KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00101AssignmentActions()); - marker.commit(); - return result; - } - result = consumeKeyword$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001000KeywordActions()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001001KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00101AssignmentActions()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001000KeywordActions(), null, false, false, getKeyword$11$Delimiter()); } - protected int consumeKeyword$12() throws Exception { + protected int consumeKeyword$12(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001001KeywordLeftCurlyBracket(), null, false, false, getKeyword$12$Delimiter()); } - protected int consumeAssignment$13() throws Exception { + protected int consumeAssignment$13(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$13(); - if (result == ConsumeResult.SUCCESS) { - marker.flush(); - while(doConsumeAssignment$13()==ConsumeResult.SUCCESS) { - marker.flush(); - } - marker.rollback(); - return ConsumeResult.SUCCESS; - } else { - error("Could not find token.", getRule().ele00101AssignmentActions()); + int result = ConsumeResult.SUCCESS; + announceNextLevel(); + switch(entryPoint) { + case -1: + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = doConsumeAssignment$13(nextEntryPoint()); + case 1: + announceNextStep(); + if (result == ConsumeResult.SUCCESS) { + marker.flush(); + while(doConsumeAssignment$13(nextEntryPoint())==ConsumeResult.SUCCESS) { + marker.flush(); + } + marker.rollback(); + announceLevelFinished(); + return ConsumeResult.SUCCESS; + } else { + error("Could not find token.", getRule().ele00101AssignmentActions()); + } } + announceLevelFinished(); marker.commit(); return result; } - protected int doConsumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "actions", true, false, getRule().ele001010CrossReferenceEStringCommand(), getCrossReference$14$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$16() throws Exception { + protected int consumeKeyword$16(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0011KeywordRightCurlyBracket(), null, false, false, getKeyword$16$Delimiter()); } - protected int consumeAssignment$17() throws Exception { + protected int consumeAssignment$17(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$17() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$17(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$17() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$17(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(transitionConsumer, "transitions", true, false, getRule().ele010ParserRuleCallTransition()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$19() throws Exception { + protected int consumeKeyword$19(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordEnd(), null, false, false, getKeyword$19$Delimiter()); } diff --git a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStatemachineConsumer.java b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStatemachineConsumer.java index 85167d0..65af040 100644 --- a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStatemachineConsumer.java +++ b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslStatemachineConsumer.java @@ -42,129 +42,168 @@ public final class FowlerDslStatemachineConsumer extends NonTerminalConsumer { keyword$7$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000000KeywordEvents()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000001AssignmentEvents()); - marker.commit(); - return result; - } - result = consumeKeyword$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001KeywordEnd()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordCommands()); - marker.commit(); - return result; - } - result = consumeAssignment$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentCommands()); - marker.commit(); - return result; - } - result = consumeKeyword$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordEnd()); - marker.commit(); - return result; - } - result = consumeAssignment$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentStates()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000000KeywordEvents()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000001AssignmentEvents()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001KeywordEnd()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordCommands()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAssignment$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentCommands()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordEnd()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 6: + announceNextStep(); + result = consumeAssignment$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentStates()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000000KeywordEvents(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { + protected int consumeAssignment$8(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$8() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$8(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(eventConsumer, "events", true, false, getRule().ele0000010ParserRuleCallEvent()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$10() throws Exception { + protected int consumeKeyword$10(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00001KeywordEnd(), null, false, false, getKeyword$10$Delimiter()); } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordCommands(), null, false, false, getKeyword$11$Delimiter()); } - protected int consumeAssignment$12() throws Exception { + protected int consumeAssignment$12(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$12() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$12(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$12() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$12(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(commandConsumer, "commands", true, false, getRule().ele0010ParserRuleCallCommand()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$14() throws Exception { + protected int consumeKeyword$14(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordEnd(), null, false, false, getKeyword$14$Delimiter()); } - protected int consumeAssignment$15() throws Exception { + protected int consumeAssignment$15(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$15() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$15(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$15() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$15(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(stateConsumer, "states", true, false, getRule().ele10ParserRuleCallState()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslTransitionConsumer.java b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslTransitionConsumer.java index 80c0ddf..361b99a 100644 --- a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslTransitionConsumer.java +++ b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/parser/packrat/consumers/FowlerDslTransitionConsumer.java @@ -35,56 +35,79 @@ public final class FowlerDslTransitionConsumer extends NonTerminalConsumer { keyword$6$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00AssignmentEvent()); - marker.commit(); - return result; - } - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordEqualsSignGreaterThanSign()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentState()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00AssignmentEvent()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordEqualsSignGreaterThanSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentState()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "event", false, false, getRule().ele000CrossReferenceEStringEvent(), getCrossReference$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordEqualsSignGreaterThanSign(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "state", false, false, getRule().ele10CrossReferenceEStringState(), getCrossReference$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore index 050e1ba..30c6432 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore @@ -14,18 +14,18 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="rules" unique="false" upperBound="-1" eType="//AbstractRule" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="AbstractRule"> - <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="AbstractMetamodelDeclaration"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="alias"> - <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> - </eStructuralFeatures> <eStructuralFeatures xsi:type="ecore:EReference" name="ePackage"> <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EPackage"/> </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="alias"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eStructuralFeatures> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="GeneratedMetamodel" eSuperTypes="//AbstractMetamodelDeclaration"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageImportConsumer.java index 69e8105..6300b60 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageImportConsumer.java @@ -32,40 +32,56 @@ public final class ImportUriTestLanguageImportConsumer extends NonTerminalConsum ruleCall$4$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0KeywordImport()); - marker.commit(); - return result; - } - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentImportURI()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentImportURI()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$2() throws Exception { + protected int consumeKeyword$2(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0KeywordImport(), null, false, false, getKeyword$2$Delimiter()); } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "importURI", false, false, getRule().ele10LexerRuleCallSTRING(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageMainConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageMainConsumer.java index a4b91f0..a8821e4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageMainConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageMainConsumer.java @@ -28,64 +28,84 @@ public final class ImportUriTestLanguageMainConsumer extends NonTerminalConsumer super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentImports()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentTypes()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentImports()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentTypes()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { + protected int consumeAssignment$2(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$2() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$2(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(importConsumer, "imports", true, false, getRule().ele00ParserRuleCallImport()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { + protected int consumeAssignment$4(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$4() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$4(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(typeConsumer, "types", true, false, getRule().ele10ParserRuleCallType()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageTypeConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageTypeConsumer.java index f58f910..063a51a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageTypeConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/ImportUriTestLanguageTypeConsumer.java @@ -38,66 +38,92 @@ public final class ImportUriTestLanguageTypeConsumer extends NonTerminalConsumer ruleCall$6$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordType()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordExtends()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentExtends()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordType()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordExtends()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentExtends()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordType(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordExtends(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "extends", false, false, getRule().ele10CrossReferenceEStringType(), getCrossReference$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageImportConsumer.java index ae958bf..c647d0b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageImportConsumer.java @@ -32,40 +32,56 @@ public final class LangATestLanguageImportConsumer extends NonTerminalConsumer { ruleCall$4$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0KeywordImport()); - marker.commit(); - return result; - } - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentUri()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentUri()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$2() throws Exception { + protected int consumeKeyword$2(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0KeywordImport(), null, false, false, getKeyword$2$Delimiter()); } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "uri", false, false, getRule().ele10LexerRuleCallSTRING(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageMainConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageMainConsumer.java index dd2a909..e8c4bf4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageMainConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageMainConsumer.java @@ -28,64 +28,84 @@ public final class LangATestLanguageMainConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentImports()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentTypes()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentImports()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentTypes()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { + protected int consumeAssignment$2(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$2() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$2(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(importConsumer, "imports", true, false, getRule().ele00ParserRuleCallImport()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { + protected int consumeAssignment$4(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$4() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$4(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(typeConsumer, "types", true, false, getRule().ele10ParserRuleCallType()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageTypeConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageTypeConsumer.java index efbb5f9..857872a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageTypeConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/packrat/consumers/LangATestLanguageTypeConsumer.java @@ -38,66 +38,92 @@ public final class LangATestLanguageTypeConsumer extends NonTerminalConsumer { ruleCall$6$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordType()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordExtends()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentExtends()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordType()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordExtends()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentExtends()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordType(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordExtends(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "extends", false, false, getRule().ele10CrossReferenceEStringType(), getCrossReference$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageElementConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageElementConsumer.java index 8887f5c..e33fb41 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageElementConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageElementConsumer.java @@ -43,50 +43,71 @@ public final class DummyTestLanguageElementConsumer extends NonTerminalConsumer ruleCall$11$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000AssignmentOptional()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordElement()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentDescriptions()); - marker.commit(); - return result; - } - result = consumeKeyword$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000AssignmentOptional()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordElement()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentDescriptions()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$5() throws Exception { + protected int consumeAssignment$5(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$5(); + int result = doConsumeAssignment$5(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -94,50 +115,62 @@ public final class DummyTestLanguageElementConsumer extends NonTerminalConsumer return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeKeyword(getRule().ele00000KeywordOptional(), "optional", false, true, getKeyword$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordElement(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$10() throws Exception { + protected int consumeAssignment$10(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$10() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$10(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$10() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$10(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "descriptions", true, false, getRule().ele010LexerRuleCallSTRING(), getRuleCall$11$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$12() throws Exception { + protected int consumeKeyword$12(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$12$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageModelConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageModelConsumer.java index 7257c99..2f129d9 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageModelConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/packrat/consumers/DummyTestLanguageModelConsumer.java @@ -26,26 +26,30 @@ public final class DummyTestLanguageModelConsumer extends NonTerminalConsumer { super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { + protected int consumeAssignment$1(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$1() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$1(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(elementConsumer, "elements", true, false, getRule().ele0ParserRuleCallElement()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/AbstractTestLanguageInheritedParserRuleConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/AbstractTestLanguageInheritedParserRuleConsumer.java index 62881a6..e4e1cba 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/AbstractTestLanguageInheritedParserRuleConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/AbstractTestLanguageInheritedParserRuleConsumer.java @@ -32,40 +32,56 @@ public final class AbstractTestLanguageInheritedParserRuleConsumer extends NonTe ruleCall$4$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0KeywordElement()); - marker.commit(); - return result; - } - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentName()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0KeywordElement()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$2() throws Exception { + protected int consumeKeyword$2(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0KeywordElement(), null, false, false, getKeyword$2$Delimiter()); } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele10LexerRuleCallID(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/ConcreteTestLanguageConcreteParserRuleConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/ConcreteTestLanguageConcreteParserRuleConsumer.java index 02105c3..d3be586 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/ConcreteTestLanguageConcreteParserRuleConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/packrat/consumers/ConcreteTestLanguageConcreteParserRuleConsumer.java @@ -37,75 +37,101 @@ public final class ConcreteTestLanguageConcreteParserRuleConsumer extends NonTer ruleCall$6$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordModel()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentMagicNumber()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordColon()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentElements()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordModel()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentMagicNumber()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentElements()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordModel(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(realConsumer, "magicNumber", false, false, getRule().ele0010LexerRuleCallREAL(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordColon(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { + protected int consumeAssignment$8(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$8() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$8(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(inheritedParserRuleConsumer, "elements", true, false, getRule().ele10ParserRuleCallInheritedParserRule()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageFooConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageFooConsumer.java index 50aa6b8..959d5cd 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageFooConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageFooConsumer.java @@ -31,55 +31,75 @@ public final class MetamodelRefTestLanguageFooConsumer extends NonTerminalConsum ruleCall$3$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentNameRefs()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentNameRefs()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00LexerRuleCallID(), getRuleCall$3$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { + protected int consumeAssignment$4(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$4() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$4(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(nameRefConsumer, "nameRefs", true, false, getRule().ele10ParserRuleCallNameRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageMyRuleConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageMyRuleConsumer.java index 905898f..abb6b61 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageMyRuleConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageMyRuleConsumer.java @@ -29,17 +29,21 @@ public final class MetamodelRefTestLanguageMyRuleConsumer extends NonTerminalCon ruleCall$2$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0LexerRuleCallID(), getRuleCall$2$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageNameRefConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageNameRefConsumer.java index acfc3d1..775aa1b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageNameRefConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MetamodelRefTestLanguageNameRefConsumer.java @@ -29,17 +29,21 @@ public final class MetamodelRefTestLanguageNameRefConsumer extends NonTerminalCo crossReference$2$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "rule", false, false, getRule().ele0CrossReferenceEStringParserRule(), getCrossReference$2$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageFooConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageFooConsumer.java index e48e42f..6b8f0c0 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageFooConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageFooConsumer.java @@ -31,55 +31,75 @@ public final class MultiGenMMTestLanguageFooConsumer extends NonTerminalConsumer ruleCall$3$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0AssignmentName()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentNameRefs()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentNameRefs()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$2() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$2(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele00LexerRuleCallID(), getRuleCall$3$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { + protected int consumeAssignment$4(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$4() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$4(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(nameRefConsumer, "nameRefs", true, false, getRule().ele10ParserRuleCallNameRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageNameRefConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageNameRefConsumer.java index e87f33e..22955ff 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageNameRefConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/packrat/consumers/MultiGenMMTestLanguageNameRefConsumer.java @@ -29,17 +29,21 @@ public final class MultiGenMMTestLanguageNameRefConsumer extends NonTerminalCons ruleCall$2$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "name", false, false, getRule().ele0LexerRuleCallSTRING(), getRuleCall$2$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageCompositeModelConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageCompositeModelConsumer.java index 8a3b2a3..5cc0da6 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageCompositeModelConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageCompositeModelConsumer.java @@ -26,34 +26,50 @@ public final class DatatypeRulesTestLanguageCompositeModelConsumer extends NonTe super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { + protected int consumeAssignment$1(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$1(); - if (result == ConsumeResult.SUCCESS) { - marker.flush(); - while(doConsumeAssignment$1()==ConsumeResult.SUCCESS) { - marker.flush(); - } - marker.rollback(); - return ConsumeResult.SUCCESS; - } else { - error("Could not find token.", getRule().eleAssignmentModel()); + int result = ConsumeResult.SUCCESS; + announceNextLevel(); + switch(entryPoint) { + case -1: + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = doConsumeAssignment$1(nextEntryPoint()); + case 1: + announceNextStep(); + if (result == ConsumeResult.SUCCESS) { + marker.flush(); + while(doConsumeAssignment$1(nextEntryPoint())==ConsumeResult.SUCCESS) { + marker.flush(); + } + marker.rollback(); + announceLevelFinished(); + return ConsumeResult.SUCCESS; + } else { + error("Could not find token.", getRule().eleAssignmentModel()); + } } + announceLevelFinished(); marker.commit(); return result; } - protected int doConsumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(modelConsumer, "model", true, false, getRule().ele0ParserRuleCallModel()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageDotsConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageDotsConsumer.java index 6ab4ed8..aecc9ed 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageDotsConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageDotsConsumer.java @@ -33,75 +33,99 @@ public final class DatatypeRulesTestLanguageDotsConsumer extends NonTerminalCons keyword$5$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeKeyword$5(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeKeyword$5(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeGroup$2() throws Exception { + protected int consumeGroup$2(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordFullStop()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$3() throws Exception { + protected int consumeKeyword$3(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00KeywordFullStop(), null, false, false, getKeyword$3$Delimiter()); } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordFullStop(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordFullStopFullStop(), null, false, false, getKeyword$5$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageFractionConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageFractionConsumer.java index 95a38ad..21e9ee9 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageFractionConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageFractionConsumer.java @@ -35,36 +35,48 @@ public final class DatatypeRulesTestLanguageFractionConsumer extends NonTerminal ruleCall$5$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeRuleCall$2(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0LexerRuleCallINT()); - marker.commit(); - return result; - } - result = consumeGroup$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeRuleCall$2(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0LexerRuleCallINT()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeTerminal(intConsumer, null, false, false, getRule().ele0LexerRuleCallINT(), getRuleCall$2$Delimiter()); } - protected int consumeGroup$3() throws Exception { + protected int consumeGroup$3(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$3(); + int result = doConsumeGroup$3(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -72,30 +84,42 @@ public final class DatatypeRulesTestLanguageFractionConsumer extends NonTerminal return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$3() throws Exception { + protected int doConsumeGroup$3(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10KeywordSolidus()); - marker.commit(); - return result; - } - result = consumeRuleCall$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11LexerRuleCallINT()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10KeywordSolidus()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeRuleCall$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11LexerRuleCallINT()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10KeywordSolidus(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeTerminal(intConsumer, null, false, false, getRule().ele11LexerRuleCallINT(), getRuleCall$5$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelConsumer.java index 28600a4..f05ef89 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelConsumer.java @@ -44,60 +44,85 @@ public final class DatatypeRulesTestLanguageModelConsumer extends NonTerminalCon keyword$19$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000AssignmentId()); - marker.commit(); - return result; - } - result = consumeGroup$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001Group()); - marker.commit(); - return result; - } - result = consumeGroup$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001Group()); - marker.commit(); - return result; - } - result = consumeGroup$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01Group()); - marker.commit(); - return result; - } - result = consumeKeyword$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000AssignmentId()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(nestedModelIdConsumer, "id", false, true, getRule().ele00000ParserRuleCallNestedModelId()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$7() throws Exception { + protected int consumeGroup$7(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$7(); + int result = doConsumeGroup$7(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -105,42 +130,58 @@ public final class DatatypeRulesTestLanguageModelConsumer extends NonTerminalCon return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$7() throws Exception { + protected int doConsumeGroup$7(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00010KeywordColon()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00011AssignmentValue()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00010KeywordColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00011AssignmentValue()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00010KeywordColon(), null, false, false, getKeyword$8$Delimiter()); } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(fractionConsumer, "value", false, true, getRule().ele000110ParserRuleCallFraction()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$11() throws Exception { + protected int consumeGroup$11(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$11(); + int result = doConsumeGroup$11(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -148,42 +189,58 @@ public final class DatatypeRulesTestLanguageModelConsumer extends NonTerminalCon return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$11() throws Exception { + protected int doConsumeGroup$11(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0010KeywordNumberSign()); - marker.commit(); - return result; - } - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011AssignmentVector()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0010KeywordNumberSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011AssignmentVector()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$12() throws Exception { + protected int consumeKeyword$12(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0010KeywordNumberSign(), null, false, false, getKeyword$12$Delimiter()); } - protected int consumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(vectorConsumer, "vector", false, true, getRule().ele00110ParserRuleCallVector()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$15() throws Exception { + protected int consumeGroup$15(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$15(); + int result = doConsumeGroup$15(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -191,40 +248,56 @@ public final class DatatypeRulesTestLanguageModelConsumer extends NonTerminalCon return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$15() throws Exception { + protected int doConsumeGroup$15(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele010KeywordPlusSign()); - marker.commit(); - return result; - } - result = consumeAssignment$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele011AssignmentDots()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele010KeywordPlusSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele011AssignmentDots()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$16() throws Exception { + protected int consumeKeyword$16(int entryPoint) throws Exception { return consumeKeyword(getRule().ele010KeywordPlusSign(), null, false, false, getKeyword$16$Delimiter()); } - protected int consumeAssignment$17() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$17(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(dotsConsumer, "dots", false, true, getRule().ele0110ParserRuleCallDots()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$19() throws Exception { + protected int consumeKeyword$19(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$19$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelIdConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelIdConsumer.java index 79a0477..159fe80 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelIdConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageModelIdConsumer.java @@ -35,44 +35,59 @@ public final class DatatypeRulesTestLanguageModelIdConsumer extends NonTerminalC ruleCall$5$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeRuleCall$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00LexerRuleCallID()); - marker.commit(); - return result; - } - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeRuleCall$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1LexerRuleCallID()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeRuleCall$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00LexerRuleCallID()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeRuleCall$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1LexerRuleCallID()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeTerminal(idConsumer, null, false, false, getRule().ele00LexerRuleCallID(), getRuleCall$3$Delimiter()); } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordFullStop(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeTerminal(idConsumer, null, false, false, getRule().ele1LexerRuleCallID(), getRuleCall$5$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageNestedModelIdConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageNestedModelIdConsumer.java index c2ec97b..41c1ca4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageNestedModelIdConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageNestedModelIdConsumer.java @@ -29,44 +29,59 @@ public final class DatatypeRulesTestLanguageNestedModelIdConsumer extends NonTer keyword$4$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeRuleCall$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00ParserRuleCallModelId()); - marker.commit(); - return result; - } - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeRuleCall$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1ParserRuleCallModelId()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeRuleCall$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00ParserRuleCallModelId()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeRuleCall$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1ParserRuleCallModelId()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(modelIdConsumer, null, false, true, getRule().ele00ParserRuleCallModelId()); } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordFullStop(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeNonTerminal(modelIdConsumer, null, false, true, getRule().ele1ParserRuleCallModelId()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageVectorConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageVectorConsumer.java index 8377f23..e8054af 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageVectorConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/packrat/consumers/DatatypeRulesTestLanguageVectorConsumer.java @@ -38,54 +38,72 @@ public final class DatatypeRulesTestLanguageVectorConsumer extends NonTerminalCo ruleCall$6$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeRuleCall$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001LexerRuleCallINT()); - marker.commit(); - return result; - } - result = consumeRuleCall$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01LexerRuleCallINT()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightParenthesis()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeRuleCall$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001LexerRuleCallINT()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeRuleCall$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01LexerRuleCallINT()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordLeftParenthesis(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeTerminal(intConsumer, null, false, false, getRule().ele001LexerRuleCallINT(), getRuleCall$5$Delimiter()); } - protected int consumeRuleCall$6() throws Exception { + protected int consumeRuleCall$6(int entryPoint) throws Exception { return consumeTerminal(intConsumer, null, false, false, getRule().ele01LexerRuleCallINT(), getRuleCall$6$Delimiter()); } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightParenthesis(), null, false, false, getKeyword$7$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore index 392f646..dc92726 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore @@ -48,10 +48,10 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="rightRoot" eType="//CreatedObject" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="NamedObject"> + <eStructuralFeatures xsi:type="ecore:EReference" name="leftMig" eType="//Migration" containment="true"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EReference" name="leftMig" eType="//Migration" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="assignments" unique="false" upperBound="-1" eType="//Assignment" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="ObjectRef" eSuperTypes="//NamedObject"> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentConsumer.java index f477e6e..3b22497 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentConsumer.java @@ -32,88 +32,106 @@ public final class EpatchTestLanguageAssignmentConsumer extends NonTerminalConsu super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$4(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$4(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$5(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 2: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$6(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 3: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$7(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$5(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$6(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$7(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$4() throws Exception { + protected int consumeRuleCall$4(int entryPoint) throws Exception { return consumeNonTerminal(biSingleAssignmentConsumer, null, false, false, getRule().ele000ParserRuleCallBiSingleAssignment()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeNonTerminal(biListAssignmentConsumer, null, false, false, getRule().ele001ParserRuleCallBiListAssignment()); } - protected int consumeRuleCall$6() throws Exception { + protected int consumeRuleCall$6(int entryPoint) throws Exception { return consumeNonTerminal(monoSingleAssignmentConsumer, null, false, false, getRule().ele01ParserRuleCallMonoSingleAssignment()); } - protected int consumeRuleCall$7() throws Exception { + protected int consumeRuleCall$7(int entryPoint) throws Exception { return consumeNonTerminal(monoListAssignmentConsumer, null, false, false, getRule().ele1ParserRuleCallMonoListAssignment()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentValueConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentValueConsumer.java index bc3385a..013ed56 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentValueConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageAssignmentValueConsumer.java @@ -61,117 +61,155 @@ public final class EpatchTestLanguageAssignmentValueConsumer extends NonTerminal ruleCall$28$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$4(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$6(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$4(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$6(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 2: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$21(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 3: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$23(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$21(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$23(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "value", false, false, getRule().ele0000LexerRuleCallSTRING(), getRuleCall$5$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$6() throws Exception { + protected int consumeGroup$6(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0010AssignmentRefObject()); - marker.commit(); - return result; - } - result = consumeGroup$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0010AssignmentRefObject()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "refObject", false, false, getRule().ele00100CrossReferenceEStringNamedObject(), getCrossReference$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$10() throws Exception { + protected int consumeGroup$10(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$10(); + int result = doConsumeGroup$10(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -179,48 +217,67 @@ public final class EpatchTestLanguageAssignmentValueConsumer extends NonTerminal return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$10() throws Exception { + protected int doConsumeGroup$10(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001100KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001101AssignmentRefFeature()); - marker.commit(); - return result; - } - result = consumeGroup$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00111Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001100KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001101AssignmentRefFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00111Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$12() throws Exception { + protected int consumeKeyword$12(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001100KeywordFullStop(), null, false, false, getKeyword$12$Delimiter()); } - protected int consumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "refFeature", false, false, getRule().ele0011010LexerRuleCallID(), getRuleCall$14$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$15() throws Exception { + protected int consumeGroup$15(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$15(); + int result = doConsumeGroup$15(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -228,95 +285,138 @@ public final class EpatchTestLanguageAssignmentValueConsumer extends NonTerminal return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$15() throws Exception { + protected int doConsumeGroup$15(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011100KeywordLeftSquareBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$18(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011101AssignmentRefIndex()); - marker.commit(); - return result; - } - result = consumeKeyword$20(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001111KeywordRightSquareBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011100KeywordLeftSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$18(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011101AssignmentRefIndex()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$20(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001111KeywordRightSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$17() throws Exception { + protected int consumeKeyword$17(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0011100KeywordLeftSquareBracket(), null, false, false, getKeyword$17$Delimiter()); } - protected int consumeAssignment$18() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$18(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "refIndex", false, false, getRule().ele00111010LexerRuleCallINT(), getRuleCall$19$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$20() throws Exception { + protected int consumeKeyword$20(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001111KeywordRightSquareBracket(), null, false, false, getKeyword$20$Delimiter()); } - protected int consumeAssignment$21() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$21(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(createdObjectConsumer, "newObject", false, false, getRule().ele010ParserRuleCallCreatedObject()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$23() throws Exception { + protected int consumeGroup$23(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$24(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10AssignmentImport()); - marker.commit(); - return result; - } - result = consumeAssignment$27(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11AssignmentImpFrag()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$24(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10AssignmentImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$27(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11AssignmentImpFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$24() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$24(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "import", false, false, getRule().ele100CrossReferenceEStringImport(), getCrossReference$25$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$27() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$27(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "impFrag", false, false, getRule().ele110LexerRuleCallFRAGMENT(), getRuleCall$28$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiListAssignmentConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiListAssignmentConsumer.java index 0cb65d2..079fb55 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiListAssignmentConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiListAssignmentConsumer.java @@ -52,86 +52,120 @@ public final class EpatchTestLanguageBiListAssignmentConsumer extends NonTermina ruleCall$9$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000000AssignmentFeature()); - marker.commit(); - return result; - } - result = consumeKeyword$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000001KeywordEqualsSign()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000001KeywordLeftSquareBracket()); - marker.commit(); - return result; - } - result = consumeGroup$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001Group()); - marker.commit(); - return result; - } - result = consumeKeyword$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordVerticalLine()); - marker.commit(); - return result; - } - result = consumeGroup$20(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001Group()); - marker.commit(); - return result; - } - result = consumeKeyword$27(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordRightSquareBracket()); - marker.commit(); - return result; - } - result = consumeKeyword$28(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000000AssignmentFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000001KeywordEqualsSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000001KeywordLeftSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordVerticalLine()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeGroup$20(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 6: + announceNextStep(); + result = consumeKeyword$27(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordRightSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 7: + announceNextStep(); + result = consumeKeyword$28(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "feature", false, false, getRule().ele00000000LexerRuleCallID(), getRuleCall$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$10() throws Exception { + protected int consumeKeyword$10(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000001KeywordEqualsSign(), null, false, false, getKeyword$10$Delimiter()); } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000001KeywordLeftSquareBracket(), null, false, false, getKeyword$11$Delimiter()); } - protected int consumeGroup$12() throws Exception { + protected int consumeGroup$12(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$12(); + int result = doConsumeGroup$12(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -139,84 +173,116 @@ public final class EpatchTestLanguageBiListAssignmentConsumer extends NonTermina return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$12() throws Exception { + protected int doConsumeGroup$12(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000010AssignmentLeftValues()); - marker.commit(); - return result; - } - result = consumeGroup$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000010AssignmentLeftValues()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(listAssignmentValueConsumer, "leftValues", true, false, getRule().ele0000100ParserRuleCallListAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$15() throws Exception { + protected int consumeGroup$15(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$15() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$15(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$15() throws Exception { + protected int doConsumeGroup$15(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000110KeywordComma()); - marker.commit(); - return result; - } - result = consumeAssignment$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000111AssignmentLeftValues()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000110KeywordComma()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000111AssignmentLeftValues()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$16() throws Exception { + protected int consumeKeyword$16(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000110KeywordComma(), null, false, false, getKeyword$16$Delimiter()); } - protected int consumeAssignment$17() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$17(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(listAssignmentValueConsumer, "leftValues", true, false, getRule().ele00001110ParserRuleCallListAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$19() throws Exception { + protected int consumeKeyword$19(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordVerticalLine(), null, false, false, getKeyword$19$Delimiter()); } - protected int consumeGroup$20() throws Exception { + protected int consumeGroup$20(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$20(); + int result = doConsumeGroup$20(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -224,82 +290,114 @@ public final class EpatchTestLanguageBiListAssignmentConsumer extends NonTermina return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$20() throws Exception { + protected int doConsumeGroup$20(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$21(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0010AssignmentRightValues()); - marker.commit(); - return result; - } - result = consumeGroup$23(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$21(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0010AssignmentRightValues()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$23(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$21() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$21(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(listAssignmentValueConsumer, "rightValues", true, false, getRule().ele00100ParserRuleCallListAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$23() throws Exception { + protected int consumeGroup$23(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$23() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$23(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$23() throws Exception { + protected int doConsumeGroup$23(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$24(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00110KeywordComma()); - marker.commit(); - return result; - } - result = consumeAssignment$25(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00111AssignmentRightValues()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$24(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00110KeywordComma()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$25(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00111AssignmentRightValues()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$24() throws Exception { + protected int consumeKeyword$24(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00110KeywordComma(), null, false, false, getKeyword$24$Delimiter()); } - protected int consumeAssignment$25() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$25(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(listAssignmentValueConsumer, "rightValues", true, false, getRule().ele001110ParserRuleCallListAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$27() throws Exception { + protected int consumeKeyword$27(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordRightSquareBracket(), null, false, false, getKeyword$27$Delimiter()); } - protected int consumeKeyword$28() throws Exception { + protected int consumeKeyword$28(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$28$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiSingleAssignmentConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiSingleAssignmentConsumer.java index 4e1e226..9269d67 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiSingleAssignmentConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageBiSingleAssignmentConsumer.java @@ -40,92 +40,128 @@ public final class EpatchTestLanguageBiSingleAssignmentConsumer extends NonTermi ruleCall$7$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000AssignmentFeature()); - marker.commit(); - return result; - } - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001KeywordEqualsSign()); - marker.commit(); - return result; - } - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentLeftValue()); - marker.commit(); - return result; - } - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordVerticalLine()); - marker.commit(); - return result; - } - result = consumeAssignment$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentRightValue()); - marker.commit(); - return result; - } - result = consumeKeyword$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000AssignmentFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001KeywordEqualsSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentLeftValue()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordVerticalLine()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAssignment$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentRightValue()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "feature", false, false, getRule().ele000000LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00001KeywordEqualsSign(), null, false, false, getKeyword$8$Delimiter()); } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(singleAssignmentValueConsumer, "leftValue", false, false, getRule().ele00010ParserRuleCallSingleAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordVerticalLine(), null, false, false, getKeyword$11$Delimiter()); } - protected int consumeAssignment$12() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$12(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(singleAssignmentValueConsumer, "rightValue", false, false, getRule().ele010ParserRuleCallSingleAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$14() throws Exception { + protected int consumeKeyword$14(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$14$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageCreatedObjectConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageCreatedObjectConsumer.java index 8528ab4..2eacaee 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageCreatedObjectConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageCreatedObjectConsumer.java @@ -45,83 +45,110 @@ public final class EpatchTestLanguageCreatedObjectConsumer extends NonTerminalCo ruleCall$7$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAlternatives$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00Alternatives()); - marker.commit(); - return result; - } - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentName()); - marker.commit(); - return result; - } - result = consumeGroup$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAlternatives$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAlternatives$3() throws Exception { + protected int consumeAlternatives$3(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$4(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$4(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$5(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$5(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$4() throws Exception { + protected int consumeRuleCall$4(int entryPoint) throws Exception { return consumeNonTerminal(objectNewConsumer, null, false, false, getRule().ele000ParserRuleCallObjectNew()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeNonTerminal(objectCopyConsumer, null, false, false, getRule().ele001ParserRuleCallObjectCopy()); } - protected int consumeAssignment$6() throws Exception { + protected int consumeAssignment$6(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$6(); + int result = doConsumeAssignment$6(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -129,19 +156,23 @@ public final class EpatchTestLanguageCreatedObjectConsumer extends NonTerminalCo return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele010LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$8() throws Exception { + protected int consumeGroup$8(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$8(); + int result = doConsumeGroup$8(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -149,118 +180,168 @@ public final class EpatchTestLanguageCreatedObjectConsumer extends NonTerminalCo return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$8() throws Exception { + protected int doConsumeGroup$8(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1000KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAlternatives$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1001Alternatives()); - marker.commit(); - return result; - } - result = consumeAssignment$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele101AssignmentLeftMig()); - marker.commit(); - return result; - } - result = consumeKeyword$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1000KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAlternatives$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1001Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele101AssignmentLeftMig()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$11() throws Exception { + protected int consumeKeyword$11(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1000KeywordLeftCurlyBracket(), null, false, false, getKeyword$11$Delimiter()); } - protected int consumeAlternatives$12() throws Exception { + protected int consumeAlternatives$12(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAlternatives$12(); - if (result == ConsumeResult.SUCCESS) { - marker.flush(); - while(doConsumeAlternatives$12()==ConsumeResult.SUCCESS) { - marker.flush(); - } - marker.rollback(); - return ConsumeResult.SUCCESS; - } else { - error("Could not find token.", getRule().ele1001Alternatives()); + int result = ConsumeResult.SUCCESS; + announceNextLevel(); + switch(entryPoint) { + case -1: + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = doConsumeAlternatives$12(nextEntryPoint()); + case 1: + announceNextStep(); + if (result == ConsumeResult.SUCCESS) { + marker.flush(); + while(doConsumeAlternatives$12(nextEntryPoint())==ConsumeResult.SUCCESS) { + marker.flush(); + } + marker.rollback(); + announceLevelFinished(); + return ConsumeResult.SUCCESS; + } else { + error("Could not find token.", getRule().ele1001Alternatives()); + } } + announceLevelFinished(); marker.commit(); return result; } - protected int doConsumeAlternatives$12() throws Exception { + protected int doConsumeAlternatives$12(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$13(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$13(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$15(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$15(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(monoSingleAssignmentConsumer, "assignments", true, false, getRule().ele100100ParserRuleCallMonoSingleAssignment()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$15() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$15(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(monoListAssignmentConsumer, "assignments", true, false, getRule().ele100110ParserRuleCallMonoListAssignment()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$17() throws Exception { + protected int consumeAssignment$17(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$17(); + int result = doConsumeAssignment$17(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -268,17 +349,21 @@ public final class EpatchTestLanguageCreatedObjectConsumer extends NonTerminalCo return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$17() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$17(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(migrationConsumer, "leftMig", false, false, getRule().ele1010ParserRuleCallMigration()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$19() throws Exception { + protected int consumeKeyword$19(int entryPoint) throws Exception { return consumeKeyword(getRule().ele11KeywordRightCurlyBracket(), null, false, false, getKeyword$19$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPackageImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPackageImportConsumer.java index b1b769c..6cb405d 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPackageImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPackageImportConsumer.java @@ -40,66 +40,92 @@ public final class EpatchTestLanguageEPackageImportConsumer extends NonTerminalC ruleCall$9$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordImport()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordNs()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentNsURI()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordNs()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentNsURI()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordImport(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordNs(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "nsURI", false, false, getRule().ele10LexerRuleCallSTRING(), getRuleCall$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPatchConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPatchConsumer.java index 12d2d2c..94c25aa 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPatchConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageEPatchConsumer.java @@ -44,135 +44,178 @@ public final class EpatchTestLanguageEPatchConsumer extends NonTerminalConsumer ruleCall$9$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000000KeywordEpatch()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001AssignmentImports()); - marker.commit(); - return result; - } - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentResources()); - marker.commit(); - return result; - } - result = consumeAssignment$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentObjects()); - marker.commit(); - return result; - } - result = consumeKeyword$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000000KeywordEpatch()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001AssignmentImports()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentResources()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeAssignment$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentObjects()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 6: + announceNextStep(); + result = consumeKeyword$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000000KeywordEpatch(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0000010LexerRuleCallID(), getRuleCall$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$10() throws Exception { + protected int consumeKeyword$10(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00001KeywordLeftCurlyBracket(), null, false, false, getKeyword$10$Delimiter()); } - protected int consumeAssignment$11() throws Exception { + protected int consumeAssignment$11(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$11() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$11(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$11() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$11(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(importConsumer, "imports", true, false, getRule().ele00010ParserRuleCallImport()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$13() throws Exception { + protected int consumeAssignment$13(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$13() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$13(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(namedResourceConsumer, "resources", true, false, getRule().ele0010ParserRuleCallNamedResource()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$15() throws Exception { + protected int consumeAssignment$15(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeAssignment$15() == ConsumeResult.SUCCESS) { + while(doConsumeAssignment$15(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$15() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$15(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(objectRefConsumer, "objects", true, false, getRule().ele010ParserRuleCallObjectRef()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$17() throws Exception { + protected int consumeKeyword$17(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightCurlyBracket(), null, false, false, getKeyword$17$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExecutableConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExecutableConsumer.java index 00edbf2..d009e9d 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExecutableConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExecutableConsumer.java @@ -28,52 +28,64 @@ public final class EpatchTestLanguageExecutableConsumer extends NonTerminalConsu super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(javaExecutableConsumer, null, false, false, getRule().ele0ParserRuleCallJavaExecutable()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(expressionExecutableConsumer, null, false, false, getRule().ele1ParserRuleCallExpressionExecutable()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExpressionExecutableConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExpressionExecutableConsumer.java index 4b02bf3..5b90033 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExpressionExecutableConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExpressionExecutableConsumer.java @@ -29,17 +29,21 @@ public final class EpatchTestLanguageExpressionExecutableConsumer extends NonTer ruleCall$2$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAssignment$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAssignment$1(entryPoint); } - protected int consumeAssignment$1() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$1(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "exprstr", false, false, getRule().ele0LexerRuleCallSTRING(), getRuleCall$2$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExtensionImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExtensionImportConsumer.java index 6c8354d..7aebb4a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExtensionImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageExtensionImportConsumer.java @@ -41,98 +41,136 @@ public final class EpatchTestLanguageExtensionImportConsumer extends NonTerminal ruleCall$11$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordImport()); - marker.commit(); - return result; - } - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordExtension()); - marker.commit(); - return result; - } - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentPath()); - marker.commit(); - return result; - } - result = consumeGroup$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordExtension()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentPath()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordImport(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordExtension(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "path", true, false, getRule().ele010LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$8() throws Exception { + protected int consumeGroup$8(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$8() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$8(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$8() throws Exception { + protected int doConsumeGroup$8(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10KeywordColonColon()); - marker.commit(); - return result; - } - result = consumeAssignment$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11AssignmentPath()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10KeywordColonColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11AssignmentPath()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$9() throws Exception { + protected int consumeKeyword$9(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10KeywordColonColon(), null, false, false, getKeyword$9$Delimiter()); } - protected int consumeAssignment$10() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$10(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "path", true, false, getRule().ele110LexerRuleCallID(), getRuleCall$11$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageImportConsumer.java index 99521d7..8a20943 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageImportConsumer.java @@ -30,70 +30,85 @@ public final class EpatchTestLanguageImportConsumer extends NonTerminalConsumer super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$4(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 2: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$5(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$4(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$5(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(modelImportConsumer, null, false, false, getRule().ele00ParserRuleCallModelImport()); } - protected int consumeRuleCall$4() throws Exception { + protected int consumeRuleCall$4(int entryPoint) throws Exception { return consumeNonTerminal(javaImportConsumer, null, false, false, getRule().ele01ParserRuleCallJavaImport()); } - protected int consumeRuleCall$5() throws Exception { + protected int consumeRuleCall$5(int entryPoint) throws Exception { return consumeNonTerminal(extensionImportConsumer, null, false, false, getRule().ele1ParserRuleCallExtensionImport()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaExecutableConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaExecutableConsumer.java index 151135f..7a53b30 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaExecutableConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaExecutableConsumer.java @@ -38,60 +38,82 @@ public final class EpatchTestLanguageJavaExecutableConsumer extends NonTerminalC ruleCall$6$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordJava()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentMethod()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordLeftParenthesis()); - marker.commit(); - return result; - } - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightParenthesis()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordJava()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentMethod()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordLeftParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightParenthesis()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordJava(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "method", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordLeftParenthesis(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightParenthesis(), null, false, false, getKeyword$8$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaImportConsumer.java index 3e7c638..a499836 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageJavaImportConsumer.java @@ -41,98 +41,136 @@ public final class EpatchTestLanguageJavaImportConsumer extends NonTerminalConsu ruleCall$11$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordImport()); - marker.commit(); - return result; - } - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordJava()); - marker.commit(); - return result; - } - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentPath()); - marker.commit(); - return result; - } - result = consumeGroup$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordJava()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentPath()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordImport(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordJava(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "path", true, false, getRule().ele010LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$8() throws Exception { + protected int consumeGroup$8(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$8() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$8(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$8() throws Exception { + protected int doConsumeGroup$8(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeAssignment$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11AssignmentPath()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11AssignmentPath()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$9() throws Exception { + protected int consumeKeyword$9(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10KeywordFullStop(), null, false, false, getKeyword$9$Delimiter()); } - protected int consumeAssignment$10() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$10(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "path", true, false, getRule().ele110LexerRuleCallID(), getRuleCall$11$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageListAssignmentValueConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageListAssignmentValueConsumer.java index 592caa5..085ed34 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageListAssignmentValueConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageListAssignmentValueConsumer.java @@ -76,213 +76,292 @@ public final class EpatchTestLanguageListAssignmentValueConsumer extends NonTerm ruleCall$40$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00AssignmentIndex()); - marker.commit(); - return result; - } - result = consumeKeyword$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordColon()); - marker.commit(); - return result; - } - result = consumeAlternatives$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Alternatives()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00AssignmentIndex()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordColon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAlternatives$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$3() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$3(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "index", false, false, getRule().ele000LexerRuleCallINT(), getRuleCall$4$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$5() throws Exception { + protected int consumeKeyword$5(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordColon(), null, false, false, getKeyword$5$Delimiter()); } - protected int consumeAlternatives$6() throws Exception { + protected int consumeAlternatives$6(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$10(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$16(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$18(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$10(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$16(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 2: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$18(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 3: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$33(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 4: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$35(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$33(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$35(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeGroup$10() throws Exception { + protected int consumeGroup$10(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1000000KeywordLeftSquareBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1000001AssignmentRefIndex()); - marker.commit(); - return result; - } - result = consumeKeyword$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele100001KeywordRightSquareBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1000000KeywordLeftSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1000001AssignmentRefIndex()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele100001KeywordRightSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$12() throws Exception { + protected int consumeKeyword$12(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1000000KeywordLeftSquareBracket(), null, false, false, getKeyword$12$Delimiter()); } - protected int consumeAssignment$13() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$13(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "refIndex", false, false, getRule().ele10000010LexerRuleCallINT(), getRuleCall$14$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$15() throws Exception { + protected int consumeKeyword$15(int entryPoint) throws Exception { return consumeKeyword(getRule().ele100001KeywordRightSquareBracket(), null, false, false, getKeyword$15$Delimiter()); } - protected int consumeAssignment$16() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$16(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "value", false, false, getRule().ele100010LexerRuleCallSTRING(), getRuleCall$17$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$18() throws Exception { + protected int consumeGroup$18(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10010AssignmentRefObject()); - marker.commit(); - return result; - } - result = consumeGroup$22(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10010AssignmentRefObject()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$22(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$19() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$19(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "refObject", false, false, getRule().ele100100CrossReferenceEStringNamedObject(), getCrossReference$20$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$22() throws Exception { + protected int consumeGroup$22(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$22(); + int result = doConsumeGroup$22(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -290,48 +369,67 @@ public final class EpatchTestLanguageListAssignmentValueConsumer extends NonTerm return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$22() throws Exception { + protected int doConsumeGroup$22(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$24(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1001100KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeAssignment$25(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1001101AssignmentRefFeature()); - marker.commit(); - return result; - } - result = consumeGroup$27(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele100111Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$24(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1001100KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$25(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1001101AssignmentRefFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$27(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele100111Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$24() throws Exception { + protected int consumeKeyword$24(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1001100KeywordFullStop(), null, false, false, getKeyword$24$Delimiter()); } - protected int consumeAssignment$25() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$25(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "refFeature", false, false, getRule().ele10011010LexerRuleCallID(), getRuleCall$26$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$27() throws Exception { + protected int consumeGroup$27(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$27(); + int result = doConsumeGroup$27(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -339,95 +437,138 @@ public final class EpatchTestLanguageListAssignmentValueConsumer extends NonTerm return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$27() throws Exception { + protected int doConsumeGroup$27(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$29(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10011100KeywordLeftSquareBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$30(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10011101AssignmentRefIndex()); - marker.commit(); - return result; - } - result = consumeKeyword$32(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1001111KeywordRightSquareBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$29(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10011100KeywordLeftSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$30(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10011101AssignmentRefIndex()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$32(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1001111KeywordRightSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$29() throws Exception { + protected int consumeKeyword$29(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10011100KeywordLeftSquareBracket(), null, false, false, getKeyword$29$Delimiter()); } - protected int consumeAssignment$30() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$30(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "refIndex", false, false, getRule().ele100111010LexerRuleCallINT(), getRuleCall$31$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$32() throws Exception { + protected int consumeKeyword$32(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1001111KeywordRightSquareBracket(), null, false, false, getKeyword$32$Delimiter()); } - protected int consumeAssignment$33() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$33(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(createdObjectConsumer, "newObject", false, false, getRule().ele1010ParserRuleCallCreatedObject()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$35() throws Exception { + protected int consumeGroup$35(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$36(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele110AssignmentImport()); - marker.commit(); - return result; - } - result = consumeAssignment$39(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele111AssignmentImpFrag()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$36(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele110AssignmentImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$39(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele111AssignmentImpFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$36() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$36(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "import", false, false, getRule().ele1100CrossReferenceEStringImport(), getCrossReference$37$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$39() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$39(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "impFrag", false, false, getRule().ele1110LexerRuleCallFRAGMENT(), getRuleCall$40$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMigrationConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMigrationConsumer.java index 224f2dc..4584a73 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMigrationConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMigrationConsumer.java @@ -38,48 +38,66 @@ public final class EpatchTestLanguageMigrationConsumer extends NonTerminalConsum keyword$16$Delimiter = ICharacterClass.Factory.nullClass(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordMigrate()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentFirst()); - marker.commit(); - return result; - } - result = consumeAlternatives$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01Alternatives()); - marker.commit(); - return result; - } - result = consumeKeyword$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordMigrate()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentFirst()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAlternatives$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordMigrate(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { + protected int consumeAssignment$5(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$5(); + int result = doConsumeAssignment$5(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -87,19 +105,23 @@ public final class EpatchTestLanguageMigrationConsumer extends NonTerminalConsum return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(executableConsumer, "first", false, false, getRule().ele0010ParserRuleCallExecutable()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAlternatives$7() throws Exception { + protected int consumeAlternatives$7(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAlternatives$7(); + int result = doConsumeAlternatives$7(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -107,110 +129,154 @@ public final class EpatchTestLanguageMigrationConsumer extends NonTerminalConsum return ConsumeResult.SUCCESS; } - protected int doConsumeAlternatives$7() throws Exception { + protected int doConsumeAlternatives$7(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$8(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$8(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$12(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$12(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeGroup$8() throws Exception { + protected int consumeGroup$8(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0100KeywordAs()); - marker.commit(); - return result; - } - result = consumeAssignment$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0101AssignmentAsOp()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0100KeywordAs()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0101AssignmentAsOp()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$9() throws Exception { + protected int consumeKeyword$9(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0100KeywordAs(), null, false, false, getKeyword$9$Delimiter()); } - protected int consumeAssignment$10() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$10(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(executableConsumer, "asOp", false, false, getRule().ele01010ParserRuleCallExecutable()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$12() throws Exception { + protected int consumeGroup$12(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0110KeywordEach()); - marker.commit(); - return result; - } - result = consumeAssignment$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0111AssignmentEachOp()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0110KeywordEach()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0111AssignmentEachOp()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$13() throws Exception { + protected int consumeKeyword$13(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0110KeywordEach(), null, false, false, getKeyword$13$Delimiter()); } - protected int consumeAssignment$14() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$14(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(executableConsumer, "eachOp", false, false, getRule().ele01110ParserRuleCallExecutable()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$16() throws Exception { + protected int consumeKeyword$16(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$16$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageModelImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageModelImportConsumer.java index 48896e7..580c85e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageModelImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageModelImportConsumer.java @@ -28,52 +28,64 @@ public final class EpatchTestLanguageModelImportConsumer extends NonTerminalCons super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(resourceImportConsumer, null, false, false, getRule().ele0ParserRuleCallResourceImport()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(ePackageImportConsumer, null, false, false, getRule().ele1ParserRuleCallEPackageImport()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoListAssignmentConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoListAssignmentConsumer.java index 0895007..b622296 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoListAssignmentConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoListAssignmentConsumer.java @@ -46,74 +46,102 @@ public final class EpatchTestLanguageMonoListAssignmentConsumer extends NonTermi ruleCall$7$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000AssignmentFeature()); - marker.commit(); - return result; - } - result = consumeKeyword$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001KeywordEqualsSign()); - marker.commit(); - return result; - } - result = consumeKeyword$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordLeftSquareBracket()); - marker.commit(); - return result; - } - result = consumeGroup$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001Group()); - marker.commit(); - return result; - } - result = consumeKeyword$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordRightSquareBracket()); - marker.commit(); - return result; - } - result = consumeKeyword$18(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000AssignmentFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001KeywordEqualsSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordLeftSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordRightSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$18(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$6() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$6(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "feature", false, false, getRule().ele000000LexerRuleCallID(), getRuleCall$7$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$8() throws Exception { + protected int consumeKeyword$8(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00001KeywordEqualsSign(), null, false, false, getKeyword$8$Delimiter()); } - protected int consumeKeyword$9() throws Exception { + protected int consumeKeyword$9(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordLeftSquareBracket(), null, false, false, getKeyword$9$Delimiter()); } - protected int consumeGroup$10() throws Exception { + protected int consumeGroup$10(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$10(); + int result = doConsumeGroup$10(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -121,82 +149,114 @@ public final class EpatchTestLanguageMonoListAssignmentConsumer extends NonTermi return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$10() throws Exception { + protected int doConsumeGroup$10(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0010AssignmentLeftValues()); - marker.commit(); - return result; - } - result = consumeGroup$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0010AssignmentLeftValues()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$11() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$11(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(assignmentValueConsumer, "leftValues", true, false, getRule().ele00100ParserRuleCallAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$13() throws Exception { + protected int consumeGroup$13(int entryPoint) throws Exception { IMarker marker = mark(); - while(doConsumeGroup$13() == ConsumeResult.SUCCESS) { + while(doConsumeGroup$13(entryPoint) == ConsumeResult.SUCCESS) { marker.flush(); } marker.rollback(); return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$13() throws Exception { + protected int doConsumeGroup$13(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00110KeywordComma()); - marker.commit(); - return result; - } - result = consumeAssignment$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00111AssignmentLeftValues()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00110KeywordComma()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00111AssignmentLeftValues()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$14() throws Exception { + protected int consumeKeyword$14(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00110KeywordComma(), null, false, false, getKeyword$14$Delimiter()); } - protected int consumeAssignment$15() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$15(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(assignmentValueConsumer, "leftValues", true, false, getRule().ele001110ParserRuleCallAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$17() throws Exception { + protected int consumeKeyword$17(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordRightSquareBracket(), null, false, false, getKeyword$17$Delimiter()); } - protected int consumeKeyword$18() throws Exception { + protected int consumeKeyword$18(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$18$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoSingleAssignmentConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoSingleAssignmentConsumer.java index 1ae2193..45c45da 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoSingleAssignmentConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageMonoSingleAssignmentConsumer.java @@ -37,66 +37,92 @@ public final class EpatchTestLanguageMonoSingleAssignmentConsumer extends NonTer ruleCall$5$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000AssignmentFeature()); - marker.commit(); - return result; - } - result = consumeKeyword$6(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001KeywordEqualsSign()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentLeftValue()); - marker.commit(); - return result; - } - result = consumeKeyword$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordSemicolon()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000AssignmentFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeKeyword$6(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001KeywordEqualsSign()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentLeftValue()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "feature", false, false, getRule().ele0000LexerRuleCallID(), getRuleCall$5$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$6() throws Exception { + protected int consumeKeyword$6(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001KeywordEqualsSign(), null, false, false, getKeyword$6$Delimiter()); } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(singleAssignmentValueConsumer, "leftValue", false, false, getRule().ele010ParserRuleCallSingleAssignmentValue()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$9() throws Exception { + protected int consumeKeyword$9(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordSemicolon(), null, false, false, getKeyword$9$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedObjectConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedObjectConsumer.java index 17adaec..9087dbe 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedObjectConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedObjectConsumer.java @@ -28,52 +28,64 @@ public final class EpatchTestLanguageNamedObjectConsumer extends NonTerminalCons super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeRuleCall$2() throws Exception { + protected int consumeRuleCall$2(int entryPoint) throws Exception { return consumeNonTerminal(objectRefConsumer, null, false, false, getRule().ele0ParserRuleCallObjectRef()); } - protected int consumeRuleCall$3() throws Exception { + protected int consumeRuleCall$3(int entryPoint) throws Exception { return consumeNonTerminal(createdObjectConsumer, null, false, false, getRule().ele1ParserRuleCallCreatedObject()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedResourceConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedResourceConsumer.java index 4b73c08..a45c3a2 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedResourceConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageNamedResourceConsumer.java @@ -66,272 +66,376 @@ public final class EpatchTestLanguageNamedResourceConsumer extends NonTerminalCo ruleCall$12$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000000000KeywordResource()); - marker.commit(); - return result; - } - result = consumeAssignment$11(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000000001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000001KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeKeyword$14(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0000001KeywordLeft()); - marker.commit(); - return result; - } - result = consumeAlternatives$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000001Alternatives()); - marker.commit(); - return result; - } - result = consumeKeyword$22(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00001KeywordSemicolon()); - marker.commit(); - return result; - } - result = consumeKeyword$23(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0001KeywordRight()); - marker.commit(); - return result; - } - result = consumeAlternatives$24(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001Alternatives()); - marker.commit(); - return result; - } - result = consumeKeyword$31(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordSemicolon()); - marker.commit(); - return result; - } - result = consumeKeyword$32(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000000000KeywordResource()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$11(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000000001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000001KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$14(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0000001KeywordLeft()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAlternatives$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000001Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeKeyword$22(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00001KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 6: + announceNextStep(); + result = consumeKeyword$23(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0001KeywordRight()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 7: + announceNextStep(); + result = consumeAlternatives$24(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 8: + announceNextStep(); + result = consumeKeyword$31(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordSemicolon()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 9: + announceNextStep(); + result = consumeKeyword$32(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$10() throws Exception { + protected int consumeKeyword$10(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000000000KeywordResource(), null, false, false, getKeyword$10$Delimiter()); } - protected int consumeAssignment$11() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$11(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0000000010LexerRuleCallID(), getRuleCall$12$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$13() throws Exception { + protected int consumeKeyword$13(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00000001KeywordLeftCurlyBracket(), null, false, false, getKeyword$13$Delimiter()); } - protected int consumeKeyword$14() throws Exception { + protected int consumeKeyword$14(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0000001KeywordLeft(), null, false, false, getKeyword$14$Delimiter()); } - protected int consumeAlternatives$15() throws Exception { + protected int consumeAlternatives$15(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$16(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$20(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$16(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$20(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeGroup$16() throws Exception { + protected int consumeGroup$16(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$17(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000100KeywordUri()); - marker.commit(); - return result; - } - result = consumeAssignment$18(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00000101AssignmentLeftUri()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$17(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000100KeywordUri()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$18(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00000101AssignmentLeftUri()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$17() throws Exception { + protected int consumeKeyword$17(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00000100KeywordUri(), null, false, false, getKeyword$17$Delimiter()); } - protected int consumeAssignment$18() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$18(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "leftUri", false, false, getRule().ele000001010LexerRuleCallSTRING(), getRuleCall$19$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$20() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$20(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(createdObjectConsumer, "leftRoot", false, false, getRule().ele00000110ParserRuleCallCreatedObject()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$22() throws Exception { + protected int consumeKeyword$22(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00001KeywordSemicolon(), null, false, false, getKeyword$22$Delimiter()); } - protected int consumeKeyword$23() throws Exception { + protected int consumeKeyword$23(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0001KeywordRight(), null, false, false, getKeyword$23$Delimiter()); } - protected int consumeAlternatives$24() throws Exception { + protected int consumeAlternatives$24(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$25(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$25(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$29(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$29(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeGroup$25() throws Exception { + protected int consumeGroup$25(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$26(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00100KeywordUri()); - marker.commit(); - return result; - } - result = consumeAssignment$27(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00101AssignmentRightUri()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$26(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00100KeywordUri()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$27(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00101AssignmentRightUri()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$26() throws Exception { + protected int consumeKeyword$26(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00100KeywordUri(), null, false, false, getKeyword$26$Delimiter()); } - protected int consumeAssignment$27() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$27(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "rightUri", false, false, getRule().ele001010LexerRuleCallSTRING(), getRuleCall$28$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$29() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$29(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(createdObjectConsumer, "rightRoot", false, false, getRule().ele00110ParserRuleCallCreatedObject()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$31() throws Exception { + protected int consumeKeyword$31(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordSemicolon(), null, false, false, getKeyword$31$Delimiter()); } - protected int consumeKeyword$32() throws Exception { + protected int consumeKeyword$32(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1KeywordRightCurlyBracket(), null, false, false, getKeyword$32$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectCopyConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectCopyConsumer.java index ceb837a..bc4de88 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectCopyConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectCopyConsumer.java @@ -37,56 +37,79 @@ public final class EpatchTestLanguageObjectCopyConsumer extends NonTerminalConsu ruleCall$8$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00KeywordCopy()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentResource()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentFragment()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00KeywordCopy()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentResource()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentFragment()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$3() throws Exception { + protected int consumeKeyword$3(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00KeywordCopy(), null, false, false, getKeyword$3$Delimiter()); } - protected int consumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "resource", false, false, getRule().ele010CrossReferenceEStringNamedResource(), getCrossReference$5$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "fragment", false, false, getRule().ele10LexerRuleCallFRAGMENT(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectNewConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectNewConsumer.java index db8554d..6e24908 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectNewConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectNewConsumer.java @@ -37,56 +37,79 @@ public final class EpatchTestLanguageObjectNewConsumer extends NonTerminalConsum ruleCall$8$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$3(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00KeywordNew()); - marker.commit(); - return result; - } - result = consumeAssignment$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01AssignmentImport()); - marker.commit(); - return result; - } - result = consumeAssignment$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentImpFrag()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$3(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00KeywordNew()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01AssignmentImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentImpFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$3() throws Exception { + protected int consumeKeyword$3(int entryPoint) throws Exception { return consumeKeyword(getRule().ele00KeywordNew(), null, false, false, getKeyword$3$Delimiter()); } - protected int consumeAssignment$4() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$4(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "import", false, false, getRule().ele010CrossReferenceEStringImport(), getCrossReference$5$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "impFrag", false, false, getRule().ele10LexerRuleCallFRAGMENT(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectRefConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectRefConsumer.java index 853a3ea..05f9f06 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectRefConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageObjectRefConsumer.java @@ -76,48 +76,66 @@ public final class EpatchTestLanguageObjectRefConsumer extends NonTerminalConsum ruleCall$30$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordObject()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeAlternatives$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01Alternatives()); - marker.commit(); - return result; - } - result = consumeGroup$31(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordObject()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAlternatives$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$31(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordObject(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { + protected int consumeAssignment$5(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAssignment$5(); + int result = doConsumeAssignment$5(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -125,186 +143,262 @@ public final class EpatchTestLanguageObjectRefConsumer extends NonTerminalConsum return ConsumeResult.SUCCESS; } - protected int doConsumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int doConsumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAlternatives$7() throws Exception { + protected int consumeAlternatives$7(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$8(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$14(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$8(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$14(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeGroup$8() throws Exception { + protected int consumeGroup$8(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$9(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0100AssignmentLeftRes()); - marker.commit(); - return result; - } - result = consumeAssignment$12(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0101AssignmentLeftFrag()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$9(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0100AssignmentLeftRes()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$12(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0101AssignmentLeftFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$9() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$9(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "leftRes", false, false, getRule().ele01000CrossReferenceEStringNamedResource(), getCrossReference$10$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$12() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$12(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "leftFrag", false, false, getRule().ele01010LexerRuleCallFRAGMENT(), getRuleCall$13$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$14() throws Exception { + protected int consumeGroup$14(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$19(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01100000KeywordLeft()); - marker.commit(); - return result; - } - result = consumeAssignment$20(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01100001AssignmentLeftRes()); - marker.commit(); - return result; - } - result = consumeAssignment$23(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0110001AssignmentLeftFrag()); - marker.commit(); - return result; - } - result = consumeKeyword$25(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele011001KeywordRight()); - marker.commit(); - return result; - } - result = consumeAssignment$26(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01101AssignmentRightRes()); - marker.commit(); - return result; - } - result = consumeAssignment$29(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0111AssignmentRightFrag()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$19(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01100000KeywordLeft()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$20(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01100001AssignmentLeftRes()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeAssignment$23(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0110001AssignmentLeftFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeKeyword$25(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele011001KeywordRight()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeAssignment$26(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01101AssignmentRightRes()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 5: + announceNextStep(); + result = consumeAssignment$29(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0111AssignmentRightFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$19() throws Exception { + protected int consumeKeyword$19(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01100000KeywordLeft(), null, false, false, getKeyword$19$Delimiter()); } - protected int consumeAssignment$20() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$20(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "leftRes", false, false, getRule().ele011000010CrossReferenceEStringNamedResource(), getCrossReference$21$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$23() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$23(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "leftFrag", false, false, getRule().ele01100010LexerRuleCallFRAGMENT(), getRuleCall$24$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$25() throws Exception { + protected int consumeKeyword$25(int entryPoint) throws Exception { return consumeKeyword(getRule().ele011001KeywordRight(), null, false, false, getKeyword$25$Delimiter()); } - protected int consumeAssignment$26() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$26(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "rightRes", false, false, getRule().ele011010CrossReferenceEStringNamedResource(), getCrossReference$27$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$29() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$29(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "rightFrag", false, false, getRule().ele01110LexerRuleCallFRAGMENT(), getRuleCall$30$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$31() throws Exception { + protected int consumeGroup$31(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$31(); + int result = doConsumeGroup$31(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -312,124 +406,177 @@ public final class EpatchTestLanguageObjectRefConsumer extends NonTerminalConsum return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$31() throws Exception { + protected int doConsumeGroup$31(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$35(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10000KeywordLeftCurlyBracket()); - marker.commit(); - return result; - } - result = consumeAlternatives$36(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10001Alternatives()); - marker.commit(); - return result; - } - result = consumeGroup$41(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1001Group()); - marker.commit(); - return result; - } - result = consumeGroup$45(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele101Group()); - marker.commit(); - return result; - } - result = consumeKeyword$49(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11KeywordRightCurlyBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$35(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10000KeywordLeftCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAlternatives$36(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10001Alternatives()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$41(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1001Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeGroup$45(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele101Group()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 4: + announceNextStep(); + result = consumeKeyword$49(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11KeywordRightCurlyBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$35() throws Exception { + protected int consumeKeyword$35(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10000KeywordLeftCurlyBracket(), null, false, false, getKeyword$35$Delimiter()); } - protected int consumeAlternatives$36() throws Exception { + protected int consumeAlternatives$36(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeAlternatives$36(); - if (result == ConsumeResult.SUCCESS) { - marker.flush(); - while(doConsumeAlternatives$36()==ConsumeResult.SUCCESS) { - marker.flush(); - } - marker.rollback(); - return ConsumeResult.SUCCESS; - } else { - error("Could not find token.", getRule().ele10001Alternatives()); + int result = ConsumeResult.SUCCESS; + announceNextLevel(); + switch(entryPoint) { + case -1: + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = doConsumeAlternatives$36(nextEntryPoint()); + case 1: + announceNextStep(); + if (result == ConsumeResult.SUCCESS) { + marker.flush(); + while(doConsumeAlternatives$36(nextEntryPoint())==ConsumeResult.SUCCESS) { + marker.flush(); + } + marker.rollback(); + announceLevelFinished(); + return ConsumeResult.SUCCESS; + } else { + error("Could not find token.", getRule().ele10001Alternatives()); + } } + announceLevelFinished(); marker.commit(); return result; } - protected int doConsumeAlternatives$36() throws Exception { + protected int doConsumeAlternatives$36(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$37(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$37(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$39(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$39(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$37() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$37(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(biSingleAssignmentConsumer, "assignments", true, false, getRule().ele1000100ParserRuleCallBiSingleAssignment()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$39() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$39(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(biListAssignmentConsumer, "assignments", true, false, getRule().ele1000110ParserRuleCallBiListAssignment()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$41() throws Exception { + protected int consumeGroup$41(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$41(); + int result = doConsumeGroup$41(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -437,42 +584,58 @@ public final class EpatchTestLanguageObjectRefConsumer extends NonTerminalConsum return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$41() throws Exception { + protected int doConsumeGroup$41(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$42(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10010KeywordLeft()); - marker.commit(); - return result; - } - result = consumeAssignment$43(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10011AssignmentLeftMig()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$42(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10010KeywordLeft()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$43(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10011AssignmentLeftMig()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$42() throws Exception { + protected int consumeKeyword$42(int entryPoint) throws Exception { return consumeKeyword(getRule().ele10010KeywordLeft(), null, false, false, getKeyword$42$Delimiter()); } - protected int consumeAssignment$43() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$43(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(migrationConsumer, "leftMig", false, false, getRule().ele100110ParserRuleCallMigration()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$45() throws Exception { + protected int consumeGroup$45(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$45(); + int result = doConsumeGroup$45(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -480,40 +643,56 @@ public final class EpatchTestLanguageObjectRefConsumer extends NonTerminalConsum return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$45() throws Exception { + protected int doConsumeGroup$45(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$46(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1010KeywordRight()); - marker.commit(); - return result; - } - result = consumeAssignment$47(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1011AssignmentRightMig()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$46(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1010KeywordRight()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$47(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1011AssignmentRightMig()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$46() throws Exception { + protected int consumeKeyword$46(int entryPoint) throws Exception { return consumeKeyword(getRule().ele1010KeywordRight(), null, false, false, getKeyword$46$Delimiter()); } - protected int consumeAssignment$47() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$47(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(migrationConsumer, "rightMig", false, false, getRule().ele10110ParserRuleCallMigration()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$49() throws Exception { + protected int consumeKeyword$49(int entryPoint) throws Exception { return consumeKeyword(getRule().ele11KeywordRightCurlyBracket(), null, false, false, getKeyword$49$Delimiter()); } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageResourceImportConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageResourceImportConsumer.java index b72228f..0d8d69c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageResourceImportConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageResourceImportConsumer.java @@ -40,66 +40,92 @@ public final class EpatchTestLanguageResourceImportConsumer extends NonTerminalC ruleCall$9$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeGroup$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeGroup$1(entryPoint); } - protected int consumeGroup$1() throws Exception { + protected int consumeGroup$1(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$4(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele000KeywordImport()); - marker.commit(); - return result; - } - result = consumeAssignment$5(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001AssignmentName()); - marker.commit(); - return result; - } - result = consumeKeyword$7(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele01KeywordUri()); - marker.commit(); - return result; - } - result = consumeAssignment$8(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele1AssignmentUri()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$4(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele000KeywordImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$5(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001AssignmentName()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$7(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele01KeywordUri()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 3: + announceNextStep(); + result = consumeAssignment$8(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele1AssignmentUri()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$4() throws Exception { + protected int consumeKeyword$4(int entryPoint) throws Exception { return consumeKeyword(getRule().ele000KeywordImport(), null, false, false, getKeyword$4$Delimiter()); } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "name", false, false, getRule().ele0010LexerRuleCallID(), getRuleCall$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$7() throws Exception { + protected int consumeKeyword$7(int entryPoint) throws Exception { return consumeKeyword(getRule().ele01KeywordUri(), null, false, false, getKeyword$7$Delimiter()); } - protected int consumeAssignment$8() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$8(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "uri", false, false, getRule().ele10LexerRuleCallSTRING(), getRuleCall$9$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageSingleAssignmentValueConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageSingleAssignmentValueConsumer.java index 3a41e8a..edf104a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageSingleAssignmentValueConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/parser/packrat/consumers/EpatchTestLanguageSingleAssignmentValueConsumer.java @@ -64,141 +64,186 @@ public final class EpatchTestLanguageSingleAssignmentValueConsumer extends NonTe ruleCall$31$Delimiter = ISequenceMatcher.Factory.nullMatcher(); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$5(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$7(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$9(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeAssignment$24(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$5(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$7(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 2: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$9(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 3: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeAssignment$24(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 4: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeGroup$26(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeGroup$26(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; - } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; bestMarker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$5() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$5(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeKeyword(getRule().ele00000KeywordNull(), "keyword", false, false, getKeyword$6$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$7() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$7(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(stringConsumer, "value", false, false, getRule().ele00010LexerRuleCallSTRING(), getRuleCall$8$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$9() throws Exception { + protected int consumeGroup$9(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$10(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0010AssignmentRefObject()); - marker.commit(); - return result; - } - result = consumeGroup$13(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$10(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0010AssignmentRefObject()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeGroup$13(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$10() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$10(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "refObject", false, false, getRule().ele00100CrossReferenceEStringNamedObject(), getCrossReference$11$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$13() throws Exception { + protected int consumeGroup$13(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$13(); + int result = doConsumeGroup$13(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -206,48 +251,67 @@ public final class EpatchTestLanguageSingleAssignmentValueConsumer extends NonTe return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$13() throws Exception { + protected int doConsumeGroup$13(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$15(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001100KeywordFullStop()); - marker.commit(); - return result; - } - result = consumeAssignment$16(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001101AssignmentRefFeature()); - marker.commit(); - return result; - } - result = consumeGroup$18(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele00111Group()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$15(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001100KeywordFullStop()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$16(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001101AssignmentRefFeature()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeGroup$18(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele00111Group()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$15() throws Exception { + protected int consumeKeyword$15(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001100KeywordFullStop(), null, false, false, getKeyword$15$Delimiter()); } - protected int consumeAssignment$16() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$16(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "refFeature", false, false, getRule().ele0011010LexerRuleCallID(), getRuleCall$17$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$18() throws Exception { + protected int consumeGroup$18(int entryPoint) throws Exception { IMarker marker = mark(); - int result = doConsumeGroup$18(); + int result = doConsumeGroup$18(entryPoint); if (result != ConsumeResult.SUCCESS) marker.rollback(); else @@ -255,95 +319,138 @@ public final class EpatchTestLanguageSingleAssignmentValueConsumer extends NonTe return ConsumeResult.SUCCESS; } - protected int doConsumeGroup$18() throws Exception { + protected int doConsumeGroup$18(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeKeyword$20(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011100KeywordLeftSquareBracket()); - marker.commit(); - return result; - } - result = consumeAssignment$21(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele0011101AssignmentRefIndex()); - marker.commit(); - return result; - } - result = consumeKeyword$23(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele001111KeywordRightSquareBracket()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeKeyword$20(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011100KeywordLeftSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$21(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele0011101AssignmentRefIndex()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 2: + announceNextStep(); + result = consumeKeyword$23(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele001111KeywordRightSquareBracket()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeKeyword$20() throws Exception { + protected int consumeKeyword$20(int entryPoint) throws Exception { return consumeKeyword(getRule().ele0011100KeywordLeftSquareBracket(), null, false, false, getKeyword$20$Delimiter()); } - protected int consumeAssignment$21() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$21(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(intConsumer, "refIndex", false, false, getRule().ele00111010LexerRuleCallINT(), getRuleCall$22$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeKeyword$23() throws Exception { + protected int consumeKeyword$23(int entryPoint) throws Exception { return consumeKeyword(getRule().ele001111KeywordRightSquareBracket(), null, false, false, getKeyword$23$Delimiter()); } - protected int consumeAssignment$24() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$24(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeNonTerminal(createdObjectConsumer, "newObject", false, false, getRule().ele010ParserRuleCallCreatedObject()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeGroup$26() throws Exception { + protected int consumeGroup$26(int entryPoint) throws Exception { + announceNextLevel(); final IMarker marker = mark(); - int result; - result = consumeAssignment$27(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele10AssignmentImport()); - marker.commit(); - return result; - } - result = consumeAssignment$30(); - if (result!=ConsumeResult.SUCCESS) { - error("Another token expected.", getRule().ele11AssignmentImpFrag()); - marker.commit(); - return result; + int result = ConsumeResult.SUCCESS; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextStep(); + result = consumeAssignment$27(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele10AssignmentImport()); + marker.commit(); + announceLevelFinished(); + return result; + } + case 1: + announceNextStep(); + result = consumeAssignment$30(nextEntryPoint()); + if (result!=ConsumeResult.SUCCESS) { + error("Another token expected.", getRule().ele11AssignmentImpFrag()); + marker.commit(); + announceLevelFinished(); + return result; + } } marker.commit(); + announceLevelFinished(); return result; } - protected int consumeAssignment$27() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$27(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(idConsumer, "import", false, false, getRule().ele100CrossReferenceEStringImport(), getCrossReference$28$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } - protected int consumeAssignment$30() throws Exception { - int result = Integer.MIN_VALUE; + protected int consumeAssignment$30(int entryPoint) throws Exception { + int result = ConsumeResult.EMPTY_MATCH; int tempResult; + announceNextLevel(); tempResult = consumeTerminal(fragmentConsumer, "impFrag", false, false, getRule().ele110LexerRuleCallFRAGMENT(), getRuleCall$31$Delimiter()); - if (tempResult == ConsumeResult.SUCCESS) + if (tempResult == ConsumeResult.SUCCESS) { + announceLevelFinished(); return tempResult; + } result = tempResult >= result ? tempResult : result; + announceLevelFinished(); return result; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/packrat/consumers/XtextGrammarTestLanguageAbstractMetamodelDeclarationConsumer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/packrat/consumers/XtextGrammarTestLanguageAbstractMetamodelDeclarationConsumer.java index 40a4f85..f89972e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/packrat/consumers/XtextGrammarTestLanguageAbstractMetamodelDeclarationConsumer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/packrat/consumers/XtextGrammarTestLanguageAbstractMetamodelDeclarationConsumer.java @@ -28,52 +28,64 @@ public final class XtextGrammarTestLanguageAbstractMetamodelDeclarationConsumer super(configuration, hiddenTokens); } - protected int doConsume() throws Exception { - return consumeAlternatives$1(); + protected int doConsume(int entryPoint) throws Exception { + return consumeAlternatives$1(entryPoint); } - protected int consumeAlternatives$1() throws Exception { + protected int consumeAlternatives$1(int entryPoint) throws Exception { + announceNextLevel(); int result = ConsumeResult.SUCCESS; IMarker bestMarker = mark(); IMarker currentMarker; int tempResult; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$2(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); - bestMarker.commit(); - return tempResult; + switch(entryPoint) { + case -1: // use fallthrough semantics of switch case + result = ConsumeResult.EMPTY_MATCH; + case 0: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$2(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; + case 1: + announceNextPath(); + currentMarker = bestMarker.fork(); + tempResult = consumeRuleCall$3(nextEntryPoint()); + if (tempResult == ConsumeResult.SUCCESS) { + bestMarker = currentMarker.join(bestMarker); + bestMarker.commit(); + announceLevelFinished(); + return tempResult; + } + if (tempResult > result) { + bestMarker = currentMarker.join(bestMarker); + result = tempResult; + } else { + bestMarker = bestMarker.join(currentMarker); + } + currentMarker = null; } - if (tempResult > result) { - bestMarker = currentMarker.join(bestMarker); - result = tempResult; - } else { - bestMarker = bestMarker.join(currentMarker); - } - currentMarker = null; - currentMarker = bestMarker.fork(); - tempResult = consumeRuleCall$3(); - if (tempResult == ConsumeResult.SUCCESS) { - bestMarker = currentMarker.join(bestMarker); |

