aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-02-12 08:47:49 (EST)
committersefftinge2009-02-12 08:47:49 (EST)
commit363af19679492fff4e0c4771175e0ebe40a8b8a0 (patch)
tree6be06d9eb48456ededdb90899527e9a99eac3d0d
parent5482837ed0be178a456ce0d4a64ed8ba6524dc17 (diff)
downloadorg.eclipse.xtext-363af19679492fff4e0c4771175e0ebe40a8b8a0.zip
org.eclipse.xtext-363af19679492fff4e0c4771175e0ebe40a8b8a0.tar.gz
org.eclipse.xtext-363af19679492fff4e0c4771175e0ebe40a8b8a0.tar.bz2
GrammarAccess has accessors for inherited rules
-rw-r--r--devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/services/ReferenceGrammarGrammarAccess.java65
-rw-r--r--examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore2
-rw-r--r--examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/services/DomainmodelGrammarAccess.java81
-rw-r--r--examples/org.eclipse.xtext.example.ecoredsl/src-gen/org/eclipse/xtext/example/services/EcoreDslGrammarAccess.java97
-rw-r--r--examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/services/FowlerDslGrammarAccess.java59
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore8
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/ImportUriTestLanguageGrammarAccess.java55
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/LangATestLanguageGrammarAccess.java55
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/services/DummyTestLanguageGrammarAccess.java53
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/generator/services/LowerCaseNamedTestLanguageGrammarAccess.java51
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/AbstractTestLanguageGrammarAccess.java59
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/ConcreteTestLanguageGrammarAccess.java162
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MetamodelRefTestLanguageGrammarAccess.java55
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MultiGenMMTestLanguageGrammarAccess.java53
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/services/DatatypeRulesTestLanguageGrammarAccess.java63
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore2
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/services/EpatchTestLanguageGrammarAccess.java101
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java51
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/XtextTerminalsTestLanguage.ecore2
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/HiddenTerminalsTestLanguageGrammarAccess.java34
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/TerminalRulesTestLanguageGrammarAccess.java22
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/XtextTerminalsTestLanguageGrammarAccess.java80
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/services/FormatterTestLanguageGrammarAccess.java57
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/ComplexReconstrTestLanguageGrammarAccess.java79
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/SimpleReconstrTestLanguageGrammarAccess.java69
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/services/TransientValuesTestGrammarAccess.java57
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/services/MultiValueFeatureTestLanguageGrammarAccess.java51
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java109
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java55
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java59
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/FowlerDslTestLanguageGrammarAccess.java59
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LexerTestLanguageGrammarAccess.java49
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LookaheadTestLanguageGrammarAccess.java63
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/OptionalEmptyTestLanguageGrammarAccess.java53
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/PartialParserTestLanguageGrammarAccess.java69
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java63
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/SimpleExpressionsTestLanguageGrammarAccess.java61
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TestLanguageGrammarAccess.java59
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java53
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/services/Bug250313GrammarAccess.java51
-rw-r--r--tests/org.eclipse.xtext.ui.integration.tests/src-gen/org/eclipse/xtext/ui/integration/services/TestLanguageGrammarAccess.java53
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/GenXtextGrammarTestLanguageScopeProvider.ext28
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/XtextTest.ecore2
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java51
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java109
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarTestLanguageScopeProvider.ext8
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore6
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java59
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java63
-rw-r--r--tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java53
50 files changed, 2177 insertions, 581 deletions
diff --git a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/services/ReferenceGrammarGrammarAccess.java b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/services/ReferenceGrammarGrammarAccess.java
index db9e97e..0db666e 100644
--- a/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/services/ReferenceGrammarGrammarAccess.java
+++ b/devtools/org.eclipse.xtext.reference/src-gen/org/eclipse/xtext/reference/services/ReferenceGrammarGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.reference.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class SpielplatzElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spielplatz");
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);
@@ -122,7 +123,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class PersonElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Person");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallKind = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallErwachsener = (RuleCall)cAlternatives.eContents().get(1);
@@ -141,7 +142,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class KindElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Kind");
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);
@@ -192,7 +193,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class ErwachsenerElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Erwachsener");
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);
@@ -243,7 +244,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class SpielzeugElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spielzeug");
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);
@@ -294,7 +295,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class FamilieElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Familie");
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);
@@ -405,7 +406,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class FarbeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Farbe");
private final Assignment cAssignmentWert = (Assignment)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAssignmentWert.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -444,7 +445,7 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
public class CustomTypeParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CustomTypeParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordType = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -478,6 +479,13 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
private static FamilieElements pFamilie;
private static FarbeElements pFarbe;
private static CustomTypeParserRuleElements pCustomTypeParserRule;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -488,10 +496,6 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Spielplatz: ("spielplatz" groesse=INT (beschreibung=STRING)? "{" (kinder+=Kind|erzieher+=Erwachsener|spielzeuge+=Spielzeug|familie+=Familie|types+=CustomTypeParserRule)* "}")?;
@@ -533,4 +537,39 @@ public class ReferenceGrammarGrammarAccess extends BaseEPackageAccess implements
public CustomTypeParserRuleElements prCustomTypeParserRule() {
return (pCustomTypeParserRule != null) ? pCustomTypeParserRule : (pCustomTypeParserRule = new CustomTypeParserRuleElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore
index 00627f8..1b4861b 100644
--- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore
+++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/domainmodel.ecore
@@ -34,10 +34,10 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="//TypedElement"/>
<eClassifiers xsi:type="ecore:EClass" name="TypedElement">
- <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TypeRef">
<eStructuralFeatures xsi:type="ecore:EReference" name="referenced" eType="//Type"/>
diff --git a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/services/DomainmodelGrammarAccess.java b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/services/DomainmodelGrammarAccess.java
index b5b1cd7..ee537f0 100644
--- a/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/services/DomainmodelGrammarAccess.java
+++ b/examples/org.eclipse.xtext.example.domainmodel/src-gen/org/eclipse/xtext/example/services/DomainmodelGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.example.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class FileElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "File");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentImports = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00ParserRuleCallImport = (RuleCall)c0AssignmentImports.eContents().get(0);
@@ -38,7 +39,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class ImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Import");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordImport = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentImportURI = (Assignment)cGroup.eContents().get(1);
@@ -61,7 +62,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class NamedElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NamedElement");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallPackage = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallType = (RuleCall)cAlternatives.eContents().get(1);
@@ -80,7 +81,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class PackageElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Package");
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);
@@ -131,7 +132,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class TypeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Type");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallEntity = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallDataType = (RuleCall)cAlternatives.eContents().get(1);
@@ -150,7 +151,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class DataTypeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "DataType");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordDatatype = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -173,7 +174,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class EntityElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Entity");
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);
@@ -244,7 +245,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class FeatureElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Feature");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallStructuralFeature = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallOperation = (RuleCall)cAlternatives.eContents().get(1);
@@ -263,7 +264,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class StructuralFeatureElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "StructuralFeature");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAttribute = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallReference = (RuleCall)cAlternatives.eContents().get(1);
@@ -282,7 +283,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class AttributeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Attribute");
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);
@@ -325,7 +326,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class ReferenceElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Reference");
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);
@@ -388,7 +389,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class OperationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Operation");
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);
@@ -479,7 +480,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class ParameterElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Parameter");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -506,7 +507,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class TypedElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TypedElement");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallFeature = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallParameter = (RuleCall)cAlternatives.eContents().get(1);
@@ -525,7 +526,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class TypeRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(16);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TypeRef");
private final Assignment cAssignmentReferenced = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringType = (CrossReference)cAssignmentReferenced.eContents().get(0);
@@ -540,7 +541,7 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
public class QualifiedNameElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(17);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "QualifiedName");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -586,6 +587,13 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
private static TypedElementElements pTypedElement;
private static TypeRefElements pTypeRef;
private static QualifiedNameElements pQualifiedName;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -596,10 +604,6 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// File: (imports+=Import)* (namedElements+=NamedElement)*;
@@ -681,4 +685,39 @@ public class DomainmodelGrammarAccess extends BaseEPackageAccess implements IGra
public QualifiedNameElements prQualifiedName() {
return (pQualifiedName != null) ? pQualifiedName : (pQualifiedName = new QualifiedNameElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/examples/org.eclipse.xtext.example.ecoredsl/src-gen/org/eclipse/xtext/example/services/EcoreDslGrammarAccess.java b/examples/org.eclipse.xtext.example.ecoredsl/src-gen/org/eclipse/xtext/example/services/EcoreDslGrammarAccess.java
index 8cdbaaf..eeeb97c 100644
--- a/examples/org.eclipse.xtext.example.ecoredsl/src-gen/org/eclipse/xtext/example/services/EcoreDslGrammarAccess.java
+++ b/examples/org.eclipse.xtext.example.ecoredsl/src-gen/org/eclipse/xtext/example/services/EcoreDslGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.example.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class EcoreDslElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EcoreDsl");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentImports = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00ParserRuleCallImportStatementDecl = (RuleCall)c0AssignmentImports.eContents().get(0);
@@ -38,7 +39,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class ImportStatementDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ImportStatementDecl");
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);
@@ -89,7 +90,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EPackageDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EPackageDecl");
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);
@@ -220,7 +221,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class SubEPackageDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SubEPackageDecl");
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);
@@ -295,7 +296,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EClassifierDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EClassifierDecl");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallEClassDecl = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallEDataTypeDecl = (RuleCall)cAlternatives.eContents().get(1);
@@ -314,7 +315,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EDataTypeDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EDataTypeDecl");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Group c0Group = (Group)cAlternatives.eContents().get(0);
private final Group c00Group = (Group)c0Group.eContents().get(0);
@@ -397,7 +398,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EAnnotationDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EAnnotationDecl");
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);
@@ -480,7 +481,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EClassDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EClassDecl");
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);
@@ -687,7 +688,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EStructuralFeatureDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EStructuralFeatureDecl");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallEAttributeDecl = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallEReferenceDecl = (RuleCall)cAlternatives.eContents().get(1);
@@ -706,7 +707,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EAttributeDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EAttributeDecl");
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);
@@ -925,7 +926,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EReferenceDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EReferenceDecl");
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);
@@ -1156,7 +1157,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EEnumDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EEnumDecl");
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);
@@ -1219,7 +1220,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EEnumLiteralDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EEnumLiteralDecl");
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);
@@ -1286,7 +1287,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class ETypeParameterDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ETypeParameterDecl");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -1321,7 +1322,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EGenericTypeReferenceDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(16);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EGenericTypeReferenceDecl");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Group c0Group = (Group)cAlternatives.eContents().get(0);
private final Assignment c00AssignmentEClassifier = (Assignment)c0Group.eContents().get(0);
@@ -1404,7 +1405,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EGenericTypeDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(17);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EGenericTypeDecl");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Group c00Group = (Group)c0Alternatives.eContents().get(0);
@@ -1535,7 +1536,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EOperationDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(18);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EOperationDecl");
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);
@@ -1758,7 +1759,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class EParameterDeclElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(19);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EParameterDecl");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentEAnnotations = (Assignment)c0Group.eContents().get(0);
@@ -1797,7 +1798,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class MapEntrySuperElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(20);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "MapEntrySuper");
private final RuleCall cParserRuleCallMapEntry = (RuleCall)rule.eContents().get(1);
// MapEntrySuper returns EObject: MapEntry;
@@ -1808,7 +1809,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class MapEntryElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(21);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "MapEntry");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentDetailKey = (Assignment)c0Group.eContents().get(0);
@@ -1843,7 +1844,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class MultiplicityExprElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(22);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "MultiplicityExpr");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Keyword c00KeywordPlusSign = (Keyword)c0Alternatives.eContents().get(0);
@@ -1870,7 +1871,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class QIDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(23);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "QID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -1905,7 +1906,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class STRING_OR_QIDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(24);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "STRING_OR_QID");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallSTRING = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallQID = (RuleCall)cAlternatives.eContents().get(1);
@@ -1924,7 +1925,7 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
public class SINTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(25);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SINT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordHyphenMinus = (Keyword)cGroup.eContents().get(0);
private final RuleCall c1LexerRuleCallINT = (RuleCall)cGroup.eContents().get(1);
@@ -1970,6 +1971,13 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
private static QIDElements pQID;
private static STRING_OR_QIDElements pSTRING_OR_QID;
private static SINTElements pSINT;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -1980,10 +1988,6 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// EcoreDsl: (imports+=ImportStatementDecl)* package=EPackageDecl;
@@ -2105,4 +2109,39 @@ public class EcoreDslGrammarAccess extends BaseEPackageAccess implements IGramma
public SINTElements prSINT() {
return (pSINT != null) ? pSINT : (pSINT = new SINTElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/services/FowlerDslGrammarAccess.java b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/services/FowlerDslGrammarAccess.java
index 99cf4e9..29ce5c0 100644
--- a/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/services/FowlerDslGrammarAccess.java
+++ b/examples/org.eclipse.xtext.example.fowlerdsl/src-gen/org/eclipse/xtext/example/services/FowlerDslGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.example.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class StatemachineElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Statemachine");
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);
@@ -82,7 +83,7 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
}
public class EventElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Event");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentResetting = (Assignment)c0Group.eContents().get(0);
@@ -121,7 +122,7 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
}
public class CommandElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Command");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -148,7 +149,7 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
}
public class StateElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "State");
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);
@@ -227,7 +228,7 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
}
public class TransitionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Transition");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentEvent = (Assignment)c0Group.eContents().get(0);
@@ -270,6 +271,13 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
private static CommandElements pCommand;
private static StateElements pState;
private static TransitionElements pTransition;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -280,10 +288,6 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Statemachine: "events" (events+=Event)* "end" "commands" (commands+=Command)* "end" (states+=State)*;
@@ -310,4 +314,39 @@ public class FowlerDslGrammarAccess extends BaseEPackageAccess implements IGramm
public TransitionElements prTransition() {
return (pTransition != null) ? pTransition : (pTransition = new TransitionElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore
index 8a9eada..ae9485c 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/XtextTest.ecore
@@ -16,18 +16,18 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" eType="//AbstractRule" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractRule">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractMetamodelDeclaration">
- <eStructuralFeatures xsi:type="ecore:EReference" name="ePackage">
- <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EPackage"/>
- </eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="alias">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ePackage">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/emf/2002/Ecore#//EPackage"/>
+ </eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GeneratedMetamodel" eSuperTypes="//AbstractMetamodelDeclaration">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/ImportUriTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/ImportUriTestLanguageGrammarAccess.java
index 327b638..77562a6 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/ImportUriTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/ImportUriTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.crossrefs.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ImportUriTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class MainElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Main");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentImports = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00ParserRuleCallImport = (RuleCall)c0AssignmentImports.eContents().get(0);
@@ -38,7 +39,7 @@ public class ImportUriTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class ImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Import");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordImport = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentImportURI = (Assignment)cGroup.eContents().get(1);
@@ -61,7 +62,7 @@ public class ImportUriTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class TypeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Type");
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);
@@ -110,6 +111,13 @@ public class ImportUriTestLanguageGrammarAccess extends BaseEPackageAccess imple
private static MainElements pMain;
private static ImportElements pImport;
private static TypeElements pType;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -120,10 +128,6 @@ public class ImportUriTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Main: (imports+=Import)* (types+=Type)*;
@@ -140,4 +144,39 @@ public class ImportUriTestLanguageGrammarAccess extends BaseEPackageAccess imple
public TypeElements prType() {
return (pType != null) ? pType : (pType = new TypeElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/LangATestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/LangATestLanguageGrammarAccess.java
index 9c830ba..0b47536 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/LangATestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/crossrefs/services/LangATestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.crossrefs.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class LangATestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class MainElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Main");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentImports = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00ParserRuleCallImport = (RuleCall)c0AssignmentImports.eContents().get(0);
@@ -38,7 +39,7 @@ public class LangATestLanguageGrammarAccess extends BaseEPackageAccess implement
}
public class ImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Import");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordImport = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentUri = (Assignment)cGroup.eContents().get(1);
@@ -61,7 +62,7 @@ public class LangATestLanguageGrammarAccess extends BaseEPackageAccess implement
}
public class TypeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Type");
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);
@@ -110,6 +111,13 @@ public class LangATestLanguageGrammarAccess extends BaseEPackageAccess implement
private static MainElements pMain;
private static ImportElements pImport;
private static TypeElements pType;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -120,10 +128,6 @@ public class LangATestLanguageGrammarAccess extends BaseEPackageAccess implement
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Main: (imports+=Import)* (types+=Type)*;
@@ -140,4 +144,39 @@ public class LangATestLanguageGrammarAccess extends BaseEPackageAccess implement
public TypeElements prType() {
return (pType != null) ? pType : (pType = new TypeElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/services/DummyTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/services/DummyTestLanguageGrammarAccess.java
index 9cec6d5..38c6e37 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/services/DummyTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/dummy/services/DummyTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.dummy.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class DummyTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentElements = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallElement = (RuleCall)cAssignmentElements.eContents().get(0);
@@ -26,7 +27,7 @@ public class DummyTestLanguageGrammarAccess extends BaseEPackageAccess implement
}
public class ElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Element");
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);
@@ -86,6 +87,13 @@ public class DummyTestLanguageGrammarAccess extends BaseEPackageAccess implement
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
private static ElementElements pElement;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -96,10 +104,6 @@ public class DummyTestLanguageGrammarAccess extends BaseEPackageAccess implement
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: (elements+=Element)*;
@@ -111,4 +115,39 @@ public class DummyTestLanguageGrammarAccess extends BaseEPackageAccess implement
public ElementElements prElement() {
return (pElement != null) ? pElement : (pElement = new ElementElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/generator/services/LowerCaseNamedTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/generator/services/LowerCaseNamedTestLanguageGrammarAccess.java
index 7e3c3c1..7c7e781 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/generator/services/LowerCaseNamedTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/generator/services/LowerCaseNamedTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.generator.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class LowerCaseNamedTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -30,6 +31,13 @@ public class LowerCaseNamedTestLanguageGrammarAccess extends BaseEPackageAccess
private static final String LOWERCASENAMEDTESTLANGUAGE_GRAMMAR_CP_URI = "classpath:/org/eclipse/xtext/generator/lowerCaseNamedTestLanguage.xmi";
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -40,14 +48,45 @@ public class LowerCaseNamedTestLanguageGrammarAccess extends BaseEPackageAccess
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: name=ID;
public ModelElements prModel() {
return (pModel != null) ? pModel : (pModel = new ModelElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/AbstractTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/AbstractTestLanguageGrammarAccess.java
index 09d6e1e..b0161d5 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/AbstractTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/AbstractTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.grammarinheritance.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class InheritedParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "InheritedParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordElement = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -34,7 +35,7 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class AbstractCallOverridenParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractCallOverridenParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordOverridemodel = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentElements = (Assignment)cGroup.eContents().get(1);
@@ -57,7 +58,7 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class OverridableParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "OverridableParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordElement = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -80,7 +81,7 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class OverridableParserRule2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "OverridableParserRule2");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordOtherElement = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -103,7 +104,7 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class AbstractCallExtendedParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractCallExtendedParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordExtendedmodel = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentElements = (Assignment)cGroup.eContents().get(1);
@@ -126,7 +127,7 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class ExtendableParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ExtendableParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordElement = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -160,6 +161,12 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
private static ExtendableParserRuleElements pExtendableParserRule;
private static LexerRule lREAL;
private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -170,10 +177,6 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// InheritedParserRule returns AType: "element" name=ID;
@@ -208,11 +211,41 @@ public class AbstractTestLanguageGrammarAccess extends BaseEPackageAccess implem
// lexer REAL returns EDouble: "RULE_INT \'.\' RULE_INT";
public LexerRule lrREAL() {
- return (lREAL != null) ? lREAL : (lREAL = (LexerRule) getGrammar().eContents().get(8));
+ return (lREAL != null) ? lREAL : (lREAL = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "REAL"));
}
// lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'\u00F6\'|\'\u00E4\'|\'\u00FC\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
public LexerRule lrID() {
- return (lID != null) ? lID : (lID = (LexerRule) getGrammar().eContents().get(9));
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
}
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/ConcreteTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/ConcreteTestLanguageGrammarAccess.java
index 5697b81..bd7af1f 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/ConcreteTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/grammarinheritance/services/ConcreteTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.grammarinheritance.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.grammarinheritance.services.AbstractTestLanguageGrammarAccess;
+@Singleton
public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class RootRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "RootRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -46,7 +47,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class ConcreteParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ConcreteParserRule");
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);
@@ -89,7 +90,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class OverridableParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "OverridableParserRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordOverriddenelement = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -112,7 +113,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class CallOverridenParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CallOverridenParserRule");
private final Assignment cAssignmentCall = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAbstractCallOverridenParserRule = (RuleCall)cAssignmentCall.eContents().get(0);
@@ -127,7 +128,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class OverridableParserRule2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "OverridableParserRule2");
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);
@@ -170,7 +171,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class ExtendableParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ExtendableParserRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final RuleCall c00ParserRuleCallSubrule1 = (RuleCall)c0Alternatives.eContents().get(0);
@@ -197,7 +198,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class Subrule1Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Subrule1");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordSubrule1 = (Keyword)c0Group.eContents().get(0);
@@ -232,7 +233,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class Subrule2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Subrule2");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordSubrule3 = (Keyword)c0Group.eContents().get(0);
@@ -267,7 +268,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class Subrule3Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Subrule3");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordSubrule3 = (Keyword)c0Group.eContents().get(0);
@@ -302,7 +303,7 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
public class CallExtendedParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CallExtendedParserRule");
private final Assignment cAssignmentCall = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAbstractCallExtendedParserRule = (RuleCall)cAssignmentCall.eContents().get(0);
@@ -315,6 +316,75 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
// AbstractCallExtendedParserRule
public RuleCall ele0ParserRuleCallAbstractCallExtendedParserRule() { return c0ParserRuleCallAbstractCallExtendedParserRule; }
}
+
+ public class InheritedParserRuleElements implements IParserRuleAccess {
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "InheritedParserRule");
+ private final Group cGroup = (Group)rule.eContents().get(1);
+ private final Keyword c0KeywordElement = (Keyword)cGroup.eContents().get(0);
+ private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
+ private final RuleCall c10LexerRuleCallID = (RuleCall)c1AssignmentName.eContents().get(0);
+
+ // InheritedParserRule returns AType: "element" name=ID;
+ public ParserRule getRule() { return rule; }
+
+ // "element" name=ID
+ public Group eleGroup() { return cGroup; }
+
+ // "element"
+ public Keyword ele0KeywordElement() { return c0KeywordElement; }
+
+ // name=ID
+ public Assignment ele1AssignmentName() { return c1AssignmentName; }
+
+ // ID
+ public RuleCall ele10LexerRuleCallID() { return c10LexerRuleCallID; }
+ }
+
+ public class AbstractCallOverridenParserRuleElements implements IParserRuleAccess {
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractCallOverridenParserRule");
+ private final Group cGroup = (Group)rule.eContents().get(1);
+ private final Keyword c0KeywordOverridemodel = (Keyword)cGroup.eContents().get(0);
+ private final Assignment c1AssignmentElements = (Assignment)cGroup.eContents().get(1);
+ private final RuleCall c10ParserRuleCallOverridableParserRule = (RuleCall)c1AssignmentElements.eContents().get(0);
+
+ // AbstractCallOverridenParserRule returns AModel: "overridemodel" (elements+=OverridableParserRule)*;
+ public ParserRule getRule() { return rule; }
+
+ // "overridemodel" (elements+=OverridableParserRule)*
+ public Group eleGroup() { return cGroup; }
+
+ // "overridemodel"
+ public Keyword ele0KeywordOverridemodel() { return c0KeywordOverridemodel; }
+
+ // (elements+=OverridableParserRule)*
+ public Assignment ele1AssignmentElements() { return c1AssignmentElements; }
+
+ // OverridableParserRule
+ public RuleCall ele10ParserRuleCallOverridableParserRule() { return c10ParserRuleCallOverridableParserRule; }
+ }
+
+ public class AbstractCallExtendedParserRuleElements implements IParserRuleAccess {
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractCallExtendedParserRule");
+ private final Group cGroup = (Group)rule.eContents().get(1);
+ private final Keyword c0KeywordExtendedmodel = (Keyword)cGroup.eContents().get(0);
+ private final Assignment c1AssignmentElements = (Assignment)cGroup.eContents().get(1);
+ private final RuleCall c10ParserRuleCallExtendableParserRule = (RuleCall)c1AssignmentElements.eContents().get(0);
+
+ // AbstractCallExtendedParserRule returns AModel: "extendedmodel" (elements+=ExtendableParserRule)*;
+ public ParserRule getRule() { return rule; }
+
+ // "extendedmodel" (elements+=ExtendableParserRule)*
+ public Group eleGroup() { return cGroup; }
+
+ // "extendedmodel"
+ public Keyword ele0KeywordExtendedmodel() { return c0KeywordExtendedmodel; }
+
+ // (elements+=ExtendableParserRule)*
+ public Assignment ele1AssignmentElements() { return c1AssignmentElements; }
+
+ // ExtendableParserRule
+ public RuleCall ele10ParserRuleCallExtendableParserRule() { return c10ParserRuleCallExtendableParserRule; }
+ }
public final static ConcreteTestLanguageGrammarAccess INSTANCE = new ConcreteTestLanguageGrammarAccess();
@@ -330,6 +400,17 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
private static Subrule2Elements pSubrule2;
private static Subrule3Elements pSubrule3;
private static CallExtendedParserRuleElements pCallExtendedParserRule;
+ private static InheritedParserRuleElements pInheritedParserRule;
+ private static AbstractCallOverridenParserRuleElements pAbstractCallOverridenParserRule;
+ private static AbstractCallExtendedParserRuleElements pAbstractCallExtendedParserRule;
+ private static LexerRule lREAL;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -340,10 +421,6 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
return GRAMMAR;
}
-
- public AbstractTestLanguageGrammarAccess getSuperGrammar() {
- return AbstractTestLanguageGrammarAccess.INSTANCE;
- }
// RootRule: ConcreteParserRule|CallOverridenParserRule|CallExtendedParserRule|OverridableParserRule2;
@@ -395,4 +472,59 @@ public class ConcreteTestLanguageGrammarAccess extends BaseEPackageAccess implem
public CallExtendedParserRuleElements prCallExtendedParserRule() {
return (pCallExtendedParserRule != null) ? pCallExtendedParserRule : (pCallExtendedParserRule = new CallExtendedParserRuleElements());
}
+
+ // InheritedParserRule returns AType: "element" name=ID;
+ public InheritedParserRuleElements prInheritedParserRule() {
+ return (pInheritedParserRule != null) ? pInheritedParserRule : (pInheritedParserRule = new InheritedParserRuleElements());
+ }
+
+ // AbstractCallOverridenParserRule returns AModel: "overridemodel" (elements+=OverridableParserRule)*;
+ public AbstractCallOverridenParserRuleElements prAbstractCallOverridenParserRule() {
+ return (pAbstractCallOverridenParserRule != null) ? pAbstractCallOverridenParserRule : (pAbstractCallOverridenParserRule = new AbstractCallOverridenParserRuleElements());
+ }
+
+ // AbstractCallExtendedParserRule returns AModel: "extendedmodel" (elements+=ExtendableParserRule)*;
+ public AbstractCallExtendedParserRuleElements prAbstractCallExtendedParserRule() {
+ return (pAbstractCallExtendedParserRule != null) ? pAbstractCallExtendedParserRule : (pAbstractCallExtendedParserRule = new AbstractCallExtendedParserRuleElements());
+ }
+
+ // lexer REAL returns EDouble: "RULE_INT \'.\' RULE_INT";
+ public LexerRule lrREAL() {
+ return (lREAL != null) ? lREAL : (lREAL = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "REAL"));
+ }
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'\u00F6\'|\'\u00E4\'|\'\u00FC\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MetamodelRefTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MetamodelRefTestLanguageGrammarAccess.java
index ff6f9d6..62393f2 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MetamodelRefTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MetamodelRefTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.metamodelreferencing.tests.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class MetamodelRefTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class FooElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Foo");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -38,7 +39,7 @@ public class MetamodelRefTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class NameRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NameRef");
private final Assignment cAssignmentRule = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringParserRule = (CrossReference)cAssignmentRule.eContents().get(0);
@@ -53,7 +54,7 @@ public class MetamodelRefTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class MyRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "MyRule");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -74,6 +75,13 @@ public class MetamodelRefTestLanguageGrammarAccess extends BaseEPackageAccess im
private static FooElements pFoo;
private static NameRefElements pNameRef;
private static MyRuleElements pMyRule;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -84,10 +92,6 @@ public class MetamodelRefTestLanguageGrammarAccess extends BaseEPackageAccess im
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Foo: name=ID (nameRefs+=NameRef)*;
@@ -104,4 +108,39 @@ public class MetamodelRefTestLanguageGrammarAccess extends BaseEPackageAccess im
public MyRuleElements prMyRule() {
return (pMyRule != null) ? pMyRule : (pMyRule = new MyRuleElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MultiGenMMTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MultiGenMMTestLanguageGrammarAccess.java
index 159ef9d..030c715 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MultiGenMMTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/metamodelreferencing/tests/services/MultiGenMMTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.metamodelreferencing.tests.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class MultiGenMMTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class FooElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Foo");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -38,7 +39,7 @@ public class MultiGenMMTestLanguageGrammarAccess extends BaseEPackageAccess impl
}
public class NameRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NameRef");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallSTRING = (RuleCall)cAssignmentName.eContents().get(0);
@@ -58,6 +59,13 @@ public class MultiGenMMTestLanguageGrammarAccess extends BaseEPackageAccess impl
private static Grammar GRAMMAR = null;
private static FooElements pFoo;
private static NameRefElements pNameRef;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -68,10 +76,6 @@ public class MultiGenMMTestLanguageGrammarAccess extends BaseEPackageAccess impl
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Foo: name=ID (nameRefs+=NameRef)*;
@@ -83,4 +87,39 @@ public class MultiGenMMTestLanguageGrammarAccess extends BaseEPackageAccess impl
public NameRefElements prNameRef() {
return (pNameRef != null) ? pNameRef : (pNameRef = new NameRefElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/services/DatatypeRulesTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/services/DatatypeRulesTestLanguageGrammarAccess.java
index f2b7ffd..75f6aa6 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/services/DatatypeRulesTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/datatyperules/services/DatatypeRulesTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.datatyperules.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class CompositeModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CompositeModel");
private final Assignment cAssignmentModel = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallModel = (RuleCall)cAssignmentModel.eContents().get(0);
@@ -26,7 +27,7 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
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);
@@ -109,7 +110,7 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ModelIdElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ModelId");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0Group.eContents().get(0);
@@ -136,7 +137,7 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class NestedModelIdElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NestedModelId");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final RuleCall c00ParserRuleCallModelId = (RuleCall)c0Group.eContents().get(0);
@@ -163,7 +164,7 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class FractionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Fraction");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallINT = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -190,7 +191,7 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class VectorElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Vector");
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);
@@ -225,7 +226,7 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class DotsElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Dots");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Group c0Group = (Group)cAlternatives.eContents().get(0);
private final Keyword c00KeywordFullStop = (Keyword)c0Group.eContents().get(0);
@@ -262,6 +263,13 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
private static FractionElements pFraction;
private static VectorElements pVector;
private static DotsElements pDots;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -272,10 +280,6 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// CompositeModel: (model+=Model)+;
@@ -312,4 +316,39 @@ public class DatatypeRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
public DotsElements prDots() {
return (pDots != null) ? pDots : (pDots = new DotsElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore
index 0d2c868..2200b6b 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/EpatchTestLanguage.ecore
@@ -48,11 +48,11 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="rightRoot" eType="//CreatedObject" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NamedObject">
- <eStructuralFeatures xsi:type="ecore:EReference" name="assignments" upperBound="-1" eType="//Assignment" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="leftMig" eType="//Migration" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="assignments" upperBound="-1" eType="//Assignment" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ObjectRef" eSuperTypes="//NamedObject">
<eStructuralFeatures xsi:type="ecore:EReference" name="leftRes" eType="//NamedResource"/>
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/services/EpatchTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/services/EpatchTestLanguageGrammarAccess.java
index 12d4339..88dfc73 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/services/EpatchTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/epatch/services/EpatchTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.epatch.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class EPatchElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EPatch");
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);
@@ -86,7 +87,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Import");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final RuleCall c00ParserRuleCallModelImport = (RuleCall)c0Alternatives.eContents().get(0);
@@ -113,7 +114,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ModelImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ModelImport");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallResourceImport = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallEPackageImport = (RuleCall)cAlternatives.eContents().get(1);
@@ -132,7 +133,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ResourceImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ResourceImport");
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);
@@ -175,7 +176,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class EPackageImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EPackageImport");
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);
@@ -218,7 +219,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class JavaImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "JavaImport");
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);
@@ -269,7 +270,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ExtensionImportElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ExtensionImport");
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);
@@ -320,7 +321,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class NamedResourceElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NamedResource");
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);
@@ -455,7 +456,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class NamedObjectElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NamedObject");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallObjectRef = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallCreatedObject = (RuleCall)cAlternatives.eContents().get(1);
@@ -474,7 +475,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ObjectRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ObjectRef");
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);
@@ -665,7 +666,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class AssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Assignment");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -700,7 +701,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class BiSingleAssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "BiSingleAssignment");
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);
@@ -763,7 +764,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class BiListAssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "BiListAssignment");
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);
@@ -882,7 +883,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class MonoSingleAssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "MonoSingleAssignment");
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);
@@ -925,7 +926,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class MonoListAssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "MonoListAssignment");
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);
@@ -1004,7 +1005,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class AssignmentValueElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(16);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AssignmentValue");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1115,7 +1116,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ListAssignmentValueElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(17);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ListAssignmentValue");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentIndex = (Assignment)c0Group.eContents().get(0);
@@ -1274,7 +1275,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class SingleAssignmentValueElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(18);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SingleAssignmentValue");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1397,7 +1398,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class CreatedObjectElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(19);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CreatedObject");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Group.eContents().get(0);
@@ -1480,7 +1481,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ObjectNewElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(20);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ObjectNew");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordNew = (Keyword)c0Group.eContents().get(0);
@@ -1515,7 +1516,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ObjectCopyElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(21);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ObjectCopy");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordCopy = (Keyword)c0Group.eContents().get(0);
@@ -1550,7 +1551,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class MigrationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(23);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Migration");
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);
@@ -1621,7 +1622,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ExecutableElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(24);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Executable");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallJavaExecutable = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallExpressionExecutable = (RuleCall)cAlternatives.eContents().get(1);
@@ -1640,7 +1641,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class JavaExecutableElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(25);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "JavaExecutable");
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);
@@ -1679,7 +1680,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ExpressionExecutableElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(26);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ExpressionExecutable");
private final Assignment cAssignmentExprstr = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallSTRING = (RuleCall)cAssignmentExprstr.eContents().get(0);
@@ -1723,6 +1724,13 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
private static ExecutableElements pExecutable;
private static JavaExecutableElements pJavaExecutable;
private static ExpressionExecutableElements pExpressionExecutable;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -1733,10 +1741,6 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// EPatch: "epatch" name=ID "{" (imports+=Import)* (resources+=NamedResource)* (objects+=ObjectRef)* "}";
@@ -1846,7 +1850,7 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
// lexer FRAGMENT: "\'#\' (\'a\'..\'z\'|\'A\'..\'Z\'|\'0\'..\'9\'|\'_\'|\'/\'|\'[\'|\']\'|\'{\'|\'}\'|\'.\'|\'@\')+";
public LexerRule lrFRAGMENT() {
- return (lFRAGMENT != null) ? lFRAGMENT : (lFRAGMENT = (LexerRule) getGrammar().eContents().get(22));
+ return (lFRAGMENT != null) ? lFRAGMENT : (lFRAGMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "FRAGMENT"));
}
// Migration: "migrate" (first=Executable)? ("as" asOp=Executable|"each" eachOp=Executable)? ";";
@@ -1868,4 +1872,39 @@ public class EpatchTestLanguageGrammarAccess extends BaseEPackageAccess implemen
public ExpressionExecutableElements prExpressionExecutable() {
return (pExpressionExecutable != null) ? pExpressionExecutable : (pExpressionExecutable = new ExpressionExecutableElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java
index cf98026..ec7dc00 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.keywords.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class KeywordsTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -66,6 +67,13 @@ public class KeywordsTestLanguageGrammarAccess extends BaseEPackageAccess implem
private static final String KEYWORDSTESTLANGUAGE_GRAMMAR_CP_URI = "classpath:/org/eclipse/xtext/parser/keywords/KeywordsTestLanguage.xmi";
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -76,14 +84,45 @@ public class KeywordsTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: first?="foo\\bar"|second?="foo\\"|third?="\\bar"|forth?="\\";
public ModelElements prModel() {
return (pModel != null) ? pModel : (pModel = new ModelElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/XtextTerminalsTestLanguage.ecore b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/XtextTerminalsTestLanguage.ecore
index 3642a8c..2da5ce6 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/XtextTerminalsTestLanguage.ecore
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/XtextTerminalsTestLanguage.ecore
@@ -16,10 +16,10 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" eType="//AbstractRule" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractRule">
- <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractMetamodelDeclaration">
<eStructuralFeatures xsi:type="ecore:EReference" name="ePackage">
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/HiddenTerminalsTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/HiddenTerminalsTestLanguageGrammarAccess.java
index ae2f196..d90d5b7 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/HiddenTerminalsTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/HiddenTerminalsTestLanguageGrammarAccess.java
@@ -4,13 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.terminalrules.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
+@Singleton
public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -53,7 +55,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class WithoutHiddensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WithoutHiddens");
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);
@@ -108,7 +110,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class WithHiddensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WithHiddens");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordWith = (Keyword)c0Group.eContents().get(0);
@@ -139,7 +141,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class OverridingHiddensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "OverridingHiddens");
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);
@@ -198,7 +200,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class OverridingHiddensCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "OverridingHiddensCall");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordCall = (Keyword)c0Group.eContents().get(0);
@@ -233,7 +235,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class InheritingHiddensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "InheritingHiddens");
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);
@@ -304,7 +306,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class DatatypeHiddensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "DatatypeHiddens");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordDatatype = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentValid = (Assignment)cGroup.eContents().get(1);
@@ -327,7 +329,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class DatatypeRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "DatatypeRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordRule = (Keyword)cGroup.eContents().get(0);
private final Keyword c1KeywordSemicolon = (Keyword)cGroup.eContents().get(1);
@@ -346,7 +348,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class HidingHiddensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "HidingHiddens");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordHiding = (Keyword)c0Group.eContents().get(0);
@@ -381,7 +383,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class InheritingHiddensCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "InheritingHiddensCall");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordCall = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentValid = (Assignment)cGroup.eContents().get(1);
@@ -404,7 +406,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ML_COMMENTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordSolidusAsterisk = (Keyword)cGroup.eContents().get(0);
private final UpToToken c1UpToToken = (UpToToken)cGroup.eContents().get(1);
@@ -427,7 +429,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class SL_COMMENTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordSolidusSolidus = (Keyword)c0Group.eContents().get(0);
@@ -474,7 +476,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class WSElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WS");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -509,7 +511,7 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ANY_OTHERElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER");
private final Wildcard cWildcard = (Wildcard)rule.eContents().get(1);
// terminal ANY_OTHER returns EString : . ;
@@ -547,10 +549,6 @@ public class HiddenTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
return GRAMMAR;
}
-
- public IGrammarAccess getSuperGrammar() {
- return null;
- }
// Model: WithoutHiddens|WithHiddens|OverridingHiddens|InheritingHiddens|DatatypeHiddens;
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/TerminalRulesTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/TerminalRulesTestLanguageGrammarAccess.java
index 2ee2e3c..068d7ae 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/TerminalRulesTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/TerminalRulesTestLanguageGrammarAccess.java
@@ -4,13 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.terminalrules.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
+@Singleton
public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -97,7 +99,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class IDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordCircumflexAccent = (Keyword)c0Group.eContents().get(0);
@@ -204,7 +206,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class INTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "INT");
private final CharacterRange cCharacterRange = (CharacterRange)rule.eContents().get(1);
private final Keyword c0KeywordDigitZero = (Keyword)cCharacterRange.eContents().get(0);
private final Keyword c1KeywordDigitNine = (Keyword)cCharacterRange.eContents().get(1);
@@ -223,7 +225,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class STRINGElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "STRING");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Group c0Group = (Group)cAlternatives.eContents().get(0);
private final Group c00Group = (Group)c0Group.eContents().get(0);
@@ -442,7 +444,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ML_COMMENTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordSolidusAsterisk = (Keyword)cGroup.eContents().get(0);
private final UpToToken c1UpToToken = (UpToToken)cGroup.eContents().get(1);
@@ -465,7 +467,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class SL_COMMENTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordSolidusSolidus = (Keyword)c0Group.eContents().get(0);
@@ -512,7 +514,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class WSElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WS");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -547,7 +549,7 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ANY_OTHERElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER");
private final Wildcard cWildcard = (Wildcard)rule.eContents().get(1);
// terminal ANY_OTHER returns EString : . ;
@@ -579,10 +581,6 @@ public class TerminalRulesTestLanguageGrammarAccess extends BaseEPackageAccess i
}
return GRAMMAR;
}
-
- public IGrammarAccess getSuperGrammar() {
- return null;
- }
// Model: idValue=ID|intValue=INT|stringValue=STRING|mlCommentValue=ML_COMMENT|slCommentValue=SL_COMMENT|wsValue=WS|anyValue=ANY_OTHER;
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/XtextTerminalsTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/XtextTerminalsTestLanguageGrammarAccess.java
index 3755259..179473e 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/XtextTerminalsTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parser/terminalrules/services/XtextTerminalsTestLanguageGrammarAccess.java
@@ -4,13 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.terminalrules.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
+@Singleton
public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class GrammarElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Grammar");
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);
@@ -149,7 +151,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class GrammarIDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "GrammarID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallID = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -176,7 +178,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AbstractRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final RuleCall c00ParserRuleCallLexerRule = (RuleCall)c0Alternatives.eContents().get(0);
@@ -203,7 +205,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AbstractMetamodelDeclarationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractMetamodelDeclaration");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGeneratedMetamodel = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallReferencedMetamodel = (RuleCall)cAlternatives.eContents().get(1);
@@ -222,7 +224,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class GeneratedMetamodelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "GeneratedMetamodel");
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);
@@ -277,7 +279,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ReferencedMetamodelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ReferencedMetamodel");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordImport = (Keyword)c0Group.eContents().get(0);
@@ -320,7 +322,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class LexerRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LexerRule");
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);
@@ -399,7 +401,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParserRule");
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);
@@ -522,7 +524,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TerminalRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalRule");
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);
@@ -597,7 +599,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TypeRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TypeRef");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentMetamodel = (Assignment)c0Group.eContents().get(0);
@@ -632,7 +634,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AlternativesElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Alternatives");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGroup = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -671,7 +673,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TerminalAlternativesElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalAlternatives");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalGroup = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -710,7 +712,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class GroupElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Group");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAbstractToken = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -741,7 +743,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TerminalGroupElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalGroup");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalToken = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -772,7 +774,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AbstractTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(16);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cGroup.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -827,7 +829,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TerminalTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(17);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalTokenElement = (RuleCall)cGroup.eContents().get(0);
private final Assignment c1AssignmentCardinality = (Assignment)cGroup.eContents().get(1);
@@ -866,7 +868,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(18);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Assignment");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentFeature = (Assignment)c0Group.eContents().get(0);
@@ -921,7 +923,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ActionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(19);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Action");
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);
@@ -1016,7 +1018,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AbstractTerminalElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(20);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractTerminal");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1051,7 +1053,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TerminalTokenElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(21);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalTokenElement");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1094,7 +1096,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AbstractNegatedTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(22);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractNegatedToken");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallNegatedToken = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallUpToToken = (RuleCall)cAlternatives.eContents().get(1);
@@ -1113,7 +1115,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class NegatedTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(23);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NegatedToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordExclamationMark = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentTerminal = (Assignment)cGroup.eContents().get(1);
@@ -1136,7 +1138,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class UpToTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(24);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "UpToToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordHyphenMinusGreaterThanSign = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentTerminal = (Assignment)cGroup.eContents().get(1);
@@ -1159,7 +1161,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class WildcardElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(25);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Wildcard");
private final Assignment cAssignmentIsWildcard = (Assignment)rule.eContents().get(1);
private final Keyword c0KeywordFullStop = (Keyword)cAssignmentIsWildcard.eContents().get(0);
@@ -1174,7 +1176,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class CharacterRangeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(26);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CharacterRange");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallKeyword = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -1213,7 +1215,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class CrossReferenceElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(27);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CrossReference");
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);
@@ -1264,7 +1266,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ParenthesizedElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(28);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParenthesizedElement");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -1291,7 +1293,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ParenthesizedTerminalElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(29);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParenthesizedTerminalElement");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -1318,7 +1320,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class KeywordElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(30);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Keyword");
private final Assignment cAssignmentValue = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallSTRING = (RuleCall)cAssignmentValue.eContents().get(0);
@@ -1333,7 +1335,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class RuleCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(31);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "RuleCall");
private final Assignment cAssignmentRule = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringAbstractRule = (CrossReference)cAssignmentRule.eContents().get(0);
@@ -1348,7 +1350,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class IDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(32);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordCircumflexAccent = (Keyword)c0Group.eContents().get(0);
@@ -1455,7 +1457,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class INTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(33);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "INT");
private final CharacterRange cCharacterRange = (CharacterRange)rule.eContents().get(1);
private final Keyword c0KeywordDigitZero = (Keyword)cCharacterRange.eContents().get(0);
private final Keyword c1KeywordDigitNine = (Keyword)cCharacterRange.eContents().get(1);
@@ -1474,7 +1476,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class STRINGElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(34);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "STRING");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Group c0Group = (Group)cAlternatives.eContents().get(0);
private final Group c00Group = (Group)c0Group.eContents().get(0);
@@ -1693,7 +1695,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ML_COMMENTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(35);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordSolidusAsterisk = (Keyword)cGroup.eContents().get(0);
private final UpToToken c1UpToToken = (UpToToken)cGroup.eContents().get(1);
@@ -1716,7 +1718,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class SL_COMMENTElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(36);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordSolidusSolidus = (Keyword)c0Group.eContents().get(0);
@@ -1763,7 +1765,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class WSElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(37);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "WS");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1798,7 +1800,7 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ANY_OTHERElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(38);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER");
private final Wildcard cWildcard = (Wildcard)rule.eContents().get(1);
// terminal ANY_OTHER returns EString : . ;
@@ -1859,10 +1861,6 @@ public class XtextTerminalsTestLanguageGrammarAccess extends BaseEPackageAccess
}
return GRAMMAR;
}
-
- public IGrammarAccess getSuperGrammar() {
- return null;
- }
// Grammar: (abstract?="abstract language"|"language") name=GrammarID ("extends" superGrammar=[Grammar|GrammarID])? (definesHiddenTokens?="hidden" "(" (hiddenTokens+=[AbstractRule] ("," hiddenTokens+=[AbstractRule])*)? ")")? (metamodelDeclarations+=AbstractMetamodelDeclaration)* (rules+=AbstractRule)+;
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/services/FormatterTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/services/FormatterTestLanguageGrammarAccess.java
index 4dc8b96..9c3c6ec 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/services/FormatterTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/formatter/services/FormatterTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parsetree.formatter.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class RootElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Root");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordTest = (Keyword)cGroup.eContents().get(0);
private final Alternatives c1Alternatives = (Alternatives)cGroup.eContents().get(1);
@@ -38,7 +39,7 @@ public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class LineElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Line");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentType = (Assignment)c0Group.eContents().get(0);
@@ -73,7 +74,7 @@ public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class TestLinewrapElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TestLinewrap");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordLinewrap = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentItems = (Assignment)cGroup.eContents().get(1);
@@ -96,7 +97,7 @@ public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class TestIndentationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TestIndentation");
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);
@@ -154,6 +155,13 @@ public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess imple
private static LineElements pLine;
private static TestLinewrapElements pTestLinewrap;
private static TestIndentationElements pTestIndentation;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -164,10 +172,6 @@ public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Root: "test" (TestLinewrap|TestIndentation);
@@ -189,4 +193,39 @@ public class FormatterTestLanguageGrammarAccess extends BaseEPackageAccess imple
public TestIndentationElements prTestIndentation() {
return (pTestIndentation != null) ? pTestIndentation : (pTestIndentation = new TestIndentationElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
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 dd7e8df..ae6db26 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
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parsetree.reconstr.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class RootElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Root");
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);
@@ -30,7 +31,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class OpElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Op");
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);
@@ -97,7 +98,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TermElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Term");
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);
@@ -116,7 +117,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AtomElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Atom");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -131,7 +132,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ParensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Parens");
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);
@@ -170,7 +171,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyAElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyA");
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);
@@ -245,7 +246,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyA1Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyA1");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -260,7 +261,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyBElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyB");
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);
@@ -307,7 +308,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyCElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyC");
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);
@@ -378,7 +379,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyD");
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);
@@ -461,7 +462,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyEElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyE");
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);
@@ -540,7 +541,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyFElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyF");
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);
@@ -599,7 +600,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyGElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyG");
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);
@@ -622,7 +623,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyG1Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyG1");
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);
@@ -673,7 +674,7 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TrickyG2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TrickyG2");
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);
@@ -714,6 +715,13 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
private static TrickyGElements pTrickyG;
private static TrickyG1Elements pTrickyG1;
private static TrickyG2Elements pTrickyG2;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -724,10 +732,6 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Root: Op|TrickyG;
@@ -804,4 +808,39 @@ public class ComplexReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
public TrickyG2Elements prTrickyG2() {
return (pTrickyG2 != null) ? pTrickyG2 : (pTrickyG2 = new TrickyG2Elements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/SimpleReconstrTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/SimpleReconstrTestLanguageGrammarAccess.java
index 4af0af6..ab350c3 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/SimpleReconstrTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/services/SimpleReconstrTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parsetree.reconstr.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class OpElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Op");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerm = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -42,7 +43,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TermElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Term");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -109,7 +110,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class AtomElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Atom");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -124,7 +125,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ParensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Parens");
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);
@@ -163,7 +164,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TwoNumbersElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TwoNumbers");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentNum1 = (Assignment)c0Group.eContents().get(0);
@@ -210,7 +211,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class ManyStringsElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ManyStrings");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordEqualsSign = (Keyword)c0Group.eContents().get(0);
@@ -245,7 +246,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class TypeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Type");
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);
@@ -288,7 +289,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class Ref2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Ref2");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordNumberSignDigitTwo = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentRef2 = (Assignment)cGroup.eContents().get(1);
@@ -327,7 +328,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class SpareElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spare");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordNumberSignDigitThree = (Keyword)c0Group.eContents().get(0);
@@ -370,7 +371,7 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
public class BooleanElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Boolean");
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);
@@ -426,6 +427,13 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
private static Ref2Elements pRef2;
private static SpareElements pSpare;
private static BooleanElements pBoolean;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -436,10 +444,6 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Op returns Expression: Term ({current=Op.values+=current} values+=Term)*;
@@ -491,4 +495,39 @@ public class SimpleReconstrTestLanguageGrammarAccess extends BaseEPackageAccess
public BooleanElements prBoolean() {
return (pBoolean != null) ? pBoolean : (pBoolean = new BooleanElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/services/TransientValuesTestGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/services/TransientValuesTestGrammarAccess.java
index 422e974..2c965bc 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/services/TransientValuesTestGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/parsetree/transientvalues/services/TransientValuesTestGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parsetree.transientvalues.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class TransientValuesTestGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class RootElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Root");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordTest = (Keyword)cGroup.eContents().get(0);
private final Alternatives c1Alternatives = (Alternatives)cGroup.eContents().get(1);
@@ -46,7 +47,7 @@ public class TransientValuesTestGrammarAccess extends BaseEPackageAccess impleme
}
public class TestRequiredElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TestRequired");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordRequired = (Keyword)c0Group.eContents().get(0);
@@ -81,7 +82,7 @@ public class TransientValuesTestGrammarAccess extends BaseEPackageAccess impleme
}
public class TestOptionalElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TestOptional");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordOptional = (Keyword)c0Group.eContents().get(0);
@@ -124,7 +125,7 @@ public class TransientValuesTestGrammarAccess extends BaseEPackageAccess impleme
}
public class TestListElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TestList");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordList = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentItem = (Assignment)cGroup.eContents().get(1);
@@ -154,6 +155,13 @@ public class TransientValuesTestGrammarAccess extends BaseEPackageAccess impleme
private static TestRequiredElements pTestRequired;
private static TestOptionalElements pTestOptional;
private static TestListElements pTestList;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -164,10 +172,6 @@ public class TransientValuesTestGrammarAccess extends BaseEPackageAccess impleme
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Root: "test" (TestRequired|TestOptional|TestList);
@@ -189,4 +193,39 @@ public class TransientValuesTestGrammarAccess extends BaseEPackageAccess impleme
public TestListElements prTestList() {
return (pTestList != null) ? pTestList : (pTestList = new TestListElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/services/MultiValueFeatureTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/services/MultiValueFeatureTestLanguageGrammarAccess.java
index e85b220..8e4e662 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/services/MultiValueFeatureTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/resource/metamodel/services/MultiValueFeatureTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.resource.metamodel.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class MultiValueFeatureTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class StartElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Start");
private final Assignment cAssignmentFeatureA = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentFeatureA.eContents().get(0);
@@ -30,6 +31,13 @@ public class MultiValueFeatureTestLanguageGrammarAccess extends BaseEPackageAcce
private static final String MULTIVALUEFEATURETESTLANGUAGE_GRAMMAR_CP_URI = "classpath:/org/eclipse/xtext/resource/metamodel/MultiValueFeatureTestLanguage.xmi";
private static Grammar GRAMMAR = null;
private static StartElements pStart;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -40,14 +48,45 @@ public class MultiValueFeatureTestLanguageGrammarAccess extends BaseEPackageAcce
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Start: (featureA+=ID)+;
public StartElements prStart() {
return (pStart != null) ? pStart : (pStart = new StartElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java
index 726a0d7..1f4d7a8 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class GrammarElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Grammar");
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);
@@ -150,7 +151,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class GrammarIDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "GrammarID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -177,7 +178,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final RuleCall c00ParserRuleCallLexerRule = (RuleCall)c0Alternatives.eContents().get(0);
@@ -204,7 +205,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractMetamodelDeclarationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractMetamodelDeclaration");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGeneratedMetamodel = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallReferencedMetamodel = (RuleCall)cAlternatives.eContents().get(1);
@@ -223,7 +224,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class GeneratedMetamodelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "GeneratedMetamodel");
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);
@@ -278,7 +279,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ReferencedMetamodelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ReferencedMetamodel");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordImport = (Keyword)c0Group.eContents().get(0);
@@ -321,7 +322,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class LexerRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LexerRule");
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);
@@ -400,7 +401,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParserRule");
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);
@@ -523,7 +524,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalRule");
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);
@@ -598,7 +599,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TypeRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TypeRef");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentMetamodel = (Assignment)c0Group.eContents().get(0);
@@ -633,7 +634,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AlternativesElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Alternatives");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGroup = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -672,7 +673,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalAlternativesElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalAlternatives");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalGroup = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -711,7 +712,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class GroupElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Group");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAbstractToken = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -742,7 +743,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalGroupElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalGroup");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalToken = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -773,7 +774,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(16);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cGroup.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -828,7 +829,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(17);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalTokenElement = (RuleCall)cGroup.eContents().get(0);
private final Assignment c1AssignmentCardinality = (Assignment)cGroup.eContents().get(1);
@@ -867,7 +868,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(18);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Assignment");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentFeature = (Assignment)c0Group.eContents().get(0);
@@ -922,7 +923,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ActionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(19);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Action");
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);
@@ -1017,7 +1018,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractTerminalElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(20);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractTerminal");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1052,7 +1053,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalTokenElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(21);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalTokenElement");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1095,7 +1096,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractNegatedTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(22);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractNegatedToken");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallNegatedToken = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallUpToToken = (RuleCall)cAlternatives.eContents().get(1);
@@ -1114,7 +1115,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class NegatedTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(23);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NegatedToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordExclamationMark = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentTerminal = (Assignment)cGroup.eContents().get(1);
@@ -1137,7 +1138,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class UpToTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(24);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "UpToToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordHyphenMinusGreaterThanSign = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentTerminal = (Assignment)cGroup.eContents().get(1);
@@ -1160,7 +1161,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class WildcardElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(25);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Wildcard");
private final Assignment cAssignmentIsWildcard = (Assignment)rule.eContents().get(1);
private final Keyword c0KeywordFullStop = (Keyword)cAssignmentIsWildcard.eContents().get(0);
@@ -1175,7 +1176,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class CharacterRangeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(26);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CharacterRange");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallKeyword = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -1214,7 +1215,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class CrossReferenceElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(27);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CrossReference");
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);
@@ -1265,7 +1266,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ParenthesizedElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(28);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParenthesizedElement");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -1292,7 +1293,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ParenthesizedTerminalElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(29);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParenthesizedTerminalElement");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -1319,7 +1320,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class KeywordElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(30);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Keyword");
private final Assignment cAssignmentValue = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallSTRING = (RuleCall)cAssignmentValue.eContents().get(0);
@@ -1334,7 +1335,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class RuleCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(31);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "RuleCall");
private final Assignment cAssignmentRule = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringAbstractRule = (CrossReference)cAssignmentRule.eContents().get(0);
@@ -1382,6 +1383,13 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
private static ParenthesizedTerminalElementElements pParenthesizedTerminalElement;
private static KeywordElements pKeyword;
private static RuleCallElements pRuleCall;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -1392,10 +1400,6 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Grammar: (abstract?="abstract language"|"language") name=GrammarID ("extends" superGrammar=[Grammar|GrammarID])? (definesHiddenTokens?="hidden" "(" (hiddenTokens+=[AbstractRule] ("," hiddenTokens+=[AbstractRule])*)? ")")? (metamodelDeclarations+=AbstractMetamodelDeclaration)* (rules+=AbstractRule)+;
@@ -1547,4 +1551,39 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
public RuleCallElements prRuleCall() {
return (pRuleCall != null) ? pRuleCall : (pRuleCall = new RuleCallElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java
index 18ab300..50f307f 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ActionTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ActionTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentChildren = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallElement = (RuleCall)cAssignmentChildren.eContents().get(0);
@@ -26,7 +27,7 @@ public class ActionTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Element");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallItem = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -57,7 +58,7 @@ public class ActionTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
public class ItemElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Item");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Action c0ActionThingcontent = (Action)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -86,6 +87,13 @@ public class ActionTestLanguageGrammarAccess extends BaseEPackageAccess implemen
private static ModelElements pModel;
private static ElementElements pElement;
private static ItemElements pItem;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -96,10 +104,6 @@ public class ActionTestLanguageGrammarAccess extends BaseEPackageAccess implemen
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: (children+=Element)*;
@@ -116,4 +120,39 @@ public class ActionTestLanguageGrammarAccess extends BaseEPackageAccess implemen
public ItemElements prItem() {
return (pItem != null) ? pItem : (pItem = new ItemElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java
index c205305..54211d0 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class StartElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Start");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordAbstractRules = (Keyword)c0Group.eContents().get(0);
@@ -42,7 +43,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class AbstractRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallFirstAbstractRuleChild = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallSecondAbstractRuleChild = (RuleCall)cAlternatives.eContents().get(1);
@@ -61,7 +62,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class FirstAbstractRuleChildElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "FirstAbstractRuleChild");
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);
@@ -112,7 +113,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class SecondAbstractRuleChildElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SecondAbstractRuleChild");
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);
@@ -163,7 +164,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class AbstractRuleCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRuleCall");
private final Assignment cAssignmentRule = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringAbstractRule = (CrossReference)cAssignmentRule.eContents().get(0);
@@ -186,6 +187,13 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
private static FirstAbstractRuleChildElements pFirstAbstractRuleChild;
private static SecondAbstractRuleChildElements pSecondAbstractRuleChild;
private static AbstractRuleCallElements pAbstractRuleCall;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -196,10 +204,6 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Start: "abstract rules" (rules+=AbstractRule)+ "end";
@@ -226,4 +230,39 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
public AbstractRuleCallElements prAbstractRuleCall() {
return (pAbstractRuleCall != null) ? pAbstractRuleCall : (pAbstractRuleCall = new AbstractRuleCallElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/FowlerDslTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/FowlerDslTestLanguageGrammarAccess.java
index d2b9826..8032f6d 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/FowlerDslTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/FowlerDslTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class StatemachineElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Statemachine");
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);
@@ -82,7 +83,7 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class EventElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Event");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentResetting = (Assignment)c0Group.eContents().get(0);
@@ -121,7 +122,7 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class CommandElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Command");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -148,7 +149,7 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class StateElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "State");
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);
@@ -227,7 +228,7 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class TransitionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Transition");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentEvent = (Assignment)c0Group.eContents().get(0);
@@ -270,6 +271,13 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
private static CommandElements pCommand;
private static StateElements pState;
private static TransitionElements pTransition;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -280,10 +288,6 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Statemachine: "events" (events+=Event)* "end" "commands" (commands+=Command)* "end" (states+=State)*;
@@ -310,4 +314,39 @@ public class FowlerDslTestLanguageGrammarAccess extends BaseEPackageAccess imple
public TransitionElements prTransition() {
return (pTransition != null) ? pTransition : (pTransition = new TransitionElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LexerTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LexerTestLanguageGrammarAccess.java
index 2a6bf08..2ff3a26 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LexerTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LexerTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class LexerTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentChildren = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallElement = (RuleCall)cAssignmentChildren.eContents().get(0);
@@ -26,7 +27,7 @@ public class LexerTestLanguageGrammarAccess extends BaseEPackageAccess implement
}
public class ElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Element");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Assignment c0AssignmentName = (Assignment)cGroup.eContents().get(0);
private final RuleCall c00LexerRuleCallID = (RuleCall)c0AssignmentName.eContents().get(0);
@@ -59,6 +60,12 @@ public class LexerTestLanguageGrammarAccess extends BaseEPackageAccess implement
private static ModelElements pModel;
private static ElementElements pElement;
private static LexerRule lSTRING;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -69,10 +76,6 @@ public class LexerTestLanguageGrammarAccess extends BaseEPackageAccess implement
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: (children+=Element)*;
@@ -87,6 +90,36 @@ public class LexerTestLanguageGrammarAccess extends BaseEPackageAccess implement
// lexer STRING: " \'#\' (\'B\')+ ";
public LexerRule lrSTRING() {
- return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) getGrammar().eContents().get(3));
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
}
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LookaheadTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LookaheadTestLanguageGrammarAccess.java
index d2bdfe5..6b0e5aa 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LookaheadTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/LookaheadTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class EntryElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Entry");
private final Assignment cAssignmentContents = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAlts = (RuleCall)cAssignmentContents.eContents().get(0);
@@ -26,7 +27,7 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class AltsElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Alts");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final RuleCall c00ParserRuleCallLookAhead0 = (RuleCall)c0Alternatives.eContents().get(0);
@@ -53,7 +54,7 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class LookAhead0Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LookAhead0");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordBar = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentX = (Assignment)cGroup.eContents().get(1);
@@ -76,7 +77,7 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class LookAhead1Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LookAhead1");
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);
@@ -123,7 +124,7 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class LookAhead2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LookAhead2");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cGroup.eContents().get(0);
private final Assignment c00AssignmentZ = (Assignment)c0Alternatives.eContents().get(0);
@@ -158,7 +159,7 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class LookAhead3Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LookAhead3");
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);
@@ -201,7 +202,7 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
public class LookAhead4Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LookAhead4");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Assignment c0AssignmentX = (Assignment)cAlternatives.eContents().get(0);
private final Keyword c00KeywordC = (Keyword)c0AssignmentX.eContents().get(0);
@@ -238,6 +239,13 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
private static LookAhead2Elements pLookAhead2;
private static LookAhead3Elements pLookAhead3;
private static LookAhead4Elements pLookAhead4;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -248,10 +256,6 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Entry: (contents+=Alts)*;
@@ -288,4 +292,39 @@ public class LookaheadTestLanguageGrammarAccess extends BaseEPackageAccess imple
public LookAhead4Elements prLookAhead4() {
return (pLookAhead4 != null) ? pLookAhead4 : (pLookAhead4 = new LookAhead4Elements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/OptionalEmptyTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/OptionalEmptyTestLanguageGrammarAccess.java
index 6199eca..d81775e 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/OptionalEmptyTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/OptionalEmptyTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class OptionalEmptyTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentChild = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGreeting = (RuleCall)cAssignmentChild.eContents().get(0);
@@ -26,7 +27,7 @@ public class OptionalEmptyTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class GreetingElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Greeting");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordHallo = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -54,6 +55,13 @@ public class OptionalEmptyTestLanguageGrammarAccess extends BaseEPackageAccess i
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
private static GreetingElements pGreeting;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -64,10 +72,6 @@ public class OptionalEmptyTestLanguageGrammarAccess extends BaseEPackageAccess i
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: (child=Greeting)?;
@@ -79,4 +83,39 @@ public class OptionalEmptyTestLanguageGrammarAccess extends BaseEPackageAccess i
public GreetingElements prGreeting() {
return (pGreeting != null) ? pGreeting : (pGreeting = new GreetingElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/PartialParserTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/PartialParserTestLanguageGrammarAccess.java
index 6b29895..4010085 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/PartialParserTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/PartialParserTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ContainerElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Container");
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);
@@ -74,7 +75,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class NestedElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Nested");
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);
@@ -113,7 +114,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ContentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Content");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallChildren = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallAbstractChildren = (RuleCall)cAlternatives.eContents().get(1);
@@ -132,7 +133,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ChildrenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Children");
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);
@@ -191,7 +192,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class ChildElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Child");
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);
@@ -238,7 +239,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class AbstractChildrenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractChildren");
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);
@@ -277,7 +278,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class AbstractChildElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractChild");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallFirstConcrete = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallSecondConcrete = (RuleCall)cAlternatives.eContents().get(1);
@@ -296,7 +297,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class FirstConcreteElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "FirstConcrete");
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);
@@ -355,7 +356,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class SecondConcreteElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SecondConcrete");
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);
@@ -422,7 +423,7 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class NamedElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Named");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -450,6 +451,13 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
private static FirstConcreteElements pFirstConcrete;
private static SecondConcreteElements pSecondConcrete;
private static NamedElements pNamed;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -460,10 +468,6 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Container: "container" name=ID "{" (nested+=Nested|content+=Content)* "}";
@@ -515,4 +519,39 @@ public class PartialParserTestLanguageGrammarAccess extends BaseEPackageAccess i
public NamedElements prNamed() {
return (pNamed != null) ? pNamed : (pNamed = new NamedElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java
index 3fdef02..a7fcf39 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class SpielplatzElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spielplatz");
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);
@@ -110,7 +111,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class PersonElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Person");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallKind = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallErwachsener = (RuleCall)cAlternatives.eContents().get(1);
@@ -129,7 +130,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class KindElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Kind");
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);
@@ -180,7 +181,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class ErwachsenerElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Erwachsener");
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);
@@ -231,7 +232,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class SpielzeugElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spielzeug");
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);
@@ -282,7 +283,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class FarbeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Farbe");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -317,7 +318,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class FamilieElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Familie");
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);
@@ -438,6 +439,13 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
private static SpielzeugElements pSpielzeug;
private static FarbeElements pFarbe;
private static FamilieElements pFamilie;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -448,10 +456,6 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Spielplatz: ("spielplatz" groesse=INT (beschreibung=STRING)? "{" (kinder+=Kind|erzieher+=Erwachsener|spielzeuge+=Spielzeug|familie+=Familie)* "}")?;
@@ -488,4 +492,39 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
public FamilieElements prFamilie() {
return (pFamilie != null) ? pFamilie : (pFamilie = new FamilieElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/SimpleExpressionsTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/SimpleExpressionsTestLanguageGrammarAccess.java
index 59d2b09..02c822b 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/SimpleExpressionsTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/SimpleExpressionsTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class SequenceElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Sequence");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAddition = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -42,7 +43,7 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
}
public class AdditionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Addition");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallMultiplication = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -93,7 +94,7 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
}
public class MultiplicationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Multiplication");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerm = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -144,7 +145,7 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
}
public class TermElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Term");
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);
@@ -163,7 +164,7 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
}
public class AtomElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Atom");
private final Assignment cAssignmentName = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cAssignmentName.eContents().get(0);
@@ -178,7 +179,7 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
}
public class ParensElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Parens");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -214,6 +215,13 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
private static TermElements pTerm;
private static AtomElements pAtom;
private static ParensElements pParens;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -224,10 +232,6 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Sequence: Addition ({current=Sequence.expressions+=current} expressions+=Addition)*;
@@ -259,4 +263,39 @@ public class SimpleExpressionsTestLanguageGrammarAccess extends BaseEPackageAcce
public ParensElements prParens() {
return (pParens != null) ? pParens : (pParens = new ParensElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TestLanguageGrammarAccess.java
index 6a16312..9acb292 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class EntryRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "EntryRule");
private final Assignment cAssignmentMultiFeature = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAbstractRule = (RuleCall)cAssignmentMultiFeature.eContents().get(0);
@@ -26,7 +27,7 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
public class AbstractRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallChoiceRule = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallReducibleRule = (RuleCall)cAlternatives.eContents().get(1);
@@ -45,7 +46,7 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
public class ChoiceRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ChoiceRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordChoice = (Keyword)c0Group.eContents().get(0);
@@ -80,7 +81,7 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
public class ReducibleRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ReducibleRule");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordReducible = (Keyword)c0Group.eContents().get(0);
@@ -119,7 +120,7 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
public class TerminalRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalRule");
private final Assignment cAssignmentStringFeature = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallSTRING = (RuleCall)cAssignmentStringFeature.eContents().get(0);
@@ -142,6 +143,13 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
private static ChoiceRuleElements pChoiceRule;
private static ReducibleRuleElements pReducibleRule;
private static TerminalRuleElements pTerminalRule;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -152,10 +160,6 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// EntryRule returns Model: (multiFeature+=AbstractRule)*;
@@ -182,4 +186,39 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
public TerminalRuleElements prTerminalRule() {
return (pTerminalRule != null) ? pTerminalRule : (pTerminalRule = new TerminalRuleElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java
index 62cd260..d4c5f79 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentChildren = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallNode = (RuleCall)cAssignmentChildren.eContents().get(0);
@@ -26,7 +27,7 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
}
public class NodeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Node");
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);
@@ -102,6 +103,13 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
private static NodeElements pNode;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -112,10 +120,6 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: (children+=Node)*;
@@ -127,4 +131,39 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
public NodeElements prNode() {
return (pNode != null) ? pNode : (pNode = new NodeElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/services/Bug250313GrammarAccess.java b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/services/Bug250313GrammarAccess.java
index a2e7b9a..4bea2c5 100644
--- a/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/services/Bug250313GrammarAccess.java
+++ b/tests/org.eclipse.xtext.generator.tests/src-gen/org/eclipse/xtext/valueconverter/services/Bug250313GrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.valueconverter.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class Bug250313GrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class Ref2Elements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Ref2");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordNumberSignDigitTwo = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentRef2 = (Assignment)cGroup.eContents().get(1);
@@ -54,6 +55,13 @@ public class Bug250313GrammarAccess extends BaseEPackageAccess implements IGramm
private static final String BUG250313_GRAMMAR_CP_URI = "classpath:/org/eclipse/xtext/valueconverter/Bug250313.xmi";
private static Grammar GRAMMAR = null;
private static Ref2Elements pRef2;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -64,14 +72,45 @@ public class Bug250313GrammarAccess extends BaseEPackageAccess implements IGramm
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Ref2: "#2" ref2=("mykeyword1"|STRING|ID);
public Ref2Elements prRef2() {
return (pRef2 != null) ? pRef2 : (pRef2 = new Ref2Elements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.ui.integration.tests/src-gen/org/eclipse/xtext/ui/integration/services/TestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.ui.integration.tests/src-gen/org/eclipse/xtext/ui/integration/services/TestLanguageGrammarAccess.java
index 7bf63dd..6acb47e 100644
--- a/tests/org.eclipse.xtext.ui.integration.tests/src-gen/org/eclipse/xtext/ui/integration/services/TestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.ui.integration.tests/src-gen/org/eclipse/xtext/ui/integration/services/TestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.ui.integration.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class FileElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "File");
private final Assignment cAssignmentStuff = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallStuff = (RuleCall)cAssignmentStuff.eContents().get(0);
@@ -26,7 +27,7 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
public class StuffElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Stuff");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordStuff = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentName = (Assignment)cGroup.eContents().get(1);
@@ -54,6 +55,13 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
private static Grammar GRAMMAR = null;
private static FileElements pFile;
private static StuffElements pStuff;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -64,10 +72,6 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// File: (stuff+=Stuff)*;
@@ -79,4 +83,39 @@ public class TestLanguageGrammarAccess extends BaseEPackageAccess implements IGr
public StuffElements prStuff() {
return (pStuff != null) ? pStuff : (pStuff = new StuffElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/GenXtextGrammarTestLanguageScopeProvider.ext b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/GenXtextGrammarTestLanguageScopeProvider.ext
index b0e1c0a..34a6412 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/GenXtextGrammarTestLanguageScopeProvider.ext
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/GenXtextGrammarTestLanguageScopeProvider.ext
@@ -23,16 +23,10 @@ List[IScopedElement] scope_hiddenTokens(Grammar this):
List[IScopedElement] scope_hiddenTokens(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_type(TypeRef this):
- allElements().typeSelect(ecore::EClassifier).collect(x | createScopedElement(x.referenceName(), x));
-
-List[IScopedElement] scope_type(emf::EObject this) :
- allElements().collect(x | createScopedElement(x.referenceName(), x));
-
-List[IScopedElement] scope_metamodel(TypeRef this):
- allElements().typeSelect(AbstractMetamodelDeclaration).collect(x | createScopedElement(x.referenceName(), x));
+List[IScopedElement] scope_hiddenTokens(ParserRule this):
+ allElements().typeSelect(AbstractRule).collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_metamodel(emf::EObject this) :
+List[IScopedElement] scope_hiddenTokens(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
List[IScopedElement] scope_superGrammar(Grammar this):
@@ -41,16 +35,16 @@ List[IScopedElement] scope_superGrammar(Grammar this):
List[IScopedElement] scope_superGrammar(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_rule(RuleCall this):
- allElements().typeSelect(AbstractRule).collect(x | createScopedElement(x.referenceName(), x));
+List[IScopedElement] scope_metamodel(TypeRef this):
+ allElements().typeSelect(AbstractMetamodelDeclaration).collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_rule(emf::EObject this) :
+List[IScopedElement] scope_metamodel(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_hiddenTokens(ParserRule this):
+List[IScopedElement] scope_rule(RuleCall this):
allElements().typeSelect(AbstractRule).collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_hiddenTokens(emf::EObject this) :
+List[IScopedElement] scope_rule(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
List[IScopedElement] scope_rule(CrossReference this):
@@ -65,3 +59,9 @@ List[IScopedElement] scope_ePackage(AbstractMetamodelDeclaration this):
List[IScopedElement] scope_ePackage(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
+List[IScopedElement] scope_type(TypeRef this):
+ allElements().typeSelect(ecore::EClassifier).collect(x | createScopedElement(x.referenceName(), x));
+
+List[IScopedElement] scope_type(emf::EObject this) :
+ allElements().collect(x | createScopedElement(x.referenceName(), x));
+
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/XtextTest.ecore b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/XtextTest.ecore
index 823721b..ae9485c 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/XtextTest.ecore
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/XtextTest.ecore
@@ -16,10 +16,10 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" eType="//AbstractRule" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractRule">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eStructuralFeatures>
- <eStructuralFeatures xsi:type="ecore:EReference" name="type" eType="//TypeRef" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractMetamodelDeclaration">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="alias">
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java
index cf98026..ec7dc00 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/parser/keywords/services/KeywordsTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.parser.keywords.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class KeywordsTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -66,6 +67,13 @@ public class KeywordsTestLanguageGrammarAccess extends BaseEPackageAccess implem
private static final String KEYWORDSTESTLANGUAGE_GRAMMAR_CP_URI = "classpath:/org/eclipse/xtext/parser/keywords/KeywordsTestLanguage.xmi";
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -76,14 +84,45 @@ public class KeywordsTestLanguageGrammarAccess extends BaseEPackageAccess implem
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: first?="foo\\bar"|second?="foo\\"|third?="\\bar"|forth?="\\";
public ModelElements prModel() {
return (pModel != null) ? pModel : (pModel = new ModelElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java
index 726a0d7..1f4d7a8 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/services/XtextGrammarTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class GrammarElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Grammar");
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);
@@ -150,7 +151,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class GrammarIDElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "GrammarID");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallID = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -177,7 +178,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final RuleCall c00ParserRuleCallLexerRule = (RuleCall)c0Alternatives.eContents().get(0);
@@ -204,7 +205,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractMetamodelDeclarationElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractMetamodelDeclaration");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGeneratedMetamodel = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallReferencedMetamodel = (RuleCall)cAlternatives.eContents().get(1);
@@ -223,7 +224,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class GeneratedMetamodelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "GeneratedMetamodel");
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);
@@ -278,7 +279,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ReferencedMetamodelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ReferencedMetamodel");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordImport = (Keyword)c0Group.eContents().get(0);
@@ -321,7 +322,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class LexerRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(8);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "LexerRule");
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);
@@ -400,7 +401,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ParserRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(9);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParserRule");
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);
@@ -523,7 +524,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(10);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalRule");
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);
@@ -598,7 +599,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TypeRefElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(11);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TypeRef");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentMetamodel = (Assignment)c0Group.eContents().get(0);
@@ -633,7 +634,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AlternativesElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(12);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Alternatives");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallGroup = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -672,7 +673,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalAlternativesElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(13);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalAlternatives");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalGroup = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -711,7 +712,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class GroupElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(14);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Group");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallAbstractToken = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -742,7 +743,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalGroupElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(15);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalGroup");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalToken = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -773,7 +774,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(16);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cGroup.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -828,7 +829,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(17);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallTerminalTokenElement = (RuleCall)cGroup.eContents().get(0);
private final Assignment c1AssignmentCardinality = (Assignment)cGroup.eContents().get(1);
@@ -867,7 +868,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AssignmentElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(18);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Assignment");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Assignment c00AssignmentFeature = (Assignment)c0Group.eContents().get(0);
@@ -922,7 +923,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ActionElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(19);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Action");
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);
@@ -1017,7 +1018,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractTerminalElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(20);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractTerminal");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1052,7 +1053,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class TerminalTokenElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(21);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "TerminalTokenElement");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -1095,7 +1096,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class AbstractNegatedTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(22);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractNegatedToken");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallNegatedToken = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallUpToToken = (RuleCall)cAlternatives.eContents().get(1);
@@ -1114,7 +1115,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class NegatedTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(23);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NegatedToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordExclamationMark = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentTerminal = (Assignment)cGroup.eContents().get(1);
@@ -1137,7 +1138,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class UpToTokenElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(24);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "UpToToken");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword c0KeywordHyphenMinusGreaterThanSign = (Keyword)cGroup.eContents().get(0);
private final Assignment c1AssignmentTerminal = (Assignment)cGroup.eContents().get(1);
@@ -1160,7 +1161,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class WildcardElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(25);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Wildcard");
private final Assignment cAssignmentIsWildcard = (Assignment)rule.eContents().get(1);
private final Keyword c0KeywordFullStop = (Keyword)cAssignmentIsWildcard.eContents().get(0);
@@ -1175,7 +1176,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class CharacterRangeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(26);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CharacterRange");
private final Group cGroup = (Group)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallKeyword = (RuleCall)cGroup.eContents().get(0);
private final Group c1Group = (Group)cGroup.eContents().get(1);
@@ -1214,7 +1215,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class CrossReferenceElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(27);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CrossReference");
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);
@@ -1265,7 +1266,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ParenthesizedElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(28);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParenthesizedElement");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -1292,7 +1293,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class ParenthesizedTerminalElementElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(29);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ParenthesizedTerminalElement");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordLeftParenthesis = (Keyword)c0Group.eContents().get(0);
@@ -1319,7 +1320,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class KeywordElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(30);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Keyword");
private final Assignment cAssignmentValue = (Assignment)rule.eContents().get(1);
private final RuleCall c0LexerRuleCallSTRING = (RuleCall)cAssignmentValue.eContents().get(0);
@@ -1334,7 +1335,7 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
public class RuleCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(31);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "RuleCall");
private final Assignment cAssignmentRule = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringAbstractRule = (CrossReference)cAssignmentRule.eContents().get(0);
@@ -1382,6 +1383,13 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
private static ParenthesizedTerminalElementElements pParenthesizedTerminalElement;
private static KeywordElements pKeyword;
private static RuleCallElements pRuleCall;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -1392,10 +1400,6 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Grammar: (abstract?="abstract language"|"language") name=GrammarID ("extends" superGrammar=[Grammar|GrammarID])? (definesHiddenTokens?="hidden" "(" (hiddenTokens+=[AbstractRule] ("," hiddenTokens+=[AbstractRule])*)? ")")? (metamodelDeclarations+=AbstractMetamodelDeclaration)* (rules+=AbstractRule)+;
@@ -1547,4 +1551,39 @@ public class XtextGrammarTestLanguageGrammarAccess extends BaseEPackageAccess im
public RuleCallElements prRuleCall() {
return (pRuleCall != null) ? pRuleCall : (pRuleCall = new RuleCallElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarTestLanguageScopeProvider.ext b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarTestLanguageScopeProvider.ext
index 9a38ee7..a2ae8fd 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarTestLanguageScopeProvider.ext
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/GenReferenceGrammarTestLanguageScopeProvider.ext
@@ -22,15 +22,15 @@ List[IScopedElement] scope_kinder(Familie this):
List[IScopedElement] scope_kinder(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_vater(Familie this):
+List[IScopedElement] scope_mutter(Familie this):
allElements().typeSelect(Erwachsener).collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_vater(emf::EObject this) :
+List[IScopedElement] scope_mutter(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_mutter(Familie this):
+List[IScopedElement] scope_vater(Familie this):
allElements().typeSelect(Erwachsener).collect(x | createScopedElement(x.referenceName(), x));
-List[IScopedElement] scope_mutter(emf::EObject this) :
+List[IScopedElement] scope_vater(emf::EObject this) :
allElements().collect(x | createScopedElement(x.referenceName(), x));
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore
index 65d8ec7..e6d7703 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/ReferenceGrammar.ecore
@@ -13,12 +13,12 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="familie" 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.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java
index c205305..54211d0 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ContentAssistTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class StartElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Start");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Group c0Group = (Group)cGroup.eContents().get(0);
private final Keyword c00KeywordAbstractRules = (Keyword)c0Group.eContents().get(0);
@@ -42,7 +43,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class AbstractRuleElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRule");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallFirstAbstractRuleChild = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallSecondAbstractRuleChild = (RuleCall)cAlternatives.eContents().get(1);
@@ -61,7 +62,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class FirstAbstractRuleChildElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "FirstAbstractRuleChild");
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);
@@ -112,7 +113,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class SecondAbstractRuleChildElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "SecondAbstractRuleChild");
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);
@@ -163,7 +164,7 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
public class AbstractRuleCallElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "AbstractRuleCall");
private final Assignment cAssignmentRule = (Assignment)rule.eContents().get(1);
private final CrossReference c0CrossReferenceEStringAbstractRule = (CrossReference)cAssignmentRule.eContents().get(0);
@@ -186,6 +187,13 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
private static FirstAbstractRuleChildElements pFirstAbstractRuleChild;
private static SecondAbstractRuleChildElements pSecondAbstractRuleChild;
private static AbstractRuleCallElements pAbstractRuleCall;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -196,10 +204,6 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Start: "abstract rules" (rules+=AbstractRule)+ "end";
@@ -226,4 +230,39 @@ public class ContentAssistTestLanguageGrammarAccess extends BaseEPackageAccess i
public AbstractRuleCallElements prAbstractRuleCall() {
return (pAbstractRuleCall != null) ? pAbstractRuleCall : (pAbstractRuleCall = new AbstractRuleCallElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java
index 3fdef02..a7fcf39 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/ReferenceGrammarTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class SpielplatzElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spielplatz");
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);
@@ -110,7 +111,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class PersonElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Person");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallKind = (RuleCall)cAlternatives.eContents().get(0);
private final RuleCall c1ParserRuleCallErwachsener = (RuleCall)cAlternatives.eContents().get(1);
@@ -129,7 +130,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class KindElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(3);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Kind");
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);
@@ -180,7 +181,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class ErwachsenerElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(4);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Erwachsener");
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);
@@ -231,7 +232,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class SpielzeugElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(5);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Spielzeug");
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);
@@ -282,7 +283,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class FarbeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(6);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Farbe");
private final Alternatives cAlternatives = (Alternatives)rule.eContents().get(1);
private final Alternatives c0Alternatives = (Alternatives)cAlternatives.eContents().get(0);
private final Alternatives c00Alternatives = (Alternatives)c0Alternatives.eContents().get(0);
@@ -317,7 +318,7 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
public class FamilieElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(7);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Familie");
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);
@@ -438,6 +439,13 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
private static SpielzeugElements pSpielzeug;
private static FarbeElements pFarbe;
private static FamilieElements pFamilie;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -448,10 +456,6 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Spielplatz: ("spielplatz" groesse=INT (beschreibung=STRING)? "{" (kinder+=Kind|erzieher+=Erwachsener|spielzeuge+=Spielzeug|familie+=Familie)* "}")?;
@@ -488,4 +492,39 @@ public class ReferenceGrammarTestLanguageGrammarAccess extends BaseEPackageAcces
public FamilieElements prFamilie() {
return (pFamilie != null) ? pFamilie : (pFamilie = new FamilieElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}
diff --git a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java
index 62cd260..d4c5f79 100644
--- a/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java
+++ b/tests/org.eclipse.xtext.xtend.tests/src-gen/org/eclipse/xtext/testlanguages/services/TreeTestLanguageGrammarAccess.java
@@ -4,14 +4,15 @@ Generated with Xtext
package org.eclipse.xtext.testlanguages.services;
+import com.google.inject.Singleton;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.BaseEPackageAccess;
-import org.eclipse.xtext.builtin.XtextBuiltinGrammarAccess;
+@Singleton
public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements IGrammarAccess {
public class ModelElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(1);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Model");
private final Assignment cAssignmentChildren = (Assignment)rule.eContents().get(1);
private final RuleCall c0ParserRuleCallNode = (RuleCall)cAssignmentChildren.eContents().get(0);
@@ -26,7 +27,7 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
}
public class NodeElements implements IParserRuleAccess {
- private final ParserRule rule = (ParserRule) getGrammar().eContents().get(2);
+ private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Node");
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);
@@ -102,6 +103,13 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
private static Grammar GRAMMAR = null;
private static ModelElements pModel;
private static NodeElements pNode;
+ private static LexerRule lID;
+ private static LexerRule lINT;
+ private static LexerRule lSTRING;
+ private static LexerRule lML_COMMENT;
+ private static LexerRule lSL_COMMENT;
+ private static LexerRule lWS;
+ private static LexerRule lANY_OTHER;
@SuppressWarnings("unused")
public synchronized Grammar getGrammar() {
@@ -112,10 +120,6 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
}
return GRAMMAR;
}
-
- public XtextBuiltinGrammarAccess getSuperGrammar() {
- return XtextBuiltinGrammarAccess.INSTANCE;
- }
// Model: (children+=Node)*;
@@ -127,4 +131,39 @@ public class TreeTestLanguageGrammarAccess extends BaseEPackageAccess implements
public NodeElements prNode() {
return (pNode != null) ? pNode : (pNode = new NodeElements());
}
+
+ // lexer ID: "(\'^\')?(\'a\'..\'z\'|\'A\'..\'Z\'|\'_\') (\'a\'..\'z\'|\'A\'..\'Z\'|\'_\'|\'0\'..\'9\')*";
+ public LexerRule lrID() {
+ return (lID != null) ? lID : (lID = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ID"));
+ }
+
+ // lexer INT returns EInt: "(\'0\'..\'9\')+";
+ public LexerRule lrINT() {
+ return (lINT != null) ? lINT : (lINT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "INT"));
+ }
+
+ // lexer STRING: "\n\t\t\t \'\"\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\"\') )* \'\"\' | \n \'\\\'\' ( \'\\\\\' (\'b\'|\'t\'|\'n\'|\'f\'|\'r\'|\'\\\"\'|\'\\\'\'|\'\\\\\') | ~(\'\\\\\'|\'\\\'\') )* \'\\\'\'\n ";
+ public LexerRule lrSTRING() {
+ return (lSTRING != null) ? lSTRING : (lSTRING = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "STRING"));
+ }
+
+ // lexer ML_COMMENT: "\'/*\' ( options {greedy=false;} : . )* \'*/\'";
+ public LexerRule lrML_COMMENT() {
+ return (lML_COMMENT != null) ? lML_COMMENT : (lML_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ML_COMMENT"));
+ }
+
+ // lexer SL_COMMENT: "\'//\' ~(\'\\n\'|\'\\r\')* (\'\\r\'? \'\\n\')?";
+ public LexerRule lrSL_COMMENT() {
+ return (lSL_COMMENT != null) ? lSL_COMMENT : (lSL_COMMENT = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "SL_COMMENT"));
+ }
+
+ // lexer WS: "(\' \'|\'\\t\'|\'\\r\'|\'\\n\')+";
+ public LexerRule lrWS() {
+ return (lWS != null) ? lWS : (lWS = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "WS"));
+ }
+
+ // lexer ANY_OTHER: ".";
+ public LexerRule lrANY_OTHER() {
+ return (lANY_OTHER != null) ? lANY_OTHER : (lANY_OTHER = (LexerRule) GrammarUtil.findRuleForName(getGrammar(), "ANY_OTHER"));
+ }
}