Search in sources :

Example 6 with IXtextGeneratorFileSystemAccess

use of org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess in project xtext-core by eclipse.

the class XtextGenerator method generateExecutableExtensionFactory.

protected void generateExecutableExtensionFactory(final IXtextGeneratorLanguage language) {
    IXtextGeneratorFileSystemAccess _srcGen = this.projectConfig.getEclipsePlugin().getSrcGen();
    boolean _tripleNotEquals = (_srcGen != null);
    if (_tripleNotEquals) {
        this.templates.createEclipsePluginExecutableExtensionFactory(language, IterableExtensions.<XtextGeneratorLanguage>head(this.languageConfigs)).writeTo(this.projectConfig.getEclipsePlugin().getSrcGen());
    }
}
Also used : XtextGeneratorLanguage(org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage) IXtextGeneratorLanguage(org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)

Example 7 with IXtextGeneratorFileSystemAccess

use of org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess in project xtext-core by eclipse.

the class XtextAntlrGeneratorFragment2 method generateDebugGrammar.

protected void generateDebugGrammar() {
    final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getRuntime().getSrcGen();
    this.debugGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
}
Also used : IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)

Example 8 with IXtextGeneratorFileSystemAccess

use of org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess in project xtext-core by eclipse.

the class XtextAntlrGeneratorFragment2 method generateContentAssistGrammar.

protected void generateContentAssistGrammar() {
    @Extension final ContentAssistGrammarNaming naming = this.contentAssistNaming;
    final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getGenericIde().getSrcGen();
    this.contentAssistGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
    this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
    this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
    this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
    this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
    this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
    this.normalizeLineDelimiters(fsa, naming.getLexerClass(this.getGrammar()), naming.getInternalParserClass(this.getGrammar()));
    if (this.removeBacktrackingGuards) {
        this.removeBackTrackingGuards(fsa, naming.getInternalParserClass(this.getGrammar()), this.lookaheadThreshold);
    }
}
Also used : Extension(org.eclipse.xtext.xbase.lib.Extension) ContentAssistGrammarNaming(org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)

Example 9 with IXtextGeneratorFileSystemAccess

use of org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess 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 10 with IXtextGeneratorFileSystemAccess

use of org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess in project xtext-core by eclipse.

the class QuickfixProviderFragment2 method generate.

@Override
public void generate() {
    GuiceModuleAccess.BindingFactory _bindingFactory = new GuiceModuleAccess.BindingFactory();
    TypeReference _typeReference = new TypeReference("org.eclipse.xtext.ui.editor.quickfix.IssueResolutionProvider");
    _bindingFactory.addTypeToType(_typeReference, this.getQuickfixProviderClass(this.getGrammar())).contributeTo(this.getLanguage().getEclipsePluginGenModule());
    boolean _isGenerateStub = this.isGenerateStub();
    if (_isGenerateStub) {
        IBundleProjectConfig _eclipsePlugin = this.getProjectConfig().getEclipsePlugin();
        IXtextGeneratorFileSystemAccess _src = null;
        if (_eclipsePlugin != null) {
            _src = _eclipsePlugin.getSrc();
        }
        boolean _tripleNotEquals = (_src != null);
        if (_tripleNotEquals) {
            boolean _isGenerateXtendStub = this.isGenerateXtendStub();
            if (_isGenerateXtendStub) {
                this.generateXtendQuickfixProvider();
            } else {
                this.generateJavaQuickfixProvider();
            }
        }
        ManifestAccess _manifest = this.getProjectConfig().getEclipsePlugin().getManifest();
        boolean _tripleNotEquals_1 = (_manifest != null);
        if (_tripleNotEquals_1) {
            Set<String> _exportedPackages = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
            String _packageName = this.getQuickfixProviderClass(this.getGrammar()).getPackageName();
            _exportedPackages.add(_packageName);
        }
        PluginXmlAccess _pluginXml = this.getProjectConfig().getEclipsePlugin().getPluginXml();
        boolean _tripleNotEquals_2 = (_pluginXml != null);
        if (_tripleNotEquals_2) {
            this.addRegistrationToPluginXml();
        }
    } else {
        IBundleProjectConfig _eclipsePlugin_1 = this.getProjectConfig().getEclipsePlugin();
        IXtextGeneratorFileSystemAccess _srcGen = null;
        if (_eclipsePlugin_1 != null) {
            _srcGen = _eclipsePlugin_1.getSrcGen();
        }
        boolean _tripleNotEquals_3 = (_srcGen != null);
        if (_tripleNotEquals_3) {
            this.generateGenQuickfixProvider();
        }
        ManifestAccess _manifest_1 = this.getProjectConfig().getEclipsePlugin().getManifest();
        boolean _tripleNotEquals_4 = (_manifest_1 != null);
        if (_tripleNotEquals_4) {
            Set<String> _exportedPackages_1 = this.getProjectConfig().getEclipsePlugin().getManifest().getExportedPackages();
            String _packageName_1 = this.getQuickfixProviderClass(this.getGrammar()).getPackageName();
            _exportedPackages_1.add(_packageName_1);
        }
    }
}
Also used : GuiceModuleAccess(org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess) IBundleProjectConfig(org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig) ManifestAccess(org.eclipse.xtext.xtext.generator.model.ManifestAccess) PluginXmlAccess(org.eclipse.xtext.xtext.generator.model.PluginXmlAccess) IXtextGeneratorFileSystemAccess(org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess) TypeReference(org.eclipse.xtext.xtext.generator.model.TypeReference)

Aggregations

IXtextGeneratorFileSystemAccess (org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess)12 ManifestAccess (org.eclipse.xtext.xtext.generator.model.ManifestAccess)5 GuiceModuleAccess (org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess)4 TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)4 Extension (org.eclipse.xtext.xbase.lib.Extension)2 IBundleProjectConfig (org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig)2 ContentAssistGrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.ContentAssistGrammarNaming)2 File (java.io.File)1 DirectoryCleaner (org.eclipse.emf.mwe.utils.DirectoryCleaner)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)1 Grammar (org.eclipse.xtext.Grammar)1 IXtextGeneratorLanguage (org.eclipse.xtext.xtext.generator.IXtextGeneratorLanguage)1 XtextGeneratorLanguage (org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage)1 GeneratedJavaFileAccess (org.eclipse.xtext.xtext.generator.model.GeneratedJavaFileAccess)1 PluginXmlAccess (org.eclipse.xtext.xtext.generator.model.PluginXmlAccess)1 ISubProjectConfig (org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig)1 AntlrGrammar (org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammar)1 CombinedGrammarMarker (org.eclipse.xtext.xtext.generator.parser.antlr.CombinedGrammarMarker)1 GrammarNaming (org.eclipse.xtext.xtext.generator.parser.antlr.GrammarNaming)1