Search in sources :

Example 1 with CombinedGrammarMarker

use of org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker in project xtext-core by eclipse.

the class XtextAntlrGeneratorFragment2 method doGenerate.

@Override
protected void doGenerate() {
    Grammar _grammar = this.getGrammar();
    boolean _isIgnoreCase = this.getOptions().isIgnoreCase();
    new KeywordHelper(_grammar, _isIgnoreCase, this.grammarUtil);
    boolean _isCombinedGrammar = this.isCombinedGrammar();
    new CombinedGrammarMarker(_isCombinedGrammar).attachToEmfObject(this.getGrammar());
    if (this.debugGrammar) {
        this.generateDebugGrammar();
    }
    this.generateProductionGrammar();
    IXtextGeneratorFileSystemAccess _srcGen = this.getProjectConfig().getGenericIde().getSrcGen();
    boolean _tripleNotEquals = (_srcGen != null);
    if (_tripleNotEquals) {
        this.generateContentAssistGrammar();
        this.addIdeBindingsAndImports();
    }
    this.generateProductionParser().writeTo(this.getProjectConfig().getRuntime().getSrcGen());
    this.generateAntlrTokenFileProvider().writeTo(this.getProjectConfig().getRuntime().getSrcGen());
    this.generateContentAssistParser().writeTo(this.getProjectConfig().getGenericIde().getSrcGen());
    boolean _hasSyntheticTerminalRule = this.hasSyntheticTerminalRule();
    if (_hasSyntheticTerminalRule) {
        this.generateProductionTokenSource().writeTo(this.getProjectConfig().getRuntime().getSrc());
        this.generateContentAssistTokenSource().writeTo(this.getProjectConfig().getGenericIde().getSrc());
    }
    this.addRuntimeBindingsAndImports();
    this.addIdeBindingsAndImports();
    this.addUiBindingsAndImports();
}
Also used : KeywordHelper(org.eclipse.xtext.xtext.generator.parser.antlr.KeywordHelper) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess) Grammar(org.eclipse.xtext.Grammar) AntlrGrammar(org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar) CombinedGrammarMarker(org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker)

Example 2 with CombinedGrammarMarker

use of org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker 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));
    }
}
Also used : RuleNames(org.eclipse.xtext.xtext.RuleNames) RuleFilter(org.eclipse.xtext.xtext.RuleFilter) Grammar(org.eclipse.xtext.Grammar) CombinedGrammarMarker(org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker) FlattenedGrammarAccess(org.eclipse.xtext.xtext.FlattenedGrammarAccess)

Aggregations

Grammar (org.eclipse.xtext.Grammar)2 CombinedGrammarMarker (org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker)2 FlattenedGrammarAccess (org.eclipse.xtext.xtext.FlattenedGrammarAccess)1 RuleFilter (org.eclipse.xtext.xtext.RuleFilter)1 RuleNames (org.eclipse.xtext.xtext.RuleNames)1 IXtextGeneratorFileSystemAccess (org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)1 AntlrGrammar (org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar)1 KeywordHelper (org.eclipse.xtext.xtext.generator.parser.antlr.KeywordHelper)1