use of org.eclipse.xtext.service.AllRulesCache in project xtext-core by eclipse.
the class AbstractInternalAntlrParser method createAllRules.
/**
* @since 2.11
*/
protected Map<String, AbstractRule> createAllRules(Grammar grammar) {
AllRulesCache cache = AllRulesCache.findInEmfObject(grammar);
if (cache != null) {
return cache.getAllRules();
}
Map<String, AbstractRule> allRules = Maps.newHashMap();
for (AbstractRule rule : GrammarUtil.allRules(grammar)) {
if (rule instanceof TerminalRule)
allRules.put(rule.getName().toUpperCase(), rule);
else
allRules.put(rule.getName(), rule);
}
return allRules;
}
Aggregations