本文整理汇总了Java中org.eclipse.xtext.GrammarUtil.findRuleForName方法的典型用法代码示例。如果您正苦于以下问题:Java GrammarUtil.findRuleForName方法的具体用法?Java GrammarUtil.findRuleForName怎么用?Java GrammarUtil.findRuleForName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.GrammarUtil
的用法示例。
在下文中一共展示了GrammarUtil.findRuleForName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UnicodeGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public UnicodeGrammarAccess(GrammarProvider grammarProvider) {
this.grammar = internalFindGrammar(grammarProvider);
this.tHEX_DIGIT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.HEX_DIGIT");
this.tDECIMAL_INTEGER_LITERAL_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.DECIMAL_INTEGER_LITERAL_FRAGMENT");
this.tDECIMAL_DIGIT_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.DECIMAL_DIGIT_FRAGMENT");
this.tZWJ = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.ZWJ");
this.tZWNJ = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.ZWNJ");
this.tBOM = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.BOM");
this.tWHITESPACE_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.WHITESPACE_FRAGMENT");
this.tLINE_TERMINATOR_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.LINE_TERMINATOR_FRAGMENT");
this.tLINE_TERMINATOR_SEQUENCE_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.LINE_TERMINATOR_SEQUENCE_FRAGMENT");
this.tSL_COMMENT_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.SL_COMMENT_FRAGMENT");
this.tML_COMMENT_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.ML_COMMENT_FRAGMENT");
this.tUNICODE_COMBINING_MARK_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.UNICODE_COMBINING_MARK_FRAGMENT");
this.tUNICODE_DIGIT_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.UNICODE_DIGIT_FRAGMENT");
this.tUNICODE_CONNECTOR_PUNCTUATION_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.UNICODE_CONNECTOR_PUNCTUATION_FRAGMENT");
this.tUNICODE_LETTER_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.UNICODE_LETTER_FRAGMENT");
this.tUNICODE_SPACE_SEPARATOR_FRAGMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.UNICODE_SPACE_SEPARATOR_FRAGMENT");
this.tANY_OTHER = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.common.unicode.Unicode.ANY_OTHER");
}
示例2: DSLPoliciesGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public DSLPoliciesGrammarAccess(GrammarProvider grammarProvider,
XbaseGrammarAccess gaXbase,
XtypeGrammarAccess gaXtype) {
this.grammar = internalFindGrammar(grammarProvider);
this.gaXbase = gaXbase;
this.gaXtype = gaXtype;
this.pModel = new ModelElements();
this.tSEV = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "gw4e.eclipse.dsl.DSLPolicies.SEV");
this.tFORMAT_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "gw4e.eclipse.dsl.DSLPolicies.FORMAT_COMMENT");
this.tNEWLINE = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "gw4e.eclipse.dsl.DSLPolicies.NEWLINE");
this.pComment = new CommentElements();
this.pGraphPolicies = new GraphPoliciesElements();
this.pModelName = new ModelNameElements();
this.pSeverity = new SeverityElements();
this.pPolicies = new PoliciesElements();
this.pPathGeneratorStopCondition = new PathGeneratorStopConditionElements();
this.pAlgorithmType = new AlgorithmTypeElements();
this.pIntegerStopCondition = new IntegerStopConditionElements();
this.pPercentageCondition = new PercentageConditionElements();
this.pStringCondition = new StringConditionElements();
this.pPercent = new PercentElements();
this.pGraphElement = new GraphElementElements();
}
示例3: RestauranteGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public RestauranteGrammarAccess(GrammarProvider grammarProvider,
TerminalsGrammarAccess gaTerminals) {
this.grammar = internalFindGrammar(grammarProvider);
this.gaTerminals = gaTerminals;
this.pRestaurante = new RestauranteElements();
this.pIngrediente = new IngredienteElements();
this.pProducto = new ProductoElements();
this.pPrincipal = new PrincipalElements();
this.pComplemento = new ComplementoElements();
this.pBebida = new BebidaElements();
this.pBebidaFria = new BebidaFriaElements();
this.pBebidaCaliente = new BebidaCalienteElements();
this.pPostre = new PostreElements();
this.pNutricional = new NutricionalElements();
this.pMenu = new MenuElements();
this.pProductoY = new ProductoYElements();
this.pProductoO = new ProductoOElements();
this.pFloat = new FloatElements();
this.eSalsaRecomendada = new SalsaRecomendadaElements();
this.eTamanioMenu = new TamanioMenuElements();
this.eDistribuidor = new DistribuidorElements();
this.tFECHA = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.xtext.dsl.restaurante.Restaurante.FECHA");
this.tURL = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.xtext.dsl.restaurante.Restaurante.URL");
}
示例4: testBug306281_06
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test
public void testBug306281_06() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("Model : name=ID (({Binary.left=current} operator = [Model] | {Binary.left=current} operator = [Model]) right=ID)*;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
示例5: testBug306281_05
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test
public void testBug306281_05() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("Model : name=ID (({Binary.left=current} operator = \'-\' | {Binary.left=current} operator = \'+\') name=ID);");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
示例6: testBug306281_03
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test
public void testBug306281_03() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("Model : name=ID (({Binary.left=current} operator = \'-\' | {Binary.left=current} operator = \'+\') right=ID)+ name=ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "Model");
final ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertTrue(this.warnings.toString(), this.warnings.isEmpty());
}
示例7: testNoMarkerForCalledRules_01
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test
public void testNoMarkerForCalledRules_01() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar org.foo with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate metamodel \'foo.sample\'");
_builder.newLine();
_builder.append("First returns Object: Second;");
_builder.newLine();
_builder.append("Second returns Object: name=ID name=ID;");
_builder.newLine();
String grammarAsString = _builder.toString();
final Grammar grammar = this.getGrammar(grammarAsString);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "First");
ParserRule rule = ((ParserRule) _findRuleForName);
this.validateRule(rule);
Assert.assertEquals(this.warnings.toString(), 0, this.warnings.size());
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "Second");
rule = ((ParserRule) _findRuleForName_1);
this.validateRule(rule);
Assert.assertEquals(this.warnings.toString(), 2, this.warnings.size());
}
示例8: HiddenTerminalsTestLanguageGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public HiddenTerminalsTestLanguageGrammarAccess(GrammarProvider grammarProvider) {
this.grammar = internalFindGrammar(grammarProvider);
this.pModel = new ModelElements();
this.pWithoutHiddens = new WithoutHiddensElements();
this.pWithHiddens = new WithHiddensElements();
this.pOverridingHiddens = new OverridingHiddensElements();
this.pOverridingHiddensCall = new OverridingHiddensCallElements();
this.pInheritingHiddens = new InheritingHiddensElements();
this.pDatatypeHiddens = new DatatypeHiddensElements();
this.pDatatypeRule = new DatatypeRuleElements();
this.pHidingHiddens = new HidingHiddensElements();
this.pInheritingHiddensCall = new InheritingHiddensCallElements();
this.tML_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.terminalrules.HiddenTerminalsTestLanguage.ML_COMMENT");
this.tSL_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.terminalrules.HiddenTerminalsTestLanguage.SL_COMMENT");
this.tWS = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.terminalrules.HiddenTerminalsTestLanguage.WS");
this.tANY_OTHER = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parser.terminalrules.HiddenTerminalsTestLanguage.ANY_OTHER");
}
示例9: testGetElementsByEObject_02
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test
public void testGetElementsByEObject_02() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("grammar test.Lang with org.eclipse.xtext.common.Terminals");
_builder.newLine();
_builder.append("generate test \'http://test\'");
_builder.newLine();
_builder.append("Rule: name=ID;");
_builder.newLine();
_builder.append("terminal ID: super;");
_builder.newLine();
final String grammarAsString = _builder.toString();
EObject _model = this.getModel(grammarAsString);
final Grammar grammar = ((Grammar) _model);
AbstractRule _head = IterableExtensions.<AbstractRule>head(grammar.getRules());
final SuperCallScope scope = new SuperCallScope(_head);
final AbstractRule id = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Iterable<IEObjectDescription> _elements = scope.getElements(id);
AbstractRule _findRuleForName = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo = Pair.<String, AbstractRule>of("super.ID", _findRuleForName);
AbstractRule _findRuleForName_1 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo_1 = Pair.<String, AbstractRule>of("Lang.ID", _findRuleForName_1);
AbstractRule _findRuleForName_2 = GrammarUtil.findRuleForName(grammar, "org.eclipse.xtext.common.Terminals.ID");
Pair<String, AbstractRule> _mappedTo_2 = Pair.<String, AbstractRule>of("test.Lang.ID", _findRuleForName_2);
this.assertElements(_elements, _mappedTo, _mappedTo_1, _mappedTo_2);
}
示例10: UnassignedTextTestLanguageGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public UnassignedTextTestLanguageGrammarAccess(GrammarProvider grammarProvider,
TerminalsGrammarAccess gaTerminals) {
this.grammar = internalFindGrammar(grammarProvider);
this.gaTerminals = gaTerminals;
this.pModel = new ModelElements();
this.pCaseInsensitiveKeywordRule = new CaseInsensitiveKeywordRuleElements();
this.tCaseInsensitiveKeyword = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parsetree.unassignedtext.UnassignedTextTestLanguage.CaseInsensitiveKeyword");
this.pPluralRule = new PluralRuleElements();
this.tPlural = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parsetree.unassignedtext.UnassignedTextTestLanguage.Plural");
this.pMultiRule = new MultiRuleElements();
this.tMulti = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parsetree.unassignedtext.UnassignedTextTestLanguage.Multi");
this.tMulti2 = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.parsetree.unassignedtext.UnassignedTextTestLanguage.Multi2");
this.pDatatypeRule = new DatatypeRuleElements();
this.pDatatype = new DatatypeElements();
this.pDatatype2 = new Datatype2Elements();
this.pCommonTerminalsRule = new CommonTerminalsRuleElements();
}
示例11: N4MFGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public N4MFGrammarAccess(GrammarProvider grammarProvider,
TerminalsGrammarAccess gaTerminals) {
this.grammar = internalFindGrammar(grammarProvider);
this.gaTerminals = gaTerminals;
this.pProjectDescription = new ProjectDescriptionElements();
this.eProjectType = new ProjectTypeElements();
this.pExecModule = new ExecModuleElements();
this.pTestedProjects = new TestedProjectsElements();
this.pInitModules = new InitModulesElements();
this.pImplementedProjects = new ImplementedProjectsElements();
this.pProjectDependencies = new ProjectDependenciesElements();
this.pProvidedRuntimeLibraries = new ProvidedRuntimeLibrariesElements();
this.pRequiredRuntimeLibraries = new RequiredRuntimeLibrariesElements();
this.pExtendedRuntimeEnvironment = new ExtendedRuntimeEnvironmentElements();
this.pDeclaredVersion = new DeclaredVersionElements();
this.pSourceFragment = new SourceFragmentElements();
this.eSourceFragmentType = new SourceFragmentTypeElements();
this.pModuleFilter = new ModuleFilterElements();
this.pBootstrapModule = new BootstrapModuleElements();
this.pModuleFilterSpecifier = new ModuleFilterSpecifierElements();
this.eModuleFilterType = new ModuleFilterTypeElements();
this.pProvidedRuntimeLibraryDependency = new ProvidedRuntimeLibraryDependencyElements();
this.pRequiredRuntimeLibraryDependency = new RequiredRuntimeLibraryDependencyElements();
this.pTestedProject = new TestedProjectElements();
this.pProjectReference = new ProjectReferenceElements();
this.pProjectDependency = new ProjectDependencyElements();
this.pSimpleProjectDescription = new SimpleProjectDescriptionElements();
this.pVersionConstraint = new VersionConstraintElements();
this.eProjectDependencyScope = new ProjectDependencyScopeElements();
this.eModuleLoader = new ModuleLoaderElements();
this.pN4mfIdentifier = new N4mfIdentifierElements();
this.tID = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.n4js.n4mf.N4MF.ID");
}
示例12: DslGrammarAccess
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Inject
public DslGrammarAccess(GrammarProvider grammarProvider) {
this.grammar = internalFindGrammar(grammarProvider);
this.pDsl = new DslElements();
this.pEntry = new EntryElements();
this.pWORD = new WORDElements();
this.pVALUE_WORD = new VALUE_WORDElements();
this.tSEPARATOR = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.gemoc.Dsl.SEPARATOR");
this.tSL_COMMENT = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.gemoc.Dsl.SL_COMMENT");
this.tLETTER = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.gemoc.Dsl.LETTER");
this.pMULTILINE = new MULTILINEElements();
this.tSPACE = (TerminalRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.gemoc.Dsl.SPACE");
}
示例13: testUnorderedGroup_10
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test public void testUnorderedGroup_10() throws Exception {
String grammarAsString = "grammar org.foo with org.eclipse.xtext.common.Terminals\n" +
"generate metamodel 'foo.sample'\n" +
"X : x=ID & y=INT;\n";
Grammar grammar = getGrammar(grammarAsString);
ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(grammar, "X");
validateRule(rule);
assertTrue(warnings.toString(), warnings.isEmpty());
}
示例14: testAction_04
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test public void testAction_04() throws Exception {
String grammarAsString = "grammar org.foo with org.eclipse.xtext.common.Terminals\n" +
"generate metamodel 'foo.sample'\n" +
"X : {X} | (ID name=ID)?;";
Grammar grammar = getGrammar(grammarAsString);
ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(grammar, "X");
validateRule(rule);
assertTrue(warnings.toString(), warnings.isEmpty());
}
示例15: testUnorderedGroup_06
import org.eclipse.xtext.GrammarUtil; //导入方法依赖的package包/类
@Test public void testUnorderedGroup_06() throws Exception {
String grammarAsString = "grammar org.foo with org.eclipse.xtext.common.Terminals\n" +
"generate metamodel 'foo.sample'\n" +
"X : 'x'? ('x' & x=ID & 'x')?;\n";
Grammar grammar = getGrammar(grammarAsString);
ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(grammar, "X");
validateRule(rule);
assertEquals(warnings.toString(), 1, warnings.size());
}