Search in sources :

Example 1 with ISpoofaxProjectConfig

use of org.metaborg.spoofax.core.config.ISpoofaxProjectConfig in project spoofax by metaborg.

the class SingleFileScopeGraphContextFactory method create.

@Override
public ISingleFileScopeGraphContext create(ContextIdentifier identifier) {
    final ISpoofaxProjectConfig config = configService.get(identifier.project);
    final NaBL2Config nabl2Config = config != null ? config.nabl2Config() : null;
    return new SingleFileScopeGraphContext(injector, identifier, nabl2Config);
}
Also used : ISpoofaxProjectConfig(org.metaborg.spoofax.core.config.ISpoofaxProjectConfig) NaBL2Config(mb.nabl2.config.NaBL2Config)

Example 2 with ISpoofaxProjectConfig

use of org.metaborg.spoofax.core.config.ISpoofaxProjectConfig in project spoofax by metaborg.

the class TermFactoryService method get.

@Override
public ITermFactory get(ILanguageComponent component, @Nullable IProject project, boolean supportsTypesmart) {
    if (!supportsTypesmart || project == null) {
        return genericFactory;
    }
    ISpoofaxProjectConfig config = configService.get(project);
    if (config == null || !config.typesmart()) {
        return genericFactory;
    }
    TypesmartContext context = getTypesmartContext(component);
    if (!context.isEmpty()) {
        return new TypesmartTermFactory(genericFactory, typesmartLogger, context);
    } else {
        return genericFactory;
    }
}
Also used : TypesmartTermFactory(org.spoofax.terms.typesmart.TypesmartTermFactory) ISpoofaxProjectConfig(org.metaborg.spoofax.core.config.ISpoofaxProjectConfig) TypesmartContext(org.spoofax.terms.typesmart.TypesmartContext)

Example 3 with ISpoofaxProjectConfig

use of org.metaborg.spoofax.core.config.ISpoofaxProjectConfig in project spoofax by metaborg.

the class MultiFileScopeGraphContextFactory method create.

@Override
public IMultiFileScopeGraphContext create(ContextIdentifier identifier) {
    final ISpoofaxProjectConfig config = configService.get(identifier.project);
    final NaBL2Config nabl2Config = config != null ? config.nabl2Config() : null;
    return new MultiFileScopeGraphContext(injector, identifier, nabl2Config);
}
Also used : ISpoofaxProjectConfig(org.metaborg.spoofax.core.config.ISpoofaxProjectConfig) NaBL2Config(mb.nabl2.config.NaBL2Config)

Example 4 with ISpoofaxProjectConfig

use of org.metaborg.spoofax.core.config.ISpoofaxProjectConfig in project spoofax by metaborg.

the class TermFactoryService method get.

@Override
public ITermFactory get(ILanguageImpl impl, @Nullable IProject project, boolean supportsTypesmart) {
    if (!supportsTypesmart || project == null) {
        return genericFactory;
    }
    ISpoofaxProjectConfig config = configService.get(project);
    if (config == null || !config.typesmart()) {
        return genericFactory;
    }
    TypesmartContext context = getTypesmartContext(impl);
    if (!context.isEmpty()) {
        return new TypesmartTermFactory(genericFactory, typesmartLogger, context);
    } else {
        return genericFactory;
    }
}
Also used : TypesmartTermFactory(org.spoofax.terms.typesmart.TypesmartTermFactory) ISpoofaxProjectConfig(org.metaborg.spoofax.core.config.ISpoofaxProjectConfig) TypesmartContext(org.spoofax.terms.typesmart.TypesmartContext)

Aggregations

ISpoofaxProjectConfig (org.metaborg.spoofax.core.config.ISpoofaxProjectConfig)4 NaBL2Config (mb.nabl2.config.NaBL2Config)2 TypesmartContext (org.spoofax.terms.typesmart.TypesmartContext)2 TypesmartTermFactory (org.spoofax.terms.typesmart.TypesmartTermFactory)2