Search in sources :

Example 1 with IAnalysisService

use of org.metaborg.core.analysis.IAnalysisService in project spoofax by metaborg.

the class SpoofaxModule method bindAnalysis.

/**
 * Overrides {@link MetaborgModule#bindAnalysis()} to provide Spoofax-specific bindings with Spoofax interfaces, and
 * to provide analyzers.
 */
@Override
protected void bindAnalysis() {
    // Analysis service
    bind(SpoofaxAnalysisService.class).in(Singleton.class);
    bind(ISpoofaxAnalysisService.class).to(SpoofaxAnalysisService.class);
    bind(new TypeLiteral<IAnalysisService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate>>() {
    }).to(SpoofaxAnalysisService.class);
    bind(new TypeLiteral<IAnalysisService<?, ?, ?>>() {
    }).to(SpoofaxAnalysisService.class);
    bind(IAnalysisService.class).to(SpoofaxAnalysisService.class);
    // Stratego runtime
    bind(StrategoRuntimeService.class).in(Singleton.class);
    bind(IStrategoRuntimeService.class).to(StrategoRuntimeService.class);
    languageCacheBinder.addBinding().to(StrategoRuntimeService.class);
    // Utilities
    bind(IStrategoCommon.class).to(StrategoCommon.class).in(Singleton.class);
    bind(AnalysisCommon.class).in(Singleton.class);
    // Stratego primitives
    bind(ParseFileStrategy.class).in(Singleton.class);
    bind(ParseStrategoFileStrategy.class).in(Singleton.class);
    final Multibinder<IOperatorRegistry> libraryBinder = Multibinder.newSetBinder(binder(), IOperatorRegistry.class);
    bindPrimitiveLibrary(libraryBinder, TaskLibrary.class);
    bindPrimitiveLibrary(libraryBinder, LegacyIndexLibrary.class);
    bindPrimitiveLibrary(libraryBinder, SpoofaxPrimitiveLibrary.class);
    bindPrimitiveLibrary(libraryBinder, ScopeGraphLibrary.class);
    bindPrimitiveLibrary(libraryBinder, FlowSpecLibrary.class);
    bindPrimitiveLibrary(libraryBinder, LegacySpoofaxPrimitiveLibrary.class);
    bindPrimitiveLibrary(libraryBinder, LegacySpoofaxJSGLRLibrary.class);
    final Multibinder<AbstractPrimitive> spoofaxPrimitiveLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named(SpoofaxPrimitiveLibrary.name));
    bindPrimitive(spoofaxPrimitiveLibrary, DigestPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguageComponentsPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguageImplementationPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguagePrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, ProjectPathPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LocalPathPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LocalReplicatePrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, AbsolutePathPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguageSourceDirectoriesPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguageSourceFilesPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguageIncludeDirectoriesPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, LanguageIncludeFilesPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, RelativeSourcePath.class);
    bindPrimitive(spoofaxPrimitiveLibrary, RelativeSourceOrIncludePath.class);
    bindPrimitive(spoofaxPrimitiveLibrary, ParsePrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, CallStrategyPrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, IsLanguageActivePrimitive.class);
    bindPrimitive(spoofaxPrimitiveLibrary, GetSortNamePrimitive.class);
    final Multibinder<AbstractPrimitive> spoofaxScopeGraphLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named("ScopeGraphLibrary"));
    bindPrimitive(spoofaxScopeGraphLibrary, SG_analysis_has_errors.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_debug_constraints.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_debug_name_resolution.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_debug_scope_graph.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_debug_symbolic_constraints.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_debug_unifier.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_erase_ast_indices.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_fresh.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_focus_term.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_all_decls.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_all_refs.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_all_scopes.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ast_analysis.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ast_decls.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ast_index.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ast_property.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ast_refs.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ast_resolution.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_custom_analysis.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_decl_property.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_decl_scope.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_direct_edges_inv.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_direct_edges.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_export_edges_inv.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_export_edges.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_import_edges_inv.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_import_edges.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_reachable_decls.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ref_resolution.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_ref_scope.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_resource_analysis.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_scope_decls.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_scope_refs.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_symbolic_facts.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_symbolic_goals.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_get_visible_decls.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_index_ast.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_is_debug_collection_enabled.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_is_debug_custom_enabled.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_is_debug_resolution_enabled.class);
    bindPrimitive(spoofaxScopeGraphLibrary, SG_set_ast_index.class);
    final Multibinder<AbstractPrimitive> spoofaxFlowSpecLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named(FlowSpecLibrary.name));
    bindPrimitive(spoofaxFlowSpecLibrary, FS_get_property_pre.class);
    bindPrimitive(spoofaxFlowSpecLibrary, FS_get_property_post.class);
    bindPrimitive(spoofaxFlowSpecLibrary, FS_show_control_flow_graph.class);
    final Multibinder<AbstractPrimitive> legacySpoofaxLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named(LegacySpoofaxPrimitiveLibrary.name));
    bindPrimitive(legacySpoofaxLibrary, LegacyProjectPathPrimitive.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyLanguageSourceLocationsPrimitive.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyLanguageSourceLocationsPrimitive2.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyLanguageIncludeLocationsPrimitive.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyLanguageIncludeLocationsPrimitive2.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyLanguageSourceFilesPrimitive.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyLanguageIncludeFilesPrimitive.class);
    bindPrimitive(legacySpoofaxLibrary, LegacyForeignCallPrimitive.class);
    bindPrimitive(legacySpoofaxLibrary, new DummyPrimitive("SSL_EXT_set_total_work_units", 0, 0));
    bindPrimitive(legacySpoofaxLibrary, new DummyPrimitive("SSL_EXT_set_markers", 0, 1));
    bindPrimitive(legacySpoofaxLibrary, new DummyPrimitive("SSL_EXT_refreshresource", 0, 1));
    bindPrimitive(legacySpoofaxLibrary, new DummyPrimitive("SSL_EXT_queue_strategy", 0, 2));
    bindPrimitive(legacySpoofaxLibrary, new DummyPrimitive("SSL_EXT_complete_work_unit", 0, 0));
    bindPrimitive(legacySpoofaxLibrary, new DummyPrimitive("SSL_EXT_pluginpath", 0, 0));
    final Multibinder<AbstractPrimitive> legacySpoofaxJSGLRLibrary = Multibinder.newSetBinder(binder(), AbstractPrimitive.class, Names.named(LegacySpoofaxJSGLRLibrary.injectionName));
    bindPrimitive(legacySpoofaxJSGLRLibrary, LegacyParseFilePrimitive.class);
    bindPrimitive(legacySpoofaxJSGLRLibrary, LegacyParseFilePtPrimitive.class);
    bindPrimitive(legacySpoofaxJSGLRLibrary, new DummyPrimitive("STRSGLR_open_parse_table", 0, 1));
    bindPrimitive(legacySpoofaxJSGLRLibrary, new DummyPrimitive("STRSGLR_close_parse_table", 0, 1));
}
Also used : ISpoofaxParseUnit(org.metaborg.spoofax.core.unit.ISpoofaxParseUnit) ISpoofaxAnalyzeUnitUpdate(org.metaborg.spoofax.core.unit.ISpoofaxAnalyzeUnitUpdate) DummyPrimitive(org.metaborg.spoofax.core.stratego.primitive.generic.DummyPrimitive) ParseStrategoFileStrategy(org.metaborg.spoofax.core.stratego.strategies.ParseStrategoFileStrategy) ParseFileStrategy(org.metaborg.spoofax.core.stratego.strategies.ParseFileStrategy) SpoofaxAnalysisService(org.metaborg.spoofax.core.analysis.SpoofaxAnalysisService) ISpoofaxAnalysisService(org.metaborg.spoofax.core.analysis.ISpoofaxAnalysisService) IAnalysisService(org.metaborg.core.analysis.IAnalysisService) IOperatorRegistry(org.spoofax.interpreter.library.IOperatorRegistry) AnalysisCommon(org.metaborg.spoofax.core.analysis.AnalysisCommon) StrategoRuntimeService(org.metaborg.spoofax.core.stratego.StrategoRuntimeService) IStrategoRuntimeService(org.metaborg.spoofax.core.stratego.IStrategoRuntimeService) TypeLiteral(com.google.inject.TypeLiteral) IStrategoRuntimeService(org.metaborg.spoofax.core.stratego.IStrategoRuntimeService) StrategoCommon(org.metaborg.spoofax.core.stratego.StrategoCommon) IStrategoCommon(org.metaborg.spoofax.core.stratego.IStrategoCommon) ISpoofaxAnalysisService(org.metaborg.spoofax.core.analysis.ISpoofaxAnalysisService) AbstractPrimitive(org.spoofax.interpreter.library.AbstractPrimitive) ISpoofaxAnalyzeUnit(org.metaborg.spoofax.core.unit.ISpoofaxAnalyzeUnit)

