use of org.eclipse.xtext.xtext.RuleFilter in project xtext-core by eclipse.
the class AbstractAntlrGrammarGenerator method generate.
public void generate(final Grammar it, final AntlrOptions options, final IXtextGeneratorFileSystemAccess fsa) {
this.keywordHelper = KeywordHelper.getHelper(it);
this.originalGrammar = it;
final RuleFilter filter = new RuleFilter();
filter.setDiscardUnreachableRules(options.isSkipUnusedRules());
final RuleNames ruleNames = RuleNames.getRuleNames(it, true);
final Grammar flattened = new FlattenedGrammarAccess(ruleNames, filter).getFlattenedGrammar();
boolean _isCombinedGrammar = this.isCombinedGrammar();
new CombinedGrammarMarker(_isCombinedGrammar).attachToEmfObject(flattened);
fsa.generateFile(this.getGrammarNaming().getParserGrammar(it).getGrammarFileName(), this.compileParser(flattened, options));
boolean _isCombinedGrammar_1 = this.isCombinedGrammar();
boolean _not = (!_isCombinedGrammar_1);
if (_not) {
fsa.generateFile(this.getGrammarNaming().getLexerGrammar(it).getGrammarFileName(), this.compileLexer(flattened, options));
}
}
Aggregations