| author | meysholdt | 2009-01-12 12:42:35 (EST) |
|---|---|---|
| committer | sefftinge | 2009-01-12 12:42:35 (EST) |
| commit | 4ad595c1a5a813e78e643377906e08b766d9cf9b (patch) (side-by-side diff) | |
| tree | 81358ee31740c475e4ea60970c6c6f9f58617310 | |
| parent | e6aa953099709612ec6c36c4e2ed66082fa221bf (diff) | |
| download | org.eclipse.xtext-4ad595c1a5a813e78e643377906e08b766d9cf9b.zip org.eclipse.xtext-4ad595c1a5a813e78e643377906e08b766d9cf9b.tar.gz org.eclipse.xtext-4ad595c1a5a813e78e643377906e08b766d9cf9b.tar.bz2 | |
- improved error reporting of the ParseTreeConstructor
- fixed a recursion bug in the ParseTreeConstructor
87 files changed, 2387 insertions, 1159 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageLexer.java index 8205469..beab96b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguage.g 2009-01-06 10:50:13 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguage.g 2009-01-12 18:22:35 package org.eclipse.xtext.crossrefs.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageParser.java index a488bf1..2fc9c79 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguage.g 2009-01-06 10:50:13 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalImportUriTestLanguage.g 2009-01-12 18:22:34 package org.eclipse.xtext.crossrefs.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageLexer.java index 0ea6326..0abd56e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguage.g 2009-01-06 10:50:01 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguage.g 2009-01-12 18:22:19 package org.eclipse.xtext.crossrefs.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageParser.java index a20b9d4..e89a6d8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguage.g 2009-01-06 10:50:00 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/crossrefs/parser/internal/InternalLangATestLanguage.g 2009-01-12 18:22:19 package org.eclipse.xtext.crossrefs.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/ImportUriTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/ImportUriTestLanguageParseTreeConstructor.java index 8fe7d85..c8b8865 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/ImportUriTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/ImportUriTestLanguageParseTreeConstructor.java @@ -14,26 +14,13 @@ import org.eclipse.xtext.crossrefs.services.ImportUriTestLanguageGrammarAccess; public class ImportUriTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Main") && (s = new Main_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Import") && (s = new Import_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Type") && (s = new Type_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Main") && (s = new Main_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Import") && (s = new Import_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Type") && (s = new Type_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,7 +48,7 @@ protected class Main_Group extends GroupToken { while(s1 != null) { Solution s2 = new Main_0_Assignment_imports(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -92,6 +79,7 @@ protected class Main_0_Assignment_imports extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Import")) { Solution s = new Import_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -122,6 +110,7 @@ protected class Main_1_Assignment_types extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Type")) { Solution s = new Type_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -160,7 +149,7 @@ protected class Import_Group extends GroupToken { while(s1 != null) { Solution s2 = new Import_0_Keyword_import(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -234,7 +223,7 @@ protected class Type_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -262,7 +251,7 @@ protected class Type_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -290,7 +279,7 @@ protected class Type_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_0_0_Keyword_type(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/LangATestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/LangATestLanguageParseTreeConstructor.java index 443fa43..4611de8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/LangATestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/parsetree/reconstr/LangATestLanguageParseTreeConstructor.java @@ -14,26 +14,13 @@ import org.eclipse.xtext.crossrefs.services.LangATestLanguageGrammarAccess; public class LangATestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Main") && (s = new Main_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Import") && (s = new Import_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Type") && (s = new Type_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Main") && (s = new Main_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Import") && (s = new Import_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Type") && (s = new Type_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,7 +48,7 @@ protected class Main_Group extends GroupToken { while(s1 != null) { Solution s2 = new Main_0_Assignment_imports(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -92,6 +79,7 @@ protected class Main_0_Assignment_imports extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Import")) { Solution s = new Import_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -122,6 +110,7 @@ protected class Main_1_Assignment_types extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Type")) { Solution s = new Type_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -160,7 +149,7 @@ protected class Import_Group extends GroupToken { while(s1 != null) { Solution s2 = new Import_0_Keyword_import(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -234,7 +223,7 @@ protected class Type_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -262,7 +251,7 @@ protected class Type_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -290,7 +279,7 @@ protected class Type_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_0_0_Keyword_type(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageLexer.java index c08370c..de94adc 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguage.g 2009-01-06 10:50:05 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguage.g 2009-01-12 18:22:25 package org.eclipse.xtext.dummy.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageParser.java index 699d6da..d588858 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguage.g 2009-01-06 10:50:05 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/dummy/parser/internal/InternalDummyTestLanguage.g 2009-01-12 18:22:25 package org.eclipse.xtext.dummy.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parsetree/reconstr/DummyTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parsetree/reconstr/DummyTestLanguageParseTreeConstructor.java index d3b8466..8400396 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parsetree/reconstr/DummyTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/parsetree/reconstr/DummyTestLanguageParseTreeConstructor.java @@ -14,23 +14,12 @@ import org.eclipse.xtext.dummy.services.DummyTestLanguageGrammarAccess; public class DummyTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Model") && (s = new Model_Assignment_elements(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Element") && (s = new Element_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Model") && (s = new Model_Assignment_elements(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Element") && (s = new Element_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,6 +50,7 @@ protected class Model_Assignment_elements extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Element")) { Solution s = new Element_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -98,7 +88,7 @@ protected class Element_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -126,7 +116,7 @@ protected class Element_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -154,7 +144,7 @@ protected class Element_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -182,7 +172,7 @@ protected class Element_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_0_0_0_0_Assignment_optional(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageLexer.java index 508cf62..a50fa6d 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguage.g 2009-01-06 10:50:02 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguage.g 2009-01-12 18:22:20 package org.eclipse.xtext.grammarinheritance.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageParser.java index 81076b5..c9d3d93 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguage.g 2009-01-06 10:50:02 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/grammarinheritance/parser/internal/InternalConcreteTestLanguage.g 2009-01-12 18:22:20 package org.eclipse.xtext.grammarinheritance.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parsetree/reconstr/ConcreteTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parsetree/reconstr/ConcreteTestLanguageParseTreeConstructor.java index 69bba0d..29c31a6 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parsetree/reconstr/ConcreteTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/parsetree/reconstr/ConcreteTestLanguageParseTreeConstructor.java @@ -15,23 +15,12 @@ import org.eclipse.xtext.grammarinheritance.services.ConcreteTestLanguageGrammar public class ConcreteTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("ConcreteParserRule") && (s = new ConcreteParserRule_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AType") && (s = new InheritedParserRule_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("ConcreteParserRule") && (s = new ConcreteParserRule_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AType") && (s = new InheritedParserRule_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -59,7 +48,7 @@ protected class ConcreteParserRule_Group extends GroupToken { while(s1 != null) { Solution s2 = new ConcreteParserRule_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -87,7 +76,7 @@ protected class ConcreteParserRule_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ConcreteParserRule_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -115,7 +104,7 @@ protected class ConcreteParserRule_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ConcreteParserRule_0_0_0_Keyword_model(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -195,6 +184,7 @@ protected class ConcreteParserRule_1_Assignment_elements extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AType")) { Solution s = new InheritedParserRule_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -233,7 +223,7 @@ protected class InheritedParserRule_Group extends GroupToken { while(s1 != null) { Solution s2 = new InheritedParserRule_0_Keyword_element(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageLexer.java index 73504f4..99e32e4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguage.g 2009-01-06 10:50:04 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguage.g 2009-01-12 18:22:24 package org.eclipse.xtext.metamodelreferencing.tests.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageParser.java index bf7d12d..177773c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguage.g 2009-01-06 10:50:04 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMetamodelRefTestLanguage.g 2009-01-12 18:22:23 package org.eclipse.xtext.metamodelreferencing.tests.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageLexer.java index 191a51f..101206c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguage.g 2009-01-06 10:50:05 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguage.g 2009-01-12 18:22:24 package org.eclipse.xtext.metamodelreferencing.tests.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageParser.java index 3371430..7d675fa 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguage.g 2009-01-06 10:50:05 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/metamodelreferencing/tests/parser/internal/InternalMultiGenMMTestLanguage.g 2009-01-12 18:22:24 package org.eclipse.xtext.metamodelreferencing.tests.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MetamodelRefTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MetamodelRefTestLanguageParseTreeConstructor.java index 3e56289..0ad683d 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MetamodelRefTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MetamodelRefTestLanguageParseTreeConstructor.java @@ -14,26 +14,13 @@ import org.eclipse.xtext.metamodelreferencing.tests.services.MetamodelRefTestLan public class MetamodelRefTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Foo") && (s = new Foo_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("RuleCall") && (s = new NameRef_Assignment_rule(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("ParserRule") && (s = new MyRule_Assignment_name(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Foo") && (s = new Foo_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("RuleCall") && (s = new NameRef_Assignment_rule(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("ParserRule") && (s = new MyRule_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,7 +48,7 @@ protected class Foo_Group extends GroupToken { while(s1 != null) { Solution s2 = new Foo_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -115,6 +102,7 @@ protected class Foo_1_Assignment_nameRefs extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("RuleCall")) { Solution s = new NameRef_Assignment_rule(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MultiGenMMTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MultiGenMMTestLanguageParseTreeConstructor.java index e8d7c88..f8b4598 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MultiGenMMTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/parsetree/reconstr/MultiGenMMTestLanguageParseTreeConstructor.java @@ -14,23 +14,12 @@ import org.eclipse.xtext.metamodelreferencing.tests.services.MultiGenMMTestLangu public class MultiGenMMTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Foo") && (s = new Foo_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("FooBar") && (s = new NameRef_Assignment_name(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Foo") && (s = new Foo_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("FooBar") && (s = new NameRef_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -58,7 +47,7 @@ protected class Foo_Group extends GroupToken { while(s1 != null) { Solution s2 = new Foo_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -112,6 +101,7 @@ protected class Foo_1_Assignment_nameRefs extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("FooBar")) { Solution s = new NameRef_Assignment_name(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageLexer.java index ace82a6..7943e1a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguage.g 2009-01-06 10:50:16 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguage.g 2009-01-12 18:22:38 package org.eclipse.xtext.parser.datatyperules.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageParser.java index 2c2791b..d5e7651 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguage.g 2009-01-06 10:50:16 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/datatyperules/parser/internal/InternalDatatypeRulesTestLanguage.g 2009-01-12 18:22:38 package org.eclipse.xtext.parser.datatyperules.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parsetree/reconstr/DatatypeRulesTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parsetree/reconstr/DatatypeRulesTestLanguageParseTreeConstructor.java index 6019044..9c4eda8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parsetree/reconstr/DatatypeRulesTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/parsetree/reconstr/DatatypeRulesTestLanguageParseTreeConstructor.java @@ -14,28 +14,12 @@ import org.eclipse.xtext.parser.datatyperules.services.DatatypeRulesTestLanguage public class DatatypeRulesTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("CompositeModel") && (s = new CompositeModel_Assignment_model(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Model") && (s = new Model_Group(inst, null).firstSolution()) != null) return s; - - - - - - + if(inst.isInstanceOf("CompositeModel") && (s = new CompositeModel_Assignment_model(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Model") && (s = new Model_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -66,6 +50,7 @@ protected class CompositeModel_Assignment_model extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Model")) { Solution s = new Model_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -103,7 +88,7 @@ protected class Model_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -131,7 +116,7 @@ protected class Model_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -159,7 +144,7 @@ protected class Model_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -187,7 +172,7 @@ protected class Model_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_0_0_0_Assignment_id(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -240,7 +225,7 @@ protected class Model_0_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_0_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -307,7 +292,7 @@ protected class Model_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -374,7 +359,7 @@ protected class Model_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Model_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageLexer.java index b2f897a..71a62a8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguage.g 2009-01-06 10:50:04 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguage.g 2009-01-12 18:22:22 package org.eclipse.xtext.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageParser.java index 93207ff..6c552b3 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguage.g 2009-01-06 10:50:03 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parser/internal/InternalXtextGrammarTestLanguage.g 2009-01-12 18:22:22 package org.eclipse.xtext.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageLexer.java index a66605b..1185abf 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguage.g 2009-01-06 10:50:16 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguage.g 2009-01-12 18:22:38 package org.eclipse.xtext.parsetree.formatter.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageParser.java index d72c827..83b780e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguage.g 2009-01-06 10:50:16 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/formatter/parser/internal/InternalFormatterTestLanguage.g 2009-01-12 18:22:37 package org.eclipse.xtext.parsetree.formatter.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parsetree/reconstr/FormatterTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parsetree/reconstr/FormatterTestLanguageParseTreeConstructor.java index 7cdbf27..868ff7b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parsetree/reconstr/FormatterTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/parsetree/reconstr/FormatterTestLanguageParseTreeConstructor.java @@ -14,29 +14,14 @@ import org.eclipse.xtext.parsetree.formatter.services.FormatterTestLanguageGramm public class FormatterTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Root") && (s = new Root_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Line") && (s = new Line_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TestLinewrap") && (s = new TestLinewrap_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TestIndentation") && (s = new TestIndentation_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Root") && (s = new Root_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Line") && (s = new Line_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TestLinewrap") && (s = new TestLinewrap_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TestIndentation") && (s = new TestIndentation_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -64,7 +49,7 @@ protected class Root_Group extends GroupToken { while(s1 != null) { Solution s2 = new Root_0_Keyword_test(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -173,7 +158,7 @@ protected class Line_Group extends GroupToken { while(s1 != null) { Solution s2 = new Line_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -201,7 +186,7 @@ protected class Line_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Line_0_0_Assignment_type(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -299,7 +284,7 @@ protected class TestLinewrap_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestLinewrap_0_Keyword_linewrap(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -342,6 +327,7 @@ protected class TestLinewrap_1_Assignment_items extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Line")) { Solution s = new Line_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -380,7 +366,7 @@ protected class TestIndentation_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestIndentation_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -408,7 +394,7 @@ protected class TestIndentation_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestIndentation_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -436,7 +422,7 @@ protected class TestIndentation_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestIndentation_0_0_0_Keyword_indentation(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -513,6 +499,7 @@ protected class TestIndentation_0_1_0_Assignment_sub extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("TestIndentation")) { Solution s = new TestIndentation_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -543,6 +530,7 @@ protected class TestIndentation_0_1_1_Assignment_items extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Line")) { Solution s = new Line_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi index b5f8173..03f8390 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi @@ -9,12 +9,21 @@ <metamodelDeclarations xsi:type="xtext:GeneratedMetamodel" name="complexrewritetest"> <ePackage href="http://complex/rewrite/test#/"/> </metamodelDeclarations> + <rules xsi:type="xtext:ParserRule" name="Root"> + <type metamodel="//@metamodelDeclarations.0"> + <type xsi:type="ecore:EClass" href="http://complex/rewrite/test#//Root"/> + </type> + <alternatives xsi:type="xtext:Alternatives"> + <groups xsi:type="xtext:RuleCall" rule="//@rules.1"/> + <groups xsi:type="xtext:RuleCall" rule="//@rules.12"/> + </alternatives> + </rules> <rules xsi:type="xtext:ParserRule" name="Op"> <type metamodel="//@metamodelDeclarations.0"> <type xsi:type="ecore:EClass" href="http://complex/rewrite/test#//Expression"/> </type> <alternatives xsi:type="xtext:Group"> - <abstractTokens xsi:type="xtext:RuleCall" rule="//@rules.1"/> + <abstractTokens xsi:type="xtext:RuleCall" rule="//@rules.2"/> <abstractTokens xsi:type="xtext:Alternatives" cardinality="*"> <groups xsi:type="xtext:Group"> <abstractTokens xsi:type="xtext:Group"> @@ -26,7 +35,7 @@ <abstractTokens xsi:type="xtext:Keyword" value="+"/> </abstractTokens> <abstractTokens xsi:type="xtext:Assignment" feature="addOperands" operator="+="> - <terminal xsi:type="xtext:RuleCall" rule="//@rules.1"/> + <terminal xsi:type="xtext:RuleCall" rule="//@rules.2"/> </abstractTokens> </groups> <groups xsi:type="xtext:Group"> @@ -39,7 +48,7 @@ <abstractTokens xsi:type="xtext:Keyword" value="-"/> </abstractTokens> <abstractTokens xsi:type="xtext:Assignment" feature="minusOperands" operator="+="> - <terminal xsi:type="xtext:RuleCall" rule="//@rules.1"/> + <terminal xsi:type="xtext:RuleCall" rule="//@rules.2"/> </abstractTokens> </groups> </abstractTokens> @@ -50,8 +59,8 @@ <type xsi:type="ecore:EClass" href="http://complex/rewrite/test#//Expression"/> </type> <alternatives xsi:type="xtext:Alternatives"> - <groups xsi:type="xtext:RuleCall" rule="//@rules.2"/> <groups xsi:type="xtext:RuleCall" rule="//@rules.3"/> + <groups xsi:type="xtext:RuleCall" rule="//@rules.4"/> </alternatives> </rules> <rules xsi:type="xtext:ParserRule" name="Atom"> @@ -72,7 +81,7 @@ <abstractTokens xsi:type="xtext:Group"> <abstractTokens xsi:type="xtext:Group"> <abstractTokens xsi:type="xtext:Keyword" value="("/> - <abstractTokens xsi:type="xtext:RuleCall" rule="//@rules.0"/> + <abstractTokens xsi:type="xtext:RuleCall" rule="//@rules.1"/> </abstractTokens> <abstractTokens xsi:type="xtext:Keyword" value=")"/> </abstractTokens> @@ -90,7 +99,7 @@ <abstractTokens xsi:type="xtext:Group"> <abstractTokens xsi:type="xtext:Group"> <abstractTokens xsi:type="xtext:Keyword" value="TA"/> - <abstractTokens xsi:type="xtext:RuleCall" rule="//@rules.5"/> + <abstractTokens xsi:type="xtext:RuleCall" rule="//@rules.6"/> </abstractTokens> <abstractTokens xsi:type="xtext:Assignment" cardinality="*" feature="name" operator="+="> <terminal xsi:type="xtext:RuleCall"> @@ -330,4 +339,50 @@ </abstractTokens> </alternatives> </rules> + <rules xsi:type="xtext:ParserRule" name="TrickyG"> + <type metamodel="//@metamodelDeclarations.0"> + <type xsi:type="ecore:EClass" href="http://complex/rewrite/test#//TrickyG"/> + </type> + <alternatives xsi:type="xtext:Group"> + <abstractTokens xsi:type="xtext:Keyword" value="TG"/> + <abstractTokens xsi:type="xtext:Assignment" feature="tree" operator="="> + <terminal xsi:type="xtext:RuleCall" rule="//@rules.13"/> + </abstractTokens> + </alternatives> + </rules> + <rules xsi:type="xtext:ParserRule" name="TrickyG1"> + <type metamodel="//@metamodelDeclarations.0"> + <type xsi:type="ecore:EClass" href="http://complex/rewrite/test#//TrickyG1"/> + </type> + <alternatives xsi:type="xtext:Group"> + <abstractTokens xsi:type="xtext:Group"> + <abstractTokens xsi:type="xtext:Keyword" value="["/> + <abstractTokens xsi:type="xtext:Group" cardinality="?"> + <abstractTokens xsi:type="xtext:Assignment" feature="vals" operator="+="> + <terminal xsi:type="xtext:RuleCall" rule="//@rules.14"/> + </abstractTokens> + <abstractTokens xsi:type="xtext:Group" cardinality="*"> + <abstractTokens xsi:type="xtext:Keyword" value=","/> + <abstractTokens xsi:type="xtext:Assignment" feature="vals" operator="+="> + <terminal xsi:type="xtext:RuleCall" rule="//@rules.14"/> + </abstractTokens> + </abstractTokens> + </abstractTokens> + </abstractTokens> + <abstractTokens xsi:type="xtext:Keyword" value="]"/> + </alternatives> + </rules> + <rules xsi:type="xtext:ParserRule" name="TrickyG2"> + <type metamodel="//@metamodelDeclarations.0"> + <type xsi:type="ecore:EClass" href="http://complex/rewrite/test#//TrickyG2"/> + </type> + <alternatives xsi:type="xtext:Alternatives"> + <groups xsi:type="xtext:RuleCall" rule="//@rules.13"/> + <groups xsi:type="xtext:Assignment" feature="val" operator="="> + <terminal xsi:type="xtext:RuleCall"> + <rule href="classpath:/org/eclipse/xtext/builtin/XtextBuiltin.xmi#//@rules.1"/> + </terminal> + </groups> + </alternatives> + </rules> </xtext:Grammar> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/XtextGrammarTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/XtextGrammarTestLanguageParseTreeConstructor.java index 9388c44..2af556f 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/XtextGrammarTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/XtextGrammarTestLanguageParseTreeConstructor.java @@ -14,71 +14,28 @@ import org.eclipse.xtext.services.XtextGrammarTestLanguageGrammarAccess; public class XtextGrammarTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Grammar") && (s = new Grammar_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractRule") && (s = new AbstractRule_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractMetamodelDeclaration") && (s = new AbstractMetamodelDeclaration_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("GeneratedMetamodel") && (s = new GeneratedMetamodel_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("ReferencedMetamodel") && (s = new ReferencedMetamodel_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("LexerRule") && (s = new LexerRule_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("ParserRule") && (s = new ParserRule_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TypeRef") && (s = new TypeRef_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractElement") && (s = new Alternatives_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractElement") && (s = new Group_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractElement") && (s = new AbstractToken_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Assignment") && (s = new Assignment_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Action") && (s = new Action_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractElement") && (s = new AbstractTerminal_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("CrossReference") && (s = new CrossReference_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractElement") && (s = new ParenthesizedElement_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Keyword") && (s = new Keyword_Assignment_value(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("RuleCall") && (s = new RuleCall_Assignment_rule(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Grammar") && (s = new Grammar_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractRule") && (s = new AbstractRule_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractMetamodelDeclaration") && (s = new AbstractMetamodelDeclaration_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("GeneratedMetamodel") && (s = new GeneratedMetamodel_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("ReferencedMetamodel") && (s = new ReferencedMetamodel_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("LexerRule") && (s = new LexerRule_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("ParserRule") && (s = new ParserRule_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TypeRef") && (s = new TypeRef_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractElement") && (s = new Alternatives_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractElement") && (s = new Group_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractElement") && (s = new AbstractToken_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Assignment") && (s = new Assignment_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Action") && (s = new Action_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractElement") && (s = new AbstractTerminal_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("CrossReference") && (s = new CrossReference_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractElement") && (s = new ParenthesizedElement_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Keyword") && (s = new Keyword_Assignment_value(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("RuleCall") && (s = new RuleCall_Assignment_rule(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -106,7 +63,7 @@ protected class Grammar_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -134,7 +91,7 @@ protected class Grammar_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -162,7 +119,7 @@ protected class Grammar_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -190,7 +147,7 @@ protected class Grammar_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -218,7 +175,7 @@ protected class Grammar_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_0_0_0_Alternatives(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -327,7 +284,7 @@ protected class Grammar_0_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -392,7 +349,7 @@ protected class Grammar_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -420,7 +377,7 @@ protected class Grammar_0_0_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_1_0_0_Keyword_extends(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -484,7 +441,7 @@ protected class Grammar_0_0_1_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Grammar_0_0_1_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -553,6 +510,7 @@ protected class Grammar_0_1_Assignment_metamodelDeclarations extends AssignmentT IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractMetamodelDeclaration")) { Solution s = new AbstractMetamodelDeclaration_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -584,6 +542,7 @@ protected class Grammar_1_Assignment_rules extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractRule")) { Solution s = new AbstractRule_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -758,7 +717,7 @@ protected class GeneratedMetamodel_Group extends GroupToken { while(s1 != null) { Solution s2 = new GeneratedMetamodel_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -786,7 +745,7 @@ protected class GeneratedMetamodel_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new GeneratedMetamodel_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -814,7 +773,7 @@ protected class GeneratedMetamodel_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new GeneratedMetamodel_0_0_0_Keyword_generate(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -902,7 +861,7 @@ protected class GeneratedMetamodel_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new GeneratedMetamodel_1_0_Keyword_as(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -977,7 +936,7 @@ protected class ReferencedMetamodel_Group extends GroupToken { while(s1 != null) { Solution s2 = new ReferencedMetamodel_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1005,7 +964,7 @@ protected class ReferencedMetamodel_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ReferencedMetamodel_0_0_Keyword_import(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1069,7 +1028,7 @@ protected class ReferencedMetamodel_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new ReferencedMetamodel_1_0_Keyword_as(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1144,7 +1103,7 @@ protected class LexerRule_Group extends GroupToken { while(s1 != null) { Solution s2 = new LexerRule_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1172,7 +1131,7 @@ protected class LexerRule_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LexerRule_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1200,7 +1159,7 @@ protected class LexerRule_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LexerRule_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1228,7 +1187,7 @@ protected class LexerRule_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LexerRule_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1256,7 +1215,7 @@ protected class LexerRule_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LexerRule_0_0_0_0_0_Alternatives(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1354,7 +1313,7 @@ protected class LexerRule_0_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new LexerRule_0_0_0_1_0_Keyword_returns(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1397,6 +1356,7 @@ protected class LexerRule_0_0_0_1_1_Assignment_type extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("TypeRef")) { Solution s = new TypeRef_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1486,7 +1446,7 @@ protected class ParserRule_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParserRule_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1514,7 +1474,7 @@ protected class ParserRule_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParserRule_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1542,7 +1502,7 @@ protected class ParserRule_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParserRule_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1570,7 +1530,7 @@ protected class ParserRule_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParserRule_0_0_0_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1621,7 +1581,7 @@ protected class ParserRule_0_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParserRule_0_0_0_1_0_Keyword_returns(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1664,6 +1624,7 @@ protected class ParserRule_0_0_0_1_1_Assignment_type extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("TypeRef")) { Solution s = new TypeRef_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1709,6 +1670,7 @@ protected class ParserRule_0_1_Assignment_alternatives extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractElement")) { Solution s = new Alternatives_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1760,7 +1722,7 @@ protected class TypeRef_Group extends GroupToken { while(s1 != null) { Solution s2 = new TypeRef_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1788,7 +1750,7 @@ protected class TypeRef_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TypeRef_0_0_Assignment_metamodel(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1892,7 +1854,7 @@ protected class Alternatives_Group extends GroupToken { while(s1 != null) { Solution s2 = new Alternatives_0_RuleCall_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1938,7 +1900,7 @@ protected class Alternatives_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Alternatives_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1966,7 +1928,7 @@ protected class Alternatives_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Alternatives_1_0_0_Action_Alternatives_groups(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2030,6 +1992,7 @@ protected class Alternatives_1_1_Assignment_groups extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractElement")) { Solution s = new Group_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -2069,7 +2032,7 @@ protected class Group_Group extends GroupToken { while(s1 != null) { Solution s2 = new Group_0_RuleCall_AbstractToken(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2115,7 +2078,7 @@ protected class Group_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Group_1_0_Action_Group_abstractTokens(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2166,6 +2129,7 @@ protected class Group_1_1_Assignment_abstractTokens extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractElement")) { Solution s = new AbstractToken_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -2205,7 +2169,7 @@ protected class AbstractToken_Group extends GroupToken { while(s1 != null) { Solution s2 = new AbstractToken_0_Alternatives(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2375,7 +2339,7 @@ protected class Assignment_Group extends GroupToken { while(s1 != null) { Solution s2 = new Assignment_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2403,7 +2367,7 @@ protected class Assignment_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Assignment_0_0_Assignment_feature(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2491,6 +2455,7 @@ protected class Assignment_1_Assignment_terminal extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractElement")) { Solution s = new AbstractTerminal_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -2529,7 +2494,7 @@ protected class Action_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2557,7 +2522,7 @@ protected class Action_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2585,7 +2550,7 @@ protected class Action_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2613,7 +2578,7 @@ protected class Action_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2641,7 +2606,7 @@ protected class Action_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2669,7 +2634,7 @@ protected class Action_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2697,7 +2662,7 @@ protected class Action_0_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_0_0_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2737,7 +2702,7 @@ protected class Action_0_0_0_0_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Action_0_0_0_0_0_0_1_0_Keyword_current(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2794,6 +2759,7 @@ protected class Action_0_0_0_0_0_1_Assignment_typeName extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("TypeRef")) { Solution s = new TypeRef_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -3072,7 +3038,7 @@ protected class CrossReference_Group extends GroupToken { while(s1 != null) { Solution s2 = new CrossReference_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -3100,7 +3066,7 @@ protected class CrossReference_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new CrossReference_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -3128,7 +3094,7 @@ protected class CrossReference_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new CrossReference_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -3171,6 +3137,7 @@ protected class CrossReference_0_0_1_Assignment_type extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("TypeRef")) { Solution s = new TypeRef_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -3199,7 +3166,7 @@ protected class CrossReference_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new CrossReference_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -3290,7 +3257,7 @@ protected class ParenthesizedElement_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParenthesizedElement_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -3318,7 +3285,7 @@ protected class ParenthesizedElement_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ParenthesizedElement_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/complexrewritetest.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/complexrewritetest.ecore index 32d299a..6656b80 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/complexrewritetest.ecore +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/complexrewritetest.ecore @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="ASCII"?> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="complexrewritetest" nsURI="http://complex/rewrite/test" nsPrefix="complexrewritetest"> - <eClassifiers xsi:type="ecore:EClass" name="Expression"> + <eClassifiers xsi:type="ecore:EClass" name="Root"/> + <eClassifiers xsi:type="ecore:EClass" name="Expression" eSuperTypes="//Root"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="em"> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> @@ -59,6 +60,17 @@ <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> </eStructuralFeatures> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="TrickyG" eSuperTypes="//Root"> + <eStructuralFeatures xsi:type="ecore:EReference" name="tree" eType="//TrickyG1" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="TrickyG1" eSuperTypes="//TrickyG2"> + <eStructuralFeatures xsi:type="ecore:EReference" name="vals" unique="false" upperBound="-1" eType="//TrickyG2" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="TrickyG2"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="val"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eStructuralFeatures> + </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Add" eSuperTypes="//Expression"> <eStructuralFeatures xsi:type="ecore:EReference" name="addOperands" unique="false" upperBound="-1" eType="//Expression" containment="true"/> </eClassifiers> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/ComplexReconstrTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/ComplexReconstrTestLanguageParser.java index 84f8b2c..323cb14 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/ComplexReconstrTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/ComplexReconstrTestLanguageParser.java @@ -39,6 +39,6 @@ public class ComplexReconstrTestLanguageParser extends org.eclipse.xtext.parser. @Override protected String getDefaultRuleName() { - return "Op"; + return "Root"; } } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g index b75f647..1781f47 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g @@ -48,7 +48,7 @@ import org.eclipse.xtext.parser.antlr.ValueConverterException; @Override protected String getFirstRuleName() { - return "Op"; + return "Root"; } } @@ -62,9 +62,46 @@ import org.eclipse.xtext.parser.antlr.ValueConverterException; +// Entry rule entryRuleRoot +entryRuleRoot returns [EObject current=null] : + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0" /* xtext::ParserRule */, currentNode); } + iv_ruleRoot=ruleRoot + { $current=$iv_ruleRoot.current; } + EOF +; + +// Rule Root +ruleRoot returns [EObject current=null] + @init { EObject temp=null; setCurrentLookahead(); resetLookahead(); } + @after { resetLookahead(); }: +( + { + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); + } + this_Op=ruleOp + { + $current = $this_Op.current; + currentNode = currentNode.getParent(); + } + + | + { + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@groups.1" /* xtext::RuleCall */, currentNode); + } + this_TrickyG=ruleTrickyG + { + $current = $this_TrickyG.current; + currentNode = currentNode.getParent(); + } +); + + + + + // Entry rule entryRuleOp entryRuleOp returns [EObject current=null] : - { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0" /* xtext::ParserRule */, currentNode); } + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1" /* xtext::ParserRule */, currentNode); } iv_ruleOp=ruleOp { $current=$iv_ruleOp.current; } EOF @@ -76,7 +113,7 @@ ruleOp returns [EObject current=null] @after { resetLookahead(); }: ( { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.0" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.0" /* xtext::RuleCall */, currentNode); } this_Term=ruleTerm { @@ -89,7 +126,7 @@ ruleOp returns [EObject current=null] factory.add(temp, "addOperands", $current, null /*ParserRule*/, currentNode); $current = temp; temp = null; - CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); + CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); newNode.getChildren().add(currentNode); moveLookaheadInfo(currentNode, newNode); currentNode = newNode; @@ -97,13 +134,13 @@ ruleOp returns [EObject current=null] } )'+' { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); } )( { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); } lv_addOperands=ruleTerm { @@ -127,7 +164,7 @@ ruleOp returns [EObject current=null] factory.add(temp, "minusOperands", $current, null /*ParserRule*/, currentNode); $current = temp; temp = null; - CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); + CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); newNode.getChildren().add(currentNode); moveLookaheadInfo(currentNode, newNode); currentNode = newNode; @@ -135,13 +172,13 @@ ruleOp returns [EObject current=null] } )'-' { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); } )( { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); } lv_minusOperands=ruleTerm { @@ -166,7 +203,7 @@ ruleOp returns [EObject current=null] // Entry rule entryRuleTerm entryRuleTerm returns [EObject current=null] : - { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1" /* xtext::ParserRule */, currentNode); } + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2" /* xtext::ParserRule */, currentNode); } iv_ruleTerm=ruleTerm { $current=$iv_ruleTerm.current; } EOF @@ -178,7 +215,7 @@ ruleTerm returns [EObject current=null] @after { resetLookahead(); }: ( { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); } this_Atom=ruleAtom { @@ -188,7 +225,7 @@ ruleTerm returns [EObject current=null] | { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@groups.1" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2/@alternatives/@groups.1" /* xtext::RuleCall */, currentNode); } this_Parens=ruleParens { @@ -203,7 +240,7 @@ ruleTerm returns [EObject current=null] // Entry rule entryRuleAtom entryRuleAtom returns [EObject current=null] : - { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2" /* xtext::ParserRule */, currentNode); } + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3" /* xtext::ParserRule */, currentNode); } iv_ruleAtom=ruleAtom { $current=$iv_ruleAtom.current; } EOF @@ -217,7 +254,7 @@ ruleAtom returns [EObject current=null] lv_name=RULE_ID { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2/@alternatives/@terminal" /* xtext::RuleCall */, "name"); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@terminal" /* xtext::RuleCall */, "name"); } { @@ -241,7 +278,7 @@ ruleAtom returns [EObject current=null] // Entry rule entryRuleParens entryRuleParens returns [EObject current=null] : - { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3" /* xtext::ParserRule */, currentNode); } + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4" /* xtext::ParserRule */, currentNode); } iv_ruleParens=ruleParens { $current=$iv_ruleParens.current; } EOF @@ -253,11 +290,11 @@ ruleParens returns [EObject current=null] @after { resetLookahead(); }: ((('(' { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Keyword */, null); } { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.1" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.1" /* xtext::RuleCall */, currentNode); } this_Op=ruleOp { @@ -266,13 +303,13 @@ ruleParens returns [EObject current=null] } )')' { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); } )( lv_em='!' { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.1/@terminal" /* xtext::Keyword */, "em"); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.1/@terminal" /* xtext::Keyword */, "em"); } { @@ -298,7 +335,7 @@ ruleParens returns [EObject current=null] // Entry rule entryRuleTrickyA1 entryRuleTrickyA1 returns [EObject current=null] : - { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.5" /* xtext::ParserRule */, currentNode); } + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.6" /* xtext::ParserRule */, currentNode); } iv_ruleTrickyA1=ruleTrickyA1 { $current=$iv_ruleTrickyA1.current; } EOF @@ -312,7 +349,7 @@ ruleTrickyA1 returns [EObject current=null] lv_name=RULE_ID { - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.5/@alternatives/@terminal" /* xtext::RuleCall */, "name"); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.6/@alternatives/@terminal" /* xtext::RuleCall */, "name"); } { @@ -344,6 +381,169 @@ ruleTrickyA1 returns [EObject current=null] +// Entry rule entryRuleTrickyG +entryRuleTrickyG returns [EObject current=null] : + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.12" /* xtext::ParserRule */, currentNode); } + iv_ruleTrickyG=ruleTrickyG + { $current=$iv_ruleTrickyG.current; } + EOF +; + +// Rule TrickyG +ruleTrickyG returns [EObject current=null] + @init { EObject temp=null; setCurrentLookahead(); resetLookahead(); } + @after { resetLookahead(); }: +('TG' + { + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.12/@alternatives/@abstractTokens.0" /* xtext::Keyword */, null); + } +( + + + { + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.12/@alternatives/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + } + lv_tree=ruleTrickyG1 + { + if ($current==null) { + $current = factory.create("TrickyG"); + associateNodeWithAstElement(currentNode.getParent(), $current); + } + + try { + factory.set($current, "tree", lv_tree, "TrickyG1", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + } + +)); + + + + + +// Entry rule entryRuleTrickyG1 +entryRuleTrickyG1 returns [EObject current=null] : + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13" /* xtext::ParserRule */, currentNode); } + iv_ruleTrickyG1=ruleTrickyG1 + { $current=$iv_ruleTrickyG1.current; } + EOF +; + +// Rule TrickyG1 +ruleTrickyG1 returns [EObject current=null] + @init { EObject temp=null; setCurrentLookahead(); resetLookahead(); } + @after { resetLookahead(); }: +(('[' + { + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.0" /* xtext::Keyword */, null); + } +(( + + + { + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.1/@abstractTokens.0/@terminal" /* xtext::RuleCall */, currentNode); + } + lv_vals=ruleTrickyG2 + { + if ($current==null) { + $current = factory.create("TrickyG1"); + associateNodeWithAstElement(currentNode.getParent(), $current); + } + + try { + factory.add($current, "vals", lv_vals, "TrickyG2", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + } + +)(',' + { + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.1/@abstractTokens.1/@abstractTokens.0" /* xtext::Keyword */, null); + } +( + + + { + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.1/@abstractTokens.1/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + } + lv_vals=ruleTrickyG2 + { + if ($current==null) { + $current = factory.create("TrickyG1"); + associateNodeWithAstElement(currentNode.getParent(), $current); + } + + try { + factory.add($current, "vals", lv_vals, "TrickyG2", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + } + +))*)?)']' + { + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.1" /* xtext::Keyword */, null); + } +); + + + + + +// Entry rule entryRuleTrickyG2 +entryRuleTrickyG2 returns [EObject current=null] : + { currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.14" /* xtext::ParserRule */, currentNode); } + iv_ruleTrickyG2=ruleTrickyG2 + { $current=$iv_ruleTrickyG2.current; } + EOF +; + +// Rule TrickyG2 +ruleTrickyG2 returns [EObject current=null] + @init { EObject temp=null; setCurrentLookahead(); resetLookahead(); } + @after { resetLookahead(); }: +( + { + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.14/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); + } + this_TrickyG1=ruleTrickyG1 + { + $current = $this_TrickyG1.current; + currentNode = currentNode.getParent(); + } + + |( + + lv_val=RULE_INT + { + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.14/@alternatives/@groups.1/@terminal" /* xtext::RuleCall */, "val"); + } + + { + if ($current==null) { + $current = factory.create("TrickyG2"); + associateNodeWithAstElement(currentNode, $current); + } + + try { + factory.set($current, "val", lv_val, "INT", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + } + +)); + + + + + RULE_ID : ('^')?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; RULE_INT : ('0'..'9')+; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.tokens b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.tokens index 86ad6d1..8107705 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.tokens +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.tokens @@ -5,8 +5,12 @@ RULE_INT=5 RULE_STRING=6 RULE_ANY_OTHER=10 RULE_SL_COMMENT=8 +','=18 '('=13 +'TG'=16 ')'=14 +'['=17 '-'=12 '+'=11 '!'=15 +']'=19 diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageLexer.java index 000b321..2f39149 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g 2009-01-06 10:50:08 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g 2009-01-12 18:22:28 package org.eclipse.xtext.parsetree.reconstr.parser.internal; @@ -16,17 +16,21 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public static final int RULE_ML_COMMENT=7; public static final int T14=14; public static final int RULE_ID=4; - public static final int RULE_WS=9; public static final int T11=11; - public static final int T15=15; - public static final int EOF=-1; - public static final int RULE_INT=5; public static final int RULE_STRING=6; public static final int T12=12; - public static final int Tokens=16; + public static final int T13=13; + public static final int T18=18; + public static final int RULE_WS=9; + public static final int T15=15; + public static final int RULE_INT=5; + public static final int EOF=-1; + public static final int T17=17; + public static final int Tokens=20; public static final int RULE_ANY_OTHER=10; + public static final int T16=16; public static final int RULE_SL_COMMENT=8; - public static final int T13=13; + public static final int T19=19; public InternalComplexReconstrTestLanguageLexer() {;} public InternalComplexReconstrTestLanguageLexer(CharStream input) { super(input); @@ -123,14 +127,87 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } // $ANTLR end T15 + // $ANTLR start T16 + public final void mT16() throws RecognitionException { + try { + int _type = T16; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:15:5: ( 'TG' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:15:7: 'TG' + { + match("TG"); + + + } + + this.type = _type; + } + finally { + } + } + // $ANTLR end T16 + + // $ANTLR start T17 + public final void mT17() throws RecognitionException { + try { + int _type = T17; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:16:5: ( '[' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:16:7: '[' + { + match('['); + + } + + this.type = _type; + } + finally { + } + } + // $ANTLR end T17 + + // $ANTLR start T18 + public final void mT18() throws RecognitionException { + try { + int _type = T18; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:17:5: ( ',' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:17:7: ',' + { + match(','); + + } + + this.type = _type; + } + finally { + } + } + // $ANTLR end T18 + + // $ANTLR start T19 + public final void mT19() throws RecognitionException { + try { + int _type = T19; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:18:5: ( ']' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:18:7: ']' + { + match(']'); + + } + + this.type = _type; + } + finally { + } + } + // $ANTLR end T19 + // $ANTLR start RULE_ID public final void mRULE_ID() throws RecognitionException { try { int _type = RULE_ID; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:347:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:347:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:547:9: ( ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:547:11: ( '^' )? ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:347:11: ( '^' )? + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:547:11: ( '^' )? int alt1=2; int LA1_0 = input.LA(1); @@ -139,7 +216,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } switch (alt1) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:347:12: '^' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:547:12: '^' { match('^'); @@ -158,7 +235,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { recover(mse); throw mse; } - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:347:41: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:547:41: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* loop2: do { int alt2=2; @@ -206,10 +283,10 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public final void mRULE_INT() throws RecognitionException { try { int _type = RULE_INT; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:349:10: ( ( '0' .. '9' )+ ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:349:12: ( '0' .. '9' )+ + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:549:10: ( ( '0' .. '9' )+ ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:549:12: ( '0' .. '9' )+ { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:349:12: ( '0' .. '9' )+ + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:549:12: ( '0' .. '9' )+ int cnt3=0; loop3: do { @@ -223,7 +300,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { switch (alt3) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:349:13: '0' .. '9' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:549:13: '0' .. '9' { matchRange('0','9'); @@ -253,7 +330,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public final void mRULE_STRING() throws RecognitionException { try { int _type = RULE_STRING; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:13: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* '\\'' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:13: ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* '\\'' ) int alt6=2; int LA6_0 = input.LA(1); @@ -265,16 +342,16 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } else { NoViableAltException nvae = - new NoViableAltException("351:1: RULE_STRING : ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* '\\'' );", 6, 0, input); + new NoViableAltException("551:1: RULE_STRING : ( '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* '\"' | '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* '\\'' );", 6, 0, input); throw nvae; } switch (alt6) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:15: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* '\"' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:15: '\"' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* '\"' { match('\"'); - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:19: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:19: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\"' ) )* loop4: do { int alt4=3; @@ -290,7 +367,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { switch (alt4) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:21: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:21: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) { match('\\'); if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) { @@ -307,7 +384,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } break; case 2 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:65: ~ ( '\\\\' | '\"' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:65: ~ ( '\\\\' | '\"' ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) { input.consume(); @@ -333,10 +410,10 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } break; case 2 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:101: '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* '\\'' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:101: '\\'' ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* '\\'' { match('\''); - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:106: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:106: ( '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) | ~ ( '\\\\' | '\\'' ) )* loop5: do { int alt5=3; @@ -352,7 +429,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { switch (alt5) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:108: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:108: '\\\\' ( 'b' | 't' | 'n' | 'f' | 'r' | '\\\"' | '\\'' | '\\\\' ) { match('\\'); if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='\\'||input.LA(1)=='b'||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t' ) { @@ -369,7 +446,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } break; case 2 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:351:152: ~ ( '\\\\' | '\\'' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:551:152: ~ ( '\\\\' | '\\'' ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='&')||(input.LA(1)>='(' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFE') ) { input.consume(); @@ -407,12 +484,12 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public final void mRULE_ML_COMMENT() throws RecognitionException { try { int _type = RULE_ML_COMMENT; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:353:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:353:19: '/*' ( options {greedy=false; } : . )* '*/' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:553:17: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:553:19: '/*' ( options {greedy=false; } : . )* '*/' { match("/*"); - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:353:24: ( options {greedy=false; } : . )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:553:24: ( options {greedy=false; } : . )* loop7: do { int alt7=2; @@ -437,7 +514,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { switch (alt7) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:353:52: . + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:553:52: . { matchAny(); @@ -466,12 +543,12 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public final void mRULE_SL_COMMENT() throws RecognitionException { try { int _type = RULE_SL_COMMENT; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:17: ( '//' (~ ( '\\n' | '\\r' ) )* ( ( '\\r' )? '\\n' )? ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:19: '//' (~ ( '\\n' | '\\r' ) )* ( ( '\\r' )? '\\n' )? + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:17: ( '//' (~ ( '\\n' | '\\r' ) )* ( ( '\\r' )? '\\n' )? ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:19: '//' (~ ( '\\n' | '\\r' ) )* ( ( '\\r' )? '\\n' )? { match("//"); - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:24: (~ ( '\\n' | '\\r' ) )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:24: (~ ( '\\n' | '\\r' ) )* loop8: do { int alt8=2; @@ -484,7 +561,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { switch (alt8) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:24: ~ ( '\\n' | '\\r' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:24: ~ ( '\\n' | '\\r' ) { if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFE') ) { input.consume(); @@ -505,7 +582,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } } while (true); - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:38: ( ( '\\r' )? '\\n' )? + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:38: ( ( '\\r' )? '\\n' )? int alt10=2; int LA10_0 = input.LA(1); @@ -514,9 +591,9 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } switch (alt10) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:39: ( '\\r' )? '\\n' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:39: ( '\\r' )? '\\n' { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:39: ( '\\r' )? + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:39: ( '\\r' )? int alt9=2; int LA9_0 = input.LA(1); @@ -525,7 +602,7 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } switch (alt9) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:355:39: '\\r' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:555:39: '\\r' { match('\r'); @@ -556,10 +633,10 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public final void mRULE_WS() throws RecognitionException { try { int _type = RULE_WS; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:357:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:357:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:557:9: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:557:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:357:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:557:11: ( ' ' | '\\t' | '\\r' | '\\n' )+ int cnt11=0; loop11: do { @@ -613,8 +690,8 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { public final void mRULE_ANY_OTHER() throws RecognitionException { try { int _type = RULE_ANY_OTHER; - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:359:16: ( . ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:359:18: . + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:559:16: ( . ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:559:18: . { matchAny(); @@ -628,8 +705,8 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { // $ANTLR end RULE_ANY_OTHER public void mTokens() throws RecognitionException { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:8: ( T11 | T12 | T13 | T14 | T15 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER ) - int alt12=12; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:8: ( T11 | T12 | T13 | T14 | T15 | T16 | T17 | T18 | T19 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER ) + int alt12=16; int LA12_0 = input.LA(1); if ( (LA12_0=='+') ) { @@ -647,64 +724,88 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { else if ( (LA12_0=='!') ) { alt12=5; } - else if ( (LA12_0=='^') ) { + else if ( (LA12_0=='T') ) { int LA12_6 = input.LA(2); - if ( ((LA12_6>='A' && LA12_6<='Z')||LA12_6=='_'||(LA12_6>='a' && LA12_6<='z')) ) { - alt12=6; + if ( (LA12_6=='G') ) { + int LA12_23 = input.LA(3); + + if ( ((LA12_23>='0' && LA12_23<='9')||(LA12_23>='A' && LA12_23<='Z')||LA12_23=='_'||(LA12_23>='a' && LA12_23<='z')) ) { + alt12=10; + } + else { + alt12=6;} + } + else { + alt12=10;} + } + else if ( (LA12_0=='[') ) { + alt12=7; + } + else if ( (LA12_0==',') ) { + alt12=8; + } + else if ( (LA12_0==']') ) { + alt12=9; + } + else if ( (LA12_0=='^') ) { + int LA12_10 = input.LA(2); + + if ( ((LA12_10>='A' && LA12_10<='Z')||LA12_10=='_'||(LA12_10>='a' && LA12_10<='z')) ) { + alt12=10; } else { - alt12=12;} + alt12=16;} } - else if ( ((LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||(LA12_0>='a' && LA12_0<='z')) ) { - alt12=6; + else if ( ((LA12_0>='A' && LA12_0<='S')||(LA12_0>='U' && LA12_0<='Z')||LA12_0=='_'||(LA12_0>='a' && LA12_0<='z')) ) { + alt12=10; } else if ( ((LA12_0>='0' && LA12_0<='9')) ) { - alt12=7; + alt12=11; } else if ( (LA12_0=='\"') ) { - int LA12_9 = input.LA(2); + int LA12_13 = input.LA(2); - if ( ((LA12_9>='\u0000' && LA12_9<='\uFFFE')) ) { - alt12=8; + if ( ((LA12_13>='\u0000' && LA12_13<='\uFFFE')) ) { + alt12=12; } else { - alt12=12;} + alt12=16;} } else if ( (LA12_0=='\'') ) { - int LA12_10 = input.LA(2); + int LA12_14 = input.LA(2); - if ( ((LA12_10>='\u0000' && LA12_10<='\uFFFE')) ) { - alt12=8; + if ( ((LA12_14>='\u0000' && LA12_14<='\uFFFE')) ) { + alt12=12; } else { - alt12=12;} + alt12=16;} } else if ( (LA12_0=='/') ) { switch ( input.LA(2) ) { case '/': { - alt12=10; + alt12=14; } break; case '*': { - alt12=9; + alt12=13; } break; default: - alt12=12;} + alt12=16;} } else if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) { - alt12=11; + alt12=15; } - else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||(LA12_0>='#' && LA12_0<='&')||LA12_0=='*'||LA12_0==','||LA12_0=='.'||(LA12_0>=':' && LA12_0<='@')||(LA12_0>='[' && LA12_0<=']')||LA12_0=='`'||(LA12_0>='{' && LA12_0<='\uFFFE')) ) { - alt12=12; + else if ( ((LA12_0>='\u0000' && LA12_0<='\b')||(LA12_0>='\u000B' && LA12_0<='\f')||(LA12_0>='\u000E' && LA12_0<='\u001F')||(LA12_0>='#' && LA12_0<='&')||LA12_0=='*'||LA12_0=='.'||(LA12_0>=':' && LA12_0<='@')||LA12_0=='\\'||LA12_0=='`'||(LA12_0>='{' && LA12_0<='\uFFFE')) ) { + alt12=16; } else { NoViableAltException nvae = - new NoViableAltException("1:1: Tokens : ( T11 | T12 | T13 | T14 | T15 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );", 12, 0, input); + new NoViableAltException("1:1: Tokens : ( T11 | T12 | T13 | T14 | T15 | T16 | T17 | T18 | T19 | RULE_ID | RULE_INT | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER );", 12, 0, input); throw nvae; } @@ -745,49 +846,77 @@ public class InternalComplexReconstrTestLanguageLexer extends Lexer { } break; case 6 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:30: RULE_ID + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:30: T16 { - mRULE_ID(); + mT16(); } break; case 7 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:38: RULE_INT + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:34: T17 { - mRULE_INT(); + mT17(); } break; case 8 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:47: RULE_STRING + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:38: T18 { - mRULE_STRING(); + mT18(); } break; case 9 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:59: RULE_ML_COMMENT + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:42: T19 { - mRULE_ML_COMMENT(); + mT19(); } break; case 10 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:75: RULE_SL_COMMENT + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:46: RULE_ID { - mRULE_SL_COMMENT(); + mRULE_ID(); } break; case 11 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:91: RULE_WS + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:54: RULE_INT { - mRULE_WS(); + mRULE_INT(); } break; case 12 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:99: RULE_ANY_OTHER + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:63: RULE_STRING + { + mRULE_STRING(); + + } + break; + case 13 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:75: RULE_ML_COMMENT + { + mRULE_ML_COMMENT(); + + } + break; + case 14 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:91: RULE_SL_COMMENT + { + mRULE_SL_COMMENT(); + + } + break; + case 15 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:107: RULE_WS + { + mRULE_WS(); + + } + break; + case 16 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:1:115: RULE_ANY_OTHER { mRULE_ANY_OTHER(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageParser.java index a93c141..0d0ca5f 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g 2009-01-06 10:50:08 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g 2009-01-12 18:22:27 package org.eclipse.xtext.parsetree.reconstr.parser.internal; @@ -23,7 +23,7 @@ import java.util.ArrayList; public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrParser { public static final String[] tokenNames = new String[] { - "<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'+'", "'-'", "'('", "')'", "'!'" + "<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_ID", "RULE_INT", "RULE_STRING", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'+'", "'-'", "'('", "')'", "'!'", "'TG'", "'['", "','", "']'" }; public static final int RULE_ML_COMMENT=7; public static final int RULE_ID=4; @@ -58,13 +58,134 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars @Override protected String getFirstRuleName() { - return "Op"; + return "Root"; } + // $ANTLR start entryRuleRoot + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:66:1: entryRuleRoot returns [EObject current=null] : iv_ruleRoot= ruleRoot EOF ; + public final EObject entryRuleRoot() throws RecognitionException { + EObject current = null; + + EObject iv_ruleRoot = null; + + + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:66:46: (iv_ruleRoot= ruleRoot EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:67:2: iv_ruleRoot= ruleRoot EOF + { + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleRoot_in_entryRuleRoot71); + iv_ruleRoot=ruleRoot(); + _fsp--; + + current =iv_ruleRoot; + match(input,EOF,FOLLOW_EOF_in_entryRuleRoot81); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end entryRuleRoot + + + // $ANTLR start ruleRoot + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:74:1: ruleRoot returns [EObject current=null] : (this_Op= ruleOp | this_TrickyG= ruleTrickyG ) ; + public final EObject ruleRoot() throws RecognitionException { + EObject current = null; + + EObject this_Op = null; + + EObject this_TrickyG = null; + + + EObject temp=null; setCurrentLookahead(); resetLookahead(); + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:76:33: ( (this_Op= ruleOp | this_TrickyG= ruleTrickyG ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:77:1: (this_Op= ruleOp | this_TrickyG= ruleTrickyG ) + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:77:1: (this_Op= ruleOp | this_TrickyG= ruleTrickyG ) + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0==RULE_ID||LA1_0==13) ) { + alt1=1; + } + else if ( (LA1_0==16) ) { + alt1=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("77:1: (this_Op= ruleOp | this_TrickyG= ruleTrickyG )", 1, 0, input); + + throw nvae; + } + switch (alt1) { + case 1 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:78:5: this_Op= ruleOp + { + + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); + + pushFollow(FOLLOW_ruleOp_in_ruleRoot128); + this_Op=ruleOp(); + _fsp--; + + + current = this_Op; + currentNode = currentNode.getParent(); + + + } + break; + case 2 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:88:5: this_TrickyG= ruleTrickyG + { + + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@groups.1" /* xtext::RuleCall */, currentNode); + + pushFollow(FOLLOW_ruleTrickyG_in_ruleRoot155); + this_TrickyG=ruleTrickyG(); + _fsp--; + + + current = this_TrickyG; + currentNode = currentNode.getParent(); + + + } + break; + + } + + + } + + resetLookahead(); + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end ruleRoot + + // $ANTLR start entryRuleOp - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:66:1: entryRuleOp returns [EObject current=null] : iv_ruleOp= ruleOp EOF ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:103:1: entryRuleOp returns [EObject current=null] : iv_ruleOp= ruleOp EOF ; public final EObject entryRuleOp() throws RecognitionException { EObject current = null; @@ -72,16 +193,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:66:44: (iv_ruleOp= ruleOp EOF ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:67:2: iv_ruleOp= ruleOp EOF + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:103:44: (iv_ruleOp= ruleOp EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:104:2: iv_ruleOp= ruleOp EOF { - currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0" /* xtext::ParserRule */, currentNode); - pushFollow(FOLLOW_ruleOp_in_entryRuleOp71); + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleOp_in_entryRuleOp187); iv_ruleOp=ruleOp(); _fsp--; current =iv_ruleOp; - match(input,EOF,FOLLOW_EOF_in_entryRuleOp81); + match(input,EOF,FOLLOW_EOF_in_entryRuleOp197); } @@ -99,7 +220,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start ruleOp - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:74:1: ruleOp returns [EObject current=null] : (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:111:1: ruleOp returns [EObject current=null] : (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) ; public final EObject ruleOp() throws RecognitionException { EObject current = null; @@ -112,16 +233,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:76:33: ( (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:77:1: (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:113:33: ( (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:114:1: (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:77:1: (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:78:5: this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:114:1: (this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:115:5: this_Term= ruleTerm ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.0" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.0" /* xtext::RuleCall */, currentNode); - pushFollow(FOLLOW_ruleTerm_in_ruleOp128); + pushFollow(FOLLOW_ruleTerm_in_ruleOp244); this_Term=ruleTerm(); _fsp--; @@ -129,39 +250,39 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars current = this_Term; currentNode = currentNode.getParent(); - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:1: ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* - loop1: + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:1: ( ( ( () '+' ) (lv_addOperands= ruleTerm ) ) | ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) )* + loop2: do { - int alt1=3; - int LA1_0 = input.LA(1); + int alt2=3; + int LA2_0 = input.LA(1); - if ( (LA1_0==11) ) { - alt1=1; + if ( (LA2_0==11) ) { + alt2=1; } - else if ( (LA1_0==12) ) { - alt1=2; + else if ( (LA2_0==12) ) { + alt2=2; } - switch (alt1) { + switch (alt2) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:2: ( ( () '+' ) (lv_addOperands= ruleTerm ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:2: ( ( () '+' ) (lv_addOperands= ruleTerm ) ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:2: ( ( () '+' ) (lv_addOperands= ruleTerm ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:3: ( () '+' ) (lv_addOperands= ruleTerm ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:2: ( ( () '+' ) (lv_addOperands= ruleTerm ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:3: ( () '+' ) (lv_addOperands= ruleTerm ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:3: ( () '+' ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:4: () '+' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:3: ( () '+' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:4: () '+' { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:86:4: () - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:87:5: + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:123:4: () + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:5: { temp=factory.create("Add"); factory.add(temp, "addOperands", current, null /*ParserRule*/, currentNode); current = temp; temp = null; - CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); + CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); newNode.getChildren().add(currentNode); moveLookaheadInfo(currentNode, newNode); currentNode = newNode; @@ -170,20 +291,20 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars } - match(input,11,FOLLOW_11_in_ruleOp148); + match(input,11,FOLLOW_11_in_ruleOp264); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); } - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:102:2: (lv_addOperands= ruleTerm ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:105:6: lv_addOperands= ruleTerm + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:139:2: (lv_addOperands= ruleTerm ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:142:6: lv_addOperands= ruleTerm { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.0/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); - pushFollow(FOLLOW_ruleTerm_in_ruleOp183); + pushFollow(FOLLOW_ruleTerm_in_ruleOp299); lv_addOperands=ruleTerm(); _fsp--; @@ -210,23 +331,23 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars } break; case 2 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:6: ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:161:6: ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:6: ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:7: ( () '-' ) (lv_minusOperands= ruleTerm ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:161:6: ( ( () '-' ) (lv_minusOperands= ruleTerm ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:161:7: ( () '-' ) (lv_minusOperands= ruleTerm ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:7: ( () '-' ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:8: () '-' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:161:7: ( () '-' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:161:8: () '-' { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:124:8: () - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:125:5: + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:161:8: () + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:162:5: { temp=factory.create("Minus"); factory.add(temp, "minusOperands", current, null /*ParserRule*/, currentNode); current = temp; temp = null; - CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); + CompositeNode newNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.0" /* xtext::Action */, currentNode.getParent()); newNode.getChildren().add(currentNode); moveLookaheadInfo(currentNode, newNode); currentNode = newNode; @@ -235,20 +356,20 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars } - match(input,12,FOLLOW_12_in_ruleOp214); + match(input,12,FOLLOW_12_in_ruleOp330); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); } - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:140:2: (lv_minusOperands= ruleTerm ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:143:6: lv_minusOperands= ruleTerm + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:177:2: (lv_minusOperands= ruleTerm ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:180:6: lv_minusOperands= ruleTerm { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.0/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@abstractTokens.1/@groups.1/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); - pushFollow(FOLLOW_ruleTerm_in_ruleOp249); + pushFollow(FOLLOW_ruleTerm_in_ruleOp365); lv_minusOperands=ruleTerm(); _fsp--; @@ -276,7 +397,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars break; default : - break loop1; + break loop2; } } while (true); @@ -301,7 +422,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start entryRuleTerm - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:168:1: entryRuleTerm returns [EObject current=null] : iv_ruleTerm= ruleTerm EOF ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:205:1: entryRuleTerm returns [EObject current=null] : iv_ruleTerm= ruleTerm EOF ; public final EObject entryRuleTerm() throws RecognitionException { EObject current = null; @@ -309,16 +430,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:168:46: (iv_ruleTerm= ruleTerm EOF ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:169:2: iv_ruleTerm= ruleTerm EOF + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:205:46: (iv_ruleTerm= ruleTerm EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:206:2: iv_ruleTerm= ruleTerm EOF { - currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1" /* xtext::ParserRule */, currentNode); - pushFollow(FOLLOW_ruleTerm_in_entryRuleTerm289); + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleTerm_in_entryRuleTerm405); iv_ruleTerm=ruleTerm(); _fsp--; current =iv_ruleTerm; - match(input,EOF,FOLLOW_EOF_in_entryRuleTerm299); + match(input,EOF,FOLLOW_EOF_in_entryRuleTerm415); } @@ -336,7 +457,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start ruleTerm - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:176:1: ruleTerm returns [EObject current=null] : (this_Atom= ruleAtom | this_Parens= ruleParens ) ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:213:1: ruleTerm returns [EObject current=null] : (this_Atom= ruleAtom | this_Parens= ruleParens ) ; public final EObject ruleTerm() throws RecognitionException { EObject current = null; @@ -347,33 +468,33 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:178:33: ( (this_Atom= ruleAtom | this_Parens= ruleParens ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:179:1: (this_Atom= ruleAtom | this_Parens= ruleParens ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:215:33: ( (this_Atom= ruleAtom | this_Parens= ruleParens ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:216:1: (this_Atom= ruleAtom | this_Parens= ruleParens ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:179:1: (this_Atom= ruleAtom | this_Parens= ruleParens ) - int alt2=2; - int LA2_0 = input.LA(1); + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:216:1: (this_Atom= ruleAtom | this_Parens= ruleParens ) + int alt3=2; + int LA3_0 = input.LA(1); - if ( (LA2_0==RULE_ID) ) { - alt2=1; + if ( (LA3_0==RULE_ID) ) { + alt3=1; } - else if ( (LA2_0==13) ) { - alt2=2; + else if ( (LA3_0==13) ) { + alt3=2; } else { NoViableAltException nvae = - new NoViableAltException("179:1: (this_Atom= ruleAtom | this_Parens= ruleParens )", 2, 0, input); + new NoViableAltException("216:1: (this_Atom= ruleAtom | this_Parens= ruleParens )", 3, 0, input); throw nvae; } - switch (alt2) { + switch (alt3) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:180:5: this_Atom= ruleAtom + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:217:5: this_Atom= ruleAtom { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); - pushFollow(FOLLOW_ruleAtom_in_ruleTerm346); + pushFollow(FOLLOW_ruleAtom_in_ruleTerm462); this_Atom=ruleAtom(); _fsp--; @@ -385,12 +506,12 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars } break; case 2 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:190:5: this_Parens= ruleParens + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:227:5: this_Parens= ruleParens { - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.1/@alternatives/@groups.1" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2/@alternatives/@groups.1" /* xtext::RuleCall */, currentNode); - pushFollow(FOLLOW_ruleParens_in_ruleTerm373); + pushFollow(FOLLOW_ruleParens_in_ruleTerm489); this_Parens=ruleParens(); _fsp--; @@ -422,7 +543,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start entryRuleAtom - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:205:1: entryRuleAtom returns [EObject current=null] : iv_ruleAtom= ruleAtom EOF ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:242:1: entryRuleAtom returns [EObject current=null] : iv_ruleAtom= ruleAtom EOF ; public final EObject entryRuleAtom() throws RecognitionException { EObject current = null; @@ -430,16 +551,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:205:46: (iv_ruleAtom= ruleAtom EOF ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:206:2: iv_ruleAtom= ruleAtom EOF + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:242:46: (iv_ruleAtom= ruleAtom EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:243:2: iv_ruleAtom= ruleAtom EOF { - currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2" /* xtext::ParserRule */, currentNode); - pushFollow(FOLLOW_ruleAtom_in_entryRuleAtom405); + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleAtom_in_entryRuleAtom521); iv_ruleAtom=ruleAtom(); _fsp--; current =iv_ruleAtom; - match(input,EOF,FOLLOW_EOF_in_entryRuleAtom415); + match(input,EOF,FOLLOW_EOF_in_entryRuleAtom531); } @@ -457,7 +578,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start ruleAtom - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:213:1: ruleAtom returns [EObject current=null] : (lv_name= RULE_ID ) ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:250:1: ruleAtom returns [EObject current=null] : (lv_name= RULE_ID ) ; public final EObject ruleAtom() throws RecognitionException { EObject current = null; @@ -465,16 +586,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:215:33: ( (lv_name= RULE_ID ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:216:1: (lv_name= RULE_ID ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:252:33: ( (lv_name= RULE_ID ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:253:1: (lv_name= RULE_ID ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:216:1: (lv_name= RULE_ID ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:218:6: lv_name= RULE_ID + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:253:1: (lv_name= RULE_ID ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:255:6: lv_name= RULE_ID { lv_name=(Token)input.LT(1); - match(input,RULE_ID,FOLLOW_RULE_ID_in_ruleAtom460); + match(input,RULE_ID,FOLLOW_RULE_ID_in_ruleAtom576); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.2/@alternatives/@terminal" /* xtext::RuleCall */, "name"); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@terminal" /* xtext::RuleCall */, "name"); if (current==null) { @@ -509,7 +630,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start entryRuleParens - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:243:1: entryRuleParens returns [EObject current=null] : iv_ruleParens= ruleParens EOF ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:280:1: entryRuleParens returns [EObject current=null] : iv_ruleParens= ruleParens EOF ; public final EObject entryRuleParens() throws RecognitionException { EObject current = null; @@ -517,16 +638,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:243:48: (iv_ruleParens= ruleParens EOF ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:244:2: iv_ruleParens= ruleParens EOF + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:280:48: (iv_ruleParens= ruleParens EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:281:2: iv_ruleParens= ruleParens EOF { - currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3" /* xtext::ParserRule */, currentNode); - pushFollow(FOLLOW_ruleParens_in_entryRuleParens503); + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleParens_in_entryRuleParens619); iv_ruleParens=ruleParens(); _fsp--; current =iv_ruleParens; - match(input,EOF,FOLLOW_EOF_in_entryRuleParens513); + match(input,EOF,FOLLOW_EOF_in_entryRuleParens629); } @@ -544,7 +665,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start ruleParens - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:251:1: ruleParens returns [EObject current=null] : ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:288:1: ruleParens returns [EObject current=null] : ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) ; public final EObject ruleParens() throws RecognitionException { EObject current = null; @@ -554,26 +675,26 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:253:33: ( ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:1: ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:290:33: ( ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:1: ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:1: ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:2: ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:1: ( ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:2: ( ( '(' this_Op= ruleOp ) ')' ) (lv_em= '!' )? { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:2: ( ( '(' this_Op= ruleOp ) ')' ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:3: ( '(' this_Op= ruleOp ) ')' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:2: ( ( '(' this_Op= ruleOp ) ')' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:3: ( '(' this_Op= ruleOp ) ')' { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:3: ( '(' this_Op= ruleOp ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:254:4: '(' this_Op= ruleOp + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:3: ( '(' this_Op= ruleOp ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:291:4: '(' this_Op= ruleOp { - match(input,13,FOLLOW_13_in_ruleParens549); + match(input,13,FOLLOW_13_in_ruleParens665); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.0" /* xtext::Keyword */, null); - currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.1" /* xtext::RuleCall */, currentNode); + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.0/@abstractTokens.0/@abstractTokens.1" /* xtext::RuleCall */, currentNode); - pushFollow(FOLLOW_ruleOp_in_ruleParens571); + pushFollow(FOLLOW_ruleOp_in_ruleParens687); this_Op=ruleOp(); _fsp--; @@ -584,28 +705,28 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars } - match(input,14,FOLLOW_14_in_ruleParens580); + match(input,14,FOLLOW_14_in_ruleParens696); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.0/@abstractTokens.1" /* xtext::Keyword */, null); } - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:271:2: (lv_em= '!' )? - int alt3=2; - int LA3_0 = input.LA(1); + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:308:2: (lv_em= '!' )? + int alt4=2; + int LA4_0 = input.LA(1); - if ( (LA3_0==15) ) { - alt3=1; + if ( (LA4_0==15) ) { + alt4=1; } - switch (alt3) { + switch (alt4) { case 1 : - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:273:6: lv_em= '!' + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:310:6: lv_em= '!' { lv_em=(Token)input.LT(1); - match(input,15,FOLLOW_15_in_ruleParens602); + match(input,15,FOLLOW_15_in_ruleParens718); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.3/@alternatives/@abstractTokens.1/@terminal" /* xtext::Keyword */, "em"); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.4/@alternatives/@abstractTokens.1/@terminal" /* xtext::Keyword */, "em"); if (current==null) { @@ -646,7 +767,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start entryRuleTrickyA1 - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:300:1: entryRuleTrickyA1 returns [EObject current=null] : iv_ruleTrickyA1= ruleTrickyA1 EOF ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:337:1: entryRuleTrickyA1 returns [EObject current=null] : iv_ruleTrickyA1= ruleTrickyA1 EOF ; public final EObject entryRuleTrickyA1() throws RecognitionException { EObject current = null; @@ -654,16 +775,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:300:50: (iv_ruleTrickyA1= ruleTrickyA1 EOF ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:301:2: iv_ruleTrickyA1= ruleTrickyA1 EOF + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:337:50: (iv_ruleTrickyA1= ruleTrickyA1 EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:338:2: iv_ruleTrickyA1= ruleTrickyA1 EOF { - currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.5" /* xtext::ParserRule */, currentNode); - pushFollow(FOLLOW_ruleTrickyA1_in_entryRuleTrickyA1650); + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.6" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleTrickyA1_in_entryRuleTrickyA1766); iv_ruleTrickyA1=ruleTrickyA1(); _fsp--; current =iv_ruleTrickyA1; - match(input,EOF,FOLLOW_EOF_in_entryRuleTrickyA1660); + match(input,EOF,FOLLOW_EOF_in_entryRuleTrickyA1776); } @@ -681,7 +802,7 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR start ruleTrickyA1 - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:308:1: ruleTrickyA1 returns [EObject current=null] : (lv_name= RULE_ID ) ; + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:345:1: ruleTrickyA1 returns [EObject current=null] : (lv_name= RULE_ID ) ; public final EObject ruleTrickyA1() throws RecognitionException { EObject current = null; @@ -689,16 +810,16 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars EObject temp=null; setCurrentLookahead(); resetLookahead(); try { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:310:33: ( (lv_name= RULE_ID ) ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:311:1: (lv_name= RULE_ID ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:347:33: ( (lv_name= RULE_ID ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:348:1: (lv_name= RULE_ID ) { - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:311:1: (lv_name= RULE_ID ) - // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:313:6: lv_name= RULE_ID + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:348:1: (lv_name= RULE_ID ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:350:6: lv_name= RULE_ID { lv_name=(Token)input.LT(1); - match(input,RULE_ID,FOLLOW_RULE_ID_in_ruleTrickyA1705); + match(input,RULE_ID,FOLLOW_RULE_ID_in_ruleTrickyA1821); - createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.5/@alternatives/@terminal" /* xtext::RuleCall */, "name"); + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.6/@alternatives/@terminal" /* xtext::RuleCall */, "name"); if (current==null) { @@ -732,30 +853,464 @@ public class InternalComplexReconstrTestLanguageParser extends AbstractAntlrPars // $ANTLR end ruleTrickyA1 + // $ANTLR start entryRuleTrickyG + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:385:1: entryRuleTrickyG returns [EObject current=null] : iv_ruleTrickyG= ruleTrickyG EOF ; + public final EObject entryRuleTrickyG() throws RecognitionException { + EObject current = null; + + EObject iv_ruleTrickyG = null; + + + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:385:49: (iv_ruleTrickyG= ruleTrickyG EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:386:2: iv_ruleTrickyG= ruleTrickyG EOF + { + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.12" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleTrickyG_in_entryRuleTrickyG874); + iv_ruleTrickyG=ruleTrickyG(); + _fsp--; + + current =iv_ruleTrickyG; + match(input,EOF,FOLLOW_EOF_in_entryRuleTrickyG884); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end entryRuleTrickyG + + + // $ANTLR start ruleTrickyG + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:393:1: ruleTrickyG returns [EObject current=null] : ( 'TG' (lv_tree= ruleTrickyG1 ) ) ; + public final EObject ruleTrickyG() throws RecognitionException { + EObject current = null; + + EObject lv_tree = null; + + + EObject temp=null; setCurrentLookahead(); resetLookahead(); + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:395:33: ( ( 'TG' (lv_tree= ruleTrickyG1 ) ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:396:1: ( 'TG' (lv_tree= ruleTrickyG1 ) ) + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:396:1: ( 'TG' (lv_tree= ruleTrickyG1 ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:396:2: 'TG' (lv_tree= ruleTrickyG1 ) + { + match(input,16,FOLLOW_16_in_ruleTrickyG918); + + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.12/@alternatives/@abstractTokens.0" /* xtext::Keyword */, null); + + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:400:1: (lv_tree= ruleTrickyG1 ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:403:6: lv_tree= ruleTrickyG1 + { + + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.12/@alternatives/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + + pushFollow(FOLLOW_ruleTrickyG1_in_ruleTrickyG952); + lv_tree=ruleTrickyG1(); + _fsp--; + + + if (current==null) { + current = factory.create("TrickyG"); + associateNodeWithAstElement(currentNode.getParent(), current); + } + + try { + factory.set(current, "tree", lv_tree, "TrickyG1", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + + + } + + + } + + + } + + resetLookahead(); + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end ruleTrickyG + + + // $ANTLR start entryRuleTrickyG1 + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:428:1: entryRuleTrickyG1 returns [EObject current=null] : iv_ruleTrickyG1= ruleTrickyG1 EOF ; + public final EObject entryRuleTrickyG1() throws RecognitionException { + EObject current = null; + + EObject iv_ruleTrickyG1 = null; + + + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:428:50: (iv_ruleTrickyG1= ruleTrickyG1 EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:429:2: iv_ruleTrickyG1= ruleTrickyG1 EOF + { + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleTrickyG1_in_entryRuleTrickyG1989); + iv_ruleTrickyG1=ruleTrickyG1(); + _fsp--; + + current =iv_ruleTrickyG1; + match(input,EOF,FOLLOW_EOF_in_entryRuleTrickyG1999); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end entryRuleTrickyG1 + + + // $ANTLR start ruleTrickyG1 + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:436:1: ruleTrickyG1 returns [EObject current=null] : ( ( '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? ) ']' ) ; + public final EObject ruleTrickyG1() throws RecognitionException { + EObject current = null; + + EObject lv_vals = null; + + + EObject temp=null; setCurrentLookahead(); resetLookahead(); + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:438:33: ( ( ( '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? ) ']' ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:439:1: ( ( '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? ) ']' ) + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:439:1: ( ( '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? ) ']' ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:439:2: ( '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? ) ']' + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:439:2: ( '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:439:3: '[' ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? + { + match(input,17,FOLLOW_17_in_ruleTrickyG11034); + + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.0" /* xtext::Keyword */, null); + + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:443:1: ( (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* )? + int alt6=2; + int LA6_0 = input.LA(1); + + if ( (LA6_0==RULE_INT||LA6_0==17) ) { + alt6=1; + } + switch (alt6) { + case 1 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:443:2: (lv_vals= ruleTrickyG2 ) ( ',' (lv_vals= ruleTrickyG2 ) )* + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:443:2: (lv_vals= ruleTrickyG2 ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:446:6: lv_vals= ruleTrickyG2 + { + + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.1/@abstractTokens.0/@terminal" /* xtext::RuleCall */, currentNode); + + pushFollow(FOLLOW_ruleTrickyG2_in_ruleTrickyG11069); + lv_vals=ruleTrickyG2(); + _fsp--; + + + if (current==null) { + current = factory.create("TrickyG1"); + associateNodeWithAstElement(currentNode.getParent(), current); + } + + try { + factory.add(current, "vals", lv_vals, "TrickyG2", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + + + } + + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:464:2: ( ',' (lv_vals= ruleTrickyG2 ) )* + loop5: + do { + int alt5=2; + int LA5_0 = input.LA(1); + + if ( (LA5_0==18) ) { + alt5=1; + } + + + switch (alt5) { + case 1 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:464:3: ',' (lv_vals= ruleTrickyG2 ) + { + match(input,18,FOLLOW_18_in_ruleTrickyG11083); + + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.1/@abstractTokens.1/@abstractTokens.0" /* xtext::Keyword */, null); + + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:468:1: (lv_vals= ruleTrickyG2 ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:471:6: lv_vals= ruleTrickyG2 + { + + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.0/@abstractTokens.1/@abstractTokens.1/@abstractTokens.1/@terminal" /* xtext::RuleCall */, currentNode); + + pushFollow(FOLLOW_ruleTrickyG2_in_ruleTrickyG11117); + lv_vals=ruleTrickyG2(); + _fsp--; + + + if (current==null) { + current = factory.create("TrickyG1"); + associateNodeWithAstElement(currentNode.getParent(), current); + } + + try { + factory.add(current, "vals", lv_vals, "TrickyG2", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + currentNode = currentNode.getParent(); + + + } + + + } + break; + + default : + break loop5; + } + } while (true); + + + } + break; + + } + + + } + + match(input,19,FOLLOW_19_in_ruleTrickyG11135); + + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.13/@alternatives/@abstractTokens.1" /* xtext::Keyword */, null); + + + } + + + } + + resetLookahead(); + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end ruleTrickyG1 + + + // $ANTLR start entryRuleTrickyG2 + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:500:1: entryRuleTrickyG2 returns [EObject current=null] : iv_ruleTrickyG2= ruleTrickyG2 EOF ; + public final EObject entryRuleTrickyG2() throws RecognitionException { + EObject current = null; + + EObject iv_ruleTrickyG2 = null; + + + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:500:50: (iv_ruleTrickyG2= ruleTrickyG2 EOF ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:501:2: iv_ruleTrickyG2= ruleTrickyG2 EOF + { + currentNode = createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.14" /* xtext::ParserRule */, currentNode); + pushFollow(FOLLOW_ruleTrickyG2_in_entryRuleTrickyG21168); + iv_ruleTrickyG2=ruleTrickyG2(); + _fsp--; + + current =iv_ruleTrickyG2; + match(input,EOF,FOLLOW_EOF_in_entryRuleTrickyG21178); + + } + + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end entryRuleTrickyG2 + + + // $ANTLR start ruleTrickyG2 + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:508:1: ruleTrickyG2 returns [EObject current=null] : (this_TrickyG1= ruleTrickyG1 | (lv_val= RULE_INT ) ) ; + public final EObject ruleTrickyG2() throws RecognitionException { + EObject current = null; + + Token lv_val=null; + EObject this_TrickyG1 = null; + + + EObject temp=null; setCurrentLookahead(); resetLookahead(); + try { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:510:33: ( (this_TrickyG1= ruleTrickyG1 | (lv_val= RULE_INT ) ) ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:511:1: (this_TrickyG1= ruleTrickyG1 | (lv_val= RULE_INT ) ) + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:511:1: (this_TrickyG1= ruleTrickyG1 | (lv_val= RULE_INT ) ) + int alt7=2; + int LA7_0 = input.LA(1); + + if ( (LA7_0==17) ) { + alt7=1; + } + else if ( (LA7_0==RULE_INT) ) { + alt7=2; + } + else { + NoViableAltException nvae = + new NoViableAltException("511:1: (this_TrickyG1= ruleTrickyG1 | (lv_val= RULE_INT ) )", 7, 0, input); + + throw nvae; + } + switch (alt7) { + case 1 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:512:5: this_TrickyG1= ruleTrickyG1 + { + + currentNode=createCompositeNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.14/@alternatives/@groups.0" /* xtext::RuleCall */, currentNode); + + pushFollow(FOLLOW_ruleTrickyG1_in_ruleTrickyG21225); + this_TrickyG1=ruleTrickyG1(); + _fsp--; + + + current = this_TrickyG1; + currentNode = currentNode.getParent(); + + + } + break; + case 2 : + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:521:6: (lv_val= RULE_INT ) + { + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:521:6: (lv_val= RULE_INT ) + // ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g:523:6: lv_val= RULE_INT + { + lv_val=(Token)input.LT(1); + match(input,RULE_INT,FOLLOW_RULE_INT_in_ruleTrickyG21251); + + createLeafNode("classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi#//@rules.14/@alternatives/@groups.1/@terminal" /* xtext::RuleCall */, "val"); + + + if (current==null) { + current = factory.create("TrickyG2"); + associateNodeWithAstElement(currentNode, current); + } + + try { + factory.set(current, "val", lv_val, "INT", currentNode); + } catch (ValueConverterException vce) { + handleValueConverterException(vce); + } + + + } + + + } + break; + + } + + + } + + resetLookahead(); + } + + catch (RecognitionException re) { + recover(input,re); + appendSkippedTokens(); + } + finally { + } + return current; + } + // $ANTLR end ruleTrickyG2 + + - public static final BitSet FOLLOW_ruleOp_in_entryRuleOp71 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleOp81 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleTerm_in_ruleOp128 = new BitSet(new long[]{0x0000000000001802L}); - public static final BitSet FOLLOW_11_in_ruleOp148 = new BitSet(new long[]{0x0000000000002010L}); - public static final BitSet FOLLOW_ruleTerm_in_ruleOp183 = new BitSet(new long[]{0x0000000000001802L}); - public static final BitSet FOLLOW_12_in_ruleOp214 = new BitSet(new long[]{0x0000000000002010L}); - public static final BitSet FOLLOW_ruleTerm_in_ruleOp249 = new BitSet(new long[]{0x0000000000001802L}); - public static final BitSet FOLLOW_ruleTerm_in_entryRuleTerm289 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleTerm299 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleAtom_in_ruleTerm346 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleParens_in_ruleTerm373 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleAtom_in_entryRuleAtom405 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleAtom415 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_RULE_ID_in_ruleAtom460 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleParens_in_entryRuleParens503 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleParens513 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_13_in_ruleParens549 = new BitSet(new long[]{0x0000000000002010L}); - public static final BitSet FOLLOW_ruleOp_in_ruleParens571 = new BitSet(new long[]{0x0000000000004000L}); - public static final BitSet FOLLOW_14_in_ruleParens580 = new BitSet(new long[]{0x0000000000008002L}); - public static final BitSet FOLLOW_15_in_ruleParens602 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ruleTrickyA1_in_entryRuleTrickyA1650 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_entryRuleTrickyA1660 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_RULE_ID_in_ruleTrickyA1705 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleRoot_in_entryRuleRoot71 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleRoot81 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleOp_in_ruleRoot128 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTrickyG_in_ruleRoot155 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleOp_in_entryRuleOp187 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleOp197 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTerm_in_ruleOp244 = new BitSet(new long[]{0x0000000000001802L}); + public static final BitSet FOLLOW_11_in_ruleOp264 = new BitSet(new long[]{0x0000000000002010L}); + public static final BitSet FOLLOW_ruleTerm_in_ruleOp299 = new BitSet(new long[]{0x0000000000001802L}); + public static final BitSet FOLLOW_12_in_ruleOp330 = new BitSet(new long[]{0x0000000000002010L}); + public static final BitSet FOLLOW_ruleTerm_in_ruleOp365 = new BitSet(new long[]{0x0000000000001802L}); + public static final BitSet FOLLOW_ruleTerm_in_entryRuleTerm405 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleTerm415 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleAtom_in_ruleTerm462 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleParens_in_ruleTerm489 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleAtom_in_entryRuleAtom521 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleAtom531 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_RULE_ID_in_ruleAtom576 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleParens_in_entryRuleParens619 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleParens629 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_13_in_ruleParens665 = new BitSet(new long[]{0x0000000000002010L}); + public static final BitSet FOLLOW_ruleOp_in_ruleParens687 = new BitSet(new long[]{0x0000000000004000L}); + public static final BitSet FOLLOW_14_in_ruleParens696 = new BitSet(new long[]{0x0000000000008002L}); + public static final BitSet FOLLOW_15_in_ruleParens718 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTrickyA1_in_entryRuleTrickyA1766 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleTrickyA1776 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_RULE_ID_in_ruleTrickyA1821 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTrickyG_in_entryRuleTrickyG874 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleTrickyG884 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_16_in_ruleTrickyG918 = new BitSet(new long[]{0x0000000000020000L}); + public static final BitSet FOLLOW_ruleTrickyG1_in_ruleTrickyG952 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTrickyG1_in_entryRuleTrickyG1989 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleTrickyG1999 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_17_in_ruleTrickyG11034 = new BitSet(new long[]{0x00000000000A0020L}); + public static final BitSet FOLLOW_ruleTrickyG2_in_ruleTrickyG11069 = new BitSet(new long[]{0x00000000000C0000L}); + public static final BitSet FOLLOW_18_in_ruleTrickyG11083 = new BitSet(new long[]{0x0000000000020020L}); + public static final BitSet FOLLOW_ruleTrickyG2_in_ruleTrickyG11117 = new BitSet(new long[]{0x00000000000C0000L}); + public static final BitSet FOLLOW_19_in_ruleTrickyG11135 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTrickyG2_in_entryRuleTrickyG21168 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_entryRuleTrickyG21178 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ruleTrickyG1_in_ruleTrickyG21225 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_RULE_INT_in_ruleTrickyG21251 = new BitSet(new long[]{0x0000000000000002L}); }
\ No newline at end of file diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage__.g b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage__.g index 7aa6144..639f3d4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage__.g +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage__.g @@ -12,26 +12,30 @@ T12 : '-' ; T13 : '(' ; T14 : ')' ; T15 : '!' ; +T16 : 'TG' ; +T17 : '[' ; +T18 : ',' ; +T19 : ']' ; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 347 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 547 RULE_ID : ('^')?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 349 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 549 RULE_INT : ('0'..'9')+; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 351 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 551 RULE_STRING : '"' ( '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') | ~('\\'|'"') )* '"' | '\'' ( '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') | ~('\\'|'\'') )* '\''; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 353 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 553 RULE_ML_COMMENT : '/*' ( options {greedy=false;} : . )* '*/' {$channel=HIDDEN;}; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 355 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 555 RULE_SL_COMMENT : '//' ~('\n'|'\r')* ('\r'? '\n')? {$channel=HIDDEN;}; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 357 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 557 RULE_WS : (' '|'\t'|'\r'|'\n')+ {$channel=HIDDEN;}; -// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 359 +// $ANTLR src "./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalComplexReconstrTestLanguage.g" 559 RULE_ANY_OTHER : .; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageLexer.java index f6646fa..ceef9da 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguage.g 2009-01-06 10:50:07 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguage.g 2009-01-12 18:22:26 package org.eclipse.xtext.parsetree.reconstr.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageParser.java index 96b0f9d..5f79b98 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguage.g 2009-01-06 10:50:07 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/reconstr/parser/internal/InternalSimpleReconstrTestLanguage.g 2009-01-12 18:22:26 package org.eclipse.xtext.parsetree.reconstr.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/ComplexReconstrTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/ComplexReconstrTestLanguageParseTreeConstructor.java index ffc413a..9e32ea6 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/ComplexReconstrTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/ComplexReconstrTestLanguageParseTreeConstructor.java @@ -14,53 +14,96 @@ import org.eclipse.xtext.parsetree.reconstr.services.ComplexReconstrTestLanguage public class ComplexReconstrTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; + if(inst.isInstanceOf("Root") && (s = new Root_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Op_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Term_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Atom") && (s = new Atom_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Parens_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TypeA1") && (s = new TrickyA_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TypeD") && (s = new TrickyA1_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyB") && (s = new TrickyB_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyC") && (s = new TrickyC_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyD") && (s = new TrickyD_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyE") && (s = new TrickyE_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyF") && (s = new TrickyF_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyG") && (s = new TrickyG_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyG1") && (s = new TrickyG1_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TrickyG2") && (s = new TrickyG2_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + return null; + } + + +/************ begin Rule Root **************** + * + * Root : Op | TrickyG ; + * + **/ - if(inst.isInstanceOf("Expression") && (s = new Op_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Term_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Atom") && (s = new Atom_Assignment_name(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Parens_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TypeA1") && (s = new TrickyA_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TypeD") && (s = new TrickyA1_Assignment_name(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TrickyB") && (s = new TrickyB_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TrickyC") && (s = new TrickyC_Group(inst, null).firstSolution()) != null) return s; +// Op | TrickyG +protected class Root_Alternatives extends AlternativesToken { - if(inst.isInstanceOf("TrickyD") && (s = new TrickyD_Group(inst, null).firstSolution()) != null) return s; + public Root_Alternatives(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Alternatives getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prRoot().eleAlternatives(); + } + + protected Solution createSolution() { + AbstractToken t = (first) ? new Root_1_RuleCall_TrickyG(current, this) : new Root_0_RuleCall_Op(current, this); + Solution s = t.firstSolution(); + if(s == null && activateNextSolution()) s = createSolution(); + if(s == null) return null; + last = s.getPredecessor(); + return s; + } +} +// Op +protected class Root_0_RuleCall_Op extends RuleCallToken { + + public Root_0_RuleCall_Op(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public RuleCall getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prRoot().ele0ParserRuleCallOp(); + } + + protected Solution createSolution() { + if(checkForRecursion(Op_Group.class, current)) return null; + if(!current.isInstanceOf("Expression")) return null; + return new Op_Group(current, this).firstSolution(); + } +} - if(inst.isInstanceOf("TrickyE") && (s = new TrickyE_Group(inst, null).firstSolution()) != null) return s; +// TrickyG +protected class Root_1_RuleCall_TrickyG extends RuleCallToken { + + public Root_1_RuleCall_TrickyG(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public RuleCall getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prRoot().ele1ParserRuleCallTrickyG(); + } + + protected Solution createSolution() { + if(checkForRecursion(TrickyG_Group.class, current)) return null; + if(!current.isInstanceOf("TrickyG")) return null; + return new TrickyG_Group(current, this).firstSolution(); + } +} - if(inst.isInstanceOf("TrickyF") && (s = new TrickyF_Group(inst, null).firstSolution()) != null) return s; +/************ end Rule Root ****************/ - return null; - } - /************ begin Rule Op **************** * @@ -85,7 +128,7 @@ protected class Op_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_0_RuleCall_Term(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -152,7 +195,7 @@ protected class Op_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_1_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -180,7 +223,7 @@ protected class Op_1_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_1_0_0_0_Action_Add_addOperands(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -244,6 +287,7 @@ protected class Op_1_0_1_Assignment_addOperands extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Expression")) { Solution s = new Term_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -272,7 +316,7 @@ protected class Op_1_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_1_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -300,7 +344,7 @@ protected class Op_1_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_1_1_0_0_Action_Minus_minusOperands(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -364,6 +408,7 @@ protected class Op_1_1_1_Assignment_minusOperands extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Expression")) { Solution s = new Term_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -505,7 +550,7 @@ protected class Parens_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -533,7 +578,7 @@ protected class Parens_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -561,7 +606,7 @@ protected class Parens_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -667,7 +712,7 @@ protected class TrickyA_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyA_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -695,7 +740,7 @@ protected class TrickyA_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyA_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -723,7 +768,7 @@ protected class TrickyA_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyA_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -751,7 +796,7 @@ protected class TrickyA_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyA_0_0_0_0_Keyword_TA(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -855,7 +900,7 @@ protected class TrickyA_0_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyA_0_1_0_0_Action_TypeB_x(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -916,7 +961,7 @@ protected class TrickyA_0_1_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyA_0_1_1_0_Action_TypeC_x(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1046,7 +1091,7 @@ protected class TrickyB_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyB_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1074,7 +1119,7 @@ protected class TrickyB_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyB_0_0_Keyword_TB(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1114,7 +1159,7 @@ protected class TrickyB_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyB_0_1_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1224,7 +1269,7 @@ protected class TrickyC_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1252,7 +1297,7 @@ protected class TrickyC_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1280,7 +1325,7 @@ protected class TrickyC_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1308,7 +1353,7 @@ protected class TrickyC_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_0_0_0_0_Keyword_TC(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1372,7 +1417,7 @@ protected class TrickyC_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_0_0_1_0_Action_C1_x(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1434,7 +1479,7 @@ protected class TrickyC_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_0_1_0_Action_C2_y(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1496,7 +1541,7 @@ protected class TrickyC_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyC_1_0_Action_C3_z(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1568,7 +1613,7 @@ protected class TrickyD_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyD_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1596,7 +1641,7 @@ protected class TrickyD_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyD_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1624,7 +1669,7 @@ protected class TrickyD_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyD_0_0_0_Keyword_TD(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1664,7 +1709,7 @@ protected class TrickyD_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyD_0_0_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1692,7 +1737,7 @@ protected class TrickyD_0_0_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyD_0_0_1_0_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1792,7 +1837,7 @@ protected class TrickyD_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyD_0_1_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1902,7 +1947,7 @@ protected class TrickyE_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyE_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1930,7 +1975,7 @@ protected class TrickyE_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyE_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1958,7 +2003,7 @@ protected class TrickyE_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyE_0_0_0_Keyword_TE(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1998,7 +2043,7 @@ protected class TrickyE_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyE_0_0_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2026,7 +2071,7 @@ protected class TrickyE_0_0_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyE_0_0_1_0_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2139,7 +2184,7 @@ protected class TrickyE_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyE_1_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2225,7 +2270,7 @@ protected class TrickyF_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyF_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2253,7 +2298,7 @@ protected class TrickyF_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyF_0_0_Keyword_TF(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2293,7 +2338,7 @@ protected class TrickyF_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TrickyF_0_1_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -2424,4 +2469,383 @@ protected class TrickyF_1_1_Assignment_type extends AssignmentToken { /************ end Rule TrickyF ****************/ + +/************ begin Rule TrickyG **************** + * + * TrickyG : 'TG' tree = TrickyG1 ; + * + **/ + + +// 'TG' tree = TrickyG1 +protected class TrickyG_Group extends GroupToken { + + public TrickyG_Group(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Group getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG().eleGroup(); + } + + protected Solution createSolution() { + Solution s1 = new TrickyG_1_Assignment_tree(current, this).firstSolution(); + while(s1 != null) { + Solution s2 = new TrickyG_0_Keyword_TG(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + if(s2 == null) { + s1 = s1.getPredecessor().nextSolution(this,s1); + if(s1 == null) return null; + } else { + last = s2.getPredecessor(); + return s2; + } + } + return null; + + } +} + +// 'TG' +protected class TrickyG_0_Keyword_TG extends KeywordToken { + + public TrickyG_0_Keyword_TG(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Keyword getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG().ele0KeywordTG(); + } +} + +// tree = TrickyG1 +protected class TrickyG_1_Assignment_tree extends AssignmentToken { + + public TrickyG_1_Assignment_tree(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Assignment getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG().ele1AssignmentTree(); + } + + protected Solution createSolution() { + if((value = current.getConsumable("tree",IS_REQUIRED)) == null) return null; + IInstanceDescription obj = current.cloneAndConsume("tree"); + + if(value instanceof EObject) { // xtext::RuleCall + IInstanceDescription param = getDescr((EObject)value); + if(param.isInstanceOf("TrickyG1")) { + Solution s = new TrickyG1_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); + if(s != null) { + type = AssignmentType.PRC; + return new Solution(obj,s.getPredecessor()); + } + } + } + + return null; + } +} + + +/************ end Rule TrickyG ****************/ + + +/************ begin Rule TrickyG1 **************** + * + * TrickyG1 : '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? ']' ; + * + **/ + + +// '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? ']' +protected class TrickyG1_Group extends GroupToken { + + public TrickyG1_Group(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Group getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().eleGroup(); + } + + protected Solution createSolution() { + Solution s1 = new TrickyG1_1_Keyword(current, this).firstSolution(); + while(s1 != null) { + Solution s2 = new TrickyG1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + if(s2 == null) { + s1 = s1.getPredecessor().nextSolution(this,s1); + if(s1 == null) return null; + } else { + last = s2.getPredecessor(); + return s2; + } + } + return null; + + } +} + +// '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? +protected class TrickyG1_0_Group extends GroupToken { + + public TrickyG1_0_Group(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Group getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele0Group(); + } + + protected Solution createSolution() { + Solution s1 = new TrickyG1_0_1_Group(current, this).firstSolution(); + while(s1 != null) { + Solution s2 = new TrickyG1_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + if(s2 == null) { + s1 = s1.getPredecessor().nextSolution(this,s1); + if(s1 == null) return null; + } else { + last = s2.getPredecessor(); + return s2; + } + } + return null; + + } +} + +// '[' +protected class TrickyG1_0_0_Keyword extends KeywordToken { + + public TrickyG1_0_0_Keyword(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Keyword getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele00KeywordLeftSquareBracket(); + } +} + +// ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? +protected class TrickyG1_0_1_Group extends GroupToken { + + public TrickyG1_0_1_Group(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, !IS_REQUIRED); + } + + public Group getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele01Group(); + } + + protected Solution createSolution() { + Solution s1 = new TrickyG1_0_1_1_Group(current, this).firstSolution(); + while(s1 != null) { + Solution s2 = new TrickyG1_0_1_0_Assignment_vals(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + if(s2 == null) { + s1 = s1.getPredecessor().nextSolution(this,s1); + if(s1 == null) return null; + } else { + last = s2.getPredecessor(); + return s2; + } + } + return null; + + } +} + +// vals += TrickyG2 +protected class TrickyG1_0_1_0_Assignment_vals extends AssignmentToken { + + public TrickyG1_0_1_0_Assignment_vals(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Assignment getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele010AssignmentVals(); + } + + protected Solution createSolution() { + if((value = current.getConsumable("vals",IS_REQUIRED)) == null) return null; + IInstanceDescription obj = current.cloneAndConsume("vals"); + + if(value instanceof EObject) { // xtext::RuleCall + IInstanceDescription param = getDescr((EObject)value); + if(param.isInstanceOf("TrickyG2")) { + Solution s = new TrickyG2_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); + if(s != null) { + type = AssignmentType.PRC; + return new Solution(obj,s.getPredecessor()); + } + } + } + + return null; + } +} + +// ( ',' vals += TrickyG2 ) * +protected class TrickyG1_0_1_1_Group extends GroupToken { + + public TrickyG1_0_1_1_Group(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, IS_MANY, !IS_REQUIRED); + } + + public Group getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele011Group(); + } + + protected Solution createSolution() { + Solution s1 = new TrickyG1_0_1_1_1_Assignment_vals(current, this).firstSolution(); + while(s1 != null) { + Solution s2 = new TrickyG1_0_1_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); + if(s2 == null) { + s1 = s1.getPredecessor().nextSolution(this,s1); + if(s1 == null) return null; + } else { + last = s2.getPredecessor(); + return s2; + } + } + return null; + + } +} + +// ',' +protected class TrickyG1_0_1_1_0_Keyword extends KeywordToken { + + public TrickyG1_0_1_1_0_Keyword(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Keyword getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele0110KeywordComma(); + } +} + +// vals += TrickyG2 +protected class TrickyG1_0_1_1_1_Assignment_vals extends AssignmentToken { + + public TrickyG1_0_1_1_1_Assignment_vals(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Assignment getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele0111AssignmentVals(); + } + + protected Solution createSolution() { + if((value = current.getConsumable("vals",!IS_REQUIRED)) == null) return null; + IInstanceDescription obj = current.cloneAndConsume("vals"); + + if(value instanceof EObject) { // xtext::RuleCall + IInstanceDescription param = getDescr((EObject)value); + if(param.isInstanceOf("TrickyG2")) { + Solution s = new TrickyG2_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); + if(s != null) { + type = AssignmentType.PRC; + return new Solution(obj,s.getPredecessor()); + } + } + } + + return null; + } +} + + + + +// ']' +protected class TrickyG1_1_Keyword extends KeywordToken { + + public TrickyG1_1_Keyword(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Keyword getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG1().ele1KeywordRightSquareBracket(); + } +} + + +/************ end Rule TrickyG1 ****************/ + + +/************ begin Rule TrickyG2 **************** + * + * TrickyG2 : TrickyG1 | val = INT ; + * + **/ + + +// TrickyG1 | val = INT +protected class TrickyG2_Alternatives extends AlternativesToken { + + public TrickyG2_Alternatives(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Alternatives getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG2().eleAlternatives(); + } + + protected Solution createSolution() { + AbstractToken t = (first) ? new TrickyG2_1_Assignment_val(current, this) : new TrickyG2_0_RuleCall_TrickyG1(current, this); + Solution s = t.firstSolution(); + if(s == null && activateNextSolution()) s = createSolution(); + if(s == null) return null; + last = s.getPredecessor(); + return s; + } +} + +// TrickyG1 +protected class TrickyG2_0_RuleCall_TrickyG1 extends RuleCallToken { + + public TrickyG2_0_RuleCall_TrickyG1(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public RuleCall getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG2().ele0ParserRuleCallTrickyG1(); + } + + protected Solution createSolution() { + if(checkForRecursion(TrickyG1_Group.class, current)) return null; + if(!current.isInstanceOf("TrickyG1")) return null; + return new TrickyG1_Group(current, this).firstSolution(); + } +} + +// val = INT +protected class TrickyG2_1_Assignment_val extends AssignmentToken { + + public TrickyG2_1_Assignment_val(IInstanceDescription curr, AbstractToken pred) { + super(curr, pred, !IS_MANY, IS_REQUIRED); + } + + public Assignment getGrammarElement() { + return ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG2().ele1AssignmentVal(); + } + + protected Solution createSolution() { + if((value = current.getConsumable("val",IS_REQUIRED)) == null) return null; + IInstanceDescription obj = current.cloneAndConsume("val"); + if(true) { // xtext::RuleCall FIXME: check if value is valid for lexer rule + type = AssignmentType.LRC; + element = ComplexReconstrTestLanguageGrammarAccess.INSTANCE.prTrickyG2().ele10LexerRuleCallINT(); + return new Solution(obj); + } + return null; + } +} + + +/************ end Rule TrickyG2 ****************/ + } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/SimpleReconstrTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/SimpleReconstrTestLanguageParseTreeConstructor.java index 00b4d5f..7fc4f0a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/SimpleReconstrTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/parsetree/reconstr/SimpleReconstrTestLanguageParseTreeConstructor.java @@ -14,44 +14,19 @@ import org.eclipse.xtext.parsetree.reconstr.services.SimpleReconstrTestLanguageG public class SimpleReconstrTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Expression") && (s = new Op_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Term_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Atom") && (s = new Atom_Assignment_name(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Parens_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TwoNumbers") && (s = new TwoNumbers_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("ManyStrings") && (s = new ManyStrings_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Type") && (s = new Type_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Ref2") && (s = new Ref2_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Spare") && (s = new Spare_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Expression") && (s = new Op_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Term_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Atom") && (s = new Atom_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Parens_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TwoNumbers") && (s = new TwoNumbers_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("ManyStrings") && (s = new ManyStrings_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Type") && (s = new Type_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Ref2") && (s = new Ref2_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Spare") && (s = new Spare_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -79,7 +54,7 @@ protected class Op_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_0_RuleCall_Term(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -125,7 +100,7 @@ protected class Op_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Op_1_0_Action_Op_values(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -176,6 +151,7 @@ protected class Op_1_1_Assignment_values extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Expression")) { Solution s = new Term_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -516,7 +492,7 @@ protected class Parens_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -544,7 +520,7 @@ protected class Parens_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -572,7 +548,7 @@ protected class Parens_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -678,7 +654,7 @@ protected class TwoNumbers_Group extends GroupToken { while(s1 != null) { Solution s2 = new TwoNumbers_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -706,7 +682,7 @@ protected class TwoNumbers_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TwoNumbers_0_0_Assignment_num1(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -781,7 +757,7 @@ protected class TwoNumbers_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TwoNumbers_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -856,7 +832,7 @@ protected class ManyStrings_Group extends GroupToken { while(s1 != null) { Solution s2 = new ManyStrings_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -884,7 +860,7 @@ protected class ManyStrings_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ManyStrings_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -982,7 +958,7 @@ protected class Type_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1010,7 +986,7 @@ protected class Type_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1038,7 +1014,7 @@ protected class Type_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Type_0_0_0_Keyword_type(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1152,7 +1128,7 @@ protected class Ref2_Group extends GroupToken { while(s1 != null) { Solution s2 = new Ref2_0_Keyword_2(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1236,7 +1212,7 @@ protected class Spare_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spare_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1264,7 +1240,7 @@ protected class Spare_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spare_0_0_Keyword_3(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1328,7 +1304,7 @@ protected class Spare_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spare_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/ComplexReconstrTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/ComplexReconstrTestLanguageGrammarAccess.java index 2bd9540..65733b6 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/ComplexReconstrTestLanguageGrammarAccess.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/ComplexReconstrTestLanguageGrammarAccess.java @@ -10,8 +10,27 @@ import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess; public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess { - public class OpElements implements IParserRuleAccess { + public class RootElements implements IParserRuleAccess { private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final RuleCall c0ParserRuleCallOp = (RuleCall)cAlternatives.eContents().get(0); + private final RuleCall c1ParserRuleCallTrickyG = (RuleCall)cAlternatives.eContents().get(1); + + // Root : Op | TrickyG ; + public ParserRule getRule() { return rule; } + + // Op | TrickyG + public Alternatives eleAlternatives() { return cAlternatives; } + + // Op + public RuleCall ele0ParserRuleCallOp() { return c0ParserRuleCallOp; } + + // TrickyG + public RuleCall ele1ParserRuleCallTrickyG() { return c1ParserRuleCallTrickyG; } + } + + public class OpElements implements IParserRuleAccess { + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2); private final Group cGroup = (Group)rule.eContents().get(1); private final RuleCall c0ParserRuleCallTerm = (RuleCall)cGroup.eContents().get(0); private final Alternatives c1Alternatives = (Alternatives)cGroup.eContents().get(1); @@ -78,7 +97,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TermElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3); private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); private final RuleCall c0ParserRuleCallAtom = (RuleCall)cAlternatives.eContents().get(0); private final RuleCall c1ParserRuleCallParens = (RuleCall)cAlternatives.eContents().get(1); @@ -97,7 +116,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class AtomElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4); private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1); private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0); @@ -112,7 +131,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class ParensElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Group c00Group = (Group)c0Group.eContents().get(0); @@ -151,7 +170,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyAElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Group c00Group = (Group)c0Group.eContents().get(0); @@ -226,7 +245,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyA1Elements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7); private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1); private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0); @@ -241,7 +260,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyBElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Keyword c00KeywordTB = (Keyword)c0Group.eContents().get(0); @@ -288,7 +307,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyCElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Group c00Group = (Group)c0Group.eContents().get(0); @@ -359,7 +378,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyDElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Group c00Group = (Group)c0Group.eContents().get(0); @@ -442,7 +461,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyEElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Group c00Group = (Group)c0Group.eContents().get(0); @@ -521,7 +540,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } public class TrickyFElements implements IParserRuleAccess { - private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11); + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12); private final Group cGroup = (Group)rule.eContents().get(1); private final Group c0Group = (Group)cGroup.eContents().get(0); private final Keyword c00KeywordTF = (Keyword)c0Group.eContents().get(0); @@ -578,11 +597,109 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess // INT public RuleCall ele110LexerRuleCallINT() { return c110LexerRuleCallINT; } } + + public class TrickyGElements implements IParserRuleAccess { + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Keyword c0KeywordTG = (Keyword)cGroup.eContents().get(0); + private final Assignment c1AssignmentTree = (Assignment)cGroup.eContents().get(1); + private final RuleCall c10ParserRuleCallTrickyG1 = (RuleCall)c1AssignmentTree.eContents().get(0); + + // TrickyG : 'TG' tree = TrickyG1 ; + public ParserRule getRule() { return rule; } + + // 'TG' tree = TrickyG1 + public Group eleGroup() { return cGroup; } + + // 'TG' + public Keyword ele0KeywordTG() { return c0KeywordTG; } + + // tree = TrickyG1 + public Assignment ele1AssignmentTree() { return c1AssignmentTree; } + + // TrickyG1 + public RuleCall ele10ParserRuleCallTrickyG1() { return c10ParserRuleCallTrickyG1; } + } + + public class TrickyG1Elements implements IParserRuleAccess { + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14); + private final Group cGroup = (Group)rule.eContents().get(1); + private final Group c0Group = (Group)cGroup.eContents().get(0); + private final Keyword c00KeywordLeftSquareBracket = (Keyword)c0Group.eContents().get(0); + private final Group c01Group = (Group)c0Group.eContents().get(1); + private final Assignment c010AssignmentVals = (Assignment)c01Group.eContents().get(0); + private final RuleCall c0100ParserRuleCallTrickyG2 = (RuleCall)c010AssignmentVals.eContents().get(0); + private final Group c011Group = (Group)c01Group.eContents().get(1); + private final Keyword c0110KeywordComma = (Keyword)c011Group.eContents().get(0); + private final Assignment c0111AssignmentVals = (Assignment)c011Group.eContents().get(1); + private final RuleCall c01110ParserRuleCallTrickyG2 = (RuleCall)c0111AssignmentVals.eContents().get(0); + private final Keyword c1KeywordRightSquareBracket = (Keyword)cGroup.eContents().get(1); + + // TrickyG1 : '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? ']' ; + public ParserRule getRule() { return rule; } + + // '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? ']' + public Group eleGroup() { return cGroup; } + + // '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? + public Group ele0Group() { return c0Group; } + + // '[' + public Keyword ele00KeywordLeftSquareBracket() { return c00KeywordLeftSquareBracket; } + + // ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? + public Group ele01Group() { return c01Group; } + + // vals += TrickyG2 + public Assignment ele010AssignmentVals() { return c010AssignmentVals; } + + // TrickyG2 + public RuleCall ele0100ParserRuleCallTrickyG2() { return c0100ParserRuleCallTrickyG2; } + + // ( ',' vals += TrickyG2 ) * + public Group ele011Group() { return c011Group; } + + // ',' + public Keyword ele0110KeywordComma() { return c0110KeywordComma; } + + // vals += TrickyG2 + public Assignment ele0111AssignmentVals() { return c0111AssignmentVals; } + + // TrickyG2 + public RuleCall ele01110ParserRuleCallTrickyG2() { return c01110ParserRuleCallTrickyG2; } + + // ']' + public Keyword ele1KeywordRightSquareBracket() { return c1KeywordRightSquareBracket; } + } + + public class TrickyG2Elements implements IParserRuleAccess { + private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15); + private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1); + private final RuleCall c0ParserRuleCallTrickyG1 = (RuleCall)cAlternatives.eContents().get(0); + private final Assignment c1AssignmentVal = (Assignment)cAlternatives.eContents().get(1); + private final RuleCall c10LexerRuleCallINT = (RuleCall)c1AssignmentVal.eContents().get(0); + + // TrickyG2 : TrickyG1 | val = INT ; + public ParserRule getRule() { return rule; } + + // TrickyG1 | val = INT + public Alternatives eleAlternatives() { return cAlternatives; } + + // TrickyG1 + public RuleCall ele0ParserRuleCallTrickyG1() { return c0ParserRuleCallTrickyG1; } + + // val = INT + public Assignment ele1AssignmentVal() { return c1AssignmentVal; } + + // INT + public RuleCall ele10LexerRuleCallINT() { return c10LexerRuleCallINT; } + } public final static ComplexReconstrTestLanguageGrammarAccess INSTANCE = new ComplexReconstrTestLanguageGrammarAccess(); private static final String COMPLEXRECONSTRTESTLANGUAGE_GRAMMAR_CP_URI = "classpath:/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xmi"; private static Grammar GRAMMAR = null; + private static RootElements pRoot; private static OpElements pOp; private static TermElements pTerm; private static AtomElements pAtom; @@ -594,6 +711,9 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess private static TrickyDElements pTrickyD; private static TrickyEElements pTrickyE; private static TrickyFElements pTrickyF; + private static TrickyGElements pTrickyG; + private static TrickyG1Elements pTrickyG1; + private static TrickyG2Elements pTrickyG2; @SuppressWarnings("unused") public synchronized Grammar getGrammar() { @@ -610,6 +730,11 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess } + // Root : Op | TrickyG ; + public RootElements prRoot() { + return (pRoot != null) ? pRoot : (pRoot = new RootElements()); + } + // Op returns Expression : Term ( { current = Add . addOperands += current } '+' addOperands += Term | { current = Minus . minusOperands += current } '-' minusOperands += Term ) * ; public OpElements prOp() { return (pOp != null) ? pOp : (pOp = new OpElements()); @@ -664,4 +789,19 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess public TrickyFElements prTrickyF() { return (pTrickyF != null) ? pTrickyF : (pTrickyF = new TrickyFElements()); } + + // TrickyG : 'TG' tree = TrickyG1 ; + public TrickyGElements prTrickyG() { + return (pTrickyG != null) ? pTrickyG : (pTrickyG = new TrickyGElements()); + } + + // TrickyG1 : '[' ( vals += TrickyG2 ( ',' vals += TrickyG2 ) * ) ? ']' ; + public TrickyG1Elements prTrickyG1() { + return (pTrickyG1 != null) ? pTrickyG1 : (pTrickyG1 = new TrickyG1Elements()); + } + + // TrickyG2 : TrickyG1 | val = INT ; + public TrickyG2Elements prTrickyG2() { + return (pTrickyG2 != null) ? pTrickyG2 : (pTrickyG2 = new TrickyG2Elements()); + } } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestLexer.java index f9fa2eb..9030ad6 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTest.g 2009-01-06 10:50:15 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTest.g 2009-01-12 18:22:37 package org.eclipse.xtext.parsetree.transientvalues.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestParser.java index fcd5d9b..73a226b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTestParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTest.g 2009-01-06 10:50:15 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/parsetree/transientvalues/parser/internal/InternalTransientValuesTest.g 2009-01-12 18:22:37 package org.eclipse.xtext.parsetree.transientvalues.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parsetree/reconstr/TransientValuesTestParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parsetree/reconstr/TransientValuesTestParseTreeConstructor.java index 36f55d6..dd0dcfd 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parsetree/reconstr/TransientValuesTestParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/parsetree/reconstr/TransientValuesTestParseTreeConstructor.java @@ -14,29 +14,14 @@ import org.eclipse.xtext.parsetree.transientvalues.services.TransientValuesTestG public class TransientValuesTestParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Root") && (s = new Root_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TestRequired") && (s = new TestRequired_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TestOptional") && (s = new TestOptional_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TestList") && (s = new TestList_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Root") && (s = new Root_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TestRequired") && (s = new TestRequired_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TestOptional") && (s = new TestOptional_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TestList") && (s = new TestList_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -64,7 +49,7 @@ protected class Root_Group extends GroupToken { while(s1 != null) { Solution s2 = new Root_0_Keyword_test(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -213,7 +198,7 @@ protected class TestRequired_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestRequired_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -241,7 +226,7 @@ protected class TestRequired_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestRequired_0_0_Keyword_required(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -339,7 +324,7 @@ protected class TestOptional_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestOptional_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -367,7 +352,7 @@ protected class TestOptional_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestOptional_0_0_Keyword_optional(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -431,7 +416,7 @@ protected class TestOptional_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestOptional_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -506,7 +491,7 @@ protected class TestList_Group extends GroupToken { while(s1 != null) { Solution s2 = new TestList_0_Keyword_list(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageLexer.java index d6cf666..4bbd400 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguage.g 2009-01-06 10:50:17 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguage.g 2009-01-12 18:22:39 package org.eclipse.xtext.resource.metamodel.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageParser.java index 2cdf1cb..f30c21b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguage.g 2009-01-06 10:50:16 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/resource/metamodel/parser/internal/InternalMultiValueFeatureTestLanguage.g 2009-01-12 18:22:39 package org.eclipse.xtext.resource.metamodel.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parsetree/reconstr/MultiValueFeatureTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parsetree/reconstr/MultiValueFeatureTestLanguageParseTreeConstructor.java index 4813c5d..ac12afc 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parsetree/reconstr/MultiValueFeatureTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/parsetree/reconstr/MultiValueFeatureTestLanguageParseTreeConstructor.java @@ -14,20 +14,11 @@ import org.eclipse.xtext.resource.metamodel.services.MultiValueFeatureTestLangua public class MultiValueFeatureTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Start") && (s = new Start_Assignment_featureA(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Start") && (s = new Start_Assignment_featureA(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore index d0d0a55..8d02c8e 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore @@ -13,12 +13,12 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="familie" unique="false" upperBound="-1" eType="//Familie" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Person"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="age"> - <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> - </eStructuralFeatures> <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:EAttribute" name="age"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eStructuralFeatures> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Kind" eSuperTypes="//Person"/> <eClassifiers xsi:type="ecore:EClass" name="Erwachsener" eSuperTypes="//Person"/> diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageLexer.java index f299f16..44541376 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguage.g 2009-01-06 10:50:09 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguage.g 2009-01-12 18:22:30 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageParser.java index 8d95a41..a4b5964 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguage.g 2009-01-06 10:50:09 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalActionTestLanguage.g 2009-01-12 18:22:30 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageLexer.java index 7004f5e..052a646 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguage.g 2009-01-06 10:50:15 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguage.g 2009-01-12 18:22:36 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageParser.java index c9b7f56..f31fb31a 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguage.g 2009-01-06 10:50:14 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalContentAssistTestLanguage.g 2009-01-12 18:22:36 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageLexer.java index 3076acf..2c832bf 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguage.g 2009-01-06 10:50:12 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguage.g 2009-01-12 18:22:33 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageParser.java index e7b6e44..725a105 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguage.g 2009-01-06 10:50:12 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalFowlerDslTestLanguage.g 2009-01-12 18:22:33 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageLexer.java index 3ddfe1b..d2dbb4f 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguage.g 2009-01-06 10:50:08 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguage.g 2009-01-12 18:22:28 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageParser.java index 3ebfb96..9269abf 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguage.g 2009-01-06 10:50:08 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLexerTestLanguage.g 2009-01-12 18:22:28 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageLexer.java index dfdbde6..b21dfc4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguage.g 2009-01-06 10:50:11 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguage.g 2009-01-12 18:22:32 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageParser.java index d34e28c..0bee9bb 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguage.g 2009-01-06 10:50:11 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalLookaheadTestLanguage.g 2009-01-12 18:22:32 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageLexer.java index 08e6915..e975c99 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguage.g 2009-01-06 10:50:10 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguage.g 2009-01-12 18:22:30 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageParser.java index 9c3412f..97136c3 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguage.g 2009-01-06 10:50:10 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalOptionalEmptyTestLanguage.g 2009-01-12 18:22:30 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageLexer.java index 7ddbd2f..0c61f29 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguage.g 2009-01-06 10:50:14 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguage.g 2009-01-12 18:22:35 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageParser.java index 7c93941..0389dde 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguage.g 2009-01-06 10:50:14 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalPartialParserTestLanguage.g 2009-01-12 18:22:35 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageLexer.java index 84fff18..04c4fc6 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguage.g 2009-01-06 10:50:10 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguage.g 2009-01-12 18:22:31 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageParser.java index 22dab92..c7c4f50 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguage.g 2009-01-06 10:50:10 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalReferenceGrammarTestLanguage.g 2009-01-12 18:22:31 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageLexer.java index 43ec9f4..bb314b4 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguage.g 2009-01-06 10:50:09 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguage.g 2009-01-12 18:22:29 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageParser.java index 3ea4252..340aeed 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguage.g 2009-01-06 10:50:09 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalSimpleExpressionsTestLanguage.g 2009-01-12 18:22:29 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageLexer.java index 50a2317..42fb28b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguage.g 2009-01-06 10:50:06 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguage.g 2009-01-12 18:22:25 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageParser.java index 1846df0..4943c97 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguage.g 2009-01-06 10:50:06 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTestLanguage.g 2009-01-12 18:22:25 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageLexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageLexer.java index 68b3e91..6b6987c 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageLexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguage.g 2009-01-06 10:50:13 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguage.g 2009-01-12 18:22:34 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageParser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageParser.java index 093a227..14fcee5 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageParser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguageParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguage.g 2009-01-06 10:50:13 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/testlanguages/parser/internal/InternalTreeTestLanguage.g 2009-01-12 18:22:34 package org.eclipse.xtext.testlanguages.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ActionTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ActionTestLanguageParseTreeConstructor.java index 264c702..ae8273b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ActionTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ActionTestLanguageParseTreeConstructor.java @@ -14,26 +14,13 @@ import org.eclipse.xtext.testlanguages.services.ActionTestLanguageGrammarAccess; public class ActionTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Model") && (s = new Model_Assignment_children(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Type") && (s = new Element_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Type") && (s = new Item_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Model") && (s = new Model_Assignment_children(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Type") && (s = new Element_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Type") && (s = new Item_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -64,6 +51,7 @@ protected class Model_Assignment_children extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Type")) { Solution s = new Element_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -101,7 +89,7 @@ protected class Element_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_0_RuleCall_Item(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -147,7 +135,7 @@ protected class Element_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_1_0_Action_Item_items(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -198,6 +186,7 @@ protected class Element_1_1_Assignment_items extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Type")) { Solution s = new Item_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -237,7 +226,7 @@ protected class Item_Group extends GroupToken { while(s1 != null) { Solution s2 = new Item_0_Action_Thing_content(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ContentAssistTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ContentAssistTestLanguageParseTreeConstructor.java index ee4b2a6..1196df3 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ContentAssistTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ContentAssistTestLanguageParseTreeConstructor.java @@ -14,32 +14,15 @@ import org.eclipse.xtext.testlanguages.services.ContentAssistTestLanguageGrammar public class ContentAssistTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Start") && (s = new Start_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractRule") && (s = new AbstractRule_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("FirstAbstractRuleChild") && (s = new FirstAbstractRuleChild_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("SecondAbstractRuleChild") && (s = new SecondAbstractRuleChild_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractRuleCall") && (s = new AbstractRuleCall_Assignment_rule(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Start") && (s = new Start_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractRule") && (s = new AbstractRule_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("FirstAbstractRuleChild") && (s = new FirstAbstractRuleChild_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("SecondAbstractRuleChild") && (s = new SecondAbstractRuleChild_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractRuleCall") && (s = new AbstractRuleCall_Assignment_rule(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -67,7 +50,7 @@ protected class Start_Group extends GroupToken { while(s1 != null) { Solution s2 = new Start_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -95,7 +78,7 @@ protected class Start_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Start_0_0_Keyword_abstractrules(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -138,6 +121,7 @@ protected class Start_0_1_Assignment_rules extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractRule")) { Solution s = new AbstractRule_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -257,7 +241,7 @@ protected class FirstAbstractRuleChild_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstAbstractRuleChild_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -285,7 +269,7 @@ protected class FirstAbstractRuleChild_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstAbstractRuleChild_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -313,7 +297,7 @@ protected class FirstAbstractRuleChild_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstAbstractRuleChild_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -341,7 +325,7 @@ protected class FirstAbstractRuleChild_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstAbstractRuleChild_0_0_0_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -408,6 +392,7 @@ protected class FirstAbstractRuleChild_0_0_1_Assignment_elements extends Assignm IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractRule")) { Solution s = new AbstractRule_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -472,7 +457,7 @@ protected class SecondAbstractRuleChild_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondAbstractRuleChild_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -500,7 +485,7 @@ protected class SecondAbstractRuleChild_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondAbstractRuleChild_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -528,7 +513,7 @@ protected class SecondAbstractRuleChild_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondAbstractRuleChild_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -556,7 +541,7 @@ protected class SecondAbstractRuleChild_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondAbstractRuleChild_0_0_0_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -636,6 +621,7 @@ protected class SecondAbstractRuleChild_0_1_Assignment_rule extends AssignmentTo IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractRuleCall")) { Solution s = new AbstractRuleCall_Assignment_rule(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/FowlerDslTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/FowlerDslTestLanguageParseTreeConstructor.java index 8ca881a..459b1dc 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/FowlerDslTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/FowlerDslTestLanguageParseTreeConstructor.java @@ -14,32 +14,15 @@ import org.eclipse.xtext.testlanguages.services.FowlerDslTestLanguageGrammarAcce public class FowlerDslTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Statemachine") && (s = new Statemachine_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Event") && (s = new Event_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Command") && (s = new Command_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("State") && (s = new State_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Transition") && (s = new Transition_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Statemachine") && (s = new Statemachine_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Event") && (s = new Event_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Command") && (s = new Command_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("State") && (s = new State_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Transition") && (s = new Transition_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -67,7 +50,7 @@ protected class Statemachine_Group extends GroupToken { while(s1 != null) { Solution s2 = new Statemachine_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -95,7 +78,7 @@ protected class Statemachine_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Statemachine_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -123,7 +106,7 @@ protected class Statemachine_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Statemachine_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -151,7 +134,7 @@ protected class Statemachine_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Statemachine_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -179,7 +162,7 @@ protected class Statemachine_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Statemachine_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -207,7 +190,7 @@ protected class Statemachine_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Statemachine_0_0_0_0_0_0_Keyword_events(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -250,6 +233,7 @@ protected class Statemachine_0_0_0_0_0_1_Assignment_events extends AssignmentTok IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Event")) { Solution s = new Event_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -307,6 +291,7 @@ protected class Statemachine_0_0_1_Assignment_commands extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Command")) { Solution s = new Command_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -351,6 +336,7 @@ protected class Statemachine_1_Assignment_states extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("State")) { Solution s = new State_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -389,7 +375,7 @@ protected class Event_Group extends GroupToken { while(s1 != null) { Solution s2 = new Event_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -417,7 +403,7 @@ protected class Event_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Event_0_0_Assignment_resetting(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -526,7 +512,7 @@ protected class Command_Group extends GroupToken { while(s1 != null) { Solution s2 = new Command_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -611,7 +597,7 @@ protected class State_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -639,7 +625,7 @@ protected class State_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -667,7 +653,7 @@ protected class State_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -695,7 +681,7 @@ protected class State_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_0_0_0_Keyword_state(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -759,7 +745,7 @@ protected class State_0_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_0_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -787,7 +773,7 @@ protected class State_0_0_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_0_1_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -815,7 +801,7 @@ protected class State_0_0_1_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new State_0_0_1_0_0_0_Keyword_actions(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -912,6 +898,7 @@ protected class State_0_1_Assignment_transitions extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Transition")) { Solution s = new Transition_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -963,7 +950,7 @@ protected class Transition_Group extends GroupToken { while(s1 != null) { Solution s2 = new Transition_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -991,7 +978,7 @@ protected class Transition_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Transition_0_0_Assignment_event(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LexerTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LexerTestLanguageParseTreeConstructor.java index 80b91cf..b3d1e03 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LexerTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LexerTestLanguageParseTreeConstructor.java @@ -14,23 +14,12 @@ import org.eclipse.xtext.testlanguages.services.LexerTestLanguageGrammarAccess; public class LexerTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Model") && (s = new Model_Assignment_children(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Element") && (s = new Element_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Model") && (s = new Model_Assignment_children(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Element") && (s = new Element_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,6 +50,7 @@ protected class Model_Assignment_children extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Element")) { Solution s = new Element_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -98,7 +88,7 @@ protected class Element_Group extends GroupToken { while(s1 != null) { Solution s2 = new Element_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LookaheadTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LookaheadTestLanguageParseTreeConstructor.java index 38999dc..e5ba460 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LookaheadTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/LookaheadTestLanguageParseTreeConstructor.java @@ -14,38 +14,17 @@ import org.eclipse.xtext.testlanguages.services.LookaheadTestLanguageGrammarAcce public class LookaheadTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Entry") && (s = new Entry_Assignment_contents(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Alts") && (s = new Alts_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("LookAhead0") && (s = new LookAhead0_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("LookAhead1") && (s = new LookAhead1_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("LookAhead2") && (s = new LookAhead2_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("LookAhead3") && (s = new LookAhead3_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("LookAhead4") && (s = new LookAhead4_Alternatives(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Entry") && (s = new Entry_Assignment_contents(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Alts") && (s = new Alts_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("LookAhead0") && (s = new LookAhead0_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("LookAhead1") && (s = new LookAhead1_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("LookAhead2") && (s = new LookAhead2_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("LookAhead3") && (s = new LookAhead3_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("LookAhead4") && (s = new LookAhead4_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -76,6 +55,7 @@ protected class Entry_Assignment_contents extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Alts")) { Solution s = new Alts_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -221,7 +201,7 @@ protected class LookAhead0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead0_0_Keyword_bar(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -295,7 +275,7 @@ protected class LookAhead1_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -323,7 +303,7 @@ protected class LookAhead1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead1_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -351,7 +331,7 @@ protected class LookAhead1_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead1_0_0_0_Keyword_foo(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -394,6 +374,7 @@ protected class LookAhead1_0_0_1_Assignment_y extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("LookAhead2")) { Solution s = new LookAhead2_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -480,7 +461,7 @@ protected class LookAhead2_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead2_0_Alternatives(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -599,7 +580,7 @@ protected class LookAhead3_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead3_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -627,7 +608,7 @@ protected class LookAhead3_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead3_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -655,7 +636,7 @@ protected class LookAhead3_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new LookAhead3_0_0_0_Keyword_foo(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -735,6 +716,7 @@ protected class LookAhead3_1_Assignment_z extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("LookAhead4")) { Solution s = new LookAhead4_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/OptionalEmptyTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/OptionalEmptyTestLanguageParseTreeConstructor.java index bb32213..1c99cf8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/OptionalEmptyTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/OptionalEmptyTestLanguageParseTreeConstructor.java @@ -14,23 +14,12 @@ import org.eclipse.xtext.testlanguages.services.OptionalEmptyTestLanguageGrammar public class OptionalEmptyTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Model") && (s = new Model_Assignment_child(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Greeting") && (s = new Greeting_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Model") && (s = new Model_Assignment_child(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Greeting") && (s = new Greeting_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,6 +50,7 @@ protected class Model_Assignment_child extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Greeting")) { Solution s = new Greeting_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -98,7 +88,7 @@ protected class Greeting_Group extends GroupToken { while(s1 != null) { Solution s2 = new Greeting_0_Keyword_hallo(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/PartialParserTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/PartialParserTestLanguageParseTreeConstructor.java index 3a3811e..8ada30f 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/PartialParserTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/PartialParserTestLanguageParseTreeConstructor.java @@ -14,47 +14,20 @@ import org.eclipse.xtext.testlanguages.services.PartialParserTestLanguageGrammar public class PartialParserTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Container") && (s = new Container_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Nested") && (s = new Nested_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Content") && (s = new Content_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Children") && (s = new Children_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Child") && (s = new Child_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractChildren") && (s = new AbstractChildren_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractChild") && (s = new AbstractChild_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("FirstConcrete") && (s = new FirstConcrete_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("SecondConcrete") && (s = new SecondConcrete_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Named") && (s = new Named_Assignment_name(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Container") && (s = new Container_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Nested") && (s = new Nested_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Content") && (s = new Content_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Children") && (s = new Children_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Child") && (s = new Child_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractChildren") && (s = new AbstractChildren_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractChild") && (s = new AbstractChild_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("FirstConcrete") && (s = new FirstConcrete_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("SecondConcrete") && (s = new SecondConcrete_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Named") && (s = new Named_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -82,7 +55,7 @@ protected class Container_Group extends GroupToken { while(s1 != null) { Solution s2 = new Container_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -110,7 +83,7 @@ protected class Container_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Container_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -138,7 +111,7 @@ protected class Container_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Container_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -166,7 +139,7 @@ protected class Container_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Container_0_0_0_0_Keyword_container(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -267,6 +240,7 @@ protected class Container_0_1_0_Assignment_nested extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Nested")) { Solution s = new Nested_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -297,6 +271,7 @@ protected class Container_0_1_1_Assignment_content extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Content")) { Solution s = new Content_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -349,7 +324,7 @@ protected class Nested_Group extends GroupToken { while(s1 != null) { Solution s2 = new Nested_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -377,7 +352,7 @@ protected class Nested_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Nested_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -405,7 +380,7 @@ protected class Nested_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Nested_0_0_0_Keyword_nested(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -461,6 +436,7 @@ protected class Nested_0_1_Assignment_nested extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Container")) { Solution s = new Container_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -580,7 +556,7 @@ protected class Children_Group extends GroupToken { while(s1 != null) { Solution s2 = new Children_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -608,7 +584,7 @@ protected class Children_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Children_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -636,7 +612,7 @@ protected class Children_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Children_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -664,7 +640,7 @@ protected class Children_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Children_0_0_0_0_Keyword_children(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -720,6 +696,7 @@ protected class Children_0_0_1_Assignment_children extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Child")) { Solution s = new Child_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -748,7 +725,7 @@ protected class Children_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Children_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -791,6 +768,7 @@ protected class Children_0_1_1_Assignment_children extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Child")) { Solution s = new Child_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -843,7 +821,7 @@ protected class Child_Group extends GroupToken { while(s1 != null) { Solution s2 = new Child_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -871,7 +849,7 @@ protected class Child_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Child_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -899,7 +877,7 @@ protected class Child_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Child_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -927,7 +905,7 @@ protected class Child_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Child_0_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -996,6 +974,7 @@ protected class Child_0_1_Assignment_value extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Named")) { Solution s = new Named_Assignment_name(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1047,7 +1026,7 @@ protected class AbstractChildren_Group extends GroupToken { while(s1 != null) { Solution s2 = new AbstractChildren_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1075,7 +1054,7 @@ protected class AbstractChildren_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new AbstractChildren_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1103,7 +1082,7 @@ protected class AbstractChildren_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new AbstractChildren_0_0_0_Keyword_abstractchildren(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1159,6 +1138,7 @@ protected class AbstractChildren_0_1_Assignment_abstractChildren extends Assignm IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractChild")) { Solution s = new AbstractChild_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1278,7 +1258,7 @@ protected class FirstConcrete_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstConcrete_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1306,7 +1286,7 @@ protected class FirstConcrete_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstConcrete_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1334,7 +1314,7 @@ protected class FirstConcrete_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstConcrete_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1362,7 +1342,7 @@ protected class FirstConcrete_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstConcrete_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1390,7 +1370,7 @@ protected class FirstConcrete_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new FirstConcrete_0_0_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1459,6 +1439,7 @@ protected class FirstConcrete_0_0_1_Assignment_value extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Named")) { Solution s = new Named_Assignment_name(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1537,7 +1518,7 @@ protected class SecondConcrete_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondConcrete_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1565,7 +1546,7 @@ protected class SecondConcrete_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondConcrete_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1593,7 +1574,7 @@ protected class SecondConcrete_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondConcrete_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1621,7 +1602,7 @@ protected class SecondConcrete_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondConcrete_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1649,7 +1630,7 @@ protected class SecondConcrete_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondConcrete_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1677,7 +1658,7 @@ protected class SecondConcrete_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new SecondConcrete_0_0_0_0_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1759,6 +1740,7 @@ protected class SecondConcrete_0_0_1_Assignment_value extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Named")) { Solution s = new Named_Assignment_name(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ReferenceGrammarTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ReferenceGrammarTestLanguageParseTreeConstructor.java index 9dd9441..162f4e0 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ReferenceGrammarTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/ReferenceGrammarTestLanguageParseTreeConstructor.java @@ -14,38 +14,17 @@ import org.eclipse.xtext.testlanguages.services.ReferenceGrammarTestLanguageGram public class ReferenceGrammarTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Spielplatz") && (s = new Spielplatz_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Person") && (s = new Person_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Kind") && (s = new Kind_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Erwachsener") && (s = new Erwachsener_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Spielzeug") && (s = new Spielzeug_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Farbe") && (s = new Farbe_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Familie") && (s = new Familie_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Spielplatz") && (s = new Spielplatz_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Person") && (s = new Person_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Kind") && (s = new Kind_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Erwachsener") && (s = new Erwachsener_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Spielzeug") && (s = new Spielzeug_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Farbe") && (s = new Farbe_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Familie") && (s = new Familie_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -73,7 +52,7 @@ protected class Spielplatz_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielplatz_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -101,7 +80,7 @@ protected class Spielplatz_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielplatz_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -129,7 +108,7 @@ protected class Spielplatz_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielplatz_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -157,7 +136,7 @@ protected class Spielplatz_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielplatz_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -185,7 +164,7 @@ protected class Spielplatz_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielplatz_0_0_0_0_0_Keyword_spielplatz(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -352,6 +331,7 @@ protected class Spielplatz_0_1_0_0_0_Assignment_kinder extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Kind")) { Solution s = new Kind_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -382,6 +362,7 @@ protected class Spielplatz_0_1_0_0_1_Assignment_erzieher extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Erwachsener")) { Solution s = new Erwachsener_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -413,6 +394,7 @@ protected class Spielplatz_0_1_0_1_Assignment_spielzeuge extends AssignmentToken IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Spielzeug")) { Solution s = new Spielzeug_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -444,6 +426,7 @@ protected class Spielplatz_0_1_1_Assignment_familie extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Familie")) { Solution s = new Familie_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -564,7 +547,7 @@ protected class Kind_Group extends GroupToken { while(s1 != null) { Solution s2 = new Kind_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -592,7 +575,7 @@ protected class Kind_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Kind_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -620,7 +603,7 @@ protected class Kind_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Kind_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -648,7 +631,7 @@ protected class Kind_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Kind_0_0_0_0_Keyword_kind(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -772,7 +755,7 @@ protected class Erwachsener_Group extends GroupToken { while(s1 != null) { Solution s2 = new Erwachsener_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -800,7 +783,7 @@ protected class Erwachsener_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Erwachsener_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -828,7 +811,7 @@ protected class Erwachsener_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Erwachsener_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -856,7 +839,7 @@ protected class Erwachsener_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Erwachsener_0_0_0_0_Keyword_erwachsener(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -980,7 +963,7 @@ protected class Spielzeug_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielzeug_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1008,7 +991,7 @@ protected class Spielzeug_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielzeug_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1036,7 +1019,7 @@ protected class Spielzeug_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielzeug_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1064,7 +1047,7 @@ protected class Spielzeug_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Spielzeug_0_0_0_0_Keyword_spielzeug(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1144,6 +1127,7 @@ protected class Spielzeug_0_1_Assignment_farbe extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Farbe")) { Solution s = new Farbe_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -1319,7 +1303,7 @@ protected class Familie_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1347,7 +1331,7 @@ protected class Familie_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1375,7 +1359,7 @@ protected class Familie_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1403,7 +1387,7 @@ protected class Familie_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1431,7 +1415,7 @@ protected class Familie_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1459,7 +1443,7 @@ protected class Familie_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1487,7 +1471,7 @@ protected class Familie_0_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_0_0_0_0_0_0_Keyword_familie(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -1655,7 +1639,7 @@ protected class Familie_0_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Familie_0_1_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/SimpleExpressionsTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/SimpleExpressionsTestLanguageParseTreeConstructor.java index be23e1c..19a4fcf 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/SimpleExpressionsTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/SimpleExpressionsTestLanguageParseTreeConstructor.java @@ -14,35 +14,16 @@ import org.eclipse.xtext.testlanguages.services.SimpleExpressionsTestLanguageGra public class SimpleExpressionsTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Sequence") && (s = new Sequence_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Addition_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Multiplication_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Term_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Atom") && (s = new Atom_Assignment_name(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Expression") && (s = new Parens_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Sequence") && (s = new Sequence_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Addition_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Multiplication_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Term_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Atom") && (s = new Atom_Assignment_name(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Expression") && (s = new Parens_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -70,7 +51,7 @@ protected class Sequence_Group extends GroupToken { while(s1 != null) { Solution s2 = new Sequence_0_RuleCall_Addition(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -116,7 +97,7 @@ protected class Sequence_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Sequence_1_0_Action_Sequence_expressions(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -167,6 +148,7 @@ protected class Sequence_1_1_Assignment_expressions extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Expression")) { Solution s = new Addition_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -206,7 +188,7 @@ protected class Addition_Group extends GroupToken { while(s1 != null) { Solution s2 = new Addition_0_RuleCall_Multiplication(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -252,7 +234,7 @@ protected class Addition_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Addition_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -280,7 +262,7 @@ protected class Addition_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Addition_1_0_0_Action_Op_values(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -360,6 +342,7 @@ protected class Addition_1_1_Assignment_values extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Expression")) { Solution s = new Multiplication_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -399,7 +382,7 @@ protected class Multiplication_Group extends GroupToken { while(s1 != null) { Solution s2 = new Multiplication_0_RuleCall_Term(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -445,7 +428,7 @@ protected class Multiplication_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new Multiplication_1_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -473,7 +456,7 @@ protected class Multiplication_1_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Multiplication_1_0_0_Action_Op_values(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -553,6 +536,7 @@ protected class Multiplication_1_1_Assignment_values extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Expression")) { Solution s = new Term_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -693,7 +677,7 @@ protected class Parens_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -721,7 +705,7 @@ protected class Parens_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Parens_0_0_Keyword(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TestLanguageParseTreeConstructor.java index fa06f87..c1b7a39 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TestLanguageParseTreeConstructor.java @@ -14,32 +14,15 @@ import org.eclipse.xtext.testlanguages.services.TestLanguageGrammarAccess; public class TestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Model") && (s = new EntryRule_Assignment_multiFeature(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("AbstractElement") && (s = new AbstractRule_Alternatives(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("ChoiceElement") && (s = new ChoiceRule_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("ReducibleElement") && (s = new ReducibleRule_Group(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("TerminalElement") && (s = new TerminalRule_Assignment_stringFeature(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Model") && (s = new EntryRule_Assignment_multiFeature(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("AbstractElement") && (s = new AbstractRule_Alternatives(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("ChoiceElement") && (s = new ChoiceRule_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("ReducibleElement") && (s = new ReducibleRule_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("TerminalElement") && (s = new TerminalRule_Assignment_stringFeature(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -70,6 +53,7 @@ protected class EntryRule_Assignment_multiFeature extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("AbstractElement")) { Solution s = new AbstractRule_Alternatives(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -175,7 +159,7 @@ protected class ChoiceRule_Group extends GroupToken { while(s1 != null) { Solution s2 = new ChoiceRule_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -203,7 +187,7 @@ protected class ChoiceRule_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ChoiceRule_0_0_Keyword_choice(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -301,7 +285,7 @@ protected class ReducibleRule_Group extends GroupToken { while(s1 != null) { Solution s2 = new ReducibleRule_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -329,7 +313,7 @@ protected class ReducibleRule_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new ReducibleRule_0_0_Keyword_reducible(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -388,7 +372,7 @@ protected class ReducibleRule_1_Group extends GroupToken { while(s1 != null) { Solution s2 = new ReducibleRule_1_0_Action_ReducibleComposite_actionFeature(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -439,6 +423,7 @@ protected class ReducibleRule_1_1_Assignment_actionFeature extends AssignmentTok IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("TerminalElement")) { Solution s = new TerminalRule_Assignment_stringFeature(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TreeTestLanguageParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TreeTestLanguageParseTreeConstructor.java index b5a7598..dcd53bd 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TreeTestLanguageParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/parsetree/reconstr/TreeTestLanguageParseTreeConstructor.java @@ -14,23 +14,12 @@ import org.eclipse.xtext.testlanguages.services.TreeTestLanguageGrammarAccess; public class TreeTestLanguageParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Model") && (s = new Model_Assignment_children(inst, null).firstSolution()) != null) return s; - - - if(inst.isInstanceOf("Node") && (s = new Node_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Model") && (s = new Model_Assignment_children(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; + if(inst.isInstanceOf("Node") && (s = new Node_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -61,6 +50,7 @@ protected class Model_Assignment_children extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Node")) { Solution s = new Node_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); @@ -98,7 +88,7 @@ protected class Node_Group extends GroupToken { while(s1 != null) { Solution s2 = new Node_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -126,7 +116,7 @@ protected class Node_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Node_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -154,7 +144,7 @@ protected class Node_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Node_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -182,7 +172,7 @@ protected class Node_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Node_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -210,7 +200,7 @@ protected class Node_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Node_0_0_0_0_0_Group(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -238,7 +228,7 @@ protected class Node_0_0_0_0_0_Group extends GroupToken { while(s1 != null) { Solution s2 = new Node_0_0_0_0_0_0_Assignment_name(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); @@ -355,6 +345,7 @@ protected class Node_0_1_Assignment_children extends AssignmentToken { IInstanceDescription param = getDescr((EObject)value); if(param.isInstanceOf("Node")) { Solution s = new Node_Group(param, this).firstSolution(); + while(s != null && !isConsumed(s,this)) s = s.getPredecessor().nextSolution(this,s); if(s != null) { type = AssignmentType.PRC; return new Solution(obj,s.getPredecessor()); diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Lexer.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Lexer.java index 917fab0..130bbc8 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Lexer.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Lexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313.g 2009-01-06 10:50:12 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313.g 2009-01-12 18:22:33 package org.eclipse.xtext.valueconverter.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Parser.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Parser.java index 7e18198..0717277 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Parser.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313Parser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313.g 2009-01-06 10:50:12 +// $ANTLR 3.0.1 ./src-gen/org/eclipse/xtext/valueconverter/parser/internal/InternalBug250313.g 2009-01-12 18:22:33 package org.eclipse.xtext.valueconverter.parser.internal; diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parsetree/reconstr/Bug250313ParseTreeConstructor.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parsetree/reconstr/Bug250313ParseTreeConstructor.java index 8ceb13e..be48a74 100644 --- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parsetree/reconstr/Bug250313ParseTreeConstructor.java +++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/parsetree/reconstr/Bug250313ParseTreeConstructor.java @@ -14,20 +14,11 @@ import org.eclipse.xtext.valueconverter.services.Bug250313GrammarAccess; public class Bug250313ParseTreeConstructor extends AbstractParseTreeConstructor { - - public IAbstractToken serialize(EObject object) { - if(object == null) throw new IllegalArgumentException("The to-be-serialialized model is null"); - Solution t = internalSerialize(object); - if(t == null) throw new XtextSerializationException(getDescr(object), "No rule found for serialization"); - return t.getPredecessor(); - } - + protected Solution internalSerialize(EObject obj) { IInstanceDescription inst = getDescr(obj); Solution s; - - if(inst.isInstanceOf("Ref2") && (s = new Ref2_Group(inst, null).firstSolution()) != null) return s; - + if(inst.isInstanceOf("Ref2") && (s = new Ref2_Group(inst, null).firstSolution()) != null && isConsumed(s,null)) return s; return null; } @@ -55,7 +46,7 @@ protected class Ref2_Group extends GroupToken { while(s1 != null) { Solution s2 = new Ref2_0_Keyword_2(s1.getCurrent(), s1.getPredecessor()).firstSolution(); if(s2 == null) { - s1 = s1.getPredecessor().nextSolution(this); + s1 = s1.getPredecessor().nextSolution(this,s1); if(s1 == null) return null; } else { last = s2.getPredecessor(); diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java index 1931452..9eab85b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java @@ -20,6 +20,18 @@ public class FormatterTest extends AbstractGeneratorTest { assertEquals(expected, res); } + public void _testKeepComments() throws Exception { + // final String model = "test linewrap float val; int x; double y;"; + final String model = "// begincomment \ntest linewrap // comment1\n" + + "float val; //comment2\n" + "int x;\n" + + "double y;//yoyoyo!\n// endcomment."; + EObject m = getModel(model); + // System.out.println(EmfFormater.objToStr(m, "")); + String res = serialize(m); + // System.out.println(res); + assertEquals(model, res); + } + public void testIndentation() throws Exception { final String model = "test indentation { float val; indentation { int x; } double y; }"; final String expected = "test indentation {\n indentation {\n int x;\n }\n float val;\n double y;\n}"; diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java index 70501dc..e826388 100644 --- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java @@ -64,6 +64,21 @@ public class ComplexReconstrTest extends AbstractGeneratorTest { reconstructAndCompare("a"); reconstructAndCompare("a + b"); } + + public void testTrickyGSimple() throws Exception { + String model = "TG [[2]]"; + assertEquals(model, parseAndSerialize(model)); + } + + public void testTrickyGWithNull() throws Exception { + String model = "TG [0,[2,0],3,4,0]"; + assertEquals(model, parseAndSerialize(model)); + } + + public void testTrickyGComplex() throws Exception { + String model = "TG [2, [2,3,45,6],242,[23423,[34,34,[242343],234]]]"; + assertEquals(model, parseAndSerialize(model)); + } private void reconstructAndCompare(String mymodel) throws Exception, InterruptedException { diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xtext b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xtext index 35823e0..a39f0c3 100644 --- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xtext +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTestLanguage.xtext @@ -10,6 +10,8 @@ language org.eclipse.xtext.parsetree.reconstr.ComplexReconstrTestLanguage generate complexrewritetest "http://complex/rewrite/test" +Root: Op | TrickyG; + Op returns Expression: Term ({Add.addOperands+=current} '+' addOperands+=Term | {Minus.minusOperands+=current} '-' minusOperands+=Term)*; @@ -43,6 +45,12 @@ TrickyE: 'TE' (name+=INT foo+=STRING type+=ID)* 'x' (name+=INT type+=ID)*; // TrickyF: 'TF' (name+=ID type+=INT)* (name+=ID | type+=INT); +TrickyG: 'TG' tree=TrickyG1; +TrickyG1: '[' (vals+=TrickyG2 (',' vals+=TrickyG2)*)? ']'; +TrickyG2: TrickyG1 | val=INT; + +//TrickyH: x+='a' TrickyH?; + // TrickyG: TrickyG1 | TrickyG2; // TrickyG1: name=TrickyG3; diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java index f56b0da..b1cf35b 100644 --- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java +++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java @@ -8,6 +8,7 @@ import org.eclipse.xtext.Grammar; import org.eclipse.xtext.XtextStandaloneSetup; import org.eclipse.xtext.resource.XtextResourceSet; import org.eclipse.xtext.tests.AbstractGeneratorTest; +import org.eclipse.xtext.util.EmfFormater; import org.eclipse.xtext.util.StringInputStream; public class XtextGrammarReconcilationTest extends AbstractGeneratorTest { @@ -31,7 +32,7 @@ public class XtextGrammarReconcilationTest extends AbstractGeneratorTest { // modify first rule object.getRules().get(0).setName("HONOLULU"); - // System.out.println(EmfFormater.objToStr(object, "")); + System.out.println(EmfFormater.objToStr(object, "")); // save ByteArrayOutputStream out = new ByteArrayOutputStream(); |