Aggregations

TypeLiteral (com.google.inject.TypeLiteral)1 IAnalysisService (org.metaborg.core.analysis.IAnalysisService)1 AnalysisCommon (org.metaborg.spoofax.core.analysis.AnalysisCommon)1 ISpoofaxAnalysisService (org.metaborg.spoofax.core.analysis.ISpoofaxAnalysisService)1 SpoofaxAnalysisService (org.metaborg.spoofax.core.analysis.SpoofaxAnalysisService)1 IStrategoCommon (org.metaborg.spoofax.core.stratego.IStrategoCommon)1 IStrategoRuntimeService (org.metaborg.spoofax.core.stratego.IStrategoRuntimeService)1 StrategoCommon (org.metaborg.spoofax.core.stratego.StrategoCommon)1 StrategoRuntimeService (org.metaborg.spoofax.core.stratego.StrategoRuntimeService)1 DummyPrimitive (org.metaborg.spoofax.core.stratego.primitive.generic.DummyPrimitive)1 ParseFileStrategy (org.metaborg.spoofax.core.stratego.strategies.ParseFileStrategy)1 ParseStrategoFileStrategy (org.metaborg.spoofax.core.stratego.strategies.ParseStrategoFileStrategy)1 ISpoofaxAnalyzeUnit (org.metaborg.spoofax.core.unit.ISpoofaxAnalyzeUnit)1 ISpoofaxAnalyzeUnitUpdate (org.metaborg.spoofax.core.unit.ISpoofaxAnalyzeUnitUpdate)1 ISpoofaxParseUnit (org.metaborg.spoofax.core.unit.ISpoofaxParseUnit)1 AbstractPrimitive (org.spoofax.interpreter.library.AbstractPrimitive)1 IOperatorRegistry (org.spoofax.interpreter.library.IOperatorRegistry)1