Spoofax API documentation

The API documentation contains all classes in MetaBorg Core, Spoofax Core, and their meta counterparts. This documentation is generated from the source code at the Spoofax GitHub repository.

Javadoc

org.metaborg.core

AggregateMetaborgException

public class AggregateMetaborgException extends MetaborgException
Constructors
AggregateMetaborgException
public AggregateMetaborgException(Iterable<MetaborgException> causes)
Methods
getCauses
public Iterable<MetaborgException> getCauses()
getMessage
public String getMessage()
throwIfAny
public static void throwIfAny(Iterable<MetaborgException> exceptions)

MetaBorg

public class MetaBorg implements AutoCloseable

Facade for instantiating and accessing the MetaBorg API. Call the public methods to perform common operations, or use the public final fields to access services directly. All services and operations available in this facade are implemented when using the default MetaborgModule.

Fields
autoCloseables
public final Set<AutoCloseable> autoCloseables
contextService
public final IContextService contextService
dependencyService
public final IDependencyService dependencyService
dialectProcessor
public final IDialectProcessor dialectProcessor
editorRegistry
public final IEditorRegistry editorRegistry
injector
public final Injector injector
languageComponentFactory
public final ILanguageComponentFactory languageComponentFactory
languageDiscoveryService
public final ILanguageDiscoveryService languageDiscoveryService
languageIdentifierService
public final ILanguageIdentifierService languageIdentifierService
languagePathService
public final ILanguagePathService languagePathService
languageService
public final ILanguageService languageService
projectService
public final IProjectService projectService
resourceService
public final IResourceService resourceService
sourceTextService
public final ISourceTextService sourceTextService
Constructors
MetaBorg
public MetaBorg(IModulePluginLoader loader, MetaborgModule module, Module... additionalModules)

Instantiate the MetaBorg API.

Parameters:
  • loader – Module plugin loader to use.
  • module – MetaBorg module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorg
public MetaBorg(MetaborgModule module, Module... additionalModules)

Instantiate the MetaBorg API.

Parameters:
  • module – MetaBorg module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorg
public MetaBorg(IModulePluginLoader loader, Module... additionalModules)

Instantiate the MetaBorg API.

Parameters:
  • loader – Module plugin loader to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorg
public MetaBorg(Module... additionalModules)

Instantiate the MetaBorg API.

Parameters:
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Methods
close
public void close()

Closes the MetaBorg API, closing any resources and services created by the API.

defaultModule
protected static MetaborgModule defaultModule()
defaultPluginLoader
protected static IModulePluginLoader defaultPluginLoader()
identifyResource
public boolean identifyResource(FileObject resource, ILanguageImpl language)

See also: ILanguageIdentifierService.identify(FileObject,ILanguageImpl)

identifyResource
public ILanguageImpl identifyResource(FileObject resource)

See also: ILanguageIdentifierService.identify(FileObject)

resolve
public FileObject resolve(String uri)

See also: IResourceService.resolve(String)

resolve
public FileObject resolve(File file)

See also: IResourceService.resolve(File)

resolve
public FileObject resolve(URI uri)

See also: IResourceService.resolve(URI)

scanLanguagesInDirectory
public Set<ILanguageImpl> scanLanguagesInDirectory(FileObject directory)

See also: ILanguageDiscoveryService.scanLanguagesInDirectory(FileObject)

MetaBorgGeneric

public class MetaBorgGeneric<I extends IInputUnit, P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>, TP extends ITransformUnit<P>, TA extends ITransformUnit<A>, F> extends MetaBorg

Generic version of the MetaBorg facade. Call the public methods to perform common operations, or use the public final fields to access services directly. This facade should only be used with a module that implements these services, like the Spoofax module, or through a subclassed facade like to the Spoofax facade. Using this facade with the MetaborgModule will cause an exception on construction.

Parameters:
  • <I> – Type of input units.
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
  • <T> – Type of transform units with any input.
  • <TP> – Type of transform units with parse units as input.
  • <TA> – Type of transform units with analyze units as input.
  • <F> – Type of fragments.
Fields
actionService
public final IActionService actionService
analysisResultProcessor
public final IAnalysisResultProcessor<I, P, A> analysisResultProcessor
analysisResultRequester
public final IAnalysisResultRequester<I, A> analysisResultRequester
analysisService
public final IAnalysisService<P, A, AU> analysisService
builder
public final IBuilder<P, A, AU, T> builder
categorizerService
public final ICategorizerService<P, A, F> categorizerService
completionService
public final ICompletionService<P> completionService
dialectIdentifier
public final IDialectIdentifier dialectIdentifier
dialectService
public final IDialectService dialectService
hoverService
public final IHoverService<P, A> hoverService
outlineService
public final IOutlineService<P, A> outlineService
parseResultProcessor
public final IParseResultProcessor<I, P> parseResultProcessor
processorRunner
public final IProcessorRunner<P, A, AU, T> processorRunner
resolverService
public final IResolverService<P, A> resolverService
stylerService
public final IStylerService<F> stylerService
syntaxService
public final ISyntaxService<I, P> syntaxService
tracingService
public final ITracingService<P, A, T, F> tracingService
transformService
public final ITransformService<P, A, TP, TA> transformService
unitService
public final IUnitService<I, P, A, AU, TP, TA> unitService
Constructors
MetaBorgGeneric
public MetaBorgGeneric(Class<I> iClass, Class<P> pClass, Class<A> aClass, Class<AU> auClass, Type tClass, Type tpClass, Type taClass, Class<F> fClass, IModulePluginLoader loader, MetaborgModule module, Module... additionalModules)

Instantiate the generic MetaBorg API.

Parameters:
  • loader – Module plugin loader to use.
  • module – MetaBorg module to use, which should implement all services in this facade. Do not use MetaborgModule.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorgGeneric
public MetaBorgGeneric(Class<I> iClass, Class<P> pClass, Class<A> aClass, Class<AU> auClass, Class<T> tClass, Class<TP> tpClass, Class<TA> taClass, Class<F> fClass, MetaborgModule module, Module... additionalModules)

Instantiate the generic MetaBorg API.

Parameters:
  • module – MetaBorg module to use, which should implement all services in this facade. Do not use MetaborgModule.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.

MetaborgConstants

public class MetaborgConstants
Fields
FILE_COMPONENT_CONFIG
public static final String FILE_COMPONENT_CONFIG
FILE_CONFIG
public static final String FILE_CONFIG
LOC_COMPONENT_CONFIG
public static final String LOC_COMPONENT_CONFIG
METABORG_GROUP_ID
public static final String METABORG_GROUP_ID
METABORG_VERSION
public static final String METABORG_VERSION

MetaborgException

public class MetaborgException extends Exception
Constructors
MetaborgException
public MetaborgException()
MetaborgException
public MetaborgException(String message)
MetaborgException
public MetaborgException(String message, Throwable cause)
MetaborgException
public MetaborgException(Throwable cause)

MetaborgModule

public class MetaborgModule extends AbstractModule

Guice module that specifies which implementations to use for services and factories.

Fields
autoClosableBinder
protected Multibinder<AutoCloseable> autoClosableBinder
contextFactoryBinder
protected MapBinder<String, IContextFactory> contextFactoryBinder
contextStrategyBinder
protected MapBinder<String, IContextStrategy> contextStrategyBinder
languageCacheBinder
protected Multibinder<ILanguageCache> languageCacheBinder
languagePathProviderBinder
protected Multibinder<ILanguagePathProvider> languagePathProviderBinder
Constructors
MetaborgModule
public MetaborgModule()
MetaborgModule
public MetaborgModule(ClassLoader resourceClassLoader)
Methods
bindAnalysis
protected void bindAnalysis()
bindBuilder
protected void bindBuilder()
bindConfigMisc
protected void bindConfigMisc()
bindContext
protected void bindContext()
bindContextFactories
protected void bindContextFactories(MapBinder<String, IContextFactory> binder)
bindContextStrategies
protected void bindContextStrategies(MapBinder<String, IContextStrategy> binder)
bindDependency
protected void bindDependency()
bindEditor
protected void bindEditor()
bindLanguage
protected void bindLanguage()
bindLanguageChangeProcessing
protected void bindLanguageChangeProcessing()
bindLanguageComponentConfig
protected void bindLanguageComponentConfig()
bindLanguagePath
protected void bindLanguagePath()
bindLanguagePathProviders
protected void bindLanguagePathProviders(Multibinder<ILanguagePathProvider> binder)
bindProcessor
protected void bindProcessor()
bindProcessorRunner
protected void bindProcessorRunner()
bindProject
protected void bindProject()
bindProjectConfig
protected void bindProjectConfig()
bindResource
protected void bindResource()
bindSourceText
protected void bindSourceText()
bindTestFramework
protected void bindTestFramework()
bindTestReporter
protected void bindTestReporter()
configure
protected void configure()

MetaborgRuntimeException

public class MetaborgRuntimeException extends RuntimeException
Constructors
MetaborgRuntimeException
public MetaborgRuntimeException()
MetaborgRuntimeException
public MetaborgRuntimeException(String message)
MetaborgRuntimeException
public MetaborgRuntimeException(String message, Throwable cause)
MetaborgRuntimeException
public MetaborgRuntimeException(Throwable cause)

org.metaborg.core.action

CompileGoal

public class CompileGoal implements ITransformGoal
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

EndNamedGoal

public class EndNamedGoal implements ITransformGoal

Named transform goal that points to a builder in a menu, without qualified menu names.

Fields
name
public final String name
Constructors
EndNamedGoal
public EndNamedGoal(String name)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

IAction

public interface IAction
Methods
name
String name()

IActionService

public interface IActionService
Methods
actionContributions
Iterable<TransformActionContrib> actionContributions(ILanguageImpl language, ITransformGoal goal)

Gets transform action contributions for given transform goal.

Parameters:
  • language – Language implementation to get transform actions from.
  • goal – Goal to get transform actions for.
Returns:

Transform action contributions.

actions
Iterable<ITransformAction> actions(ILanguageImpl language, ITransformGoal goal)

Gets transform actions for given goal.

Parameters:
  • language – Language implementation to get transform actions from.
  • goal – Goal to get transform actions for.
Returns:

Transform actions.

available
boolean available(ILanguageImpl language, ITransformGoal goal)

Checks if transform actions are available for given transform goal.

Parameters:
  • language – Language implementation to check transform actions from.
  • goal – Goal to check transform actions for.
Returns:

True if transform actions are available, false if not.

requiresAnalysis
boolean requiresAnalysis(ILanguageImpl language, ITransformGoal goal)

Checks if analysis is required for given transform goal.

Parameters:
  • language – Language implementation to check from.
  • goal – Goal to check for.
Returns:

True if analysis is required, false if not.

ITransformAction

public interface ITransformAction extends IAction
Methods
flags
TransformActionFlags flags()
goal
ITransformGoal goal()

ITransformGoal

public interface ITransformGoal extends Serializable

Tag interface for transformation goals.

NamedGoal

public class NamedGoal implements ITransformGoal

Named transform goal that points to a builder in a menu via a list of menu names and builder name.

Fields
names
public final List<String> names
Constructors
NamedGoal
public NamedGoal(List<String> names)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

TransformActionContrib

public class TransformActionContrib
Fields
action
public final ITransformAction action
contributor
public final ILanguageComponent contributor
Constructors
TransformActionContrib
public TransformActionContrib(ITransformAction action, ILanguageComponent contributor)
Methods
toString
public String toString()

TransformActionFlags

public class TransformActionFlags
Fields
openEditor
public boolean openEditor

Flag indicating if the result of this action should be shown in a new editor.

parsed
public boolean parsed

Flag indicating if the strategy should be invoked on the parsed AST instead of the analyzed AST.

realtime
public boolean realtime

Flag indicating if this action should be updated in real time whenever the input changes.

Constructors
TransformActionFlags
public TransformActionFlags()
TransformActionFlags
public TransformActionFlags(boolean parsed, boolean openEditor, boolean realtime)
Methods

org.metaborg.core.analysis

AnalysisException

public class AnalysisException extends MetaborgException

Exception indicating that analysis failed unexpectedly.

Fields
context
public final IContext context
Constructors
AnalysisException
public AnalysisException(IContext context)
AnalysisException
public AnalysisException(IContext context, String message)
AnalysisException
public AnalysisException(IContext context, Throwable cause)
AnalysisException
public AnalysisException(IContext context, String message, Throwable cause)

AnalysisService

public class AnalysisService<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate> implements IAnalysisService<P, A, AU>
Methods
analyze
public IAnalyzeResult<A, AU> analyze(P input, IContext context, IProgress progress, ICancel cancel)
analyzeAll
public IAnalyzeResults<A, AU> analyzeAll(Iterable<P> inputs, IContext context, IProgress progress, ICancel cancel)
available
public boolean available(ILanguageImpl langImpl)

AnalyzeResult

public class AnalyzeResult<A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate> implements IAnalyzeResult<A, AU>
Constructors
AnalyzeResult
public AnalyzeResult(A result, Collection<AU> updates, IContext context)
AnalyzeResult
public AnalyzeResult(A result, IContext context)
Methods
context
public IContext context()
result
public A result()
updates
public Collection<AU> updates()

AnalyzeResults

public class AnalyzeResults<A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate> implements IAnalyzeResults<A, AU>
Constructors
AnalyzeResults
public AnalyzeResults(Collection<A> results, Collection<AU> updates, IContext context)
AnalyzeResults
public AnalyzeResults(Collection<A> results, IContext context)
AnalyzeResults
public AnalyzeResults(IContext context)
Methods
context
public IContext context()
results
public Collection<A> results()
updates
public Collection<AU> updates()

AnalyzerFacet

public class AnalyzerFacet<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate> implements IFacet
Fields
analyzer
public final IAnalyzer<P, A, AU> analyzer
Constructors
AnalyzerFacet
public AnalyzerFacet(IAnalyzer<P, A, AU> analyzer)

IAnalysisService

public interface IAnalysisService<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate>

Interface for context-sensitive analysis of parse units.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
Methods
analyze
IAnalyzeResult<A, AU> analyze(P input, IContext context, IProgress progress, ICancel cancel)

Analyzes given parse input, in given context, into an analysis result which contains an analyze unit and optionally updates to analyze units.

Parameters:
  • input – Parse unit to analyze.
  • context – Context to perform analysis in.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Analysis result which contains an analyze unit and optionally updates to analyze units.

analyze
IAnalyzeResult<A, AU> analyze(P input, IContext context)

Analyzes given parse input, in given context, into an analysis result which contains an analyze unit and optionally updates to analyze units.

Parameters:
  • input – Parse unit to analyze.
  • context – Context to perform analysis in.
Throws:
Returns:

Analysis result which contains an analyze unit and optionally updates to analyze units.

analyzeAll
IAnalyzeResults<A, AU> analyzeAll(Iterable<P> inputs, IContext context, IProgress progress, ICancel cancel)

Analyzes given parse input, in given context, into an analysis result which contains an analyze unit and optionally updates to analyze units.

Parameters:
  • input – Parse unit to analyze.
  • context – Context to perform analysis in.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Analysis result which contains an analyze unit and optionally updates to analyze units.

analyzeAll
IAnalyzeResults<A, AU> analyzeAll(Iterable<P> inputs, IContext context)

Analyzes given parse input, in given context, into an analysis result which contains an analyze unit and optionally updates to analyze units.

Parameters:
  • input – Parse unit to analyze.
  • context – Context to perform analysis in.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Analysis result which contains an analyze unit and optionally updates to analyze units.

available
boolean available(ILanguageImpl langImpl)

Checks if analysis is available for given language implementation.

Parameters:
  • langImpl – Language implementation to check.
Returns:

True if analysis is a available, false if not.

IAnalyzeResult

public interface IAnalyzeResult<A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate>

Result of the analysis of a single parse unit.

Parameters:
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
Methods
context
IContext context()
Returns:The context that was used during analysis.
result
A result()
Returns:Resulting analyze unit of the analysis.
updates
Collection<AU> updates()
Returns:Updates to existing analyze units.

IAnalyzeResults

public interface IAnalyzeResults<A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate>

Result of the analysis of a multiple parse units.

Parameters:
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
Methods
context
IContext context()
Returns:The context that was used during analysis.
results
Collection<A> results()
Returns:Resulting analyze units of the analysis.
updates
Collection<AU> updates()
Returns:Updates to existing analyze units.

IAnalyzeUnit

public interface IAnalyzeUnit extends IUnit

Unit representing an analyzed source file. An analyze unit can be passed to the ITransformService to transform the parse unit into a ITransformUnit

Methods
context
IContext context()
Returns:The context that was used during analysis.
duration
long duration()
Returns:Analysis duration in nanoseconds, or -1 if the duration is unknown.
input
IParseUnit input()
Returns:The parse unit this unit was made with.
messages
Iterable<IMessage> messages()
Returns:Messages produced by the analyzer.
success
boolean success()
Returns:True if analysis was successful, i.e. the analyzed produced a result and no errors were encountered. False otherwise.
valid
boolean valid()
Returns:True if this unit is valid, i.e. the analyzer analyzed the parse unit without exceptions. Even when the unit is valid, it may still be unsuccessful, use success() to check for that.

IAnalyzeUnitUpdate

public interface IAnalyzeUnitUpdate

An update to an analyze unit, made from analyzing a different unit.

Methods
messages
Iterable<IMessage> messages()
Returns:Updated messages.
source
FileObject source()
Returns:Source file the update is for.

IAnalyzer

public interface IAnalyzer<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate>

Interface for a context-sensitive analyzer implementation.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
Methods
analyze
IAnalyzeResult<A, AU> analyze(P input, IContext context, IProgress progress, ICancel cancel)

Analyzes given parse input, in given context, into an analysis result which contains an analyze unit and optionally updates to analyze units.

Parameters:
  • input – Parse unit to analyze.
  • context – Context to perform analysis in.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Analysis result which contains an analyze unit and optionally updates to analyze units.

analyzeAll
IAnalyzeResults<A, AU> analyzeAll(Iterable<P> inputs, IContext context, IProgress progress, ICancel cancel)

Analyzes given parse inputs, in given context, into an analysis result which contains analyze units and optionally updates to analyze units.

Parameters:
  • inputs – Parse units to analyze.
  • context – Context to perform analysis in.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Analysis result which contains analyze units and optionally updates to analyze units.

org.metaborg.core.build

BuildInput

public class BuildInput

Input for a build. Use the BuildInputBuilder fluent interface to create objects of this class.

See also: BuildInputBuilder

Fields
analyze
public final boolean analyze

If analysis is enabled.

analyzeSelector
public final FileSelector analyzeSelector

File selector to determine which resources should be analyzed, or null to analyze everything.

buildOrder
public final BuildOrder buildOrder

Language build order.

includePaths
public final Multimap<ILanguageImpl, FileObject> includePaths

Per-language include paths;

messagePrinter
public final IMessagePrinter messagePrinter

Message printer to use during build, or null to skip printing messages.

pardonedLanguages
public final Set<ILanguageImpl> pardonedLanguages

Languages for which errors are pardoned; prevents throwing an exception when throwOnErrors is true.

project
public final IProject project

Project to build.

selector
public final FileSelector selector

File selector to determine which resources should be processed, or null to process everything.

sourceChanges
public final Iterable<ResourceChange> sourceChanges

Sources that have changed.

state
public final BuildState state

Build state with information about previous builds.

throwOnErrors
public final boolean throwOnErrors

If an exception should be thrown when there are parsing, analysis, or transformation errors.

transform
public final boolean transform

If transformation is enabled.

transformGoals
public final Iterable<ITransformGoal> transformGoals

Transformer goals to execute on analyzed or parsed results.

transformSelector
public final FileSelector transformSelector

File selector to determine which resources should be transformed, or null to transform everything.

Constructors
BuildInput
public BuildInput(BuildState state, IProject project, Iterable<ResourceChange> resourceChanges, Multimap<ILanguageImpl, FileObject> includePaths, BuildOrder buildOrder, FileSelector parseSelector, boolean analyze, FileSelector analyzeSelector, boolean transform, FileSelector transformSelector, Iterable<ITransformGoal> transformGoals, IMessagePrinter messagePrinter, boolean throwOnErrors, Set<ILanguageImpl> pardonedLanguages)

BuildInputBuilder

public class BuildInputBuilder

Fluent interface for creating BuildInput objects.

See also: BuildInput

Constructors
BuildInputBuilder
public BuildInputBuilder(IProject project)
Methods
addComponent
public BuildInputBuilder addComponent(ILanguageComponent component)

Adds languages from given language component.

addComponents
public BuildInputBuilder addComponents(Iterable<? extends ILanguageComponent> components)

Adds languages from given language components.

addIdentifiedSources
public BuildInputBuilder addIdentifiedSources(Iterable<IdentifiedResource> sources)

Add addition source changes from given identified sources.

addIncludePaths
public BuildInputBuilder addIncludePaths(ILanguageImpl language, Iterable<FileObject> includePaths)

Add given include files for given language.

addLanguage
public BuildInputBuilder addLanguage(ILanguageImpl language)

Adds a single language implementation.

addLanguages
public BuildInputBuilder addLanguages(Iterable<? extends ILanguageImpl> languages)

Adds given language implementations.

addPardonedLanguage
public BuildInputBuilder addPardonedLanguage(ILanguageImpl pardonedLanguage)

Adds a single pardoned language.

addPardonedLanguageString
public BuildInputBuilder addPardonedLanguageString(String pardonedLanguage)

Adds a single pardoned language from given language name.

addSource
public BuildInputBuilder addSource(IdentifiedResource source)

Adds a single addition source change from given identified source.

addSource
public BuildInputBuilder addSource(FileObject source)

Adds a single addition source change from given source.

addSourceChanges
public BuildInputBuilder addSourceChanges(Iterable<ResourceChange> sourceChanges)

Adds a source change.

addSources
public BuildInputBuilder addSources(Iterable<FileObject> sources)

Add addition source changes from given sources.

addSourcesFromSourceLocations
public BuildInputBuilder addSourcesFromSourceLocations(Iterable<FileObject> sourceLocations)

Add addition source changes from source files at given source locations.

addTransformGoal
public BuildInputBuilder addTransformGoal(ITransformGoal goal)

Adds a single transform goal.

build
public BuildInput build(IDependencyService dependencyService, ILanguagePathService languagePathService)

Builds a build input object from the current state.

Throws:
reset
public BuildInputBuilder reset()

Resets the builder to its original state.

withAnalysis
public BuildInputBuilder withAnalysis(boolean analyze)

Sets if analysis should be executed. Defaults to true.

withAnalyzeSelector
public BuildInputBuilder withAnalyzeSelector(FileSelector analyzeSelector)

Sets the analysis file selector to given selector.

withCompileDependencyLanguages
public BuildInputBuilder withCompileDependencyLanguages(boolean addDependencyLanguages)

Sets if compile time dependencies should be added to languages when the input is built. Defaults to true.

withComponents
public BuildInputBuilder withComponents(Iterable<ILanguageComponent> components)

Sets the languages from given language components.

withDefaultIncludePaths
public BuildInputBuilder withDefaultIncludePaths(boolean addDefaultIncludePaths)

Sets if default include files should be added when the input is build. Defaults to true.

withIncludePaths
public BuildInputBuilder withIncludePaths(Multimap<ILanguageImpl, FileObject> includePaths)

Sets the include files to given files.

withLanguages
public BuildInputBuilder withLanguages(Set<ILanguageImpl> languages)

Sets the languages to given language implementations.

withLanguages
public BuildInputBuilder withLanguages(Iterable<ILanguageImpl> languages)

Sets the languages to given language implementations.

withMessagePrinter
public BuildInputBuilder withMessagePrinter(IMessagePrinter messagePrinter)

Sets the message printer to given message printer.

withPardonedLanguageStrings
public BuildInputBuilder withPardonedLanguageStrings(Iterable<String> pardonedLanguages)

Set the pardoned languages from given language names.

withPardonedLanguages
public BuildInputBuilder withPardonedLanguages(Set<ILanguageImpl> pardonedLanguages)

Set the pardoned languages from given set of pardoned languages.

withSelector
public BuildInputBuilder withSelector(FileSelector selector)

Sets the file selector to given selector.

withSourceChanges
public BuildInputBuilder withSourceChanges(Collection<ResourceChange> sourceChanges)

Sets the source changes to given resource changes.

withSourceChanges
public BuildInputBuilder withSourceChanges(Iterable<ResourceChange> sourceChanges)

Sets the source changes to given resource changes.

withSources
public BuildInputBuilder withSources(Iterable<FileObject> sources)

Set the source changes to additions from given sources.

withSourcesFromDefaultSourceLocations
public BuildInputBuilder withSourcesFromDefaultSourceLocations(boolean addSourcesFromDefaultSourceLocations)

Sets if addition source changes should be added from source at default source locations, when the input is built. Defaults to false.

withState
public BuildInputBuilder withState(BuildState state)

Sets the build state to given build state.

withThrowOnErrors
public BuildInputBuilder withThrowOnErrors(boolean throwOnErrors)

Sets if a runtime exception should be thrown when errors occur. Defaults to false.

withTransformGoals
public BuildInputBuilder withTransformGoals(Collection<ITransformGoal> transformGoals)

Sets the transform goals to given transform goals.

withTransformSelector
public BuildInputBuilder withTransformSelector(FileSelector transformSelector)

Sets the transformation file selector to given selector.

withTransformation
public BuildInputBuilder withTransformation(boolean transform)

Sets if transformations should be executed. Defaults to true.

BuildOrder

public class BuildOrder

Language build order calculation.

Constructors
BuildOrder
public BuildOrder(Iterable<ILanguageImpl> languages)

Creates a build order for given languages, using their dependencies.

Parameters:
  • languages – Languages to create a build order for.
Throws:
  • MetaborgRuntimeException – When there is a cyclic dependency between languages.
Methods
buildOrder
public Iterable<ILanguageImpl> buildOrder()
Returns:Build order.
languages
public Iterable<ILanguageImpl> languages()
Returns:Languages in this build order, in the same order that they were passed in the constructor.

BuildOutput

public class BuildOutput<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>> implements IBuildOutputInternal<P, A, AU, T>
Fields
analysisResults
public final Collection<A> analysisResults
analysisUpdates
public final Collection<AU> analysisUpdates
changedResources
public final Collection<FileObject> changedResources
extraMessages
public final Collection<IMessage> extraMessages
includedResources
public final Set<FileName> includedResources
parseResults
public final Collection<P> parseResults
removedResources
public final Set<FileName> removedResources
state
public BuildState state
transformResults
public final Collection<T> transformResults
Methods
add
public void add(boolean success, Iterable<FileName> removedResources, Iterable<FileName> includedResources, Iterable<FileObject> changedResources, Iterable<P> parseResults, Iterable<A> analysisResults, Iterable<AU> analysisUpdates, Iterable<T> transformResults, Iterable<IMessage> extraMessages)
allMessages
public Iterable<IMessage> allMessages()
analysisResults
public Iterable<A> analysisResults()
analysisUpdates
public Iterable<AU> analysisUpdates()
changedResources
public Iterable<FileObject> changedResources()
extraMessages
public Iterable<IMessage> extraMessages()
includedResources
public Set<FileName> includedResources()
parseResults
public Iterable<P> parseResults()
removedResources
public Set<FileName> removedResources()
setState
public void setState(BuildState state)
state
public BuildState state()
success
public boolean success()
transformResults
public Iterable<T> transformResults()

BuildState

public class BuildState
Methods
add
public void add(ILanguageImpl language, LanguageBuildState state)
get
public LanguageBuildState get(IResourceService resourceService, ILanguageIdentifierService languageIdentifierService, ILanguageImpl language)

Builder

public class Builder<I extends IInputUnit, P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>, TP extends ITransformUnit<P>, TA extends ITransformUnit<A>> implements IBuilder<P, A, AU, T>

Builder implementation.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
  • <T> – Type of transform units with any input.
  • <TP> – Type of transform units with parse units as input.
  • <TA> – Type of transform units with analyze units as input.
Constructors
Builder
public Builder(IResourceService resourceService, ILanguageIdentifierService languageIdentifier, ILanguagePathService languagePathService, IUnitService<I, P, A, AU, TP, TA> unitService, ISourceTextService sourceTextService, ISyntaxService<I, P> syntaxService, IContextService contextService, IAnalysisService<P, A, AU> analysisService, ITransformService<P, A, TP, TA> transformService, IParseResultUpdater<P> parseResultUpdater, IAnalysisResultUpdater<P, A> analysisResultUpdater, Provider<IBuildOutputInternal<P, A, AU, T>> buildOutputProvider)
Methods
build
public IBuildOutput<P, A, AU, T> build(BuildInput input, IProgress progress, ICancel cancel)
clean
public void clean(CleanInput input, IProgress progress, ICancel cancel)

CleanInput

public class CleanInput

Input for a clean build.

Fields
languages
public final Iterable<ILanguageImpl> languages

Languages to run clean operations for.

project
public final IProject project

Project to clean.

selector
public final FileSelector selector

File selector to determine which resources are eligible for cleaning, or null to allow everything to be cleaned.

Constructors
CleanInput
public CleanInput(IProject project, Iterable<ILanguageImpl> languages, FileSelector selector)

CleanInputBuilder

public class CleanInputBuilder
Constructors
CleanInputBuilder
public CleanInputBuilder(IProject project)
Methods
addComponent
public CleanInputBuilder addComponent(ILanguageComponent component)

Adds languages from given language component.

addComponents
public CleanInputBuilder addComponents(Iterable<? extends ILanguageComponent> components)

Adds languages from given language components.

addLanguage
public CleanInputBuilder addLanguage(ILanguageImpl language)

Adds a single language implementation.

addLanguages
public CleanInputBuilder addLanguages(Iterable<? extends ILanguageImpl> languages)

Adds given language implementations.

build
public CleanInput build(IDependencyService dependencyService)

Builds a clean input object from the current state.

Throws:
reset
public void reset()
withCompileDependencyLanguages
public CleanInputBuilder withCompileDependencyLanguages(boolean addDependencyLanguages)

Sets if compile time dependencies should be added to languages when the input is built. Defaults to true.

withComponents
public CleanInputBuilder withComponents(Iterable<ILanguageComponent> components)

Sets the languages from given language components.

withLanguages
public CleanInputBuilder withLanguages(Set<ILanguageImpl> languages)

Sets the languages to given language implementations.

withSelector
public CleanInputBuilder withSelector(FileSelector selector)

Sets the file selector to given selector.

CommonPaths

public class CommonPaths
Fields
logger
static final ILogger logger
root
protected final FileObject root
Constructors
CommonPaths
public CommonPaths(FileObject root)
Methods
find
protected FileObject find(Iterable<FileObject> dirs, String path)
mbComponentConfigFile
public FileObject mbComponentConfigFile()
Returns:Metaborg component configuration file.
replicateDir
public FileObject replicateDir()
Returns:Target output directory for replicated resources.
resolve
protected FileObject resolve(FileObject dir, String path)
resolve
protected FileObject resolve(FileObject dir, String... paths)
root
public FileObject root()
Returns:Root directory.
srcGenDir
public FileObject srcGenDir()
Returns:Generated sources directory. All generated source code (Stratego, SDF, config files, etc.) go into this directory.
targetDir
public FileObject targetDir()
Returns:Target output directory. All compiled outputs go into this directory.
targetMetaborgDir
public FileObject targetMetaborgDir()
Returns:Target output directory for compiled MetaBorg artifacts (Stratego JAR, parse table, etc.). All compiled artifacts that should be included with the language go into this directory.
transDir
public FileObject transDir()
Returns:Transformations directory. Contains the Stratego definition, NaBL definition, TS definition, and DynSem definition.

FilesBuildState

class FilesBuildState
Fields
files
public final Set<FileName> files
modification
public final Map<FileName, Long> modification
Methods
add
public long add(FileObject resource)
add
public void add(FilesBuildState state)
remove
public void remove(FileName name)

IBuildOutput

public interface IBuildOutput<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>>

Output generated by a build.

Parameters:
  • <P> – Type of parse units
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
  • <T> – Type of transform units.
Methods
allMessages
Iterable<IMessage> allMessages()
Returns:All messages. Includes parse, analysis, transformation, and extra messages.
analysisResults
Iterable<A> analysisResults()
Returns:Analysis results for changed resources. Resources that could not be parsed are not analyzed.
analysisUpdates
Iterable<AU> analysisUpdates()
Returns:Analysis updates for affected resources.
changedResources
Iterable<FileObject> changedResources()
Returns:Resources that were added or changed prior to the build.
extraMessages
Iterable<IMessage> extraMessages()
Returns:Extra messages generated by exceptions.
includedResources
Set<FileName> includedResources()
Returns:Resources that were included into the build, but not used as source files. These files were parsed and analyzed, but not transformed.
parseResults
Iterable<P> parseResults()
Returns:Parse results for changed resources. If parsing fails exceptionally by a ParseException or IOException, there is no parse result for that resource.
removedResources
Set<FileName> removedResources()
Returns:Resources that were removed prior to the build.
state
BuildState state()
Returns:State produced by the build.
success
boolean success()
Returns:If the build was successful.
transformResults
Iterable<T> transformResults()
Returns:Transformation results for changed resources. Resources that could not be parsed or analyzed, or that do not require compilation, are not transformed.

IBuildOutputInternal

public interface IBuildOutputInternal<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>> extends IBuildOutput<P, A, AU, T>
Methods
add
void add(boolean success, Iterable<FileName> removedResources, Iterable<FileName> includedResources, Iterable<FileObject> changedResources, Iterable<P> parseResults, Iterable<A> analysisResults, Iterable<AU> analysisUpdates, Iterable<T> transformResults, Iterable<IMessage> extraMessages)
setState
void setState(BuildState state)

IBuilder

public interface IBuilder<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>>

Incrementally parses, analyzes, and compiles source files.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
  • <T> – Type of transform units with any input.
Methods
build
IBuildOutput<P, A, AU, T> build(BuildInput input, IProgress progress, ICancel cancel)

Parses, analyses, and compiles changed resources.

Parameters:
  • input – Build input.
  • progress – Progress reporter used for reporting build progress.
  • cancel – Cancellation token for canceling the build.
Throws:
Returns:

Result of building.

build
IBuildOutput<P, A, AU, T> build(BuildInput input)

Parses, analyzes, and compiles changed resources.

Parameters:
  • input – Build input.
Throws:
Returns:

Result of building.

clean
void clean(CleanInput input, IProgress progress, ICancel cancellation)

Cleans derived resources and contexts from given location.

Parameters:
  • input – Clean input.
  • progress – Progress reporter used for reporting clean progress.
  • cancellation – Cancellation token for canceling the clean.
Throws:
clean
void clean(CleanInput input)

Cleans derived resources and contexts from given location.

Parameters:
  • input – Clean input.
Throws:

LanguageBuildDiff

public class LanguageBuildDiff
Fields
includeChanges
public final Iterable<IdentifiedResourceChange> includeChanges
newState
public final LanguageBuildState newState
sourceChanges
public final Iterable<IdentifiedResourceChange> sourceChanges
Constructors
LanguageBuildDiff
public LanguageBuildDiff(LanguageBuildState newState, Iterable<IdentifiedResourceChange> sourceFileChanges, Iterable<IdentifiedResourceChange> includeFileChanges)

LanguageBuildState

public class LanguageBuildState
Constructors
LanguageBuildState
public LanguageBuildState(IResourceService resourceService, ILanguageIdentifierService languageIdentifierService, ILanguageImpl language)
Methods
diff
public LanguageBuildDiff diff(Iterable<IdentifiedResourceChange> sourceFileChanges, Iterable<IdentifiedResource> newIncludeFiles)

ResourceModificationInfo

class ResourceModificationInfo
Fields
modificationDate
public final long modificationDate
resource
public final FileObject resource
Constructors
ResourceModificationInfo
public ResourceModificationInfo(FileObject resource)
ResourceModificationInfo
public ResourceModificationInfo(FileObject resource, long modificationDate)

UpdateKind

public enum UpdateKind
Enum Constants
Error
public static final UpdateKind Error
Invalidate
public static final UpdateKind Invalidate
Remove
public static final UpdateKind Remove
Update
public static final UpdateKind Update

org.metaborg.core.build.dependency

DefaultDependencyService

public final class DefaultDependencyService implements IDependencyService

Default implementation of the IDependencyService interface.

Constructors
DefaultDependencyService
public DefaultDependencyService(ILanguageService languageService)
Methods
checkDependencies
public MissingDependencies checkDependencies(IProject project)
compileDeps
public Collection<ILanguageComponent> compileDeps(IProject project)
sourceDeps
public Collection<ILanguageComponent> sourceDeps(IProject project)
sourceDeps
public Collection<ILanguageComponent> sourceDeps(ILanguageComponent component)

IDependencyService

public interface IDependencyService

Returns compile and source dependencies for a project or language component.

Methods
checkDependencies
MissingDependencies checkDependencies(IProject project)

Checks if compile and source dependencies for the given project are loaded; and returns any missing dependencies.

Parameters:
  • project – Project to check the dependencies for.
Returns:

Missing dependencies.

compileDeps
Collection<ILanguageComponent> compileDeps(IProject project)

Gets compile dependencies for the given project.

Parameters:
  • project – Project to get dependencies for.
Returns:

Compile dependencies.

sourceDeps
Collection<ILanguageComponent> sourceDeps(IProject project)

Gets source dependencies for the given project.

Parameters:
  • project – Project to get dependencies for.
Returns:

Source dependencies.

sourceDeps
Collection<ILanguageComponent> sourceDeps(ILanguageComponent component)

Gets source dependencies for the given language component.

Parameters:
  • component – Language component to get dependencies for.
Returns:

Source dependencies.

MissingDependencies

public class MissingDependencies
Fields
compile
public final Iterable<LanguageIdentifier> compile
runtime
public final Iterable<LanguageIdentifier> runtime
Constructors
MissingDependencies
public MissingDependencies(Iterable<LanguageIdentifier> compile, Iterable<LanguageIdentifier> runtime)
MissingDependencies
public MissingDependencies()
Methods
empty
public boolean empty()
toString
public String toString()

MissingDependencyException

public class MissingDependencyException extends MetaborgException

Thrown when a dependency is not found or not loaded.

Constructors
MissingDependencyException
public MissingDependencyException(String message, Throwable cause)

Initializes a new instance of the MissingDependencyException class.

Parameters:
  • message – The error message; or null.
  • cause – The exception cause; or null.
MissingDependencyException
public MissingDependencyException(String message)

Initializes a new instance of the MissingDependencyException class.

Parameters:
  • message – The error message; or null.
MissingDependencyException
public MissingDependencyException(Throwable cause)

Initializes a new instance of the MissingDependencyException class.

Parameters:
  • cause – The exception cause; or null.
MissingDependencyException
public MissingDependencyException()

Initializes a new instance of the MissingDependencyException class.

org.metaborg.core.build.paths

DependencyPathProvider

public class DependencyPathProvider implements ILanguagePathProvider
Constructors
DependencyPathProvider
public DependencyPathProvider(IDependencyService dependencyService)
Methods
includePaths
public Iterable<FileObject> includePaths(IProject project, String languageName)
sourcePaths
public Iterable<FileObject> sourcePaths(IProject project, String languageName)

ILanguagePathProvider

public interface ILanguagePathProvider

Interface for providers for source and include paths.

Methods
includePaths
Iterable<FileObject> includePaths(IProject project, String languageName)

Gets include paths in given project, for given language.

Parameters:
  • project – Project to get include paths relative to.
  • languageName – Name of the language to get include paths for.
Throws:
Returns:

Include paths.

sourcePaths
Iterable<FileObject> sourcePaths(IProject project, String languageName)

Gets source paths in given project, for given language.

Parameters:
  • project – Project to get source paths relative to.
  • languageName – Name of the language to get source paths for.
Throws:
Returns:

Source paths.

ILanguagePathService

public interface ILanguagePathService

Interface for service that returns source/include paths/files for languages.

Methods
includeFiles
Iterable<IdentifiedResource> includeFiles(IProject project, ILanguageImpl language)

Gets include files in given project, for given language.

Parameters:
  • project – Project to get include files relative to.
  • language – Language to get include files for.
Returns:

Identified include files.

includePaths
Iterable<FileObject> includePaths(IProject project, String languageName)

Gets include paths in given project, for given language.

Parameters:
  • project – Project to get include paths relative to.
  • languageName – Name of the language to get include paths for.
Returns:

Include paths.

sourceAndIncludeFiles
Iterable<IdentifiedResource> sourceAndIncludeFiles(IProject project, ILanguageImpl language)

Gets source and include files in given project, for given language.

Parameters:
  • project – Project to get source and include files relative to.
  • language – Language to get source and include files for.
Returns:

Identified source and include files.

sourceAndIncludePaths
Iterable<FileObject> sourceAndIncludePaths(IProject project, String languageName)

Gets source and include paths in given project, for given language.

Parameters:
  • project – Project to get source and include paths relative to.
  • languageName – Name of the language to get source and include paths for.
Returns:

Source and include paths.

sourceFiles
Iterable<IdentifiedResource> sourceFiles(IProject project, ILanguageImpl language)

Gets source files in given project, for given language.

Parameters:
  • project – Project to get source files relative to.
  • language – Language to get source files for.
Returns:

Identified source files.

sourcePaths
Iterable<FileObject> sourcePaths(IProject project, String languageName)

Gets source paths in given project, for given language.

Parameters:
  • project – Project to get source paths relative to.
  • languageName – Name of the language to get source paths for.
Returns:

Source paths.

toFiles
Iterable<IdentifiedResource> toFiles(Iterable<FileObject> paths, ILanguageImpl language)

Gets source/include files given source/include paths.

Parameters:
  • paths – Source and/or include paths to get files for.
  • language – Language to get source and include files for.
Returns:

Identified source and include files.

LanguagePathService

public class LanguagePathService implements ILanguagePathService
Constructors
LanguagePathService
public LanguagePathService(ILanguageIdentifierService languageIdentifierService, Set<ILanguagePathProvider> providers)
Methods
includeFiles
public Iterable<IdentifiedResource> includeFiles(IProject project, ILanguageImpl language)
includePaths
public Set<FileObject> includePaths(IProject project, String languageName)
sourceAndIncludeFiles
public Iterable<IdentifiedResource> sourceAndIncludeFiles(IProject project, ILanguageImpl language)
sourceAndIncludePaths
public Iterable<FileObject> sourceAndIncludePaths(IProject project, String languageName)
sourceFiles
public Iterable<IdentifiedResource> sourceFiles(IProject project, ILanguageImpl language)
sourcePaths
public Set<FileObject> sourcePaths(IProject project, String languageName)
toFiles
public Collection<IdentifiedResource> toFiles(Iterable<FileObject> paths, ILanguageImpl language)

SourcePathProvider

public class SourcePathProvider implements ILanguagePathProvider
Methods
includePaths
public Iterable<FileObject> includePaths(IProject project, String languageName)
sourcePaths
public Iterable<FileObject> sourcePaths(IProject project, String languageName)

org.metaborg.core.completion

Completion

public class Completion implements ICompletion, Serializable
Constructors
Completion
public Completion(String name, String sort, String text, String additionalInfo, int startOffset, int endOffset, CompletionKind kind)
Completion
public Completion(String name, String sort, String text, String additionalInfo, int startOffset, int endOffset, CompletionKind kind, String prefix, String suffix)
Methods
additionalInfo
public String additionalInfo()
endOffset
public int endOffset()
equals
public boolean equals(Object obj)
fromOptionalPlaceholder
public boolean fromOptionalPlaceholder()
hashCode
public int hashCode()
isNested
public boolean isNested()
items
public Iterable<ICompletionItem> items()
kind
public CompletionKind kind()
name
public String name()
prefix
public String prefix()
setItems
public void setItems(Iterable<ICompletionItem> items)
setNested
public void setNested(boolean nested)
setOptionalPlaceholder
public void setOptionalPlaceholder(boolean optional)
sort
public String sort()
startOffset
public int startOffset()
suffix
public String suffix()
text
public String text()
toString
public String toString()

CompletionKind

public enum CompletionKind
Enum Constants
expansion
public static final CompletionKind expansion
expansionEditing
public static final CompletionKind expansionEditing
recovery
public static final CompletionKind recovery

ICompletion

public interface ICompletion extends Serializable
Methods
additionalInfo
String additionalInfo()
endOffset
int endOffset()
equals
boolean equals(Object obj)
fromOptionalPlaceholder
boolean fromOptionalPlaceholder()
hashCode
int hashCode()
isNested
boolean isNested()
items
Iterable<ICompletionItem> items()
kind
CompletionKind kind()
name
String name()

Serializable because it is necessary to pass an object as a String to Eclipse additional info menu

prefix
String prefix()
setItems
void setItems(Iterable<ICompletionItem> items)
setNested
void setNested(boolean nested)
setOptionalPlaceholder
void setOptionalPlaceholder(boolean optional)
sort
String sort()
startOffset
int startOffset()
suffix
String suffix()
text
String text()

ICompletionItem

public interface ICompletionItem extends Serializable

ICompletionService

public interface ICompletionService<P extends IParseUnit>
Methods
get
Iterable<ICompletion> get(int offset, P result, boolean nested)

IPlaceholderCompletionItem

public interface IPlaceholderCompletionItem extends ICompletionItem
Methods
endOffset
int endOffset()
name
String name()
optional
boolean optional()
placeholderText
String placeholderText()
startOffset
int startOffset()

org.metaborg.core.config

AConfig

public class AConfig implements IConfig
Fields
config
protected final HierarchicalConfiguration<ImmutableNode> config
Constructors
AConfig
public AConfig(HierarchicalConfiguration<ImmutableNode> config)
Methods
configurationAt
protected HierarchicalConfiguration<ImmutableNode> configurationAt(String key, boolean supportUpdates)
getConfig
public HierarchicalConfiguration<ImmutableNode> getConfig()

AConfigBuilder

public class AConfigBuilder
Fields
configReaderWriter
protected final AConfigurationReaderWriter configReaderWriter
configuration
protected HierarchicalConfiguration<ImmutableNode> configuration
Constructors
AConfigBuilder
public AConfigBuilder(AConfigurationReaderWriter configReaderWriter)
Methods
cloneConfiguration
protected HierarchicalConfiguration<ImmutableNode> cloneConfiguration(IConfig config)
setConfiguration
void setConfiguration(HierarchicalConfiguration<ImmutableNode> configuration)

AConfigService

public abstract class AConfigService<TSubject, TConfig>

Stores and retrieves configurations using the Configuration class.

Fields
configReaderWriter
protected final AConfigurationReaderWriter configReaderWriter
Constructors
AConfigService
protected AConfigService(AConfigurationReaderWriter configReaderWriter)

Initializes a new instance of the AConfigService class.

Parameters:
  • configReaderWriter – The configuration reader/writer.
Methods
available
public boolean available(FileObject rootDirectory)

Checks if a configuration exists for a subject.

Parameters:
  • rootDirectory – The root directory of the subject to get the configuration for.
Returns:

True if a configuration exists, false otherwise.

fromConfig
protected abstract HierarchicalConfiguration<ImmutableNode> fromConfig(TConfig config)

Creates a new hierarchical configuration for the specified config object.

Parameters:
  • config – The config object.
Returns:

The configuration.

get
public ConfigRequest<TConfig> get(FileObject rootDirectory)

Gets the configuration for the a subject.

Parameters:
  • rootDirectory – The root directory of the subject to get the configuration for.
Returns:

The configuration, or null when no configuration could be retrieved.

getConfigFile
protected FileObject getConfigFile(TSubject subject)

Gets the configuration file for the specified subject.

Parameters:
  • subject – The subject.
Throws:
  • FileSystemException
Returns:

The configuration file.

getConfigFile
protected abstract FileObject getConfigFile(FileObject rootFolder)

Gets the configuration file for the specified subject.

Parameters:
  • rootFolder – The root folder.
Throws:
  • FileSystemException
Returns:

The configuration file.

getFromConfigFile
public ConfigRequest<TConfig> getFromConfigFile(FileObject configFile, FileObject rootFolder)

Gets the configuration from the given file.

Parameters:
  • configFile – The configuration file with the configuration.
Returns:

The configuration, or null when no configuration could be retrieved.

getRootDirectory
protected abstract FileObject getRootDirectory(TSubject subject)

Gets the configuration file for the specified subject.

Parameters:
  • subject – The subject.
Throws:
  • FileSystemException
Returns:

The configuration file.

readConfig
protected HierarchicalConfiguration<ImmutableNode> readConfig(FileObject configFile, FileObject rootDirectory)

Reads a configuration from a file.

Parameters:
  • configFile – The configuration file to read.
Throws:
  • IOException
  • ConfigurationException
Returns:

The read configuration, or null when the configuration could not be read.

toConfig
protected abstract ConfigRequest<TConfig> toConfig(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)

Creates a new instance of the config type for the specified configuration.

Parameters:
  • configuration – The configuration.
write
public void write(TSubject subject, TConfig config, IFileAccess access)

Writes the configuration for the given subject.

Parameters:
  • subject – The subject to set the configuration for.
  • config – The configuration, or null to remove an existing configuration.
  • access
write
public void write(FileObject rootDirectory, TConfig config, IFileAccess access)

Writes the configuration for the given subject.

Parameters:
  • rootDirectory – The root directory of the subject to set the configuration for.
  • config – The configuration, or null to remove an existing configuration.
  • access
writeConfig
protected void writeConfig(FileObject configFile, HierarchicalConfiguration<ImmutableNode> config, FileObject rootDirectory)

Writes a configuration to a file.

Parameters:
  • configFile – The configuration file to write to.
  • config – The configuration to write, or null to delete the configuration file.
  • rootDirectory – The root folder.
Throws:
  • ConfigurationException
  • IOException

AConfigurationReaderWriter

public abstract class AConfigurationReaderWriter

Reads, writes, and creates configurations Apache Commons HierarchicalConfiguration objects.

Methods
create
public JacksonConfiguration create(HierarchicalConfiguration<ImmutableNode> source, FileObject rootFolder)

Creates a configuration object.

Parameters:
  • source – The source configuration; or null.
  • rootFolder – The root folder; or null.
Returns:

The created configuration object.

create
public JacksonConfiguration create()

Creates a configuration object.

Returns:The created configuration object.
createNew
protected abstract JacksonConfiguration createNew(HierarchicalConfiguration<ImmutableNode> sourceConfiguration)

Creates a configuration object.

Parameters:
  • sourceConfiguration – The source configuration; or null.
Returns:

The created configuration object.

read
public HierarchicalConfiguration<ImmutableNode> read(FileObject source, FileObject rootFolder)

Reads a configuration from the specified file.

Parameters:
  • source – The source file.
Returns:

The read configuration.

read
public HierarchicalConfiguration<ImmutableNode> read(InputStream input, FileObject rootFolder)

Reads a configuration from the specified input stream.

Parameters:
  • input – The input stream.
  • rootFolder – The root folder; or null.
Returns:

The read configuration.

read
public HierarchicalConfiguration<ImmutableNode> read(Reader reader, FileObject rootFolder)

Reads a configuration from the specified reader.

Parameters:
  • reader – The reader.
  • rootFolder – The root folder; or null.
Returns:

The read configuration.

write
public void write(HierarchicalConfiguration<ImmutableNode> configuration, FileObject destination, FileObject rootFolder)

Writes a configuration to the specified writer.

Parameters:
  • configuration – The configuration to write.
  • destination – The destination file.
  • rootFolder – The root folder.
write
public void write(HierarchicalConfiguration<ImmutableNode> configuration, OutputStream output, FileObject rootFolder)

Writes a configuration to the specified writer.

Parameters:
  • configuration – The configuration to write.
  • output – The output stream.
  • rootFolder – The root folder; or null.
write
public void write(HierarchicalConfiguration<ImmutableNode> configuration, Writer writer, FileObject rootFolder)

Writes a configuration to the specified writer.

Parameters:
  • configuration – The configuration to write.
  • writer – The writer.
  • rootFolder – The root folder; or null.

AllLangSource

public class AllLangSource implements ISourceConfig, Serializable

Source for all languages. This is for internal use only, it should not be created from a project configuration.

Fields
directory
public final String directory

Source directory, relative to the project root.

Constructors
AllLangSource
public AllLangSource(String directory)
Methods
accept
public void accept(ISourceVisitor visitor)
toString
public String toString()

ConfigException

public class ConfigException extends MetaborgException
Constructors
ConfigException
public ConfigException()
ConfigException
public ConfigException(String message)
ConfigException
public ConfigException(String message, Throwable cause)
ConfigException
public ConfigException(Throwable cause)

ConfigRequest

public class ConfigRequest<T>
Constructors
ConfigRequest
public ConfigRequest()
ConfigRequest
public ConfigRequest(T config)
ConfigRequest
public ConfigRequest(Collection<IMessage> errors)
ConfigRequest
public ConfigRequest(IMessage error)
ConfigRequest
public ConfigRequest(T config, Collection<IMessage> errors)
Methods
config
public T config()
Returns:Configuration if it exists, null if it does not exist or is invalid. May be a partial configuration if it is invalid.
errors
public Iterable<IMessage> errors()
Returns:List of errors if the configuration is invalid, empty list otherwise.
reportErrors
public void reportErrors(IMessagePrinter printer)

Reports errors to given message printer.

Parameters:
  • printer – Message printer to print errors with.
valid
public boolean valid()
Returns:True if configuration is valid, false if not.

GenerateConfig

public class GenerateConfig implements IGenerateConfig
Fields
directory
public final String directory
language
public final String language
Constructors
GenerateConfig
public GenerateConfig(String languageName, String directory)
Methods
directory
public String directory()
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
languageName
public String languageName()
toString
public String toString()

IConfig

public interface IConfig

Interface for configurations that are backed by an ImmutableConfiguration object.

Methods
getConfig
HierarchicalConfiguration<ImmutableNode> getConfig()

Gets the underlying configuration.

Returns:The underlying configuration.

IExportConfig

public interface IExportConfig extends Serializable

Configuration for file exports. Use the visitor pattern access implementations.

Methods
accept
void accept(IExportVisitor visitor)

Accepts an export visitor.

Parameters:
  • visitor – Visitor to accept.

IExportVisitor

public interface IExportVisitor

Visitor for IExportConfigs.

Methods
visit
void visit(LangDirExport resource)

Visit a language-specific resource directory.

Parameters:
  • resource – Language resource directory.
visit
void visit(LangFileExport resource)

Visit a language-specific single-file resource.

Parameters:
  • resource – Language resource file.
visit
void visit(ResourceExport resource)

Visit a generic resource.

Parameters:
  • resource – Generic resource.

IGenerateConfig

public interface IGenerateConfig

Configuration for a language that generates source files in a directory.

Methods
directory
String directory()
Returns:Directory to which source files are generated, relative to a project root.
languageName
String languageName()
Returns:Name of the language for which source files are generated.

ILanguageComponentConfig

public interface ILanguageComponentConfig extends IProjectConfig

Configuration of a language component at runtime. To create a new instance of this interface, use an ILanguageComponentConfigBuilder interface.

Methods
completionsParseTable
String completionsParseTable()

Gets the (relative) path to the completions parse table.

Returns:path to the completions parse table.
exports
Collection<IExportConfig> exports()

Gets the file exports.

Returns:The file exports.
generates
Collection<IGenerateConfig> generates()

Gets the languages for while files are generated.

Returns:The languages for while files are generated.
identifier
LanguageIdentifier identifier()

Gets the language identifier.

Returns:The language identifier.
jsglrVersion
JSGLRVersion jsglrVersion()

Gets the parser version.

Returns:the parser version.
langContribs
Collection<LanguageContributionIdentifier> langContribs()

Gets the language contributions.

Returns:The language contributions.
name
String name()

Gets the name of the language the component belongs to.

Returns:Name of the language the component belongs to.
parseTable
String parseTable()

Gets the (relative) path to the parse table.

Returns:path to the parse table.
sdf2tableVersion
Sdf2tableVersion sdf2tableVersion()

Gets the sdf2table version to use.

Returns:sdf2table version to use.
sdfEnabled
Boolean sdfEnabled()

Gets whether the project depends on SDF or not.

Returns:true if SDF is enabled and false otherwise.

ILanguageComponentConfigBuilder

public interface ILanguageComponentConfigBuilder

Builder for ILanguageComponentConfig objects.

Methods
addCompileDeps
ILanguageComponentConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> deps)

{@see IProjectConfigBuilder#addCompileDeps(Iterable)}

addExports
ILanguageComponentConfigBuilder addExports(Iterable<IExportConfig> exports)

Adds file exports.

Parameters:
  • exports – The file exports.
Returns:

This builder.

addGenerates
ILanguageComponentConfigBuilder addGenerates(Iterable<IGenerateConfig> generates)

Adds languages for while files are generated.

Parameters:
  • generates – The languages for while files are generated.
Returns:

This builder.

addJavaDeps
ILanguageComponentConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)

{@see IProjectConfigBuilder#addSourceDeps(Iterable)}

addLangContribs
ILanguageComponentConfigBuilder addLangContribs(Iterable<LanguageContributionIdentifier> contribs)

Adds language contributions.

Parameters:
  • contribs – The language contributions.
Returns:

This builder.

addSourceDeps
ILanguageComponentConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> deps)

{@see IProjectConfigBuilder#addSourceDeps(Iterable)}

build
ILanguageComponentConfig build(FileObject rootFolder)

Builds the configuration.

Returns:The built configuration.
copyFrom
ILanguageComponentConfigBuilder copyFrom(ILanguageComponentConfig config)

Copies the values from the specified configuration.

Parameters:
  • config – The configuration to copy values from.
reset
ILanguageComponentConfigBuilder reset()

Resets the values of this builder.

Returns:This builder.
withCompileDeps
ILanguageComponentConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> deps)

{@see IProjectConfigBuilder#withCompileDeps(Iterable)}

withExports
ILanguageComponentConfigBuilder withExports(Iterable<IExportConfig> exports)

Sets the file exports.

Parameters:
  • exports – The file exports.
Returns:

This builder.

withGenerates
ILanguageComponentConfigBuilder withGenerates(Iterable<IGenerateConfig> generates)

Sets the languages for while files are generated.

Parameters:
  • generates – The languages for while files are generated.
Returns:

This builder.

withIdentifier
ILanguageComponentConfigBuilder withIdentifier(LanguageIdentifier identifier)

Sets the language identifier.

Parameters:
  • identifier – The language identifier.
Returns:

This builder.

withJSGLRVersion
ILanguageComponentConfigBuilder withJSGLRVersion(JSGLRVersion jsglrVersion)

Sets the JSGLR parser version.

Parameters:
  • jsglrVersion – The JSGLR parser version.
Returns:

This builder.

withJavaDeps
ILanguageComponentConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)

{@see IProjectConfigBuilder#addSourceDeps(Iterable)}

withLangContribs
ILanguageComponentConfigBuilder withLangContribs(Iterable<LanguageContributionIdentifier> contribs)

Sets the language contributions.

Parameters:
  • contribs – The language contributions.
Returns:

This builder.

withMetaborgVersion
ILanguageComponentConfigBuilder withMetaborgVersion(String metaborgVersion)

{@see IProjectConfigBuilder#withMetaborgVersion(String)}

withName
ILanguageComponentConfigBuilder withName(String name)

Sets the language name.

Parameters:
  • name – The language name.
Returns:

This builder.

withSdf2tableVersion
ILanguageComponentConfigBuilder withSdf2tableVersion(Sdf2tableVersion sdf2tableVersion)

Sets the sdf2table version.

Parameters:
  • sdf2tableVersion – The sdf2table version.
Returns:

This builder.

withSdfCompletionsTable
ILanguageComponentConfigBuilder withSdfCompletionsTable(String completionsParseTable)

Sets the completion parse table (relative) path.

Parameters:
  • completionsParseTable – The completion parse table (relative) path.
Returns:

This builder.

withSdfEnabled
ILanguageComponentConfigBuilder withSdfEnabled(Boolean sdfEnabled)

Sets the whether SDF is enabled in the project

Parameters:
  • sdfEnabled – If SDF is enabled or not.
Returns:

This builder.

withSdfTable
ILanguageComponentConfigBuilder withSdfTable(String parseTable)

Sets the parse table (relative) path.

Parameters:
  • parseTable – The parse table (relative) path.
Returns:

This builder.

withSourceDeps
ILanguageComponentConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> deps)

{@see IProjectConfigBuilder#withSourceDeps(Iterable)}

ILanguageComponentConfigService

public interface ILanguageComponentConfigService

Stores and retrieves language component configurations.

Methods
available
boolean available(FileObject rootFolder)

Checks if a configuration exists for the language component at given location.

Parameters:
  • rootFolder – The language component root folder.
Returns:

True if a configuration exists, false otherwise.

get
ConfigRequest<ILanguageComponentConfig> get(FileObject rootFolder)

Gets the configuration for the language component at given location.

Parameters:
  • rootFolder – The language component root folder.
Returns:

Configuration request, either with a valid configuration, or a collection of error messages.

ILanguageComponentConfigWriter

public interface ILanguageComponentConfigWriter

Writes a configuration for the specified ILanguageComponent.

Methods
write
void write(FileObject root, ILanguageComponentConfig config, IFileAccess access)

Writes the specified configuration for the specified language component.

Parameters:
  • root – The language root folder.
  • config – The configuration to write.
  • access

ILanguageImplConfig

public interface ILanguageImplConfig

Configuration of a language component at runtime. Composition of multiple ILanguageComponentConfig configurations.

Methods
compileDeps
Iterable<LanguageIdentifier> compileDeps()

Gets the compile dependencies.

Returns:The compile dependency identifiers.
exports
Iterable<IExportConfig> exports()

Gets the file exports.

Returns:The file exports.
generates
Iterable<IGenerateConfig> generates()

Gets the languages for while files are generated.

Returns:The languages for while files are generated.
javaDeps
Iterable<LanguageIdentifier> javaDeps()

Gets the Java dependencies.

Returns:The Java dependency identifiers.
sourceDeps
Iterable<LanguageIdentifier> sourceDeps()

Gets the source dependencies.

Returns:The source dependency identifiers.

IProjectConfig

public interface IProjectConfig
Methods
compileDeps
Collection<LanguageIdentifier> compileDeps()
Returns:Compile dependency identifiers.
javaDeps
Collection<LanguageIdentifier> javaDeps()
Returns:Java dependency identifiers.
metaborgVersion
String metaborgVersion()
Returns:Version of MetaBorg tooling to use.
sourceDeps
Collection<LanguageIdentifier> sourceDeps()
Returns:Source dependency identifiers.
sources
Collection<ISourceConfig> sources()

Gets the file sources.

Returns:The file sources.

IProjectConfigBuilder

public interface IProjectConfigBuilder

Builder for ILanguageComponentConfig objects.

Methods
addCompileDeps
IProjectConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> deps)

Adds compile dependencies.

Parameters:
  • deps – The compile dependency identifiers.
Returns:

This builder.

addJavaDeps
IProjectConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)

Adds java dependencies.

Parameters:
  • deps – The java dependency identifiers.
Returns:

This builder.

addSourceDeps
IProjectConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> deps)

Adds source dependencies.

Parameters:
  • deps – The source dependency identifiers.
Returns:

This builder.

addSources
IProjectConfigBuilder addSources(Iterable<IExportConfig> sources)

Adds file sources.

Parameters:
  • sources – The file sources.
Returns:

This builder.

build
IProjectConfig build(FileObject rootFolder)

Builds the configuration.

Returns:The built configuration.
copyFrom
IProjectConfigBuilder copyFrom(IProjectConfig config)

Copies the values from the specified configuration.

Parameters:
  • config – The configuration to copy values from.
reset
IProjectConfigBuilder reset()

Resets the values of this builder.

Returns:This builder.
withCompileDeps
IProjectConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> deps)

Sets the compile-time dependencies.

Parameters:
  • deps – The compile-time dependency identifiers.
Returns:

This builder.

withJavaDeps
IProjectConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)

Sets the java dependencies.

Parameters:
  • deps – The java dependency identifiers.
Returns:

This builder.

withMetaborgVersion
IProjectConfigBuilder withMetaborgVersion(String metaborgVersion)

Sets the MetaBorg version.

Parameters:
  • metaborgVersion – The MetaBorg version.
Returns:

This builder.

withSourceDeps
IProjectConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> deps)

Sets the source dependencies.

Parameters:
  • deps – The source dependency identifiers.
Returns:

This builder.

withSources
IProjectConfigBuilder withSources(Iterable<IExportConfig> sources)

Sets the file sources.

Parameters:
  • sources – The file sources.
Returns:

This builder.

IProjectConfigService

public interface IProjectConfigService

Stores and retrieves language component configurations.

Methods
available
boolean available(FileObject rootFolder)

Checks if a configuration exists for the project at the given location.

Parameters:
  • rootFolder – The project root folder.
Returns:

True if a configuration exists, false otherwise.

defaultConfig
IProjectConfig defaultConfig(FileObject rootFolder)

Gets the default configuration for the project at the given location.

Parameters:
  • rootFolder – The project root folder.
Returns:

Default project configuration.

get
ConfigRequest<? extends IProjectConfig> get(FileObject rootFolder)

Gets the configuration for the project at the given location.

Parameters:
  • rootFolder – The project root folder.
Returns:

Configuration request, either with a valid configuration, or a collection of error messages.

IProjectConfigWriter

public interface IProjectConfigWriter

Writes a configuration for an IProject.

Methods
write
void write(IProject project, IProjectConfig config, IFileAccess access)

Writes the specified configuration for the specified project.

Parameters:
  • project – The project.
  • config – The configuration to write.
  • access

ISourceConfig

public interface ISourceConfig
Methods
accept
void accept(ISourceVisitor visitor)

ISourceVisitor

public interface ISourceVisitor
Methods
of
static ISourceVisitor of(Consumer<LangSource> onLangSource, Consumer<AllLangSource> onAllLangSource)
visit
void visit(LangSource langSource)
visit
void visit(AllLangSource allLangSource)

JSGLRVersion

public enum JSGLRVersion
Enum Constants
dataDependent
public static final JSGLRVersion dataDependent
layoutSensitive
public static final JSGLRVersion layoutSensitive
v1
public static final JSGLRVersion v1
v2
public static final JSGLRVersion v2

LangDirExport

public class LangDirExport implements IExportConfig

Language-specific directory export.

Fields
directory
public final String directory

Directory which is exported, relative to the location of the language component that exports sources.

excludes
public final Iterable<String> excludes

Exclude patterns, following the Ant pattern syntax.

See also: Ant patterns

includes
public final Iterable<String> includes

Include patterns, following the Ant pattern syntax.

See also: Ant patterns

language
public final String language

Name of the language for which source files are exported.

Constructors
LangDirExport
public LangDirExport(String languageName, String directory, Iterable<String> includes, Iterable<String> excludes)
Methods
accept
public void accept(IExportVisitor visitor)
toString
public String toString()

LangFileExport

public class LangFileExport implements IExportConfig

Language-specific single-file export.

Fields
file
public final String file

File which is exported, relative to the location of the language component that exports sources.

language
public final String language

Name of the language for which source files are exported.

Constructors
LangFileExport
public LangFileExport(String languageName, String file)
Methods
accept
public void accept(IExportVisitor visitor)
toString
public String toString()

LangSource

public class LangSource implements ISourceConfig, Serializable

Language-specific source.

Fields
directory
public final String directory

File which is exported, relative to the location of the language component that exports sources.

language
public final String language

Name of the language for which source files are exported.

Constructors
LangSource
public LangSource(String languageName, String directory)
Methods
accept
public void accept(ISourceVisitor visitor)
toString
public String toString()

LanguageComponentConfig

public class LanguageComponentConfig extends AConfig implements ILanguageComponentConfig, IConfig

An implementation of the ILanguageComponentConfig interface that is backed by an ImmutableConfiguration object.

Constructors
LanguageComponentConfig
public LanguageComponentConfig(HierarchicalConfiguration<ImmutableNode> config, ProjectConfig projectConfig)
LanguageComponentConfig
protected LanguageComponentConfig(HierarchicalConfiguration<ImmutableNode> config, ProjectConfig projectConfig, LanguageIdentifier identifier, String name, Boolean sdfEnabled, String parseTable, String completionParseTable, Sdf2tableVersion sdf2tableVersion, Boolean dataDependent, JSGLRVersion jsglrVersion, Collection<LanguageContributionIdentifier> langContribs, Collection<IGenerateConfig> generates, Collection<IExportConfig> exports)
Methods
compileDeps
public Collection<LanguageIdentifier> compileDeps()
completionsParseTable
public String completionsParseTable()
exports
public Collection<IExportConfig> exports()
generates
public Collection<IGenerateConfig> generates()
getConfig
public HierarchicalConfiguration<ImmutableNode> getConfig()
identifier
public LanguageIdentifier identifier()
javaDeps
public Collection<LanguageIdentifier> javaDeps()
jsglrVersion
public JSGLRVersion jsglrVersion()
langContribs
public Collection<LanguageContributionIdentifier> langContribs()
metaborgVersion
public String metaborgVersion()
name
public String name()
parseTable
public String parseTable()
sdf2tableVersion
public Sdf2tableVersion sdf2tableVersion()
sdfEnabled
public Boolean sdfEnabled()
sourceDeps
public Collection<LanguageIdentifier> sourceDeps()
sources
public Collection<ISourceConfig> sources()
validate
public Collection<IMessage> validate(MessageBuilder mb)

LanguageComponentConfigBuilder

public class LanguageComponentConfigBuilder extends AConfigBuilder implements ILanguageComponentConfigBuilder

Configuration-based builder for ILanguageComponentConfig objects.

Fields
completionsParseTable
protected String completionsParseTable
dataDependent
protected Boolean dataDependent
exports
protected List<IExportConfig> exports
generates
protected List<IGenerateConfig> generates
identifier
protected LanguageIdentifier identifier
jsglrVersion
protected JSGLRVersion jsglrVersion
langContribs
protected Set<LanguageContributionIdentifier> langContribs
name
protected String name
parseTable
protected String parseTable
projectConfigBuilder
protected final ProjectConfigBuilder projectConfigBuilder
sdf2tableVersion
protected Sdf2tableVersion sdf2tableVersion
sdfEnabled
protected Boolean sdfEnabled
Constructors
LanguageComponentConfigBuilder
public LanguageComponentConfigBuilder(AConfigurationReaderWriter configReaderWriter)
Methods
addCompileDeps
public ILanguageComponentConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> deps)
addExports
public ILanguageComponentConfigBuilder addExports(Iterable<IExportConfig> exports)
addGenerates
public ILanguageComponentConfigBuilder addGenerates(Iterable<IGenerateConfig> generates)
addJavaDeps
public ILanguageComponentConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)
addLangContribs
public ILanguageComponentConfigBuilder addLangContribs(Iterable<LanguageContributionIdentifier> contribs)
addSourceDeps
public ILanguageComponentConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> deps)
build
public ILanguageComponentConfig build(FileObject rootFolder)
withCompileDeps
public ILanguageComponentConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> deps)
withExports
public ILanguageComponentConfigBuilder withExports(Iterable<IExportConfig> exports)
withGenerates
public ILanguageComponentConfigBuilder withGenerates(Iterable<IGenerateConfig> generates)
withIdentifier
public ILanguageComponentConfigBuilder withIdentifier(LanguageIdentifier identifier)
withJSGLRVersion
public ILanguageComponentConfigBuilder withJSGLRVersion(JSGLRVersion jsglrVersion)
withJavaDeps
public ILanguageComponentConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)
withLangContribs
public ILanguageComponentConfigBuilder withLangContribs(Iterable<LanguageContributionIdentifier> contribs)
withMetaborgVersion
public ILanguageComponentConfigBuilder withMetaborgVersion(String metaborgVersion)
withName
public ILanguageComponentConfigBuilder withName(String name)
withSdf2tableVersion
public ILanguageComponentConfigBuilder withSdf2tableVersion(Sdf2tableVersion sdf2tableVersion)
withSdfCompletionsTable
public ILanguageComponentConfigBuilder withSdfCompletionsTable(String completionsTable)
withSdfEnabled
public ILanguageComponentConfigBuilder withSdfEnabled(Boolean sdfEnabled)
withSdfTable
public ILanguageComponentConfigBuilder withSdfTable(String table)
withSourceDeps
public ILanguageComponentConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> deps)

LanguageComponentConfigService

public class LanguageComponentConfigService extends AConfigService<ILanguageComponent, ILanguageComponentConfig> implements ILanguageComponentConfigService, ILanguageComponentConfigWriter
Constructors
LanguageComponentConfigService
public LanguageComponentConfigService(AConfigurationReaderWriter configReaderWriter, LanguageComponentConfigBuilder configBuilder)
Methods
fromConfig
protected HierarchicalConfiguration<ImmutableNode> fromConfig(ILanguageComponentConfig config)
getConfigFile
protected FileObject getConfigFile(FileObject rootFolder)
getRootDirectory
protected FileObject getRootDirectory(ILanguageComponent languageComponent)
toConfig
protected ConfigRequest<ILanguageComponentConfig> toConfig(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)

LanguageIdentifierDeserializer

public class LanguageIdentifierDeserializer extends StdDeserializer<LanguageIdentifier>
Constructors
LanguageIdentifierDeserializer
public LanguageIdentifierDeserializer()
Methods
deserialize
public LanguageIdentifier deserialize(JsonParser parser, DeserializationContext context)

LanguageIdentifierSerializer

public class LanguageIdentifierSerializer extends StdSerializer<LanguageIdentifier>
Constructors
LanguageIdentifierSerializer
public LanguageIdentifierSerializer()
Methods
serialize
public void serialize(LanguageIdentifier value, JsonGenerator generator, SerializerProvider provider)

LanguageImplConfig

public class LanguageImplConfig implements ILanguageImplConfig
Constructors
LanguageImplConfig
public LanguageImplConfig(Iterable<ILanguageComponentConfig> configs)
Methods
compileDeps
public Iterable<LanguageIdentifier> compileDeps()
exports
public Iterable<IExportConfig> exports()
generates
public Iterable<IGenerateConfig> generates()
javaDeps
public Iterable<LanguageIdentifier> javaDeps()
sourceDeps
public Iterable<LanguageIdentifier> sourceDeps()

MetaborgConversionHandler

class MetaborgConversionHandler extends DefaultConversionHandler

Converts Metaborg Core types to and from their Configuration representations.

Methods
convertValue
protected <T> T convertValue(Object src, Class<T> target, ConfigurationInterpolator interp)

PathLookup

public final class PathLookup implements Lookup

Provides path information for configurations.

Constructors
PathLookup
public PathLookup(FileObject rootFolder)
Methods
lookup
public Object lookup(String s)

ProjectConfig

public class ProjectConfig extends AConfig implements IProjectConfig, IConfig

An implementation of the ILanguageComponentConfig interface that is backed by an ImmutableConfiguration object.

Constructors
ProjectConfig
public ProjectConfig(HierarchicalConfiguration<ImmutableNode> config)
ProjectConfig
protected ProjectConfig(HierarchicalConfiguration<ImmutableNode> config, String metaborgVersion, Collection<IExportConfig> sources, Collection<LanguageIdentifier> compileDeps, Collection<LanguageIdentifier> sourceDeps, Collection<LanguageIdentifier> javaDeps)
Methods
compileDeps
public Collection<LanguageIdentifier> compileDeps()
javaDeps
public Collection<LanguageIdentifier> javaDeps()
metaborgVersion
public String metaborgVersion()
sourceDeps
public Collection<LanguageIdentifier> sourceDeps()
sources
public Collection<ISourceConfig> sources()
validate
public Collection<IMessage> validate(MessageBuilder mb)

ProjectConfigBuilder

public class ProjectConfigBuilder extends AConfigBuilder implements IProjectConfigBuilder

Configuration-based builder for ILanguageComponentConfig objects.

Fields
compileDeps
protected Set<LanguageIdentifier> compileDeps
javaDeps
protected Set<LanguageIdentifier> javaDeps
metaborgVersion
protected String metaborgVersion
sourceDeps
protected Set<LanguageIdentifier> sourceDeps
sources
protected List<IExportConfig> sources
Constructors
ProjectConfigBuilder
public ProjectConfigBuilder(AConfigurationReaderWriter configReaderWriter)
Methods
addCompileDeps
public IProjectConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> deps)
addJavaDeps
public IProjectConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)
addSourceDeps
public IProjectConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> deps)
addSources
public IProjectConfigBuilder addSources(Iterable<IExportConfig> sources)
build
public IProjectConfig build(FileObject rootFolder)
build
public ProjectConfig build(HierarchicalConfiguration<ImmutableNode> configuration)
copyFrom
public IProjectConfigBuilder copyFrom(IProjectConfig config)
copyValuesFrom
protected void copyValuesFrom(IProjectConfig config)
reset
public IProjectConfigBuilder reset()
withCompileDeps
public IProjectConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> deps)
withJavaDeps
public IProjectConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)
withMetaborgVersion
public IProjectConfigBuilder withMetaborgVersion(String metaborgVersion)
withSourceDeps
public IProjectConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> deps)
withSources
public IProjectConfigBuilder withSources(Iterable<IExportConfig> sources)

ProjectConfigService

public class ProjectConfigService extends AConfigService<IProject, IProjectConfig> implements IProjectConfigService, IProjectConfigWriter
Constructors
ProjectConfigService
public ProjectConfigService(AConfigurationReaderWriter configReaderWriter, ProjectConfigBuilder configBuilder)
Methods
defaultConfig
public IProjectConfig defaultConfig(FileObject rootFolder)
fromConfig
protected HierarchicalConfiguration<ImmutableNode> fromConfig(IProjectConfig config)
getConfigFile
protected FileObject getConfigFile(FileObject rootFolder)
getRootDirectory
protected FileObject getRootDirectory(IProject project)
toConfig
protected ConfigRequest<IProjectConfig> toConfig(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)

ResourceExport

public class ResourceExport implements IExportConfig

Generic resource export.

Fields
directory
public final String directory

Directory which is exported, relative to the location of the language component that exports sources.

excludes
public final Iterable<String> excludes

Exclude patterns, following the Ant pattern syntax.

See also: Ant patterns

includes
public final Iterable<String> includes

Include patterns, following the Ant pattern syntax.

See also: Ant patterns

Constructors
ResourceExport
public ResourceExport(String directory, Iterable<String> includes, Iterable<String> excludes)
Methods
accept
public void accept(IExportVisitor visitor)
toString
public String toString()

Sdf2tableVersion

public enum Sdf2tableVersion
Enum Constants
c
public static final Sdf2tableVersion c
dynamic
public static final Sdf2tableVersion dynamic
incremental
public static final Sdf2tableVersion incremental
java
public static final Sdf2tableVersion java

YamlConfiguration

public class YamlConfiguration extends JacksonConfiguration

Configuration that uses YAML files.

Constructors
YamlConfiguration
public YamlConfiguration()

Initializes a new instance of the YamlConfiguration class.

YamlConfiguration
public YamlConfiguration(HierarchicalConfiguration<ImmutableNode> config)

Initializes a new instance of the YamlConfiguration class.

Parameters:
  • config – The configuration whose nodes to copy.

YamlConfigurationReaderWriter

public class YamlConfigurationReaderWriter extends AConfigurationReaderWriter

Reads/writes configurations in YAML files.

Methods
createNew
protected JacksonConfiguration createNew(HierarchicalConfiguration<ImmutableNode> sourceConfiguration)

org.metaborg.core.context

ContextException

public class ContextException extends MetaborgException
Fields
language
public final ILanguageImpl language
resource
public final FileObject resource
Constructors
ContextException
public ContextException(FileObject resource, ILanguageImpl language)
ContextException
public ContextException(FileObject resource, ILanguageImpl language, String message)
ContextException
public ContextException(FileObject resource, ILanguageImpl language, String message, Throwable cause)
ContextException
public ContextException(FileObject resource, ILanguageImpl language, Throwable cause)

ContextFacet

public class ContextFacet implements IFacet
Fields
factory
public final IContextFactory factory
strategy
public final IContextStrategy strategy
Constructors
ContextFacet
public ContextFacet(IContextFactory factory, IContextStrategy strategy)

ContextIdentifier

public class ContextIdentifier
Fields
language
public final ILanguageImpl language
location
public final FileObject location
project
public final IProject project
Constructors
ContextIdentifier
public ContextIdentifier(FileObject resource, IProject project, ILanguageImpl language)
Parameters:
  • resource – The resource.
  • project – The project to which the resource belongs.
  • language
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

ContextService

public class ContextService implements IContextService, IContextProcessor
Methods
available
public boolean available(ILanguageImpl language)
get
public IContext get(FileObject resource, IProject project, ILanguageImpl language)
getTemporary
public ITemporaryContext getTemporary(FileObject resource, IProject project, ILanguageImpl language)
unload
public void unload(IContext context)
update
public void update(LanguageImplChange change)

ContextUtils

public class ContextUtils
Methods
getAll
public static Set<IContext> getAll(Iterable<FileObject> resources, IProject project, ILanguageIdentifierService languageIdentifier, IContextService contextService)

Gets a set of all contexts for given resources.

Parameters:
  • resources – Resources to get contexts for.
  • project – The project the resources belong to.
  • languageIdentifier – Language identifier service.
  • contextService – Context service.
Returns:

Set of all contexts.

IContext

public interface IContext

Interface for a context in which analysis or transformations occurs. Implementors must override hashCode() and equals(Object) using location() and language(), and also implement IContextInternal.

Methods
equals
boolean equals(Object other)
hashCode
int hashCode()
injector
Injector injector()
Returns:Injector to retrieve implementations.
language
ILanguageImpl language()
Returns:Language of this context.
location
FileObject location()
Returns:Location of this context.
persist
void persist()

Persist context data from memory to permanent storing. Acquires a read lock. Can be called while holding the write lock.

Throws:
  • IOException – When persisting fails unexpectedly.
project
IProject project()
Returns:The project that contains the transformed resource.
read
IClosableLock read()

Request read access to this context.

Returns:Closable lock which must be held during reading. Close the lock when done.
reset
void reset()

Resets the state of this context. Acquires a write lock. Cannot be called while holding the read lock.

Throws:
  • IOException – When resetting fails unexpectedly
write
IClosableLock write()

Request write access to this context.

Returns:Closable lock which must be held during writing. Close the lock when done.

IContextFactory

public interface IContextFactory

Interface for creating IContext instances.

Methods
create
IContextInternal create(ContextIdentifier identifier)

Creates a new context from given identifier. A fast operation, expensive initialization is performed later.

Parameters:
  • identifier – Identifier to create the context with.
Returns:

Created context.

createTemporary
ITemporaryContextInternal createTemporary(ContextIdentifier identifier)

Creates a new temporary context from given identifier. A fast operation, expensive initialization is performed in IContextInternal.init().

Parameters:
  • identifier – Identifier to create the temporary context with.
Returns:

Created context.

IContextInternal

public interface IContextInternal extends IContext

Extension of IContext with methods that should not be exposed to clients.

Methods
identifier
ContextIdentifier identifier()
Returns:Identifier of this context.
init
void init()

Initializes the context if it has not been initialized yet. Will not load anything from disk.Acquires a write lock. Cannot be called while holding the read lock.

load
void load()

Initializes and loads the context if it has not been initialized or loaded yet.Acquires a write lock. Cannot be called while holding the read lock.

unload
void unload()

Unloads the context, removing it from memory. Acquires a write lock. Cannot be called while holding the read lock.

IContextProcessor

public interface IContextProcessor
Methods
update
void update(LanguageImplChange change)

Updates contexts using a language implementation change.

Parameters:
  • change – Language change to process.

IContextService

public interface IContextService

Interface for retrieving or creating IContext instances.

Methods
available
boolean available(ILanguageImpl language)

Checks if contexts are available for given language implementation.

Parameters:
  • language – Language implementation to check.
Returns:

True if contexts are available, false if not.

get
IContext get(FileObject resource, IProject project, ILanguageImpl language)

Retrieves or creates a context for given resource and language.

Parameters:
  • resource – Resource to get a context for.
  • project – The project the resource belongs to.
  • language – Language to get a context for.
Throws:
Returns:

Existing or created context.

getTemporary
ITemporaryContext getTemporary(FileObject resource, IProject project, ILanguageImpl language)

Creates a temporary context for given resource and language. Temporary contexts are not thread-safe, and must be closed after usage. Supports the try-with-resources statement for closing the temporary context.

Parameters:
  • resource – Resource to get a context for.
  • project – The project the resource belongs to.
  • language – Language to get a context for.
Throws:
Returns:

Temporary context.

unload
void unload(IContext context)

Unloads given context, persisting it to disk (if supported by the context) and removing it from memory.

Parameters:
  • context – Context to unload.

IContextStrategy

public interface IContextStrategy

Interface for IContext creation/retrieval strategies.

Methods
get
ContextIdentifier get(FileObject resource, IProject project, ILanguageImpl language)

Returns the context identifier for given resource and language.

Parameters:
  • resource – Resource to get a context identifier for.
  • project – Project to which the resource belongs.
  • language – Language to get a context identifier for.
Throws:
Returns:

Context identifier.

ITemporaryContext

public interface ITemporaryContext extends IContext, AutoCloseable

IContext for temporary use. Is not thread-safe. Has to be closed after usage.

Methods
close
void close()

Close the context, releasing any state.

ITemporaryContextInternal

public interface ITemporaryContextInternal extends IContextInternal, ITemporaryContext

Extension of ITemporaryContext with IContextInternal that should not be exposed to clients.

ProjectContextStrategy

public class ProjectContextStrategy implements IContextStrategy
Fields
name
public static final String name
Methods
get
public ContextIdentifier get(FileObject resource, IProject project, ILanguageImpl language)

ResourceContextStrategy

public class ResourceContextStrategy implements IContextStrategy
Fields
name
public static final String name
Methods
get
public ContextIdentifier get(FileObject resource, IProject project, ILanguageImpl language)

org.metaborg.core.editor

DummyEditorRegistry

public class DummyEditorRegistry implements IEditorRegistry

Dummy editor registry that gets bound by default, to display sane warnings when nothing else is bound to IEditorRegistry. Replace with working implementation or bind NullEditorRegistry to disable the warning.

Methods
open
public void open(FileObject resource, IProject project)
open
public void open(Iterable<FileObject> resources, IProject project)
openEditors
public Iterable<IEditor> openEditors()

IEditor

public interface IEditor

Interface for an editor in an IDE.

Methods
disable
void disable()

Disables parsing, analysis, and implementation-specific services. Does nothing if editor has not been initialized, or if it has been disposed, or if the editor is already disabled.

enable
void enable()

Enables parsing, analysis, and implementation-specific services. Does nothing if editor has not been initialized, or if it has been disposed, or if the editor is already enabled.

enabled
boolean enabled()
Returns:If this editor is enabled.
forceUpdate
void forceUpdate()

Force a parser, analysis, and implementation-specific update. Does nothing if editor has not been initialized, or if it has been disposed.

language
ILanguageImpl language()
Returns:Language of the current input resource. Null if the editor has not been initialized yet, if it has been disposed, or if the editor was opened before languages were loaded.
reconfigure
void reconfigure()

Reconfigure the editor, updates its language and performs any implementation-specific reconfiguration. Does nothing if editor has not been initialized, or if it has been disposed.

resource
FileObject resource()
Returns:Current resource. Null if the editor has not been initialized yet, or if it has been disposed.

IEditorRegistry

public interface IEditorRegistry
Methods
open
void open(FileObject resource, IProject project)

Open an editor for given resource.

Parameters:
  • resource – Resource to open editor for.
  • project – The project that contains the resource.
open
void open(Iterable<FileObject> resources, IProject project)

Open editors for the given resources.

Parameters:
  • resources – Resources to open editor for.
  • project – The project that contains the resource.
openEditors
Iterable<IEditor> openEditors()
Returns:All open editors.

NullEditorRegistry

public class NullEditorRegistry implements IEditorRegistry

Editor registry that always returns an empty iterable.

Methods
open
public void open(FileObject resource, IProject project)
open
public void open(Iterable<FileObject> resources, IProject project)
openEditors
public Iterable<IEditor> openEditors()

org.metaborg.core.language

AllLanguagesFileSelector

public class AllLanguagesFileSelector implements FileSelector
Constructors
AllLanguagesFileSelector
public AllLanguagesFileSelector(ILanguageIdentifierService languageIdentifierService)
Methods
includeFile
public boolean includeFile(FileSelectInfo fileInfo)
traverseDescendents
public boolean traverseDescendents(FileSelectInfo fileInfo)

ComponentCreationConfig

public class ComponentCreationConfig
Fields
config
public final ILanguageComponentConfig config
facets
protected final Collection<IFacet> facets
identifier
public final LanguageIdentifier identifier
implIds
public final Iterable<LanguageContributionIdentifier> implIds
location
public final FileObject location
Constructors
ComponentCreationConfig
public ComponentCreationConfig(LanguageIdentifier identifier, FileObject location, Iterable<LanguageContributionIdentifier> implIds, ILanguageComponentConfig config)
Methods
addFacet
public void addFacet(IFacet facet)

DescriptionFacet

public class DescriptionFacet implements IFacet

Represents a facet that provides basic information about a language

Fields
description
public final String description

Description of the language.

url
public final String url

Website URL of the language, or null if none.

Constructors
DescriptionFacet
public DescriptionFacet(String description, String url)

Creates an ‘about’ facet from a description and URL.

Parameters:
  • description – Description of the language.
  • url – Website URL of the language, or null if none.

FacetContribution

public class FacetContribution<T extends IFacet>
Fields
contributor
public final ILanguageComponent contributor
facet
public final T facet
Constructors
FacetContribution
public FacetContribution(T facet, ILanguageComponent contributor)

IComponentCreationConfigRequest

public interface IComponentCreationConfigRequest extends ILanguageDiscoveryRequest

Request for creating a ComponentCreationConfig.

Methods
available
boolean available()

See also: .valid()

config
ILanguageComponentConfig config()
Returns:Language component configuration; or null when not available.
errors
Collection<String> errors()

Gets the errors produced during the creation of this request. The resulting collection is empty when valid() is true.

Returns:Produced error messages.
exceptions
Collection<Throwable> exceptions()

Gets the exceptions thrown during the creation of this request. The resulting collection is empty when valid() is true.

Returns:Thrown exceptions.
location
FileObject location()
Returns:Location of the request.
valid
boolean valid()

Gets whether a language component can be constructed from this request. A request is valid when all required files exist, such as the parse table and JAR files, and all configuration files are valid.

Returns:true when a request is valid, false otherwise.

IFacet

public interface IFacet

Interface that represents a facet of a language.

IFacetContributions

public interface IFacetContributions

Interface representing language facet contributions. Facets are retrieved by type, multiple facets of the same type are allowed. Clients determine how multiple facets of the same type are handled.

Methods
facet
<T extends IFacet> T facet(Class<T> type)

Returns a facet of given type.

Parameters:
  • type – Facet type.
Throws:
Returns:

Facet of given type, or null if there is no facet of given type.

facetContribution
<T extends IFacet> FacetContribution<T> facetContribution(Class<T> type)

Returns a facet contribution of given type.

Parameters:
  • type – Facet type.
Throws:
Returns:

Facet contribution of given type.

facetContributions
<T extends IFacet> Iterable<FacetContribution<T>> facetContributions(Class<T> type)

Returns facet contributions of given type.

Parameters:
  • type – Facet type
Returns:

Facet contributions of given type.

facetContributions
Iterable<FacetContribution<IFacet>> facetContributions()
Returns:All facet contributions.
facets
<T extends IFacet> Iterable<T> facets(Class<T> type)

Returns facets of given type.

Parameters:
  • type – Facet type
Returns:

Facets of given type.

facets
Iterable<IFacet> facets()
Returns:All facets.
hasFacet
boolean hasFacet(Class<? extends IFacet> type)

Checks if there is at least one facet of given type.

Parameters:
  • type – Facet type.
Returns:

True if at least one facet of given type exists, false otherwise.

ILanguage

public interface ILanguage

Interface that represents a language. A language has multiple implementations.

Methods
activeImpl
ILanguageImpl activeImpl()
Returns:Active language implementation for this language. A language implementation is active when it has a higher version number than other language implementations. When there are multiple implementations with the highest version number, the one that was added last wins. Returns null when #impls() returns an empty iterable, which only happens if this language has been removed from the language service.
impls
Iterable<? extends ILanguageImpl> impls()
Returns:All language implementations that belong to this language.
name
String name()
Returns:Name of this language.

ILanguageCache

public interface ILanguageCache

Interface for services that cache language resources, to support invalidation of those caches when the language is removed or reloaded. Add Guice bindings to this interface for classes that implement it.

Methods
invalidateCache
void invalidateCache(ILanguageComponent component)

Invalidate the cache for given language component.

Parameters:
  • component – Component to invalidate the cache for.
invalidateCache
void invalidateCache(ILanguageImpl impl)

Invalidate the cache for given language implementation.

Parameters:
  • impl – Implementation to invalidate the cache for.

ILanguageComponent

public interface ILanguageComponent extends IFacetContributions

Interface that represents a language component. A language component contributes facets to language implementations. Facet operations only return facets of this component.

Methods
config
ILanguageComponentConfig config()
Returns:Configuration of this component.
contributesTo
Iterable<? extends ILanguageImpl> contributesTo()
Returns:All language implementations that this component contributes to.
id
LanguageIdentifier id()
Returns:Identifier of this component.
location
FileObject location()
Returns:Location of this component.
sequenceId
int sequenceId()
Returns:Sequence identifier of this component. Used to find out if a component was created after or before another component.

ILanguageComponentFactory

public interface ILanguageComponentFactory

Interface for creating ComponentCreationConfigs which are used to load language components into a ILanguageService.

Methods
createConfig
ComponentCreationConfig createConfig(IComponentCreationConfigRequest request)

Creates a language component configuration from a valid request.

Parameters:
  • request – Request to create a component configuration for.
Throws:
  • MetaborgException – When request is not valid, or when there are further configuration issues in the request.
Returns:

A language component configuration which is passed to ILanguageService.add(ComponentCreationConfig) to load the component.

createConfigs
Collection<ComponentCreationConfig> createConfigs(Iterable<IComponentCreationConfigRequest> requests)

Creates language component configurations from valid requests.

Parameters:
  • requests – Requests to create component configurations for.
Throws:
  • MetaborgException – When a request is not valid, or when there are further configuration issues in a request.
Returns:

Language component configurations which are passed to ILanguageService.add(ComponentCreationConfig) to load the component.

requestAllInDirectory
Collection<IComponentCreationConfigRequest> requestAllInDirectory(FileObject directory)

Creates component creation configuration requests by scanning given directory and all descendants for compiled language components.

Parameters:
  • directory – Directory to start scanning for compiled language components.
Throws:
  • MetaborgException – When directory is not a directory, does not exist; or when an unexpected I/O error occurs.
Returns:

Requests which can be checked for validity. Pass valid requests to createConfig(IComponentCreationConfigRequest) to create a language component configuration.

requestFromArchive
IComponentCreationConfigRequest requestFromArchive(FileObject archiveFile)

Create a component creation configuration request from a ZIP archive file that contains a compiled language component.

Parameters:
  • archiveFile – ZIP archive file that contains the compiled language component.
Throws:
  • MetaborgException – When archiveFile is not a file, does not exist, or does not contain a compiled language component; or when an unexpected I/O error occurs.
Returns:

Request which can be checked for validity. Pass valid requests to createConfig(IComponentCreationConfigRequest) to create a language component configuration.

requestFromDirectory
IComponentCreationConfigRequest requestFromDirectory(FileObject directory)

Create a component creation configuration request from a directory that contains a compiled language component.

Parameters:
  • directory – Directory that contains the compiled language component.
Throws:
  • MetaborgException – When directory is not a directory, does not exist, or does not contain a compiled language component; or when an unexpected I/O error occurs.
Returns:

Request which can be checked for validity. Pass valid requests to createConfig(IComponentCreationConfigRequest) to create a language component configuration.

ILanguageComponentInternal

public interface ILanguageComponentInternal extends ILanguageComponent
Methods
clearContributions
void clearContributions()

Removes all contributing implementations from this component.

contributesToInternal
Iterable<? extends ILanguageImplInternal> contributesToInternal()
Returns:All language implementations that this component contributes to.

ILanguageDiscoveryRequest

public interface ILanguageDiscoveryRequest

Request for language discovery.

Methods
available
boolean available()

See also: .valid()

config
ILanguageComponentConfig config()

Gets the configuration of the language.

Returns:The configuration; or null when not available.
errors
Collection<String> errors()

Gets the errors produced during the creation of this request. The resulting collection is empty when valid() is true.

Returns:The produced error messages.
exceptions
Collection<Throwable> exceptions()

Gets the exceptions thrown during the creation of this request. The resulting collection is empty when valid() is true.

Returns:The thrown exceptions.
location
FileObject location()

Gets the location of the request.

Returns:The location of the request.
valid
boolean valid()

Gets whether the language component is available. A language component is available when all required files exist, such as the parse table and JAR files, and all configuration files are valid.

Returns:true when a request is available; otherwise, false.

ILanguageDiscoveryService

public interface ILanguageDiscoveryService

Interface for a language discovery service that finds and loads language components and implementations.

Methods
componentFromArchive
ILanguageComponent componentFromArchive(FileObject archiveFile)

Load a language component from a ZIP archive file that contains a compiled language component.

Parameters:
  • archiveFile – ZIP archive file that contains the compiled language component.
Throws:
Returns:

Loaded language component.

componentFromDirectory
ILanguageComponent componentFromDirectory(FileObject directory)

Load a language component from a directory that contains a compiled language component.

Parameters:
  • directory – Directory that contains the compiled language component.
Throws:
Returns:

Loaded language component.

discover
ILanguageComponent discover(ILanguageDiscoveryRequest request)

Discover language component with given request.

Parameters:
Throws:
Returns:

Language components that were created.

discover
Iterable<ILanguageComponent> discover(Iterable<ILanguageDiscoveryRequest> requests)

Discover all language components with the given requests.

Parameters:
Throws:
Returns:

Language components that were created.

languageFromArchive
ILanguageImpl languageFromArchive(FileObject archiveFile)

Load a language implementation from a ZIP archive file that contains a compiled language component.

Parameters:
  • archiveFile – ZIP archive file that contains the compiled language component.
Throws:
  • MetaborgException – When loading the language component fails, or when more than one language implementation is loaded.
Returns:

Loaded language implementation.

languageFromDirectory
ILanguageImpl languageFromDirectory(FileObject directory)

Load a language implementation from a directory that contains a compiled language component.

Parameters:
  • directory – Directory that contains the compiled language component.
Throws:
  • MetaborgException – When loading the language component fails, or when more than one language implementation is loaded.
Returns:

Loaded language implementation.

languagesFromArchive
Set<ILanguageImpl> languagesFromArchive(FileObject archiveFile)

Load language implementations from a ZIP archive file that contains a compiled language component.

Parameters:
  • archiveFile – ZIP archive file that contains the compiled language component.
Throws:
Returns:

Loaded language implementations.

languagesFromDirectory
Set<ILanguageImpl> languagesFromDirectory(FileObject directory)

Load language implementations from a directory that contains a compiled language component.

Parameters:
  • directory – Directory that contains the compiled language component.
Throws:
Returns:

Loaded language implementations.

request
Iterable<ILanguageDiscoveryRequest> request(FileObject location)

Request language discovery at given location. Returns language discovery requests which can be checked for availability and errors. Pass requests to discover(ILanguageDiscoveryRequest) to actually load the components.

Parameters:
  • location – The directory to search in.
Throws:
Returns:

Language discovery requests. Empty when no components can be discovered.

scanComponentsInDirectory
Set<ILanguageComponent> scanComponentsInDirectory(FileObject directory)

Scans given directory and all descendants for language components and loads them all.

Parameters:
  • directory – Directory to start scanning for language components.
Throws:
  • MetaborgException – When directory is not a directory or does not exist, when loading a language component fails, or when an unexpected I/O error occurs.
Returns:

Loaded language components.

scanLanguagesInDirectory
Set<ILanguageImpl> scanLanguagesInDirectory(FileObject directory)

Scans given directory and all descendants for language components and loads them all.

Parameters:
  • directory – Directory to start scanning for language components.
Throws:
  • MetaborgException – When directory is not a directory or does not exist, when loading a language component fails, or when an unexpected I/O error occurs.
Returns:

Loaded language implementations.

ILanguageIdentifierService

public interface ILanguageIdentifierService

Interface for identifying the language of a resource.

Methods
available
boolean available(ILanguageImpl impl)

Returns if language identification is available for given implementation.

Parameters:
  • impl – Language implementation to check.
Returns:

True if identification is available, false if not.

identify
boolean identify(FileObject resource, ILanguageImpl language)

Checks if given resource is of given language.

Parameters:
  • resource – Resource to check.
  • language – Language to check against.
Returns:

True if resource is of given language, false otherwise.

identify
ILanguageImpl identify(FileObject resource)

Attempts to identify the active language of given resource.

Parameters:
  • resource – Resource to identify.
Throws:
Returns:

Identified language, or null if language could not be identified.

identify
ILanguageImpl identify(FileObject resource, IProject project)

Attempts to identify the active language of given resource.

Parameters:
  • resource – Resource to identify.
  • project – The projectto which the resource belongs; or null if not known.
Throws:
Returns:

Identified language, or null if language could not be identified.

identify
ILanguageImpl identify(FileObject resource, Iterable<? extends ILanguageImpl> languages)

Attempts to identify the language of given resource, among given list of languages.

Parameters:
  • resource – Resource to identify.
Throws:
Returns:

Identified language, or null if language could not be identified.

identifyToResource
IdentifiedResource identifyToResource(FileObject resource)

Attempts to identify the active language of given resource, and return an identified resource.

Parameters:
  • resource – Resource to identify.
Throws:
Returns:

Identified resource, or null if language could not be identified.

identifyToResource
IdentifiedResource identifyToResource(FileObject resource, IProject project)

Attempts to identify the active language of given resource, and return an identified resource.

Parameters:
  • resource – Resource to identify.
  • project – The project to which the resource belongs; or null if not known.
Throws:
Returns:

Identified resource, or null if language could not be identified.

identifyToResource
IdentifiedResource identifyToResource(FileObject resource, Iterable<? extends ILanguageImpl> languages)

Attempts to identify the language of given resource, among given list of languages, and return an identified resource.

Parameters:
  • resource – Resource to identify.
Throws:
Returns:

Identified resource, or null if language could not be identified.

ILanguageImpl

public interface ILanguageImpl extends IFacetContributions

Interface that represents a language implementation. A language implementation is a view over all components that contribute to the implementation. An implementation belongs to a language. Facet operations return facets from all components.

Methods
belongsTo
ILanguage belongsTo()
Returns:Language this implementation belongs to.
components
Iterable<ILanguageComponent> components()
Returns:All components that contribute to this implementation.
config
ILanguageImplConfig config()
Returns:Configuration of this language implementation.
id
LanguageIdentifier id()
Returns:Identifier of this implementation.
locations
Iterable<FileObject> locations()
Returns:Locations of this implementation’s components.
sequenceId
int sequenceId()
Returns:Maximum sequence identifier of this implementation’s components.

ILanguageImplInternal

public interface ILanguageImplInternal extends ILanguageImpl
Methods
addComponent
boolean addComponent(ILanguageComponent component)

Adds a component to the implementation.

Parameters:
  • component – Component to add.
Returns:

True if the component was added, false if it already existed.

belongsToInternal
ILanguageInternal belongsToInternal()
Returns:Language this implementation belongs to.
removeComponent
boolean removeComponent(ILanguageComponent component)

Removes a component from the implementation.

Parameters:
  • component – Component to remove.
Returns:

True if the component was removed, false if it did not exist.

ILanguageInternal

public interface ILanguageInternal extends ILanguage
Methods
add
void add(ILanguageImplInternal implementation)

Adds a language implementation that belongs to this language.

Parameters:
  • implementation – Language implementation to add.
remove
void remove(ILanguageImplInternal implementation)

Removes a language implementation that no longer belongs to this language.

Parameters:
  • implementation – Language implementation to remove.

ILanguageService

public interface ILanguageService

Interface for a language service that creates and destroys languages, maps names to active languages, and provides an observable of language changes. A language is active if it has the highest version, and highest loading date.

Methods
add
ILanguageComponent add(ComponentCreationConfig config)

Adds language component created from given configuration object, and return the created component.

Parameters:
  • config – Request object to process.
Throws:
  • IllegalStateException – When a component with a different id has already been created at given component’s location.
Returns:

Created component.

componentChanges
Observable<LanguageComponentChange> componentChanges()
Returns:Observable over language component changes.
create
ComponentCreationConfig create(LanguageIdentifier identifier, FileObject location, Iterable<LanguageContributionIdentifier> contribs, ILanguageComponentConfig config)

Creates a request object with given identifier and location, contributing to given language implementation identifiers. Returns a request object where facets can be added before passing it to add(ComponentCreationConfig).

Parameters:
  • identifier – Identifier of the component to create.
  • location – Location of the component to create.
  • contribs – Identifiers of language implementations that the component should contribute to.
  • config – Configuration of the component to create.
Returns:

Creation request object, when passed to add(ComponentCreationConfig) actually adds the language.

getAllComponents
Iterable<? extends ILanguageComponent> getAllComponents()
Returns:All language components.
getAllImpls
Iterable<? extends ILanguageImpl> getAllImpls()
Returns:All language implementations.
getAllImpls
Iterable<? extends ILanguageImpl> getAllImpls(String groupId, String id)

Gets language implementations with group id and id.

Parameters:
  • groupId – Group ID of the implementations to get.
  • id – ID of the implementations to get.
Returns:

Implementations with given group id and id.

getAllLanguages
Iterable<? extends ILanguage> getAllLanguages()
Returns:All languages
getComponent
ILanguageComponent getComponent(LanguageIdentifier identifier)

Gets a language component by its identifier.

Parameters:
  • identifier – Identifier of the implementation to get.
Returns:

Component with given identifier, or null if it could not be found.

getComponent
ILanguageComponent getComponent(FileName location)

Gets a language component by its location.

Parameters:
  • location – Location of the implementation to get.
Returns:

Component at given location, or null if it could not be found.

getImpl
ILanguageImpl getImpl(LanguageIdentifier identifier)

Gets a language implementation by its identifier.

Parameters:
  • identifier – Identifier of the implementation to get.
Returns:

Implementation with given identifier, or null if it could not be found.

getLanguage
ILanguage getLanguage(String name)

Gets a language by its name.

Parameters:
  • name – Name of the language to get.
Returns:

Language with given name, or null if it could not be found.

implChanges
Observable<LanguageImplChange> implChanges()
Returns:Observable over language implementation changes.
remove
void remove(ILanguageComponent component)

Removes given language component.

Parameters:
  • component – Language component to remove.
Throws:

IdentificationFacet

public class IdentificationFacet implements IFacet

Represents a facet that can identify resources languages.

Constructors
IdentificationFacet
public IdentificationFacet(Func1<FileObject, Boolean> identifier)

Creates an identification facet using an identification function.

Parameters:
  • identifier – The identification function.
Methods
identify
public boolean identify(FileObject file)

IdentifiedResource

public class IdentifiedResource

Resource with an identified language and optionally dialect.

Fields
dialect
public final ILanguageImpl dialect

Identified dialect of the resource, or null if it does not have a dialect.

language
public final ILanguageImpl language

Identified language of the resource.

resource
public final FileObject resource

Resource.

Constructors
IdentifiedResource
public IdentifiedResource(FileObject resource, IdentifiedDialect identifiedDialect)
IdentifiedResource
public IdentifiedResource(FileObject resource, ILanguageImpl dialect, ILanguageImpl language)
Methods
dialectOrLanguage
public ILanguageImpl dialectOrLanguage()
Returns:Dialect of the resource, or the language if it does not belong to a dialect.
toString
public String toString()

Language

public class Language implements ILanguage, ILanguageInternal
Constructors
Language
public Language(String name)
Methods
activeImpl
public ILanguageImpl activeImpl()
add
public void add(ILanguageImplInternal implementation)
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
impls
public Iterable<? extends ILanguageImpl> impls()
name
public String name()
remove
public void remove(ILanguageImplInternal implementation)
toString
public String toString()

LanguageComponent

public class LanguageComponent implements ILanguageComponentInternal
Constructors
LanguageComponent
public LanguageComponent(LanguageIdentifier identifier, FileObject location, int sequenceId, Iterable<ILanguageImplInternal> contributesTo, ILanguageComponentConfig config, Iterable<? extends IFacet> facets)
Methods
clearContributions
public void clearContributions()
config
public ILanguageComponentConfig config()
contributesTo
public Iterable<? extends ILanguageImpl> contributesTo()
contributesToInternal
public Iterable<? extends ILanguageImplInternal> contributesToInternal()
equals
public boolean equals(Object obj)
facet
public <T extends IFacet> T facet(Class<T> type)
facetContribution
public <T extends IFacet> FacetContribution<T> facetContribution(Class<T> type)
facetContributions
public <T extends IFacet> Iterable<FacetContribution<T>> facetContributions(Class<T> type)
facetContributions
public Iterable<FacetContribution<IFacet>> facetContributions()
facets
public <T extends IFacet> Iterable<T> facets(Class<T> type)
facets
public Iterable<IFacet> facets()
hasFacet
public boolean hasFacet(Class<? extends IFacet> type)
hashCode
public int hashCode()
id
public LanguageIdentifier id()
location
public FileObject location()
sequenceId
public int sequenceId()
toString
public String toString()

LanguageComponentChange

public class LanguageComponentChange

Represents a change of a language component in the ILanguageService.

Fields
kind
public final Kind kind

Kind of language change.

newComponent
public final ILanguageComponent newComponent

New language component. Value under different kinds:

oldComponent
public final ILanguageComponent oldComponent

Existing language component. Value under different kinds:

Constructors
LanguageComponentChange
public LanguageComponentChange(Kind kind, ILanguageComponent oldComponent, ILanguageComponent newComponent)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

LanguageComponentChange.Kind

public enum Kind
Enum Constants
Add
public static final LanguageComponentChange.Kind Add
Reload
public static final LanguageComponentChange.Kind Reload
Remove
public static final LanguageComponentChange.Kind Remove
Methods
toString
public String toString()

LanguageContributionIdentifier

public class LanguageContributionIdentifier implements Serializable
Fields
id
public final LanguageIdentifier id

Identifier of the language implementation to contribute to.

name
public final String name
Constructors
LanguageContributionIdentifier
public LanguageContributionIdentifier(LanguageIdentifier id, String name)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

LanguageFileSelector

public class LanguageFileSelector implements FileSelector
Constructors
LanguageFileSelector
public LanguageFileSelector(ILanguageIdentifierService languageIdentifierService, ILanguageImpl language)
Methods
includeFile
public boolean includeFile(FileSelectInfo fileInfo)
traverseDescendents
public boolean traverseDescendents(FileSelectInfo fileInfo)

LanguageIdentifier

public class LanguageIdentifier implements Comparable<LanguageIdentifier>, Serializable
Fields
errorDescription
public static final String errorDescription
groupId
public final String groupId
id
public final String id
version
public final LanguageVersion version
Constructors
LanguageIdentifier
public LanguageIdentifier(String groupId, String id, LanguageVersion version)
LanguageIdentifier
public LanguageIdentifier(LanguageIdentifier identifier, LanguageVersion version)
Methods
compareTo
public int compareTo(LanguageIdentifier other)
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
parse
public static LanguageIdentifier parse(String identifier)
parseFull
public static LanguageIdentifier parseFull(String identifier)
toFileString
public String toFileString()
toFullFileString
public String toFullFileString()
toString
public String toString()
valid
public boolean valid()
valid
public static boolean valid(String identifier)
validId
public static boolean validId(String id)

LanguageIdentifierService

public class LanguageIdentifierService implements ILanguageIdentifierService
Constructors
LanguageIdentifierService
public LanguageIdentifierService(ILanguageService languageService, IDialectIdentifier dialectIdentifier, IProjectService projectService, IDependencyService dependencyService)
Methods
available
public boolean available(ILanguageImpl impl)
identify
public boolean identify(FileObject resource, ILanguageImpl language)
identify
public ILanguageImpl identify(FileObject resource)
identify
public ILanguageImpl identify(FileObject resource, IProject project)
identify
public ILanguageImpl identify(FileObject resource, Iterable<? extends ILanguageImpl> languages)
identifyToResource
public IdentifiedResource identifyToResource(FileObject resource)
identifyToResource
public IdentifiedResource identifyToResource(FileObject resource, IProject project)
identifyToResource
public IdentifiedResource identifyToResource(FileObject resource, Iterable<? extends ILanguageImpl> impls)

LanguageImplChange

public class LanguageImplChange

Represents a change of a language implementation in the ILanguageService.

Fields
impl
public final ILanguageImpl impl

Changed language implementation.

kind
public final Kind kind

Kind of language change.

Constructors
LanguageImplChange
public LanguageImplChange(Kind kind, ILanguageImpl impl)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

LanguageImplChange.Kind

public enum Kind
Enum Constants
Add
public static final LanguageImplChange.Kind Add
Reload
public static final LanguageImplChange.Kind Reload
Remove
public static final LanguageImplChange.Kind Remove

LanguageImplementation

public class LanguageImplementation implements ILanguageImpl, ILanguageImplInternal
Constructors
LanguageImplementation
public LanguageImplementation(LanguageIdentifier id, ILanguageInternal belongsTo)
Methods
addComponent
public boolean addComponent(ILanguageComponent component)
belongsTo
public ILanguage belongsTo()
belongsToInternal
public ILanguageInternal belongsToInternal()
components
public Iterable<ILanguageComponent> components()
config
public ILanguageImplConfig config()
equals
public boolean equals(Object obj)
facet
public <T extends IFacet> T facet(Class<T> type)
facetContribution
public <T extends IFacet> FacetContribution<T> facetContribution(Class<T> type)
facetContributions
public <T extends IFacet> Iterable<FacetContribution<T>> facetContributions(Class<T> type)
facetContributions
public Iterable<FacetContribution<IFacet>> facetContributions()
facets
public <T extends IFacet> Iterable<T> facets(Class<T> type)
facets
public Iterable<IFacet> facets()
hasFacet
public boolean hasFacet(Class<? extends IFacet> type)
hashCode
public int hashCode()
id
public LanguageIdentifier id()
locations
public Iterable<FileObject> locations()
removeComponent
public boolean removeComponent(ILanguageComponent component)
sequenceId
public int sequenceId()
toString
public String toString()

LanguageService

public class LanguageService implements ILanguageService
Methods
componentChanges
public Observable<LanguageComponentChange> componentChanges()
getAllComponents
public Iterable<? extends ILanguageComponent> getAllComponents()
getAllImpls
public Iterable<? extends ILanguageImpl> getAllImpls()
getAllImpls
public Iterable<? extends ILanguageImpl> getAllImpls(String groupId, String id)
getAllLanguages
public Iterable<? extends ILanguage> getAllLanguages()
getComponent
public ILanguageComponent getComponent(LanguageIdentifier identifier)
getComponent
public ILanguageComponent getComponent(FileName location)
getImpl
public ILanguageImpl getImpl(LanguageIdentifier identifier)
getLanguage
public ILanguage getLanguage(String name)
implChanges
public Observable<LanguageImplChange> implChanges()
remove
public void remove(ILanguageComponent component)

LanguageUtils

public class LanguageUtils
Methods
active
public static ILanguageImpl active(Iterable<? extends ILanguageImpl> impls)
allActiveComponents
public static Iterable<ILanguageComponent> allActiveComponents(ILanguageService languageService)
allActiveImpls
public static Iterable<ILanguageImpl> allActiveImpls(ILanguageService languageService)
toComponents
public static Set<ILanguageComponent> toComponents(Iterable<? extends ILanguageImpl> impls)
toImpls
public static Set<ILanguageImpl> toImpls(Iterable<? extends ILanguageComponent> components)

LanguageVersion

public class LanguageVersion implements Comparable<LanguageVersion>, Serializable

Representation for the version of a language. Follows the Maven versioning style.

Fields
errorDescription
public static final String errorDescription
major
public final int major
minor
public final Integer minor
patch
public final Integer patch
qualifier
public final String qualifier
Constructors
LanguageVersion
public LanguageVersion(int major)
LanguageVersion
public LanguageVersion(int major, int minor)
LanguageVersion
public LanguageVersion(int major, int minor, int patch)
LanguageVersion
public LanguageVersion(int major, Integer minor, Integer patch, String qualifier)
Methods
compareTo
public int compareTo(LanguageVersion other)
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
parse
public static LanguageVersion parse(String version)
toString
public String toString()
valid
public static boolean valid(String version)

LanguagesFileSelector

public class LanguagesFileSelector implements FileSelector
Constructors
LanguagesFileSelector
public LanguagesFileSelector(ILanguageIdentifierService languageIdentifierService, Iterable<ILanguageImpl> languages)
Methods
includeFile
public boolean includeFile(FileSelectInfo fileInfo)
traverseDescendents
public boolean traverseDescendents(FileSelectInfo fileInfo)

ResourceExtensionFacet

public class ResourceExtensionFacet implements IFacet

Represents a facet that specifies the file extensions for languages. Complements the IdentificationFacet.

Constructors
ResourceExtensionFacet
public ResourceExtensionFacet(Iterable<String> extensions)
Methods
extensions
public Iterable<String> extensions()

ResourceExtensionsIdentifier

public class ResourceExtensionsIdentifier implements Func1<FileObject, Boolean>, Serializable
Constructors
ResourceExtensionsIdentifier
public ResourceExtensionsIdentifier(Iterable<String> extensions)
Methods
call
public Boolean call(FileObject resource)

org.metaborg.core.language.dialect

IDialectIdentifier

public interface IDialectIdentifier

Interface for identifying the dialect of a resource.

Methods
identify
IdentifiedDialect identify(FileObject resource)

Attempts to identify the dialect of given resource.

Parameters:
  • resource – Resource to identify.
Throws:
Returns:

Identified dialect, or null if dialect could not be identified.

identify
boolean identify(FileObject resource, ILanguageImpl dialect)

Checks if given resource is of given dialect.

Parameters:
  • resource – Resource to check.
  • dialect – Dialect to check against.
Throws:
Returns:

True if resource is of given dialect, false otherwise.

IDialectProcessor

public interface IDialectProcessor

Interface for processing dialect updates.

Methods
update
void update(FileObject location, Iterable<ResourceChange> changes)

Updates dialects using given changes.

Parameters:
  • location – Location to process changes for.
  • changes – Resource changes to process.
update
void update(LanguageImplChange change)

Updates dialects using a language implementation change.

Parameters:
  • change – Language change to process.

IDialectService

public interface IDialectService
Methods
add
ILanguageImpl add(String name, FileObject location, ILanguageImpl base, IFacet syntaxFacet)

Creates a new dialect language for given base language and parser facet. The dialect replaces the parser facet, and retains all other facets of the base language.

Parameters:
  • name – Name of the new dialect language.
  • location – Location of the new dialect language.
  • base – Base language of the dialect.
  • syntaxFacet – Syntax facet to replace the base language’s syntax facet with.
Throws:
Returns:

Created dialect language.

dialectName
String dialectName(ILanguageImpl dialect)

Returns dialect name for the given dialect.

Parameters:
  • dialect – The dialect.
Returns:

the name of the dialect, null if it isn’t a dialect.

getBase
ILanguageImpl getBase(ILanguageImpl dialect)

Gets the base language for given dialect.

Parameters:
  • dialect – Dialect to get base language for.
Returns:

Base language of given dialect, or null if given language is not a dialect or the dialect has been removed.

getDialect
ILanguageImpl getDialect(String name)

Gets dialect language with given name.

Parameters:
  • name – Name of the dialect to get.
Returns:

Dialect language with given name, or null if it does not exist.

getDialects
Iterable<ILanguageImpl> getDialects(ILanguageImpl base)

Gets all dialects for given base language

Parameters:
  • base – Base language of the dialects.
Returns:

Dialects for given base language.

hasDialect
boolean hasDialect(String name)

Returns if dialect with given name exists.

Parameters:
  • name – Name of the dialect to check.
Returns:

True if dialect exists, false if not.

remove
ILanguageImpl remove(String name)

Removes dialect with given name.

Parameters:
  • name – Name of the dialect to remove.
Throws:
Returns:

Removed dialect language.

remove
Iterable<ILanguageImpl> remove(ILanguageImpl base)

Removes all dialects based on given language. Does nothing if there are no dialects of that language.

Parameters:
  • base – Base language to remove all dialects for.
Returns:

Removed dialect languages.

update
ILanguageImpl update(String name, IFacet parserFacet)

Updates dialect of given name, with a new parser facet.

Parameters:
  • name – Name of the dialect to update.
  • parserFacet – Parser facet to update the dialect with.
Throws:
Returns:

Updated dialect language.

update
Iterable<ILanguageImpl> update(ILanguageImpl base)

Updates all dialects based on base. Does nothing if there were no dialects based on base.

Parameters:
  • base – Base language for which to update dialects.
Returns:

Updated dialect languages.

IdentifiedDialect

public class IdentifiedDialect

Dialect with its base language.

Fields
base
public final ILanguageImpl base

Base language of the dialect.

dialect
public final ILanguageImpl dialect

The dialect.

Constructors
IdentifiedDialect
public IdentifiedDialect(ILanguageImpl dialect, ILanguageImpl base)

org.metaborg.core.menu

IMenu

public interface IMenu extends IMenuItem
Methods
action
IAction action(String name)
items
Iterable<IMenuItem> items()

IMenuAction

public interface IMenuAction extends IMenuItem
Methods
action
ITransformAction action()

IMenuItem

public interface IMenuItem
Methods
accept
void accept(IMenuItemVisitor visitor)

Accepts the specified visitor.

Parameters:
  • visitor – The visitor.
name
String name()
Returns:Name of the menu item.

IMenuItemVisitor

public interface IMenuItemVisitor

Visitor for menu items.

Methods
visitAction
void visitAction(IMenuAction action)

Visits the action.

Parameters:
  • action – The action to visit.
visitMenu
void visitMenu(IMenu menu)

Visits the menu.

Parameters:
  • menu – The menu to visit.
visitMenuItem
void visitMenuItem(IMenuItem item)

Visits the menu item. This method is called when no more specific visitor method applies.

Parameters:
  • item – The menu item to visit.
visitSeparator
void visitSeparator(Separator separator)

Visits the separator.

Parameters:
  • separator – The separator to visit.

IMenuService

public interface IMenuService

Interface for service that combines menus for language implementations.

Methods

Separator

public class Separator implements IMenuItem
Methods
accept
public void accept(IMenuItemVisitor visitor)
name
public String name()

org.metaborg.core.messages

IMessage

public interface IMessage extends Serializable

Interface representing a message on a region in a source file.

Methods
exception
Throwable exception()
Returns:Exception belonging to this message, or null if there is no exception.
message
String message()
Returns:Message text.
region
ISourceRegion region()
Returns:Affected region inside the source, or null if the entire source is affected.
severity
MessageSeverity severity()
Returns:Message severity
source
FileObject source()
Returns:Source of the message, or null if the source is unknown.
type
MessageType type()
Returns:Message type.

IMessagePrinter

public interface IMessagePrinter

Interface for printing messages.

Methods
print
void print(IMessage message, boolean pardoned)

Prints given message.

Parameters:
  • message – Message to print.
  • pardoned – If the (error or warning) message is pardoned, i.e. the message is acceptable even if it indicates a problem.
print
void print(FileObject resource, String message, Throwable e, boolean pardoned)

Prints given message and exception, located at a resource. Used if the source location is not available.

Parameters:
  • resource – Resource the message occurred in, or null if the message was detached.
  • message – Message to print.
  • e – Exception to print, or null if there is no exception.
  • pardoned – If the (error or warning) message is pardoned, i.e. the message is acceptable even if it indicates a problem.
print
void print(IProject project, String message, Throwable e, boolean pardoned)

Prints given message and exception, located at a project. Used if the source location or resource is not available.

Parameters:
  • project – Project the message occurred in.
  • message – Message to print.
  • e – Exception to print, or null if there is no exception.
  • pardoned – If the (error or warning) message is pardoned, i.e. the message is acceptable even if it indicates a problem.
printSummary
void printSummary()

Prints a summary based on printed messages before.

Message

public class Message implements IMessage
Constructors
Message
public Message(String message, MessageSeverity severity, MessageType type, FileObject source, ISourceRegion region, Throwable exception)
Methods
exception
public Throwable exception()
message
public String message()
region
public ISourceRegion region()
severity
public MessageSeverity severity()
source
public FileObject source()
toString
public String toString()
type
public MessageType type()

MessageBuilder

public class MessageBuilder
Methods
asAnalysis
public MessageBuilder asAnalysis()
asError
public MessageBuilder asError()
asInternal
public MessageBuilder asInternal()
asNote
public MessageBuilder asNote()
asParser
public MessageBuilder asParser()
asTransform
public MessageBuilder asTransform()
asWarning
public MessageBuilder asWarning()
build
public IMessage build()
create
public static MessageBuilder create()
withException
public MessageBuilder withException(Throwable exception)
withMessage
public MessageBuilder withMessage(String message)
withRegion
public MessageBuilder withRegion(ISourceRegion region)
withSeverity
public MessageBuilder withSeverity(MessageSeverity severity)
withSource
public MessageBuilder withSource(FileObject source)
withType
public MessageBuilder withType(MessageType type)

MessageCategory

public class MessageCategory
Fields
name
public final String name
Constructors
MessageCategory
public MessageCategory(String name)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

MessageFactory

public class MessageFactory
Methods
newAnalysisError
public static Message newAnalysisError(FileObject resource, ISourceRegion region, String msg, Throwable cause)
newAnalysisErrorAtTop
public static Message newAnalysisErrorAtTop(FileObject resource, String msg, Throwable cause)
newAnalysisMessage
public static Message newAnalysisMessage(FileObject resource, ISourceRegion region, String msg, MessageSeverity severity, Throwable cause)
newAnalysisMessageAtTop
public static Message newAnalysisMessageAtTop(FileObject resource, String msg, MessageSeverity severity, Throwable cause)
newAnalysisNote
public static Message newAnalysisNote(FileObject resource, ISourceRegion region, String msg, Throwable cause)
newAnalysisNoteAtTop
public static Message newAnalysisNoteAtTop(FileObject resource, String msg, Throwable cause)
newAnalysisWarning
public static Message newAnalysisWarning(FileObject resource, ISourceRegion region, String msg, Throwable cause)
newAnalysisWarningAtTop
public static Message newAnalysisWarningAtTop(FileObject resource, String msg, Throwable cause)
newAtTop
public static Message newAtTop(FileObject resource, String msg, MessageType type, MessageSeverity severity, Throwable cause)
newBuilderErrorAtTop
public static Message newBuilderErrorAtTop(FileObject resource, String msg, Throwable cause)
newBuilderWarningAtTop
public static Message newBuilderWarningAtTop(FileObject resource, String msg, Throwable cause)
newErrorAtTop
public static Message newErrorAtTop(FileObject resource, String msg, MessageType type, Throwable cause)
newMessage
public static Message newMessage(FileObject resource, ISourceRegion region, String msg, MessageSeverity severity, MessageType type, Throwable cause)
newNoteAtTop
public static Message newNoteAtTop(FileObject resource, String msg, MessageType type, Throwable cause)
newParseError
public static Message newParseError(FileObject resource, ISourceRegion region, String msg, Throwable cause)
newParseErrorAtTop
public static Message newParseErrorAtTop(FileObject resource, String msg, Throwable cause)
newParseMessage
public static Message newParseMessage(FileObject resource, ISourceRegion region, String msg, MessageSeverity severity, Throwable cause)
newParseWarning
public static Message newParseWarning(FileObject resource, ISourceRegion region, String msg, Throwable cause)
newParseWarningAtTop
public static Message newParseWarningAtTop(FileObject resource, String msg, Throwable cause)
newWarningAtTop
public static Message newWarningAtTop(FileObject resource, String msg, MessageType type, Throwable cause)

MessageSeverity

public enum MessageSeverity implements Serializable
Enum Constants
ERROR
public static final MessageSeverity ERROR
NOTE
public static final MessageSeverity NOTE
WARNING
public static final MessageSeverity WARNING
Fields
value
public final int value

MessageType

public enum MessageType implements Serializable
Enum Constants
ANALYSIS
public static final MessageType ANALYSIS
INTERNAL
public static final MessageType INTERNAL
PARSER
public static final MessageType PARSER
TRANSFORMATION
public static final MessageType TRANSFORMATION

MessageUtils

public class MessageUtils
Methods
containsSeverity
public static boolean containsSeverity(Iterable<IMessage> messages, MessageSeverity severity)
highestSeverity
public static MessageSeverity highestSeverity(Iterable<IMessage> messages)

StreamMessagePrinter

public class StreamMessagePrinter implements IMessagePrinter

Message printer implementation that prints detailed messages to a stream.

Constructors
StreamMessagePrinter
public StreamMessagePrinter(ISourceTextService sourceTextService, boolean printHighlight, boolean printExceptions, OutputStream infoStream, OutputStream warnStream, OutputStream errorStream)
StreamMessagePrinter
public StreamMessagePrinter(ISourceTextService sourceTextService, boolean printHighlight, boolean printExceptions, ILogger logger)
Methods
print
public void print(IMessage message, boolean pardoned)
print
public void print(FileObject source, String message, Throwable e, boolean pardoned)
print
public void print(IProject project, String message, Throwable e, boolean pardoned)
printSummary
public void printSummary()

WithLocationStreamMessagePrinter

public class WithLocationStreamMessagePrinter implements IMessagePrinter

Prints note, warning, and error messages similar to large compilers such as GCC or Clang. That is, the message comes with filename, line, column, and severity. Also the affected code is underlined with carets (^).

Constructors
WithLocationStreamMessagePrinter
public WithLocationStreamMessagePrinter(ISourceTextService sourceTextService, IProjectService projectService, OutputStream outputStream)
Methods
print
public void print(IMessage message, boolean pardoned)
print
public void print(FileObject resource, String message, Throwable e, boolean pardoned)
print
public void print(IProject project, String message, Throwable e, boolean pardoned)
printSummary
public void printSummary()

org.metaborg.core.outline

IOutline

public interface IOutline

Interface representing an outline.

Methods
expandTo
int expandTo()
Returns:Automatically expand the outline returned levels deep.
roots
Iterable<IOutlineNode> roots()
Returns:Root nodes of the outline.

IOutlineNode

public interface IOutlineNode

Interface representing a node in an outline tree view.

Methods
icon
FileObject icon()
Returns:File object containing an icon, or null if there is no icon.
label
String label()
Returns:Label
nodes
Iterable<IOutlineNode> nodes()
Returns:Sub nodes
origin
ISourceRegion origin()
Returns:Region in the source text this node originates from, or null if no region is available.
parent
IOutlineNode parent()
Returns:Parent node, or null if this is a root.

IOutlineService

public interface IOutlineService<P extends IParseUnit, A extends IAnalyzeUnit>

Interface for creating outlines.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
Methods
available
boolean available(ILanguageImpl langImpl)

Checks if outlining is available for given language implementation.

Parameters:
  • langImpl – Language implementation to check.
Returns:

True if outlining is available, false if not.

outline
IOutline outline(P result)

Creates an outline from given parse unit.

Parameters:
  • result – Parsed result.
Throws:
Returns:

Created outline, or null if the outline is empty.

outline
IOutline outline(A result)

Creates an outline from given analyze unit.

Parameters:
  • result – Analyzed result.
Throws:
Returns:

Created outline, or null if the outline is empty.

Outline

public class Outline implements IOutline
Fields
expandTo
public final int expandTo
roots
public final Iterable<IOutlineNode> roots
Constructors
Outline
public Outline(Iterable<IOutlineNode> roots, int expandTo)
Methods
expandTo
public int expandTo()
roots
public Iterable<IOutlineNode> roots()

OutlineNode

public class OutlineNode implements IOutlineNode
Constructors
OutlineNode
public OutlineNode(String label, FileObject icon, ISourceRegion origin, IOutlineNode parent)
Methods
addChild
public void addChild(IOutlineNode child)
icon
public FileObject icon()
label
public String label()
nodes
public Iterable<IOutlineNode> nodes()
origin
public ISourceRegion origin()
parent
public IOutlineNode parent()
toString
public String toString()

org.metaborg.core.plugin

IModulePluginLoader

public interface IModulePluginLoader

Loads static Module plugins which can be passed to a Guice Injector.

Methods
modules
Iterable<Module> modules()
Returns:All modules provided by plugins.

IServiceModulePlugin

public interface IServiceModulePlugin

Plugin that creates Modules that are passed to Metaborg’s Guice Injector at startup.

Methods
modules
Iterable<Module> modules()
Returns:All modules provided by this plugin.

InjectorFactory

public class InjectorFactory

Utility methods for creating Guice Injector instances.

Methods
create
public static Injector create(Iterable<Module> modules)
create
public static Injector create(Module... modules)
createChild
public static Injector createChild(Injector parent, Iterable<Module> modules)
createChild
public static Injector createChild(Injector parent, Module... modules)
modules
public static Iterable<Module> modules(IModulePluginLoader loader, Iterable<Module> modules)
modules
public static Iterable<Module> modules(IModulePluginLoader loader, Module... modules)

ServiceModulePluginLoader

public class ServiceModulePluginLoader<T extends IServiceModulePlugin> implements IModulePluginLoader

Module plugin loader using Java’s ServiceLoader.

Constructors
ServiceModulePluginLoader
public ServiceModulePluginLoader(Class<T> serviceClass)
Methods
modules
public Iterable<Module> modules()

org.metaborg.core.processing

BlockingProcessor

public class BlockingProcessor<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>> implements IProcessor<P, A, AU, T>

Processor implementation that uses BlockingTask as task implementation. Tasks execute and block when scheduled.

Constructors
BlockingProcessor
public BlockingProcessor(IDialectProcessor dialectProcessor, IBuilder<P, A, AU, T> builder, ILanguageChangeProcessor languageChangeProcessor)
Methods
build
public ITask<? extends IBuildOutput<P, A, AU, T>> build(BuildInput input, IProgress progressReporter, ICancel cancellationToken)
clean
public ITask<?> clean(CleanInput input, IProgress progressReporter, ICancel cancellationToken)
languageChange
public ITask<?> languageChange(LanguageComponentChange change)
languageChange
public ITask<?> languageChange(LanguageImplChange change)
updateDialects
public ITask<?> updateDialects(FileObject location, Iterable<ResourceChange> changes)

BlockingTask

public class BlockingTask<T> implements ITask<T>

Task implementation that executes a function in blocking way when scheduled. Does not support cancellation.

Constructors
BlockingTask
public BlockingTask(Func0<T> func)
Methods
block
public ITask<T> block()
cancel
public void cancel()
cancel
public void cancel(int killTimeout)
cancelled
public boolean cancelled()
completed
public boolean completed()
result
public T result()
schedule
public ITask<T> schedule()

CancellationToken

public class CancellationToken implements ICancel

Simple cancellation token implementation.

Methods
cancel
public void cancel()
cancelled
public boolean cancelled()
throwIfCancelled
public void throwIfCancelled()

ICancellationToken

public interface ICancellationToken extends ICancel

Interface for figuring out if something has been cancelled.

ILanguageChangeProcessor

public interface ILanguageChangeProcessor

Interface for processing language change events. Used internally only, clients should use a IProcessorRunner which handles language change events automatically.

Methods
processComponentChange
void processComponentChange(LanguageComponentChange change)

Process given language component change event.

Parameters:
  • change – Language implementation component event to process.
processImplChange
void processImplChange(LanguageImplChange change)

Process given language implementation change event.

Parameters:
  • change – Language implementation change event to process.

IProcessor

public interface IProcessor<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>>

Interface for creating processing tasks. Used internally, clients should use a IProcessorRunner.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
  • <T> – Type of transform units.
Methods
build
ITask<? extends IBuildOutput<P, A, AU, T>> build(BuildInput input, IProgress progressReporter, ICancel cancellationToken)

See also: IProcessorRunner.build(BuildInput,IProgress,ICancel)

clean
ITask<?> clean(CleanInput input, IProgress progressReporter, ICancel cancellationToken)

See also: IProcessorRunner.clean(CleanInput,IProgress,ICancel)

languageChange
ITask<?> languageChange(LanguageComponentChange change)

Creates a task that processes given language component change.

Parameters:
  • change – Language implementation change to process.
Returns:

Task that processes given language change.

languageChange
ITask<?> languageChange(LanguageImplChange change)

Creates a task that processes given language implementation change.

Parameters:
  • change – Language implementation change to process.
Returns:

Task that processes given language change.

updateDialects
ITask<?> updateDialects(FileObject location, Iterable<ResourceChange> changes)

See also: IProcessorRunner.updateDialects(FileObject,Iterable)

IProcessorRunner

public interface IProcessorRunner<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>>

Interface for language processing. Handles building and cleaning on-demand, and language change events automatically.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <AU> – Type of analyze unit updates.
  • <T> – Type of transform units.
Methods
build
ITask<? extends IBuildOutput<P, A, AU, T>> build(BuildInput input, IProgress progress, ICancel cancel)

Creates a task that builds with given build input.

Parameters:
  • input – Build input to use.
  • progress – Progress reporter, or null to use a processor-specific implementation for progress reporting.
  • cancel – Cancellation token, or null to a use a processor-specific implementation for cancellation.
Returns:

Task that builds with given input, and has the build output as result. Schedule the task and wait for it to complete to get the build output.

clean
ITask<?> clean(CleanInput input, IProgress progress, ICancel cancel)

Creates a task that cleans with given clean input.

Parameters:
  • input – Clean input to use.
  • progress – Progress reporter, or null to use a processor-specific implementation for progress reporting.
  • cancel – Cancellation token, or null to a use a processor-specific implementation for cancellation.
Returns:

Task that cleans with given input.

updateDialects
ITask<?> updateDialects(FileObject location, Iterable<ResourceChange> changes)

Creates a task that updates dialects using given changes.

Parameters:
  • location – Location to process changes at.
  • changes – Resource changes to process.
Returns:

Task that processes dialect updates.

IProgressReporter

public interface IProgressReporter extends IProgress

Interface for progress reporting.

ITask

public interface ITask<T>

Interface for asynchronous task with cancellation.

Parameters:
  • <T> – Type of the result.
Methods
block
ITask<T> block()

Blocks until the task has been completed or cancelled, and return itself.

Throws:
cancel
void cancel()

Request cancellation.

cancel
void cancel(int forceTimeout)

Request cancellation, force cancel after after stopTimeout milliseconds.

Parameters:
  • forceTimeout – Timeout in milliseconds after which the cancellation is forced.
cancelled
boolean cancelled()
Returns:If the task has been cancelled.
completed
boolean completed()
Returns:If the task has been completed.
result
T result()
Returns:Result of the task, or null if it has been cancelled, or not completed yet.
schedule
ITask<T> schedule()

Schedule this task and returns itself.

LanguageChangeProcessor

public class LanguageChangeProcessor implements ILanguageChangeProcessor

Default implementation for the language change processor.

Constructors
LanguageChangeProcessor
public LanguageChangeProcessor(IDialectProcessor dialectProcessor, IContextProcessor contextProcessor, IParseResultProcessor<?, ?> parseResultProcessor, IAnalysisResultProcessor<?, ?, ?> analysisResultProcessor, IEditorRegistry editorRegistry, Set<ILanguageCache> languageCaches)
Methods
addedComponent
protected void addedComponent(ILanguageComponent component)

Component was added

Parameters:
  • component – Added component
addedImpl
protected void addedImpl(ILanguageImpl impl)

Implementation was added

Parameters:
  • impl – Added implementation
processComponentChange
public void processComponentChange(LanguageComponentChange change)
processImplChange
public void processImplChange(LanguageImplChange change)
reloadedComponent
protected void reloadedComponent(ILanguageComponent oldComponent, ILanguageComponent newComponent)

Component was reloaded

Parameters:
  • oldComponent – Component before the reload
  • newComponent – Component after the reload
reloadedImpl
protected void reloadedImpl(ILanguageImpl impl)

Implementation was reloaded

Parameters:
  • impl – Reloaded implementation
removedComponent
protected void removedComponent(ILanguageComponent component)

Component was removed

Parameters:
  • component – Removed component
removedImpl
protected void removedImpl(ILanguageImpl impl)

Implementation was removed

Parameters:
  • impl – Removed implementation

NullCancellationToken

public class NullCancellationToken extends NullCancel implements ICancel

Cancellation token implementation that never cancels.

NullProgressReporter

public class NullProgressReporter extends NullProgress implements IProgress

Progress reporter implementation that ignores all progress reporting.

ProcessorRunner

public class ProcessorRunner<P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, T extends ITransformUnit<?>> implements IProcessorRunner<P, A, AU, T>

Default implementation for the processor runner.

Constructors
ProcessorRunner
public ProcessorRunner(IProcessor<P, A, AU, T> processor, ILanguageService languageService)
Methods
build
public ITask<? extends IBuildOutput<P, A, AU, T>> build(BuildInput input, IProgress progress, ICancel cancel)
clean
public ITask<?> clean(CleanInput input, IProgress progress, ICancel cancel)
updateDialects
public ITask<?> updateDialects(FileObject location, Iterable<ResourceChange> changes)

org.metaborg.core.processing.analyze

AnalysisChange

public class AnalysisChange<A extends IAnalyzeUnit>
Fields
exception
public final AnalysisException exception
kind
public final UpdateKind kind
resource
public final FileObject resource
result
public final A result
Constructors
AnalysisChange
protected AnalysisChange(UpdateKind kind, FileObject resource, A result, AnalysisException exception)
Methods
error
public static <A extends IAnalyzeUnit> AnalysisChange<A> error(FileObject resource, AnalysisException exception)

Creates an analysis change that represents an error that occurred while updating an analysis result.

Parameters:
  • resource – Changed resource.
  • exception – Error that occurred.
Returns:

Analysis change.

invalidate
public static <A extends IAnalyzeUnit> AnalysisChange<A> invalidate(FileObject resource)

Creates an analysis change that represents an invalidation of given resource.

Parameters:
  • resource – Resource to invalidate.
Returns:

Analysis change.

remove
public static <A extends IAnalyzeUnit> AnalysisChange<A> remove(FileObject resource)

Creates an analysis change that represents removal of an analysis result.

Parameters:
  • resource – Resource that was removed.
Returns:

Analysis change.

update
public static <A extends IAnalyzeUnit> AnalysisChange<A> update(FileObject resource, A result)

Creates an analysis change that represents an update to the analysis result.

Parameters:
  • resource – Changed resource.
  • result – Updated analysis result.
  • parentResult – Parent of the updated analysis result.
Returns:

Analysis change.

AnalysisResultProcessor

public class AnalysisResultProcessor<I extends IInputUnit, P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate> implements IAnalysisResultProcessor<I, P, A>
Constructors
AnalysisResultProcessor
public AnalysisResultProcessor(IAnalysisService<P, A, AU> analysisService, IParseResultRequester<I, P> parseResultRequester)
Methods
error
public void error(FileObject resource, AnalysisException exception)
error
public void error(Iterable<P> results, AnalysisException exception)
get
public A get(FileObject resource)
invalidate
public void invalidate(FileObject resource)
invalidate
public void invalidate(Iterable<P> results)
invalidate
public void invalidate(ILanguageImpl impl)
remove
public void remove(FileObject resource)
request
public Observable<A> request(I input, IContext context)
update
public void update(A result, Set<FileName> removedResources)
updates
public Observable<AnalysisChange<A>> updates(FileObject resource)

IAnalysisResultProcessor

public interface IAnalysisResultProcessor<I extends IInputUnit, P extends IParseUnit, A extends IAnalyzeUnit> extends IAnalysisResultRequester<I, A>, IAnalysisResultUpdater<P, A>

Typedef interface for combining IAnalysisResultRequester and IAnalysisResultUpdater.

IAnalysisResultRequester

public interface IAnalysisResultRequester<I extends IInputUnit, A extends IAnalyzeUnit>

Interface for requesting single analysis results or updates for analysis results.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
Methods
get
A get(FileObject resource)
Returns:Latest analysis result for given resource, or null if there is none.
request
Observable<A> request(I input, IContext context)

Requests the analysis result for given resource. When subscribing to the returned observer, it always returns a single element; the latest analysis result, or pushes an error if an error occurred while getting it. If the analysis result is cached, the observable will immediately push it. If the analysis result has been invalidated (when it is in the process of being updated), it will be pushed when it has been updated. If there is no analysis result yet, it will request a parse result, analyze the resource in given context, and push the analysis result. The simplest way to get the analysis result is to wait for it: result = requester.request(resource, context, text).toBlocking().single();

Parameters:
  • resource – Resource to get the analysis result for.
  • context – Context in which the analysis should be performed, in case there is no analysis result for given resource.
  • text – Text which should be parsed, in case there is no parse result for given resource.
Returns:

Cold observable which pushes a single element when subscribed; the latest analysis result, or pushes an error if an error occurred while getting it.

updates
Observable<AnalysisChange<A>> updates(FileObject resource)

Returns an observable that pushes analysis result updates to subscribers for given resource.

Parameters:
  • resource – Resource to push updates for.
Returns:

Hot observable that pushes updates to subscribers for given resource.

IAnalysisResultUpdater

public interface IAnalysisResultUpdater<P extends IParseUnit, A extends IAnalyzeUnit>

Interface for updating analysis results which are requested by an IAnalysisResultRequester.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
Methods
error
void error(FileObject resource, AnalysisException exception)

Sets an analysis error for given resource. Pushes the analysis error to subscribed requests.

Parameters:
  • resource – Resource to set an analysis error for.
  • exception – Analysis error to set.
error
void error(Iterable<P> results, AnalysisException exception)

Sets an analysis error for sources in given parse result. Pushes analysis errors to subscribed requests.

Parameters:
  • results – Parse results with sources to set an analysis error for.
  • exception – Analysis error to set.
invalidate
void invalidate(FileObject resource)

Invalidates the analysis result for given resource. Must be followed by a call to update or error for that resource eventually. Failing to do so will block any request made while resource was in an invalid state.

Parameters:
  • resource – Resource to invalidate.
invalidate
void invalidate(Iterable<P> results)

Invalidates the analysis results for sources in given parse results. Must be followed by a call to update or error for those resources eventually. Failing to do so will block any requests made while resources were in invalid states.

Parameters:
  • results – Parse results with sources to invalidate.
invalidate
void invalidate(ILanguageImpl lang)

Invalidates the analysis results for all sources for the given language. Must be followed by a call to update or error for those resources eventually. Failing to do so will block any requests made while resources were in invalid states.

Parameters:
  • lang – Language to invalidate for.
remove
void remove(FileObject resource)

Removes cached analysis results for given resource.

Parameters:
  • resource – Resource to remove cached analysis results for.
update
void update(A result, Set<FileName> removedResources)

Updates the analysis result for a single resource. Pushes the analysis result to subscribed requests. Removes cached analysis results for given removed resource.

Parameters:
  • result – Result to update.
  • parentResult – Parent of the result to update.
  • removedResources – Set of resources that have actually been removed instead of updated. Used for legacy analysis where removal is indicated by an empty tuple as parse result.

org.metaborg.core.processing.parse

IParseResultProcessor

public interface IParseResultProcessor<I extends IInputUnit, P extends IParseUnit> extends IParseResultRequester<I, P>, IParseResultUpdater<P>

Typedef interface for combining IParseResultRequester and IParseResultUpdater.

IParseResultRequester

public interface IParseResultRequester<I extends IInputUnit, P extends IParseUnit>

Interface for requesting single parse results or updates for parse results.

Methods
get
P get(FileObject resource)
Returns:Latest parse result for given resource, or null if there is none.
request
Observable<P> request(I unit)

Requests the parse result for given resource. When subscribing to the returned observer, it always returns a single element; the latest parse result, or pushes an error if an error occurred while getting it. If the parse result is cached, the observable will immediately push it. If the parse result has been invalidated (when it is in the process of being updated), it will be pushed when it has been updated. If there is no parse result yet, it will parse with given text and push the parse result. The simplest way to get the parse result is to wait for it: result = requester.request(resource, language, text).toBlocking().single();

Parameters:
  • resource – Resource to get the parse result for.
  • language – Language given text should be parsed with, in case there is no parse result for given resource.
  • text – Text which should be parsed, in case there is no parse result for given resource.
Returns:

Cold observable which pushes a single element when subscribed; the latest parse result, or pushes an error if an error occurred while getting it.

updates
Observable<ParseChange<P>> updates(FileObject resource)

Returns an observable that pushes parse result updates to subscribers for given resource.

Parameters:
  • resource – Resource to push updates for.
Returns:

Hot observable that pushes updates to subscribers for given resource.

IParseResultUpdater

public interface IParseResultUpdater<P extends IParseUnit>

Interface for updating parse results which are requested by an IParseResultRequester.

Methods
error
void error(FileObject resource, ParseException exception)

Sets a parse error for given resource. Pushes the parse error to subscribed requests.

Parameters:
  • resource – Resource to set a parse error for.
  • exception – Parse error to set.
invalidate
void invalidate(FileObject resource)

Invalidates the parse result for given resource. Must be followed by a call to update or error for that resource eventually. Failing to do so will block any request made while resource was in an invalid state.

Parameters:
  • resource – Resource to invalidate.
invalidate
void invalidate(ILanguageImpl lang)

Invalidates the parse result for all sources of the given language. Must be followed by a call to update or error for that resource eventually. Failing to do so will block any request made while resource was in an invalid state.

Parameters:
  • lang – Language to invalidate for.
remove
void remove(FileObject resource)

Removes cached parse results for given resource.

Parameters:
  • resource – Resource to remove cached parse results for.
update
void update(FileObject resource, P unit)

Updates the parse result for a single resource. Pushes the parse result to subscribed requests.

Parameters:
  • result – Result to update.
  • result – Parent of the result to update.

ParseChange

public class ParseChange<P extends IParseUnit>
Fields
exception
public final ParseException exception
kind
public final UpdateKind kind
resource
public final FileObject resource
unit
public final P unit
Constructors
ParseChange
protected ParseChange(UpdateKind kind, FileObject resource, P unit, ParseException exception)
Methods
error
public static <P extends IParseUnit> ParseChange<P> error(ParseException exception)

Creates a parse change that represents an error that occurred while updating a parse result.

Parameters:
  • exception – Error that occurred.
Returns:

Parse change.

invalidate
public static <P extends IParseUnit> ParseChange<P> invalidate(FileObject resource)

Creates a parse change that represents an invalidation of given resource.

Parameters:
  • resource – Resource to invalidate.
Returns:

Parse change.

remove
public static <P extends IParseUnit> ParseChange<P> remove(FileObject resource)

Creates a parse change that represents removal of a parse result.

Parameters:
  • resource – Resource that was removed.
Returns:

Parse change.

update
public static <P extends IParseUnit> ParseChange<P> update(P unit)

Creates a parse change that represents an update to the parse result.

Parameters:
  • result – Updated parse result.
Returns:

Parse change.

ParseResultProcessor

public class ParseResultProcessor<I extends IInputUnit, P extends IParseUnit> implements IParseResultProcessor<I, P>
Constructors
ParseResultProcessor
public ParseResultProcessor(ISyntaxService<I, P> syntaxService)
Methods
error
public void error(FileObject resource, ParseException exception)
get
public P get(FileObject resource)
invalidate
public void invalidate(FileObject resource)
invalidate
public void invalidate(ILanguageImpl impl)
remove
public void remove(FileObject resource)
request
public Observable<P> request(I input)
update
public void update(FileObject resource, P unit)
updates
public Observable<ParseChange<P>> updates(FileObject resource)

org.metaborg.core.project

ConfigBasedProjectService

public class ConfigBasedProjectService implements IProjectService
Constructors
ConfigBasedProjectService
public ConfigBasedProjectService(ISourceTextService sourceTextService, IProjectConfigService projectConfigService)
Methods
get
public IProject get(FileObject resource)

DummyProjectService

public class DummyProjectService implements IProjectService
Methods
get
public IProject get(FileObject resource)

IProject

public interface IProject
Methods
config
IProjectConfig config()

Gets the configuration of the project. The configuration is read only once when this class is instantiated. To get a new configuration, get a new instance of this class.

Returns:Configuration of the project.
location
FileObject location()

Gets the location of the root folder of the project.

Returns:Location of the root folder.

IProjectService

public interface IProjectService

Interface for retrieving projects of resources.

Methods
get
IProject get(FileObject resource)

Retrieves the project of given resource.

Parameters:
  • resource – Resource to retrieve project for.
Returns:

Retrieved project, or null if no project could be retrieved.

ISimpleProjectService

public interface ISimpleProjectService extends IProjectService

Specialization of the IProjectService that supports creating and removing projects. Project instances are returned based on the file names of projects and resources. Nested projects are not supported.

Methods
create
IProject create(FileObject location)

Creates a project at given location.

Throws:
  • MetaborgException – When a project already exists at given location, or when given location is nested in another project.
Returns:

Created project.

remove
void remove(IProject project)

Removes given project.

Parameters:
  • project – Project to remove.
Throws:

NameUtil

public class NameUtil
Methods
isValidFileExtension
public static boolean isValidFileExtension(String ext)
toJavaId
public static String toJavaId(String id)

Project

public class Project implements IProject

A project.

Constructors
Project
public Project(FileObject location, IProjectConfig config)
Methods
config
public IProjectConfig config()
location
public FileObject location()
toString
public String toString()

ProjectException

public class ProjectException extends MetaborgException
Constructors
ProjectException
public ProjectException()
ProjectException
public ProjectException(String message)
ProjectException
public ProjectException(String message, Throwable cause)
ProjectException
public ProjectException(Throwable cause)

SimpleProjectService

public class SimpleProjectService implements ISimpleProjectService
Constructors
SimpleProjectService
public SimpleProjectService(ISourceTextService sourceTextService, IProjectConfigService projectConfigService)
Methods
create
public IProject create(FileObject location)
get
public IProject get(FileObject resource)
remove
public void remove(IProject project)

SingleFileProjectService

public class SingleFileProjectService implements IProjectService

Creates a project from a single file with the parent directory as project location (if possible, otherwise just the file) and no config (== null). Never returns null for the project. Doesn’t cache projects.

Constructors
SingleFileProjectService
public SingleFileProjectService(IProjectConfigService projectConfigService)
Methods
get
public IProject get(FileObject resource)

org.metaborg.core.resource

DefaultFileSystemManagerProvider

public class DefaultFileSystemManagerProvider implements Provider<FileSystemManager>

Guice provider for the VFS file system manager. Subclass and override the protected methods, and bind the provider in your Guice module, to customize the file providers.

Methods
addDefaultProvider
protected void addDefaultProvider(DefaultFileSystemManager manager)
addProviders
protected void addProviders(DefaultFileSystemManager manager)
get
public FileSystemManager get()
setBaseFile
protected void setBaseFile(DefaultFileSystemManager manager)

IResourceChangeService

public interface IResourceChangeService

Interface for subscribing to resource changes.

Methods
changes
Observable<ResourceChange> changes()

Returns an observable over resource changes. This returns a ‘hot’ observable, meaning that any changes that occurred before subscribing are NOT observed.

IResourceService

public interface IResourceService extends AutoCloseable

Interface for access to the virtual file system.

Methods
localFile
File localFile(FileObject resource)

Attempts to get a local file for given resource, or copies the resource to the local file system if it does not reside on the local file system.

Parameters:
  • resource – Resource to get a local file for.
Throws:
Returns:

Local file.

localFile
File localFile(FileObject resource, FileObject dir)

Attempts to get a local file for given resource, or copies the resource to the local file system at given directory if it does not reside on the local file system.

Parameters:
  • resource – Resource to get a local file for.
  • dir – Directory to copy the resources to if they are not on a local filesystem. Must be on the local filesystem.
Throws:
Returns:

Local file.

localPath
File localPath(FileObject resource)

Attempts to get a local file handle for given resource.

Parameters:
  • resource – Resource to get a local file handle for.
Returns:

Local file handle, or null if given resource does not reside on the local file system.

resolve
FileObject resolve(String uri)

Returns a file system object for given (absolute or relative to the root) URI. The given URI will be encoded (, /, and : symbols will not be encoded) in its entirely. If your URI is already encoded, convert it to an URI and call resolve(URI) instead. See FVS file systems for examples of URIs.

Parameters:
  • uri – Absolute or relative to the root URI to resolve.
Throws:
Returns:

File system object for given URI.

resolve
FileObject resolve(File file)

Returns a local file system object for given Java file system object.

Parameters:
  • file – Java file system object to resolve.
Throws:
Returns:

File system object for given Java file system object.

resolve
FileObject resolve(URI uri)

Returns a file system object for given Java URI object. See FVS file systems for examples of URIs.

Parameters:
  • uri – Java URI object to resolve.
Throws:
Returns:

File system object for given Java URI object.

resolve
FileObject resolve(FileObject parent, String path)

Tries to resolve path as an absolute path first, if that fails, resolves path relative to parent. If path is absolute but does not have a scheme, it is assumed to be on the local file system.

Parameters:
  • parent – Parent file object to resolve relatively to, if path is a relative path.
  • path – Path to resolve
Throws:
Returns:

File system object for given path.

resolveToName
FileName resolveToName(String uri)

Returns a file name for given URI. The given URI will be encoded (, /, and : symbols will not be encoded) in its entirely. If your URI is already encoded, convert it to an URI and call resolveToName(URI) instead. See FVS file systems for examples of URIs.

Parameters:
  • uri – URI to resolve to a name.
Throws:
Returns:

File name for given URI.

resolveToName
FileName resolveToName(URI uri)

Returns a file name for given Java URI object. See FVS file systems for examples of URIs.

Parameters:
  • uri – Java URI object to resolve to a name.
Throws:
Returns:

File name for given Java URI object.

root
FileObject root()

Returns the root file system object.

Throws:
Returns:

The root file system object.

IResourceTreeChange

public interface IResourceTreeChange

Interface for changes on resource trees between two discrete points in time. A tree represents a change in a resource, and changes in child resources.

Methods
children
Iterable<IResourceTreeChange> children()

Returns changes in children of the changed resource. Only child resources with changes will be returned. The returned changes are also trees, which can be traversed further.

kind
ResourceChangeKind kind()

Returns the kind of change.

resource
FileObject resource()

Returns the resource that has changed.

IdentifiedResourceChange

public class IdentifiedResourceChange

Resource change with an identified language and dialect.

Fields
change
public final ResourceChange change

Resource change.

dialect
public final ILanguageImpl dialect

Identified dialect of the resource change, or null if it does not have a dialect.

language
public final ILanguageImpl language

Identified language of the resource change.

Constructors
IdentifiedResourceChange
public IdentifiedResourceChange(ResourceChange change, IdentifiedDialect identifiedDialect)
IdentifiedResourceChange
public IdentifiedResourceChange(ResourceChange change, IdentifiedResource identifiedResource)
IdentifiedResourceChange
public IdentifiedResourceChange(ResourceChange change, ILanguageImpl dialect, ILanguageImpl language)
Methods
dialectOrLanguage
public ILanguageImpl dialectOrLanguage()
Returns:Dialect of the resource change, or the language if it does not belong to a dialect.
toString
public String toString()

ResourceChange

public final class ResourceChange implements Serializable
Fields
from
public final FileObject from

Resource based on the value of ResourceChange.kind.

kind
public final ResourceChangeKind kind

Kind of change.

resource
public final FileObject resource

Resource that has changed.

to
public final FileObject to

Resource based on the value of ResourceChange.kind.

Constructors
ResourceChange
public ResourceChange(FileObject resource, ResourceChangeKind kind, FileObject renamedFrom, FileObject renamedTo)
ResourceChange
public ResourceChange(FileObject resource, ResourceChangeKind kind)
ResourceChange
public ResourceChange(FileObject resource)
Methods
toString
public String toString()

ResourceChangeKind

public enum ResourceChangeKind
Enum Constants
Copy
public static final ResourceChangeKind Copy
Create
public static final ResourceChangeKind Create
Delete
public static final ResourceChangeKind Delete
Modify
public static final ResourceChangeKind Modify
Rename
public static final ResourceChangeKind Rename

ResourceService

public class ResourceService implements IResourceService
Constructors
ResourceService
public ResourceService(FileSystemManager fileSystemManager, ClassLoader classLoader)
Methods
close
public void close()
localFile
public File localFile(FileObject resource)
localFile
public File localFile(FileObject resource, FileObject dir)
localPath
public File localPath(FileObject resource)
resolve
public FileObject resolve(String uri)
resolve
public FileObject resolve(File file)
resolve
public FileObject resolve(URI uri)
resolve
public FileObject resolve(FileObject parent, String path)
resolveToName
public FileName resolveToName(String uri)
resolveToName
public FileName resolveToName(URI uri)
root
public FileObject root()

ResourceUtils

public class ResourceUtils
Methods
find
public static Iterable<FileObject> find(FileObject base, FileSelector selector)
find
public static Iterable<FileObject> find(FileObject base)
toChanges
public static Iterable<ResourceChange> toChanges(Iterable<FileObject> resources, ResourceChangeKind kind)

org.metaborg.core.source

AffectedSourceHelper

public class AffectedSourceHelper

Helper class for highlighting code in consoles.

Methods
affectedSourceText
public static String affectedSourceText(ISourceRegion region, String sourceText, String indentation)

Returns a multi-line string that highlights the affected source code region, given the full source text and indentation to use.

Parameters:
  • region – Region in the source text that should be highlighted.
  • sourceText – Full source text.
  • indentation – Indentation to add to each line in the resulting string.
Returns:

Multi-line string that highlights the affected source code region.

ISourceLocation

public interface ISourceLocation

Represents a region in a resource.

Methods
region
ISourceRegion region()
Returns:Region in the source file.
resource
FileObject resource()
Returns:Resource of the source file, or null if the source file could not be determined.

ISourceRegion

public interface ISourceRegion extends Serializable

Interface for representing a finite region in source code text. A region has:

  • Offset - number of characters from the beginning of the source text, with interval [0,#chars).
  • Row - row or line in the source text, with interval [0,#rows), or -1 if the row is not supported.
  • Column - column in the source text, with interval [0,#columns@row), or -1 if the column is not supported.

Both the starting and ending numbers are inclusive.

Methods
contains
boolean contains(ISourceRegion region)

Checks if this region contains given region.

Parameters:
  • region – Other region to check.
Returns:

True if this region contains given region, false otherwise.

endColumn
int endColumn()
Returns:Inclusive ending column in the source text with interval [0,#columns@row), or -1 if not supported by this source region.
endOffset
int endOffset()
Returns:Inclusive ending offset, the number of characters from the beginning of the source text with interval [0,#chars).
endRow
int endRow()
Returns:Inclusive ending row or line in the source text with interval [0,#rows), or -1 if not supported by this source region.
length
int length()
Returns:Length of the source region.
startColumn
int startColumn()
Returns:Inclusive starting column in the source text with interval [0,#columns@row), or -1 if not supported by this source region.
startOffset
int startOffset()
Returns:Inclusive starting offset, the number of characters from the beginning of the source text with interval [0,#chars).
startRow
int startRow()
Returns:Inclusive starting row or line in the source text with interval [0,#rows), or -1 if not supported by this source region.

ISourceTextService

public interface ISourceTextService

Interface for retrieving text of resources.

Methods
text
String text(FileObject resource)

Retrieves the text for given resource.

Parameters:
  • resource – Resource to retrieve text for.
Returns:

Text for given resource.

SourceLocation

public class SourceLocation implements ISourceLocation
Fields
region
public final ISourceRegion region
resource
public final FileObject resource
Constructors
SourceLocation
public SourceLocation(ISourceRegion region, FileObject resource)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
region
public ISourceRegion region()
resource
public FileObject resource()
toString
public String toString()

SourceRegion

public class SourceRegion implements ISourceRegion
Constructors
SourceRegion
public SourceRegion(int offset)

Creates a zero-length source region from a single offset. Row and column fields are set to -1 to indicate that they are not supported.

Parameters:
  • offset – Offset in the source file.
SourceRegion
public SourceRegion(int startOffset, int endOffset)

Creates a source region from a starting and ending offset. Row and column fields are set to -1 to indicate that they are not supported.

Parameters:
  • startOffset – Starting offset in the source file.
  • endOffset – Ending offset in the source file.
SourceRegion
public SourceRegion(int startOffset, int startRow, int startColumn, int endOffset, int endRow, int endColumn)
Methods
contains
public boolean contains(ISourceRegion region)
endColumn
public int endColumn()
endOffset
public int endOffset()
endRow
public int endRow()
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
length
public int length()
startColumn
public int startColumn()
startOffset
public int startOffset()
startRow
public int startRow()
toString
public String toString()

SourceTextService

public class SourceTextService implements ISourceTextService
Methods
text
public String text(FileObject resource)

org.metaborg.core.style

ICategorizerService

public interface ICategorizerService<P extends IParseUnit, A extends IAnalyzeUnit, F>

Interface for categorization of parse and analysis results.

Parameters:
  • <P> – Type of parse units
  • <A> – Type of analyze units.
  • <F> – Type of fragments.
Methods
categorize
Iterable<IRegionCategory<F>> categorize(ILanguageImpl langImpl, P result)

Returns a categorization of given parse result.

Parameters:
  • langImpl – Language implementation that contains the categorization logic.
  • parseResult – Parse result to categorize.
Returns:

Iterable over categories assigned to regions of the source text. Regions do not overlap and are iterated over in ascending order.

categorize
Iterable<IRegionCategory<F>> categorize(ILanguageImpl langImpl, A result)

Returns a categorization of given analysis result.

Parameters:
  • langImpl – Language implementation that contains the categorization logic.
  • analysisResult – Analysis result to categorize.
Returns:

Iterable over categories assigned to regions of the source text. Regions do not overlap and are iterated over in ascending order.

ICategory

public interface ICategory extends Serializable
Methods
name
String name()

IRegionCategory

public interface IRegionCategory<F>

Interface for categories that range over a region in source text. Created by the ICategorizerService from a parse or analysis result.

Parameters:
  • <F> – Type of fragments.
Methods
category
ICategory category()
Returns:Category assigned to the region.
fragment
F fragment()
Returns:Fragment associated with the region, or null if there is no such association.
region
ISourceRegion region()
Returns:Region in source text over which the category spans.

IRegionStyle

public interface IRegionStyle<F>

Interface for styles that range over a region in source text. Created by the IStylerService from a categorization of a parse or analysis result.

Parameters:
  • <F> – Type of fragments.
Methods
fragment
F fragment()
Returns:Fragment associated with the region, or null if there is no such association.
region
ISourceRegion region()
Returns:Region in source text over which the style spans.
style
IStyle style()
Returns:Style assigned to the region.

IStyle

public interface IStyle extends Serializable

Interface for text styles.

Methods
backgroundColor
Color backgroundColor()
Returns:Background color
bold
boolean bold()
Returns:If text should be in bold.
color
Color color()
Returns:Text color
italic
boolean italic()
Returns:If text should be in italic.
strikeout
boolean strikeout()
Returns:If text should be strikeout.
underscore
boolean underscore()
Returns:If text should be underscored.

IStylerService

public interface IStylerService<F>

Interface for styling of categorized parse and analysis results.

Parameters:
  • <F> – Type of fragments.
Methods
styleAnalyzed
Iterable<IRegionStyle<F>> styleAnalyzed(ILanguageImpl langImpl, Iterable<IRegionCategory<F>> categorization)

Returns a styling of given categorized analysis result.

Parameters:
  • langImpl – Language implementation that contains the styling logic.
  • categorization – Analysis result categorization to style.
Returns:

Iterable over styles assigned to regions of the source text. Regions do not overlap and are iterated over in ascending order.

styleParsed
Iterable<IRegionStyle<F>> styleParsed(ILanguageImpl langImpl, Iterable<IRegionCategory<F>> categorization)

Returns a styling of given categorized parse result.

Parameters:
  • langImpl – Language implementation that contains the styling logic.
  • categorization – Parse result categorization to style.
Returns:

Iterable over styles assigned to regions of the source text. Regions do not overlap and are iterated over in ascending order.

RegionCategory

public class RegionCategory<F> implements IRegionCategory<F>
Constructors
RegionCategory
public RegionCategory(ISourceRegion region, ICategory category, F fragment)
Methods
category
public ICategory category()
fragment
public F fragment()
region
public ISourceRegion region()
toString
public String toString()

RegionStyle

public class RegionStyle<F> implements IRegionStyle<F>
Constructors
RegionStyle
public RegionStyle(ISourceRegion region, IStyle style, F fragment)
Methods
fragment
public F fragment()
region
public ISourceRegion region()
style
public IStyle style()
toString
public String toString()

Style

public class Style implements IStyle
Constructors
Style
public Style(Color color, Color backgroundColor, boolean bold, boolean italic, boolean underscore, boolean strikeout)
Methods
backgroundColor
public Color backgroundColor()
bold
public boolean bold()
color
public Color color()
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
italic
public boolean italic()
strikeout
public boolean strikeout()
toString
public String toString()
underscore
public boolean underscore()

org.metaborg.core.syntax

FenceCharacters

public class FenceCharacters
Fields
close
public final String close
open
public final String open
Constructors
FenceCharacters
public FenceCharacters(String open, String close)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

IInputUnit

public interface IInputUnit extends IUnit

Unit representing a textual source file of a certain language implementation. An input unit can be passed to the ISyntaxService to parse the source file into a IParseUnit.

Methods
dialect
ILanguageImpl dialect()
Returns:Dialect of the source file, or null if it has no dialect.
langImpl
ILanguageImpl langImpl()
Returns:Language implementation of the source file.
text
String text()
Returns:Text of the source file.

IParseUnit

public interface IParseUnit extends IUnit

Unit representing a parsed source file. A parse unit can be passed to the IAnalysisService to analyze the parse unit into a IAnalyzeUnit, or passed to the ITransformService to transform the parse unit into a ITransformUnit.

Methods
duration
long duration()
Returns:Parse duration in nanoseconds, or -1 if the duration is unknown.
input
IInputUnit input()
Returns:The input unit this unit was made with.
messages
Iterable<IMessage> messages()
Returns:Messages produced by the parser.
success
boolean success()
Returns:True if parsing was successful, i.e. the parser produced a result and no errors were encountered. False otherwise.
valid
boolean valid()
Returns:True if this unit is valid, i.e. the parser parsed the source file without exceptions. Even when this unit is valid, it may still be unsuccessful, use success() to check for that.

IParser

public interface IParser<I extends IInputUnit, P extends IParseUnit>

Interface for a context-free parser implementation.

Parameters:
  • <I> – Type of input units.
  • <P> – Type of parse units.
Methods
parse
P parse(I input, IProgress progress, ICancel cancel)

Parses given input unit into a parse unit.

Parameters:
  • input – Input unit to parse.
Throws:
Returns:

Parse unit.

parseAll
Collection<P> parseAll(Iterable<I> inputs, IProgress progress, ICancel cancel)

Parses all given input units into a parse units.

Parameters:
  • inputs – Input units to parse.
Throws:
Returns:

Parse units.

ISyntaxService

public interface ISyntaxService<I extends IInputUnit, P extends IParseUnit>

Interface for context-free syntactical services, including parsing and information about lexical characters.

Parameters:
  • <I> – Type of input units.
  • <P> – Type of parse units.
Methods
available
boolean available(ILanguageImpl langImpl)

Checks if syntactical services are available for given language implementation.

Parameters:
  • langImpl – Language implementation to check.
Returns:

True if syntactical services are available, false if not.

fenceCharacters
Iterable<FenceCharacters> fenceCharacters(ILanguageImpl langImpl)
Returns:Fence (brackets, parentheses, etc.) open and close characters for given language.
multiLineCommentCharacters
Iterable<MultiLineCommentCharacters> multiLineCommentCharacters(ILanguageImpl langImpl)
Returns:Multi line comment prefix and postfix characters for given language.
parse
P parse(I input, IProgress progress, ICancel cancel)

Parses given input unit into a parse unit.

Parameters:
  • input – Input unit to parse.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Parse unit.

parse
P parse(I input)

Parses given input unit into a parse unit.

Parameters:
  • input – Input unit to parse.
Throws:
Returns:

Parse unit.

parseAll
Collection<P> parseAll(Iterable<I> inputs, IProgress progress, ICancel cancel)

Parses all given input units into a parse units.

Parameters:
  • inputs – Input units to parse.
  • progress – Progress reporter.
  • cancel – Cancellation token.
Throws:
Returns:

Parse units.

parseAll
Collection<P> parseAll(Iterable<I> inputs)

Parses all given input units into a parse units.

Parameters:
  • inputs – Input units to parse.
Throws:
Returns:

Parse units.

singleLineCommentPrefixes
Iterable<String> singleLineCommentPrefixes(ILanguageImpl langImpl)
Returns:Single line comment prefix characters for given language.

MultiLineCommentCharacters

public class MultiLineCommentCharacters
Fields
postfix
public final String postfix
prefix
public final String prefix
Constructors
MultiLineCommentCharacters
public MultiLineCommentCharacters(String prefix, String postfix)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

ParseException

public class ParseException extends MetaborgException

Exception indicating that parsing failed unexpectedly.

Fields
unit
public final IInputUnit unit
Constructors
ParseException
public ParseException(IInputUnit unit)
ParseException
public ParseException(IInputUnit unit, String message)
ParseException
public ParseException(IInputUnit unit, Throwable cause)
ParseException
public ParseException(IInputUnit unit, String message, Throwable cause)

ParseFacet

public class ParseFacet implements IFacet
Fields
type
public final String type
Constructors
ParseFacet
public ParseFacet(String type)

SyntaxService

public abstract class SyntaxService<I extends IInputUnit, P extends IParseUnit> implements ISyntaxService<I, P>
Constructors
SyntaxService
public SyntaxService(Map<String, ? extends IParser<I, P>> parsers)
Methods
available
public boolean available(ILanguageImpl langImpl)
parse
public P parse(I input, IProgress progress, ICancel cancel)
parseAll
public Collection<P> parseAll(Iterable<I> inputs, IProgress progress, ICancel cancel)

org.metaborg.core.testing

ITestReporterService

public interface ITestReporterService

Used to report the status of tests. Derive from TestReporterServiceBase instead of this interface. The base class performs some additional checks to ensure it is used correctly. Test frameworks, such as SPT, can report the status of the testing through a test reporter. Different test reporters handle these status messages differently. For example, a test reporter might simply write the test status to the standard output, whereas another test reporter would report the test results in the IDE UI.

Methods
getErr
PrintStream getErr()

Gets a stream to which test errors may be written.

Returns:A stream.
getLogger
ILogger getLogger()

Gets a logger to which the test output may be logged.

Returns:A logger.
getOut
PrintStream getOut()

Gets a stream to which test output may be written.

Returns:A stream.
sessionFinished
void sessionFinished()

The test session has finished. After this method no calls to the reporter are allowed.

sessionStarted
void sessionStarted()

A test session has started. After this method only calls to sessionFinished(), testStarted(String) and testSuiteStarted(String) are allowed.

testFailed
void testFailed(String name, String reason, String details)

The test has finished and failed. After this method only calls to sessionFinished(), testStarted(String) and testSuiteStarted(String) are allowed.

Parameters:
  • name – The name of the test.
  • reason – The reason the test failed; or null.
  • details – The details about the failed test, such as additional messages and the stack trace; or null.
testIgnored
void testIgnored(String name, String reason)

The test has finished and was ignored. After this method only calls to sessionFinished(), testStarted(String) and testSuiteStarted(String) are allowed.

Parameters:
  • name – The name of the test.
  • reason – The reason the test was ignored; or null.
testPassed
void testPassed(String name)

The test has finished and passed. After this method only calls to sessionFinished(), testStarted(String) and testSuiteStarted(String) are allowed.

Parameters:
  • name – The name of the test.
testStarted
void testStarted(String name)

A test has started. After this method only calls to testPassed(String), testFailed(String,String,String) and testIgnored(String,String) are allowed.

Parameters:
  • name – The name of the test.
testSuiteFinished
void testSuiteFinished(String name)

The test suite has finished. After this method only calls to sessionFinished(), testStarted(String) and testSuiteStarted(String) are allowed.

Parameters:
  • name – The name of the test suite.
testSuiteStarted
void testSuiteStarted(String name)

A test suite has started. After this method only calls to testSuiteStarted(String), testSuiteFinished(String) and testStarted(String) are allowed. In other words, test suites can be nested.

Parameters:
  • name – The name of the test suite.

LoggingTestReporterService

public final class LoggingTestReporterService extends TestReporterServiceBase

Test reporter that logs to the logger, standard out and standard error. If you want to change the default output of a test runner (e.g. SPT), this is the place to be.

Methods
getErr
public PrintStream getErr()
getLogger
public ILogger getLogger()
getOut
public PrintStream getOut()
onSessionFinished
protected void onSessionFinished()
onSessionStarted
protected void onSessionStarted()
onTestFailed
protected void onTestFailed(String name, String reason, String details)
onTestIgnored
protected void onTestIgnored(String name, String reason)
onTestPassed
protected void onTestPassed(String name)
onTestStarted
protected void onTestStarted(String name)
onTestSuiteFinished
protected void onTestSuiteFinished(String name)
onTestSuiteStarted
protected void onTestSuiteStarted(String name)

TeamCityLogger

public class TeamCityLogger extends AbstractLogger

Logger producing TeamCity messages.

Constructors
TeamCityLogger
public TeamCityLogger(TeamCityWriter writer)
Methods
debug
public void debug(String msg, Throwable cause)
debugEnabled
public boolean debugEnabled()
error
public void error(String msg, Throwable cause)
errorEnabled
public boolean errorEnabled()
format
public String format(String msg, Object... args)
info
public void info(String msg, Throwable cause)
infoEnabled
public boolean infoEnabled()
trace
public void trace(String msg, Throwable cause)
traceEnabled
public boolean traceEnabled()
warn
public void warn(String msg, Throwable cause)
warnEnabled
public boolean warnEnabled()

TeamCityTestReporterService

public class TeamCityTestReporterService extends TestReporterServiceBase

Test reporter that produces TeamCity test service messages.

See also: ` Build Script Interaction with TeamCity <https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity>`_

Constructors
TeamCityTestReporterService
public TeamCityTestReporterService(TeamCityWriter writer, TeamCityLogger logger)
Methods
getErr
public PrintStream getErr()
getLogger
public ILogger getLogger()
getOut
public PrintStream getOut()
onSessionFinished
protected void onSessionFinished()
onSessionStarted
protected void onSessionStarted()
onTestFailed
protected void onTestFailed(String name, String reason, String details)
onTestIgnored
protected void onTestIgnored(String name, String reason)
onTestPassed
protected void onTestPassed(String name)
onTestStarted
protected void onTestStarted(String name)
onTestSuiteFinished
protected void onTestSuiteFinished(String name)
onTestSuiteStarted
protected void onTestSuiteStarted(String name)

TeamCityWriter

public class TeamCityWriter

Writes Teamcity messages.

Constructors
TeamCityWriter
public TeamCityWriter()

Creates a new instance of TeamCityWriter that writes to standard out and has no flow ID.

TeamCityWriter
public TeamCityWriter(PrintStream output, String flowID)

Creates a new instance of TeamCityWriter.

Parameters:
  • output – The stream to write to.
  • flowID – he flow ID that indicates which messages belong together; or null.
Methods
send
public void send(String name, Attribute... attributes)

Sends a TeamCity message.

Parameters:
  • name – The message name.
  • attributes – A list of pairs of attribute names and values. When a value is null, it is ignored. Values are escaped properly.

TeamCityWriter.Attribute

public static final class Attribute

An attribute in a Teamcity message.

Fields
name
public final String name
value
public final Object value
Constructors
Attribute
public Attribute(String name, Object value)

TestReporterServiceBase

public abstract class TestReporterServiceBase implements ITestReporterService

Used to report the status of tests. This base class performs some additional checks to ensure it is used correctly.

Methods
onSessionFinished
protected abstract void onSessionFinished()

The test session has finished.

onSessionStarted
protected abstract void onSessionStarted()

A test session has started.

onTestFailed
protected abstract void onTestFailed(String name, String reason, String details)

The test has finished and failed.

Parameters:
  • name – The name of the test.
  • reason – The reason the test failed; or null.
  • details – The details about the failed test, such as additional messages and the stack trace; or null.
onTestIgnored
protected abstract void onTestIgnored(String name, String reason)

The test has finished and was ignored.

Parameters:
  • name – The name of the test.
  • reason – The reason the test was ignored; or null.
onTestPassed
protected abstract void onTestPassed(String name)

The test has finished and passed.

Parameters:
  • name – The name of the test.
onTestStarted
protected abstract void onTestStarted(String name)

A test has started.

Parameters:
  • name – The name of the test.
onTestSuiteFinished
protected abstract void onTestSuiteFinished(String name)

The test suite has finished.

Parameters:
  • name – The name of the test suite.
onTestSuiteStarted
protected abstract void onTestSuiteStarted(String name)

A test suite has started. Test suites can be nested.

Parameters:
  • name – The name of the test suite.
sessionFinished
public final void sessionFinished()
sessionStarted
public final void sessionStarted()
testFailed
public final void testFailed(String name, String reason, String details)
testIgnored
public final void testIgnored(String name, String reason)
testPassed
public final void testPassed(String name)
testStarted
public final void testStarted(String name)
testSuiteFinished
public final void testSuiteFinished(String name)
testSuiteStarted
public final void testSuiteStarted(String name)

org.metaborg.core.tracing

Hover

public class Hover

Represents hover information produced by the hover service.

Fields
region
public final ISourceRegion region

Region in the source file where the hover information is for.

text
public final String text

Text to show as hover information.

Constructors
Hover
public Hover(ISourceRegion region, String text)

IHoverService

public interface IHoverService<P extends IParseUnit, A extends IAnalyzeUnit>

Interface for getting hover tooltip information.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
Methods
available
boolean available(ILanguageImpl language)

Checks if hover tooltip information is available for given language implementation.

Parameters:
  • language – Language implementation to check.
Returns:

True if hover tooltip information is available, false if not.

hover
Hover hover(int offset, P input)

Attempts to get hover tooltip information at offset in the source text, using given parsed input for resolving and tracing.

Parameters:
  • offset – Offset in the source text.
  • input – Parsed input to use for tracing.
Throws:
Returns:

Hover tooltip information if successful, or null if no information can be retrieved.

hover
Hover hover(int offset, A input)

Attempts to get hover tooltip information at offset in the source text, using given analyzed input for resolving and tracing.

Parameters:
  • offset – Offset in the source text.
  • input – Analyzed input to use for tracing.
Throws:
Returns:

Hover tooltip information if successful, or null if no information can be retrieved.

IResolverService

public interface IResolverService<P extends IParseUnit, A extends IAnalyzeUnit>

Interface for reference resolution, resolving use sites to their definition sites.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
Methods
available
boolean available(ILanguageImpl language)

Checks if reference resolution is available for given language implementation.

Parameters:
  • language – Language implementation to check.
Returns:

True if reference resolution is available, false if not.

resolve
Resolution resolve(int offset, P input)

Attempt to resolve use site at offset in the source text, using given parse result for resolving and tracing.

Parameters:
  • offset – Offset in the source text to perform reference resolution for.
  • input – Parsed input to use for resolving and tracing.
Throws:
Returns:

Resolution if reference resolution was successful, or null if no resolution could be made.

resolve
Resolution resolve(int offset, A input)

Attempt to resolve use site at offset in the source text, using given analysis result for resolving and tracing.

Parameters:
  • offset – Offset in the source text to perform reference resolution for.
  • input – Analyzed input to use for resolving and tracing.
Throws:
Returns:

Resolution if reference resolution was successful, or null if no resolution could be made.

ITracingService

public interface ITracingService<P extends IParseUnit, A extends IAnalyzeUnit, T extends ITransformUnit<?>, F>

Interface for tracing between parsed, analyzed, and transformed fragments and results, and their region in source files.

Parameters:
  • <P> – Type of parse units
  • <A> – Type of analyze units.
  • <T> – Type of transform units.
  • <F> – Type of fragments.
Methods
fragments
Iterable<F> fragments(P result, ISourceRegion region)

Finds a fragment and its ancestors that contain given region, in given parse result.

Parameters:
  • result – Parsed result to get fragments from.
  • region – Region inside the result to get fragments for.
Returns:

Fragment and its ancestors that contain given region. The returned iterable iterates from deepest (leaf) fragment to outermost (root) fragment. An empty iterable is returned when no fragments could be found.

fragments
Iterable<F> fragments(A result, ISourceRegion region)

Finds a fragment and its ancestors that contain given region, in given analysis file result.

Parameters:
  • result – Analyzed result to get fragments from.
  • region – Region inside the result to get fragments for.
Returns:

Fragment and its ancestors that contain given region. The returned iterable iterates from deepest (leaf) fragment to outermost (root) fragment. An empty iterable is returned when no fragments could be found.

fragments
Iterable<F> fragments(T result, ISourceRegion region)

Finds a fragment and its ancestors that contain given region, in given transform result.

Parameters:
  • result – Transformed result to get fragments from.
  • region – Region inside the to get fragments for.
Returns:

Fragment and its ancestors that contain given region. The returned iterable iterates from deepest (leaf) fragment to outermost (root) fragment. An empty iterable is returned when no fragments could be found.

fragmentsWithin
Iterable<F> fragmentsWithin(P result, ISourceRegion region)

Finds all fragments contained within the given region. This only returns the outermost fragments that are contained in the region. Their children are trivially also contained in the region and will not be added separately to the returned result.

Parameters:
  • result – Parsed result to get fragments from.
  • region – Region inside the result to get fragments for.
Returns:

Fragments contained within the given region. An empty iterable is returned when no fragments could be found.

fragmentsWithin
Iterable<F> fragmentsWithin(A result, ISourceRegion region)

Finds all fragments contained within the given region. This only returns the outermost fragments that are contained in the region. Their children are trivially also contained in the region and will not be added separately to the returned result.

Parameters:
  • result – Analyzed result to get fragments from.
  • region – Region inside the result to get fragments for.
Returns:

Fragments contained within the given region. An empty iterable is returned when no fragments could be found.

fragmentsWithin
Iterable<F> fragmentsWithin(T result, ISourceRegion region)

Finds all fragments contained within the given region. This only returns the outermost fragments that are contained in the region. Their children are trivially also contained in the region and will not be added separately to the returned result.

Parameters:
  • result – Transformed result to get fragments from.
  • region – Region inside the result to get fragments for.
Returns:

Fragments contained within the given region. An empty iterable is returned when no fragments could be found.

location
ISourceLocation location(F fragment)

Retrieves the source location of given fragment.

Parameters:
  • fragment – Fragment to get source location for.
Returns:

Source location, or null if it could not be determined.

origin
F origin(F fragment)

Retrieves the originating fragment of given fragment.

Parameters:
  • fragment – Fragment to get origin for.
Returns:

Originating fragment, or null if it could not be determined.

Resolution

public class Resolution

Represents a resolution produced by reference resolution.

Fields
highlight
public final ISourceRegion highlight

Area in the source file to highlight as a hyperlink.

targets
public final Iterable<ResolutionTarget> targets

Resolution targets. Multiple targets indicate resolution to multiple valid locations.

Constructors
Resolution
public Resolution(ISourceRegion highlight, Iterable<ResolutionTarget> targets)

ResolutionTarget

public class ResolutionTarget
Fields
hyperlinkName
public final String hyperlinkName
location
public final ISourceLocation location
Constructors
ResolutionTarget
public ResolutionTarget(ISourceLocation location)
ResolutionTarget
public ResolutionTarget(String hyperlinkName, ISourceLocation location)

org.metaborg.core.transform

ITransformConfig

public interface ITransformConfig

Optional configuration for the transform service.

Methods
dryRun
public boolean dryRun()

If this returns true, the transformation should be performed without side effects like writing output files.

ITransformOutput

public interface ITransformOutput

Class representing output of a transformation.

Methods
name
String name()

Name of the output result, usually a string representation of the output file.

output
FileObject output()

Output file, or null if output was not written to a file.

ITransformService

public interface ITransformService<P extends IParseUnit, A extends IAnalyzeUnit, TP extends ITransformUnit<P>, TA extends ITransformUnit<A>>

Interface for transformations on parsed or analyzed files.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <TP> – Type of transform units with parse units as input.
  • <TA> – Type of transform units with analyze units as input.
Methods
available
boolean available(IContext context, ITransformGoal goal)

Checks if transform actions are available for given context and goal.

Parameters:
  • context – Context to check transform actions from.
  • goal – Goal to check transform actions for.
Returns:

True if transform actions are available, false if not.

requiresAnalysis
boolean requiresAnalysis(IContext context, ITransformGoal goal)

Checks if analysis is required before transformation, for given context and goal.

Parameters:
  • context – Context to check from.
  • goal – Goal to check for.
Returns:

True if analysis is required, false if not.

transform
Collection<TP> transform(P input, IContext context, ITransformGoal goal)

Transforms parse input in a context with given goal.

Parameters:
  • input – Parsed input to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
Throws:
Returns:

Transformation result.

transform
Collection<TP> transform(P input, IContext context, ITransformGoal goal, ITransformConfig config)

Transforms parse input in a context with given goal.

Parameters:
  • input – Parsed input to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation result.

transform
TP transform(P input, IContext context, TransformActionContrib action)

Transforms parse input in a context with given action.

Parameters:
  • input – Parsed input to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
Throws:
Returns:

Transformation result.

transform
TP transform(P input, IContext context, TransformActionContrib action, ITransformConfig config)

Transforms parse input in a context with given action.

Parameters:
  • input – Parsed input to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation result.

transform
Collection<TA> transform(A input, IContext context, ITransformGoal goal)

Transforms analyzed input in a context with given goal.

Parameters:
  • input – Analyzed input to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
Throws:
Returns:

Transformation result.

transform
Collection<TA> transform(A input, IContext context, ITransformGoal goal, ITransformConfig config)

Transforms analyzed input in a context with given goal.

Parameters:
  • input – Analyzed input to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation result.

transform
TA transform(A input, IContext context, TransformActionContrib action)

Transforms analyzed input in a context with given action.

Parameters:
  • input – Analyzed input to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
Throws:
Returns:

Transformation result.

transform
TA transform(A input, IContext context, TransformActionContrib action, ITransformConfig config)

Transforms analyzed input in a context with given action.

Parameters:
  • input – Analyzed input to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation result.

transformAllAnalyzed
Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, ITransformGoal goal)

Transforms analyzed inputs in a context with given goal.

Parameters:
  • inputs – Analyzed inputs to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
Throws:
Returns:

Transformation results.

transformAllAnalyzed
Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, ITransformGoal goal, ITransformConfig config)

Transforms analyzed inputs in a context with given goal.

Parameters:
  • inputs – Analyzed inputs to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation results.

transformAllAnalyzed
Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, TransformActionContrib action)

Transforms analyzed inputs in a context with given action.

Parameters:
  • input – Analyzed inputs to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
Throws:
Returns:

Transformation results.

transformAllAnalyzed
Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, TransformActionContrib action, ITransformConfig config)

Transforms analyzed inputs in a context with given action.

Parameters:
  • input – Analyzed inputs to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation results.

transformAllParsed
Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, ITransformGoal goal)

Transforms parse inputs in a context with given goal.

Parameters:
  • inputs – Parsed inputs to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
Throws:
Returns:

Transformation results.

transformAllParsed
Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, ITransformGoal goal, ITransformConfig config)

Transforms parse inputs in a context with given goal.

Parameters:
  • inputs – Parsed inputs to transform.
  • context – Context in which to apply transformation.
  • goal – Transform goal to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation results.

transformAllParsed
Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, TransformActionContrib action)

Transforms parse input in a context with given action.

Parameters:
  • inputs – Parsed inputs to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
Throws:
Returns:

Transformation results.

transformAllParsed
Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, TransformActionContrib action, ITransformConfig config)

Transforms parse input in a context with given action.

Parameters:
  • inputs – Parsed inputs to transform.
  • context – Context in which to apply transformation.
  • action – Transform action to execute.
  • config – Configuration settings for the execution of the transformation.
Throws:
Returns:

Transformation results.

ITransformUnit

public interface ITransformUnit<I extends IUnit> extends IUnit

Unit representing a transformed source file.

Parameters:
  • <I> – Type of input unit.
Methods
action
TransformActionContrib action()
Returns:The action that was used to execute the transformation.
context
IContext context()
Returns:The context that was used during transformation.
duration
long duration()
Returns:Transformation duration in nanoseconds, or -1 if the duration is unknown.
input
I input()
Returns:The unit this unit was made with.
messages
Iterable<IMessage> messages()
Returns:Messages produced by the transformer.
outputs
Iterable<? extends ITransformOutput> outputs()
Returns:Outputs of the transformation. Empty if valid() returns false.
success
boolean success()
Returns:True if transformation was successful, i.e. the transformed produced a result and no errors were encountered. False otherwise.
valid
boolean valid()
Returns:True if this unit is valid, i.e. the transformed transformed the input unit without exceptions. Even when the unit is valid, it may still be unsuccessful, use success() to check for that.

ITransformer

public interface ITransformer<P extends IParseUnit, A extends IAnalyzeUnit, TP extends ITransformUnit<P>, TA extends ITransformUnit<A>>

Interface for transformation implementations.

Parameters:
  • <P> – Type of parse units.
  • <A> – Type of analyze units.
  • <TP> – Type of transform units with parse units as input.
  • <TA> – Type of transform units with analyze units as input.
Methods
transform
TP transform(P input, IContext context, TransformActionContrib action, ITransformConfig config)
transform
TA transform(A input, IContext context, TransformActionContrib action, ITransformConfig config)
transformAllAnalyzed
Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, TransformActionContrib action, ITransformConfig config)
transformAllParsed
Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, TransformActionContrib action, ITransformConfig config)

TransformConfig

public class TransformConfig implements ITransformConfig
Constructors
TransformConfig
public TransformConfig()
TransformConfig
public TransformConfig(boolean dry)
Methods
dryRun
public boolean dryRun()

TransformException

public class TransformException extends MetaborgException

Exception indicating that transformation failed unexpectedly.

Constructors
TransformException
public TransformException(String msg)
TransformException
public TransformException(String msg, Throwable t)
TransformException
public TransformException(Throwable t)

TransformService

public class TransformService<P extends IParseUnit, A extends IAnalyzeUnit, TP extends ITransformUnit<P>, TA extends ITransformUnit<A>> implements ITransformService<P, A, TP, TA>
Constructors
TransformService
public TransformService(IActionService actionService, IAnalysisService<P, A, ?> analysisService, ITransformer<P, A, TP, TA> transformer)
Methods
available
public boolean available(IContext context, ITransformGoal goal)
requiresAnalysis
public boolean requiresAnalysis(IContext context, ITransformGoal goal)
transform
public Collection<TP> transform(P input, IContext context, ITransformGoal goal, ITransformConfig config)
transform
public TP transform(P input, IContext context, TransformActionContrib action, ITransformConfig config)
transform
public Collection<TA> transform(A input, IContext context, ITransformGoal goal, ITransformConfig config)
transform
public TA transform(A input, IContext context, TransformActionContrib action, ITransformConfig config)
transformAllAnalyzed
public Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, ITransformGoal goal, ITransformConfig config)
transformAllAnalyzed
public Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, TransformActionContrib action, ITransformConfig config)
transformAllParsed
public Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, ITransformGoal goal, ITransformConfig config)
transformAllParsed
public Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, TransformActionContrib action, ITransformConfig config)

org.metaborg.core.unit

IInputUnitService

public interface IInputUnitService<I extends IInputUnit>
Methods
emptyInputUnit
I emptyInputUnit(FileObject source, ILanguageImpl langImpl, ILanguageImpl dialect)
emptyInputUnit
I emptyInputUnit(ILanguageImpl langImpl, ILanguageImpl dialect)
inputUnit
I inputUnit(FileObject source, String text, ILanguageImpl langImpl, ILanguageImpl dialect)
inputUnit
I inputUnit(String text, ILanguageImpl langImpl, ILanguageImpl dialect)

IUnit

public interface IUnit

Results of operations on a single source file. Extensible through unit contributions.

Methods
detached
boolean detached()
Returns:True if the unit is detached, i.e. the source is unknown. False otherwise.
source
FileObject source()
Returns:Source file that operations were executed on, or null if the source file is unknown. The source file can be unknown when executing operations on a string of text in memory for example. When the source is unknown, this unit is detached.
unitContrib
IUnitContrib unitContrib(String id)

Returns a unit contribution with given identifier.

Parameters:
  • id – Unit contribution identifier.
Returns:

Unit contribution with given identifier, or null if it does not exist.

unitContribs
Iterable<IUnitContrib> unitContribs()
Returns:All unit contributions.

IUnitContrib

public interface IUnitContrib
Methods
id
String id()

IUnitService

public interface IUnitService<I extends IInputUnit, P extends IParseUnit, A extends IAnalyzeUnit, AU extends IAnalyzeUnitUpdate, TP extends ITransformUnit<P>, TA extends ITransformUnit<A>> extends IInputUnitService<I>
Methods
emptyAnalyzeUnit
A emptyAnalyzeUnit(P input, IContext context)
emptyAnalyzeUnitUpdate
AU emptyAnalyzeUnitUpdate(FileObject source, IContext context)
emptyParseUnit
P emptyParseUnit(I input)
emptyTransformUnit
TP emptyTransformUnit(P input, IContext context, TransformActionContrib action)
emptyTransformUnit
TA emptyTransformUnit(A input, IContext context, TransformActionContrib action)

Javadoc

org.metaborg.spoofax.core

Spoofax

public class Spoofax extends MetaBorgGeneric<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>, IStrategoTerm>

Facade for instantiating and accessing the Metaborg API, instantiated with the Spoofax implementation.

Fields
analysisResultProcessor
public final ISpoofaxAnalysisResultProcessor analysisResultProcessor
analysisService
public final ISpoofaxAnalysisService analysisService
builder
public final ISpoofaxBuilder builder
categorizerService
public final ISpoofaxCategorizerService categorizerService
completionService
public final ISpoofaxCompletionService completionService
hoverService
public final ISpoofaxHoverService hoverService
outlineService
public final ISpoofaxOutlineService outlineService
parseResultProcessor
public final ISpoofaxParseResultProcessor parseResultProcessor
processorRunner
public final ISpoofaxProcessorRunner processorRunner
resolverService
public final ISpoofaxResolverService resolverService
strategoCommon
public final IStrategoCommon strategoCommon
strategoRuntimeService
public final IStrategoRuntimeService strategoRuntimeService
stylerService
public final ISpoofaxStylerService stylerService
syntaxService
public final ISpoofaxSyntaxService syntaxService
termFactoryService
public final ITermFactoryService termFactoryService
tracingService
public final ISpoofaxTracingService tracingService
transformService
public final ISpoofaxTransformService transformService
unitService
public final ISpoofaxUnitService unitService
Constructors
Spoofax
public Spoofax(IModulePluginLoader loader, SpoofaxModule module, Module... additionalModules)

Instantiate the MetaBorg API with a Spoofax implementation.

Parameters:
  • loader – Module plugin loader to use.
  • module – Spoofax module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Spoofax
public Spoofax(SpoofaxModule module, Module... additionalModules)

Instantiate the MetaBorg API with a Spoofax implementation.

Parameters:
  • module – Spoofax module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Spoofax
public Spoofax(IModulePluginLoader loader, Module... additionalModules)

Instantiate the MetaBorg API with a Spoofax implementation.

Parameters:
  • loader – Module plugin loader to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Spoofax
public Spoofax(Module... additionalModules)

Instantiate the MetaBorg API with a Spoofax implementation.

Parameters:
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Methods
defaultModule
protected static SpoofaxModule defaultModule()

SpoofaxConstants

public class SpoofaxConstants
Fields
DIR_BUILD
public static final String DIR_BUILD
DIR_CACHE
public static final String DIR_CACHE
DIR_CLASSES
public static final String DIR_CLASSES
DIR_EDITOR
public static final String DIR_EDITOR
DIR_ICONS
public static final String DIR_ICONS
DIR_INCLUDE
public static final String DIR_INCLUDE
DIR_LIB
public static final String DIR_LIB
DIR_OUTPUT
public static final String DIR_OUTPUT
DIR_SRCGEN
public static final String DIR_SRCGEN
DIR_SRCGEN_SYNTAX
public static final String DIR_SRCGEN_SYNTAX
DIR_STR_JAVA
public static final String DIR_STR_JAVA
DIR_STR_JAVA_CLASSES
public static final String DIR_STR_JAVA_CLASSES
DIR_STR_JAVA_TRANS
public static final String DIR_STR_JAVA_TRANS
DIR_SYNTAX
public static final String DIR_SYNTAX
DIR_TESTCLASSES
public static final String DIR_TESTCLASSES
DIR_TRANS
public static final String DIR_TRANS
GROUP_ID
public static final String GROUP_ID
LANG_ATERM_ID
public static final String LANG_ATERM_ID
LANG_ATERM_NAME
public static final String LANG_ATERM_NAME
LANG_DYNSEM_ID
public static final String LANG_DYNSEM_ID
LANG_DYNSEM_NAME
public static final String LANG_DYNSEM_NAME
LANG_ESV_ID
public static final String LANG_ESV_ID
LANG_ESV_NAME
public static final String LANG_ESV_NAME
LANG_FLOWSPEC_ID
public static final String LANG_FLOWSPEC_ID
LANG_FLOWSPEC_NAME
public static final String LANG_FLOWSPEC_NAME
LANG_NABL2_ID
public static final String LANG_NABL2_ID
LANG_NABL2_NAME
public static final String LANG_NABL2_NAME
LANG_NABL_ID
public static final String LANG_NABL_ID
LANG_NABL_NAME
public static final String LANG_NABL_NAME
LANG_SDF3_ID
public static final String LANG_SDF3_ID
LANG_SDF3_NAME
public static final String LANG_SDF3_NAME
LANG_SDF_ID
public static final String LANG_SDF_ID
LANG_SDF_NAME
public static final String LANG_SDF_NAME
LANG_SPT_ID
public static final String LANG_SPT_ID
LANG_STRATEGO_ID
public static final String LANG_STRATEGO_ID
LANG_STRATEGO_NAME
public static final String LANG_STRATEGO_NAME
LANG_TS_ID
public static final String LANG_TS_ID
LANG_TS_NAME
public static final String LANG_TS_NAME
LIB_ANALYSIS_ID
public static final String LIB_ANALYSIS_ID
LIB_ANALYSIS_NAME
public static final String LIB_ANALYSIS_NAME
META_LANG_IDS
public static final Set<String> META_LANG_IDS
META_LANG_NAMES
public static final Set<String> META_LANG_NAMES
STRJ_INFO_WRITING_FILE
public static final String STRJ_INFO_WRITING_FILE
Methods
isMetaLanguage
public static boolean isMetaLanguage(ILanguageImpl language)
isMetaLanguage
public static boolean isMetaLanguage(LanguageIdentifier identifier)
isMetaLanguage
public static boolean isMetaLanguage(String groupId, String id)
isMetaLanguage
public static boolean isMetaLanguage(String name)

SpoofaxModule

public class SpoofaxModule extends MetaborgModule

Guice module that specifies which implementations to use for services and factories.

Constructors
SpoofaxModule
public SpoofaxModule()
SpoofaxModule
public SpoofaxModule(ClassLoader resourceClassLoader)
Methods
bindAction
protected void bindAction()
bindAnalysis
protected void bindAnalysis()

Overrides MetaborgModule.bindAnalysis() to provide Spoofax-specific bindings with Spoofax interfaces, and to provide analyzers.

bindBuilder
protected void bindBuilder()

Overrides MetaborgModule.bindBuilder() to provide Spoofax-specific bindings with generics filled in as IStrategoTerm.

bindCategorizer
protected void bindCategorizer()
bindCompletion
protected void bindCompletion()
bindContextFactories
protected void bindContextFactories(MapBinder<String, IContextFactory> binder)
bindLanguage
protected void bindLanguage()
bindMenu
protected void bindMenu()
bindOutline
protected void bindOutline()
bindParsers
protected void bindParsers(MapBinder<String, IParser<ISpoofaxInputUnit, ISpoofaxParseUnit>> parserBinder, MapBinder<String, ISpoofaxParser> spoofaxParserBinder)
bindPrimitive
protected static void bindPrimitive(Multibinder<AbstractPrimitive> binder, AbstractPrimitive primitive)
bindPrimitive
protected static void bindPrimitive(Multibinder<AbstractPrimitive> binder, Class<? extends AbstractPrimitive> primitive)
bindPrimitiveLibrary
protected static void bindPrimitiveLibrary(Multibinder<IOperatorRegistry> binder, Class<? extends IOperatorRegistry> primitiveLibrary)
bindProcessor
protected void bindProcessor()

Overrides MetaborgModule.bindProcessor() to provide Spoofax-specific bindings with generics filled in as IStrategoTerm.

bindProcessorRunner
protected void bindProcessorRunner()

Overrides MetaborgModule.bindProcessorRunner() to provide Spoofax-specific bindings with generics filled in as IStrategoTerm.

bindProjectConfig
protected void bindProjectConfig()
bindStyler
protected void bindStyler()
bindSyntax
protected void bindSyntax()
bindTracing
protected void bindTracing()
bindTransformer
protected void bindTransformer()
bindUnit
protected void bindUnit()
configure
protected void configure()

org.metaborg.spoofax.core.action

ActionFacet

public class ActionFacet implements IFacet
Fields
actions
public final Multimap<ITransformGoal, ITransformAction> actions
Constructors
ActionFacet
public ActionFacet(Multimap<ITransformGoal, ITransformAction> actions, Iterable<? extends IMenuItem> menuItems)
Methods
actions
public Iterable<ITransformAction> actions(ITransformGoal goal)

ActionFacetFromESV

public class ActionFacetFromESV
Methods
create
public static ActionFacet create(IStrategoAppl esv)

ActionService

public class ActionService implements IActionService
Methods
actionContributions
public Collection<TransformActionContrib> actionContributions(ILanguageImpl language, ITransformGoal goal)
actions
public Collection<ITransformAction> actions(ILanguageImpl language, ITransformGoal goal)
available
public boolean available(ILanguageImpl language, ITransformGoal goal)
requiresAnalysis
public boolean requiresAnalysis(ILanguageImpl language, ITransformGoal goal)

TransformAction

public class TransformAction implements ITransformAction
Fields
flags
public final TransformActionFlags flags
goal
public final ITransformGoal goal
name
public final String name
strategy
public final String strategy
Constructors
TransformAction
public TransformAction(String name, ITransformGoal goal, TransformActionFlags flags, String strategy)
Methods
flags
public TransformActionFlags flags()
goal
public ITransformGoal goal()
name
public String name()
toString
public String toString()

org.metaborg.spoofax.core.analysis

AnalysisCommon

public class AnalysisCommon
Constructors
AnalysisCommon
public AnalysisCommon(ISpoofaxTracingService tracingService)
Methods
ambiguityMessages
public Collection<IMessage> ambiguityMessages(FileObject resource, IStrategoTerm ast)
analysisFailedMessage
public String analysisFailedMessage(HybridInterpreter interpreter)
messages
public Collection<IMessage> messages(FileObject resource, MessageSeverity severity, IStrategoTerm messagesTerm)
messages
public Multimap<FileObject, IMessage> messages(MessageSeverity severity, IStrategoTerm messagesTerm)

AnalysisFacet

public class AnalysisFacet implements IFacet
Fields
strategyName
public final String strategyName
Constructors
AnalysisFacet
public AnalysisFacet(String strategyName)

AnalysisFacetFromESV

public class AnalysisFacetFromESV
Methods
create
public static AnalysisFacet create(IStrategoAppl esv)
hasAnalysis
public static boolean hasAnalysis(IStrategoAppl esv)
type
public static String type(IStrategoAppl esv)

ISpoofaxAnalysisService

public interface ISpoofaxAnalysisService extends IAnalysisService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate>

Typedef interface for IAnalysisService with Spoofax interfaces.

Methods
analyze
ISpoofaxAnalyzeResult analyze(ISpoofaxParseUnit input, IContext context, IProgress progress, ICancel cancel)

{@inheritDoc}

analyzeAll
ISpoofaxAnalyzeResults analyzeAll(Iterable<ISpoofaxParseUnit> inputs, IContext context, IProgress progress, ICancel cancel)

{@inheritDoc}

ISpoofaxAnalyzeResult

public interface ISpoofaxAnalyzeResult extends IAnalyzeResult<ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate>

Typedef interface for IAnalyzeResult with Spoofax interfaces.

Methods
debugData
Object debugData()
Returns:Debug data produced by analysis, or null if there is none.

ISpoofaxAnalyzeResults

public interface ISpoofaxAnalyzeResults extends IAnalyzeResults<ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate>

Typedef interface for IAnalyzeResults with Spoofax interfaces.

Methods
debugData
Object debugData()
Returns:Debug data produced by analysis, or null if there is none.

ISpoofaxAnalyzer

public interface ISpoofaxAnalyzer extends IAnalyzer<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate>

Typedef interface for IAnalyzer with Spoofax interfaces.

Methods
analyze
ISpoofaxAnalyzeResult analyze(ISpoofaxParseUnit input, IContext context, IProgress progress, ICancel cancel)

{@inheritDoc}

analyzeAll
ISpoofaxAnalyzeResults analyzeAll(Iterable<ISpoofaxParseUnit> inputs, IContext context, IProgress progress, ICancel cancel)

{@inheritDoc}

SpoofaxAnalysisService

public class SpoofaxAnalysisService extends AnalysisService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate> implements ISpoofaxAnalysisService

Typedef class for AnalysisService with Spoofax interfaces.

Methods
analyze
public ISpoofaxAnalyzeResult analyze(ISpoofaxParseUnit input, IContext context, IProgress progress, ICancel cancel)
analyzeAll
public ISpoofaxAnalyzeResults analyzeAll(Iterable<ISpoofaxParseUnit> inputs, IContext context, IProgress progress, ICancel cancel)

SpoofaxAnalyzeResult

public class SpoofaxAnalyzeResult extends AnalyzeResult<ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate> implements ISpoofaxAnalyzeResult

Typedef class for AnalyzeResult with Spoofax interfaces.

Constructors
SpoofaxAnalyzeResult
public SpoofaxAnalyzeResult(ISpoofaxAnalyzeUnit result, Collection<ISpoofaxAnalyzeUnitUpdate> updates, IContext context, Object debugData)
SpoofaxAnalyzeResult
public SpoofaxAnalyzeResult(ISpoofaxAnalyzeUnit result, Collection<ISpoofaxAnalyzeUnitUpdate> updates, IContext context)
SpoofaxAnalyzeResult
public SpoofaxAnalyzeResult(ISpoofaxAnalyzeUnit result, IContext context, Object debugData)
SpoofaxAnalyzeResult
public SpoofaxAnalyzeResult(ISpoofaxAnalyzeUnit result, IContext context)
Methods
debugData
public Object debugData()

SpoofaxAnalyzeResults

public class SpoofaxAnalyzeResults extends AnalyzeResults<ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate> implements ISpoofaxAnalyzeResults

Typedef class for AnalyzeResults with Spoofax interfaces.

Constructors
SpoofaxAnalyzeResults
public SpoofaxAnalyzeResults(Collection<ISpoofaxAnalyzeUnit> results, Collection<ISpoofaxAnalyzeUnitUpdate> updates, IContext context, Object debugData)
SpoofaxAnalyzeResults
public SpoofaxAnalyzeResults(Collection<ISpoofaxAnalyzeUnit> results, Collection<ISpoofaxAnalyzeUnitUpdate> updates, IContext context)
SpoofaxAnalyzeResults
public SpoofaxAnalyzeResults(Collection<ISpoofaxAnalyzeUnit> results, IContext context, Object debugData)
SpoofaxAnalyzeResults
public SpoofaxAnalyzeResults(Collection<ISpoofaxAnalyzeUnit> results, IContext context)
SpoofaxAnalyzeResults
public SpoofaxAnalyzeResults(IContext context, Object debugData)
SpoofaxAnalyzeResults
public SpoofaxAnalyzeResults(IContext context)
Methods
debugData
public Object debugData()

org.metaborg.spoofax.core.analysis.constraint

AbstractConstraintAnalyzer

public abstract class AbstractConstraintAnalyzer implements ISpoofaxAnalyzer
Fields
analysisCommon
protected final AnalysisCommon analysisCommon
resourceService
protected final IResourceService resourceService
runtimeService
protected final IStrategoRuntimeService runtimeService
strategoCommon
protected final IStrategoCommon strategoCommon
termFactory
protected final ITermFactory termFactory
tracingService
protected final ISpoofaxTracingService tracingService
unitService
protected final ISpoofaxUnitService unitService
Constructors
AbstractConstraintAnalyzer
public AbstractConstraintAnalyzer(AnalysisCommon analysisCommon, IResourceService resourceService, IStrategoRuntimeService runtimeService, IStrategoCommon strategoCommon, ITermFactoryService termFactoryService, ISpoofaxTracingService tracingService, ISpoofaxUnitService unitService)
Methods
analyze
public ISpoofaxAnalyzeResult analyze(ISpoofaxParseUnit input, IContext genericContext, IProgress progress, ICancel cancel)
analyzeAll
public ISpoofaxAnalyzeResults analyzeAll(Iterable<ISpoofaxParseUnit> inputs, IContext genericContext, IProgress progress, ICancel cancel)
analyzeAll
protected abstract ISpoofaxAnalyzeResults analyzeAll(Map<String, ISpoofaxParseUnit> changed, Map<String, ISpoofaxParseUnit> removed, IConstraintContext context, HybridInterpreter runtime, String strategy, IProgress progress, ICancel cancel)
build
protected IStrategoTerm build(String op, IStrategoTerm... subterms)
match
protected List<IStrategoTerm> match(IStrategoTerm term, String op, int n)
success
protected boolean success(Collection<IMessage> messages)

MultiFileConstraintAnalyzer

public class MultiFileConstraintAnalyzer extends AbstractConstraintAnalyzer implements ISpoofaxAnalyzer
Fields
name
public static final String name
Constructors
MultiFileConstraintAnalyzer
public MultiFileConstraintAnalyzer(AnalysisCommon analysisCommon, IResourceService resourceService, IStrategoRuntimeService runtimeService, IStrategoCommon strategoCommon, ITermFactoryService termFactoryService, ISpoofaxTracingService tracingService, ISpoofaxUnitService unitService)
Methods
analyzeAll
protected ISpoofaxAnalyzeResults analyzeAll(Map<String, ISpoofaxParseUnit> changed, Map<String, ISpoofaxParseUnit> removed, IConstraintContext context, HybridInterpreter runtime, String strategy, IProgress progress, ICancel cancel)

SingleFileConstraintAnalyzer

public class SingleFileConstraintAnalyzer extends AbstractConstraintAnalyzer implements ISpoofaxAnalyzer
Fields
name
public static final String name
Constructors
SingleFileConstraintAnalyzer
public SingleFileConstraintAnalyzer(AnalysisCommon analysisCommon, IResourceService resourceService, IStrategoRuntimeService runtimeService, IStrategoCommon strategoCommon, ITermFactoryService termFactoryService, ISpoofaxTracingService tracingService, ISpoofaxUnitService unitService)
Methods
analyzeAll
protected ISpoofaxAnalyzeResults analyzeAll(Map<String, ISpoofaxParseUnit> changed, Map<String, ISpoofaxParseUnit> removed, IConstraintContext context, HybridInterpreter runtime, String strategy, IProgress progress, ICancel cancel)

org.metaborg.spoofax.core.analysis.legacy

StrategoAnalyzer

public class StrategoAnalyzer implements ISpoofaxAnalyzer

Analyzer for legacy Stratego projects. Calls the analysis strategy for each input.

Fields
name
public static final String name
Constructors
StrategoAnalyzer
public StrategoAnalyzer(ISpoofaxUnitService unitService, ITermFactoryService termFactoryService, IStrategoRuntimeService runtimeService, IStrategoCommon strategoCommon, AnalysisCommon analysisCommon)
Methods
analyze
public ISpoofaxAnalyzeResult analyze(ISpoofaxParseUnit input, IContext context, IProgress progress, ICancel cancel)
analyzeAll
public ISpoofaxAnalyzeResults analyzeAll(Iterable<ISpoofaxParseUnit> inputs, IContext context, IProgress progress, ICancel cancel)

org.metaborg.spoofax.core.analysis.taskengine

AnalysisDebugResult

public class AnalysisDebugResult implements Serializable
Fields
evaluatedTasks
public final IStrategoList evaluatedTasks
indexEntriesAdded
public final int indexEntriesAdded
indexEntriesRemoved
public final int indexEntriesRemoved
skippedTasks
public final IStrategoList skippedTasks
tasksAdded
public final int tasksAdded
tasksInvalidated
public final int tasksInvalidated
tasksRemoved
public final int tasksRemoved
unevaluatedTasks
public final IStrategoList unevaluatedTasks
Constructors
AnalysisDebugResult
public AnalysisDebugResult(int indexEntriesRemoved, int indexEntriesAdded, int tasksRemoved, int tasksAdded, int tasksInvalidated, IStrategoList evaluatedTasks, IStrategoList skippedTasks, IStrategoList unevaluatedTasks)
AnalysisDebugResult
public AnalysisDebugResult(ITermFactory factory)

AnalysisTimeResult

public class AnalysisTimeResult implements Serializable
Fields
collect
public final long collect
indexPersist
public final long indexPersist
parse
public final long parse
postTrans
public final long postTrans
preTrans
public final long preTrans
taskEval
public final long taskEval
taskPersist
public final long taskPersist
Constructors
AnalysisTimeResult
public AnalysisTimeResult(long parse, long preTrans, long collect, long taskEval, long postTrans, long indexPersist, long taskPersist)
AnalysisTimeResult
public AnalysisTimeResult()

TaskEngineAnalyzer

public class TaskEngineAnalyzer implements ISpoofaxAnalyzer

Analyzer for NaBL + TS + index + task engine projects. Calls the analysis strategy with a list of all inputs.

Fields
name
public static final String name
Constructors
TaskEngineAnalyzer
public TaskEngineAnalyzer(IResourceService resourceService, ISpoofaxUnitService unitService, ITermFactoryService termFactoryService, IStrategoRuntimeService runtimeService, IStrategoCommon strategoCommon, AnalysisCommon analysisCommon)
Methods
analyze
public ISpoofaxAnalyzeResult analyze(ISpoofaxParseUnit input, IContext context, IProgress progress, ICancel cancel)
analyzeAll
public ISpoofaxAnalyzeResults analyzeAll(Iterable<ISpoofaxParseUnit> inputs, IContext context, IProgress progress, ICancel cancel)

TaskEngineAnalyzerData

public class TaskEngineAnalyzerData
Fields
affectedPartitions
public final Iterable<String> affectedPartitions
debugResult
public final AnalysisDebugResult debugResult
timeResult
public final AnalysisTimeResult timeResult
Constructors
TaskEngineAnalyzerData
public TaskEngineAnalyzerData(Iterable<String> affectedPartitions, AnalysisDebugResult debugResult, AnalysisTimeResult timeResult)

org.metaborg.spoofax.core.build

ISpoofaxBuildOutput

public interface ISpoofaxBuildOutput extends IBuildOutput<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>

Typedef interface for IBuildOutput with Spoofax interfaces.

ISpoofaxBuildOutputInternal

public interface ISpoofaxBuildOutputInternal extends IBuildOutputInternal<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>, ISpoofaxBuildOutput

Typedef interface for IBuildOutputInternal with Spoofax interfaces.

ISpoofaxBuilder

public interface ISpoofaxBuilder extends IBuilder<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>

Typedef interface for IBuilder with Spoofax interfaces.

Methods
build
ISpoofaxBuildOutput build(BuildInput input, IProgress progress, ICancel cancel)
build
ISpoofaxBuildOutput build(BuildInput input)

SpoofaxBuildOutput

public class SpoofaxBuildOutput extends BuildOutput<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>> implements ISpoofaxBuildOutputInternal

Typedef class for BuildOutput with Spoofax interfaces.

SpoofaxBuilder

public class SpoofaxBuilder extends Builder<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> implements ISpoofaxBuilder

Typedef class for Builder with Spoofax interfaces.

Constructors
SpoofaxBuilder
public SpoofaxBuilder(IResourceService resourceService, ILanguageIdentifierService languageIdentifier, ILanguagePathService languagePathService, ISpoofaxUnitService unitService, ISourceTextService sourceTextService, ISpoofaxSyntaxService syntaxService, IContextService contextService, ISpoofaxAnalysisService analysisService, ISpoofaxTransformService transformService, ISpoofaxParseResultUpdater parseResultUpdater, ISpoofaxAnalysisResultUpdater analysisResultUpdater, Provider<IBuildOutputInternal<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>> buildOutputProvider)
Methods
build
public ISpoofaxBuildOutput build(BuildInput input, IProgress progress, ICancel cancel)
build
public ISpoofaxBuildOutput build(BuildInput input)

SpoofaxCommonPaths

public class SpoofaxCommonPaths extends CommonPaths
Fields
logger
static final ILogger logger
Constructors
SpoofaxCommonPaths
public SpoofaxCommonPaths(FileObject root)
Methods
capitalsForDollars
public String capitalsForDollars(String strategy)
dsManualJavaDir
public FileObject dsManualJavaDir()
Returns:DynSem manual Java interpreter directory.
dsSrcGenJavaDir
public FileObject dsSrcGenJavaDir()
Returns:DynSem generated Java interpreter directory.
findDsMainFile
public FileObject findDsMainFile(Iterable<FileObject> sources, String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main DynSem file.

findEsvMainFile
public FileObject findEsvMainFile(Iterable<FileObject> sources)
Returns:Main ESV file.
findStrMainFile
public FileObject findStrMainFile(Iterable<FileObject> sources, String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main Stratego file.

findSyntaxMainFile
public FileObject findSyntaxMainFile(Iterable<FileObject> sources, String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main SDF2 file.

iconsDir
public FileObject iconsDir()
Returns:Icons directory.
javaSrcDirs
public Collection<FileObject> javaSrcDirs(String languageId)

Gets all the Java source root folders.

Parameters:
  • languageId – Identifier of the language.
Returns:

A list of Java source root folders.

prepareModuleName
public String prepareModuleName(String projectName, String moduleName)
spxArchiveFile
public FileObject spxArchiveFile(String languageId)
Parameters:
  • languageId – Identifier of the language.
Returns:

Archived Spoofax language file.

srcMainDir
public FileObject srcMainDir()
Returns:Java sources directory.
strCacheDir
public FileObject strCacheDir()
Returns:Stratego parse cache directory.
strJavaStratDir
public FileObject strJavaStratDir()
Returns:Stratego Java strategies directory.
strJavaStratPkg
public String strJavaStratPkg(String languageId)
Parameters:
  • languageId – Identifier of the language.
Returns:

Stratego Java strategies package.

strJavaStratPkgPath
public String strJavaStratPkgPath(String languageId)
Parameters:
  • languageId – Identifier of the language.
Returns:

Stratego Java strategies package path.

strJavaTransPkg
public String strJavaTransPkg(String languageId)
Parameters:
  • languageId – Identifier of the language.
Returns:

Stratego Java transformation package.

strMainJavaStratFile
public FileObject strMainJavaStratFile(String languageId)
Parameters:
  • languageId – Identifier of the language.
Returns:

Main Stratego Java strategies file.

strSepCompBoilerplateFile
public FileObject strSepCompBoilerplateFile(String projectName, String moduleName)
strSepCompPackedBoilerplateFile
public FileObject strSepCompPackedBoilerplateFile()
strSepCompPackedStrategyFile
public FileObject strSepCompPackedStrategyFile(String strategy)
strSepCompSrcGenDir
public FileObject strSepCompSrcGenDir()
strSepCompStrategyDir
public FileObject strSepCompStrategyDir(String strategy)
strSepCompStrategyFile
public FileObject strSepCompStrategyFile(String projectName, String moduleName, String strategy)
strTypesmartExportedFile
public FileObject strTypesmartExportedFile()
syntaxCompletionMainFile
public FileObject syntaxCompletionMainFile(String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main SDF2 completion file.

syntaxCompletionMainFileNormalized
public FileObject syntaxCompletionMainFileNormalized(String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main normalized aterm completion file.

syntaxCompletionSrcGenDir
public FileObject syntaxCompletionSrcGenDir()
Returns:Generated SDF2 completion syntax directory, generated from SDF3 definition.
syntaxNormDir
public FileObject syntaxNormDir()
Returns:Normalized syntax directory. Contains the SDF3 normalized files.
syntaxSrcGenDir
public FileObject syntaxSrcGenDir()
Returns:Generated SDF2 syntax directory, generated from SDF3 definition.
syntaxSrcGenMainFile
public FileObject syntaxSrcGenMainFile(String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main generated SDF2 file, generated from main SDF3 file.

syntaxSrcGenMainNormFile
public FileObject syntaxSrcGenMainNormFile(String languageName)
Parameters:
  • languageName – Name of the language.
Returns:

Main generated SDF2 file, generated from main SDF3 file.

syntaxSrcGenPpDir
public FileObject syntaxSrcGenPpDir()
Returns:Generated Stratego/Box pretty printer directory, generated from SDF3 definition.
syntaxSrcGenSignatureDir
public FileObject syntaxSrcGenSignatureDir()
Returns:Generated Stratego signatures directory, generated from SDF3 definition.

SpoofaxDefaultSources

public class SpoofaxDefaultSources
Fields
DEFAULT_SPOOFAX_SOURCES
public static final Collection<ISourceConfig> DEFAULT_SPOOFAX_SOURCES

org.metaborg.spoofax.core.completion

CompletionDefinition

public class CompletionDefinition
Fields
description
public final String description
expectedSort
public final IStrategoTerm expectedSort
items
public final Iterable<ICompletionItem> items
producedSort
public final IStrategoTerm producedSort
Constructors
CompletionDefinition
public CompletionDefinition(IStrategoTerm producedSort, IStrategoTerm expectedSort, String description, Iterable<ICompletionItem> items)

ISpoofaxCompletionService

public interface ISpoofaxCompletionService extends ICompletionService<ISpoofaxParseUnit>

Typedef interface for ICompletionService with Spoofax interfaces.

JSGLRCompletionService

public class JSGLRCompletionService implements ISpoofaxCompletionService
Constructors
JSGLRCompletionService
public JSGLRCompletionService(ITermFactoryService termFactoryService, IStrategoRuntimeService strategoRuntimeService, IStrategoCommon strategoCommon, IResourceService resourceService, ISpoofaxUnitService unitService, ISpoofaxSyntaxService syntaxService)
Methods
completionCorrectPrograms
public Collection<ICompletion> completionCorrectPrograms(int position, boolean blankLineCompletion, ISpoofaxParseUnit parseResult)
completionEmptyProgram
public Collection<? extends ICompletion> completionEmptyProgram(Iterable<String> startSymbols, int endOffset, ILanguageImpl language, FileObject location)
completionErroneousPrograms
public Collection<ICompletion> completionErroneousPrograms(int cursorPosition, Iterable<IStrategoTerm> completionTerms, ISpoofaxParseUnit completionParseResult)
completionErroneousProgramsNested
public Collection<? extends ICompletion> completionErroneousProgramsNested(int cursorPosition, Collection<IStrategoTerm> nestedCompletionTerms, ISpoofaxParseUnit completionParseResult)
fromTokens
protected ISourceLocation fromTokens(IStrategoTerm fragment, HybridInterpreter runtime, ITermFactory termFactory, int position, String languageName, Map<IStrategoTerm, Boolean> leftRecursiveTerms, Map<IStrategoTerm, Boolean> rightRecursiveTerms)
get
public Iterable<ICompletion> get(int position, ISpoofaxParseUnit parseInput, boolean nested)
listsCompletions
public Collection<ICompletion> listsCompletions(int position, boolean blankLineCompletion, Iterable<IStrategoList> lists, String languageName, ILanguageComponent component, FileObject location)
optionalCompletions
public Collection<ICompletion> optionalCompletions(Iterable<IStrategoTerm> optionals, boolean blankLineCompletion, String languageName, ILanguageComponent component, FileObject location)
placeholderCompletions
public Collection<ICompletion> placeholderCompletions(IStrategoAppl placeholder, String languageName, ILanguageComponent component, FileObject location)

PlaceholderCompletionItem

public class PlaceholderCompletionItem implements IPlaceholderCompletionItem
Fields
endOffset
public final int endOffset
name
public final String name
optional
public final boolean optional
sort
public final String sort
startOffset
public final int startOffset
Constructors
PlaceholderCompletionItem
public PlaceholderCompletionItem(String sort, int startOffset, int endOffset, boolean optional)
Methods
endOffset
public int endOffset()
name
public String name()
optional
public boolean optional()
placeholderText
public String placeholderText()
startOffset
public int startOffset()
toString
public String toString()

SyntacticCompletionFacet

public class SyntacticCompletionFacet implements IFacet
Constructors
SyntacticCompletionFacet
public SyntacticCompletionFacet(Multimap<Integer, CompletionDefinition> completionDefinitions)
Methods
get
public Iterable<CompletionDefinition> get(int s)

org.metaborg.spoofax.core.config

ISpoofaxProjectConfig

public interface ISpoofaxProjectConfig extends IProjectConfig
Methods
nabl2Config
NaBL2Config nabl2Config()
Returns:NaBL2 configuration.
sources
Collection<ISourceConfig> sources()
typesmart
boolean typesmart()
Returns:Whether typesmart dynamic analysis is enabled.

ISpoofaxProjectConfigBuilder

public interface ISpoofaxProjectConfigBuilder extends IProjectConfigBuilder
Methods
copyFrom
ISpoofaxProjectConfigBuilder copyFrom(ISpoofaxProjectConfig config)

Copies the values from the specified configuration.

Parameters:
  • config – The configuration to copy values from.
withMetaborgVersion
ISpoofaxProjectConfigBuilder withMetaborgVersion(String metaborgVersion)

{@inheritDoc}

withNaBL2Config
ISpoofaxProjectConfigBuilder withNaBL2Config(NaBL2Config config)

Sets whether debug output is enabled for the constraint solver.

Parameters:
  • incremental – True to enable, false to disable.
Returns:

This builder.

withTypesmart
ISpoofaxProjectConfigBuilder withTypesmart(boolean typesmart)

Sets the typesmart property.

Parameters:
  • typesmart – The typesmart property.
Returns:

This builder.

ISpoofaxProjectConfigService

public interface ISpoofaxProjectConfigService extends IProjectConfigService

Stores and retrieves language component configurations.

Methods
available
boolean available(FileObject rootFolder)

Checks if a configuration exists for the project at the given location.

Parameters:
  • rootFolder – The project root folder.
Returns:

True if a configuration exists, false otherwise.

get
ConfigRequest<ISpoofaxProjectConfig> get(FileObject rootFolder)

Gets the configuration for the project at the given location.

Parameters:
  • rootFolder – The project root folder.
Returns:

Configuration request, either with a valid configuration, or a collection of error messages.

get
ISpoofaxProjectConfig get(IProject project)

Gets the configuration for the given project.

Parameters:
  • project – The project.
Returns:

The configuration, or null.

ISpoofaxProjectConfigWriter

public interface ISpoofaxProjectConfigWriter

Writes a configuration for an IProject.

Methods
write
void write(IProject project, ISpoofaxProjectConfig config, IFileAccess access)

Writes the specified configuration for the specified project.

Parameters:
  • project – The project.
  • config – The configuration to write.
  • access

SpoofaxProjectConfig

public class SpoofaxProjectConfig extends ProjectConfig implements ISpoofaxProjectConfig
Constructors
SpoofaxProjectConfig
public SpoofaxProjectConfig(HierarchicalConfiguration<ImmutableNode> config)
SpoofaxProjectConfig
protected SpoofaxProjectConfig(HierarchicalConfiguration<ImmutableNode> config, String metaborgVersion, Collection<IExportConfig> sources, Collection<LanguageIdentifier> compileDeps, Collection<LanguageIdentifier> sourceDeps, Collection<LanguageIdentifier> javaDeps, Boolean typesmart, NaBL2Config nabl2Config)
Methods
nabl2Config
public NaBL2Config nabl2Config()
sources
public Collection<ISourceConfig> sources()
typesmart
public boolean typesmart()
validate
public Collection<IMessage> validate(MessageBuilder mb)

SpoofaxProjectConfigBuilder

public class SpoofaxProjectConfigBuilder extends ProjectConfigBuilder implements ISpoofaxProjectConfigBuilder
Fields
nabl2Config
protected NaBL2Config nabl2Config
typesmart
protected Boolean typesmart
Constructors
SpoofaxProjectConfigBuilder
public SpoofaxProjectConfigBuilder(AConfigurationReaderWriter configReaderWriter)
Methods
addCompileDeps
public ISpoofaxProjectConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> deps)
addJavaDeps
public ISpoofaxProjectConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)
addSourceDeps
public ISpoofaxProjectConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> deps)
addSources
public ISpoofaxProjectConfigBuilder addSources(Iterable<IExportConfig> sources)
build
public ISpoofaxProjectConfig build(FileObject rootFolder)
build
public SpoofaxProjectConfig build(HierarchicalConfiguration<ImmutableNode> configuration)
copyFrom
public ISpoofaxProjectConfigBuilder copyFrom(ISpoofaxProjectConfig config)
copyValuesFrom
public void copyValuesFrom(ISpoofaxProjectConfig config)
reset
public ISpoofaxProjectConfigBuilder reset()
withCompileDeps
public ISpoofaxProjectConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> deps)
withJavaDeps
public ISpoofaxProjectConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)
withMetaborgVersion
public ISpoofaxProjectConfigBuilder withMetaborgVersion(String metaborgVersion)
withNaBL2Config
public ISpoofaxProjectConfigBuilder withNaBL2Config(NaBL2Config config)
withSourceDeps
public ISpoofaxProjectConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> deps)
withSources
public ISpoofaxProjectConfigBuilder withSources(Iterable<IExportConfig> sources)
withTypesmart
public ISpoofaxProjectConfigBuilder withTypesmart(boolean typesmart)

SpoofaxProjectConfigService

public class SpoofaxProjectConfigService extends AConfigService<IProject, ISpoofaxProjectConfig> implements ISpoofaxProjectConfigService, ISpoofaxProjectConfigWriter
Constructors
SpoofaxProjectConfigService
public SpoofaxProjectConfigService(AConfigurationReaderWriter configReaderWriter, SpoofaxProjectConfigBuilder configBuilder)
Methods
defaultConfig
public IProjectConfig defaultConfig(FileObject rootFolder)
fromConfig
protected HierarchicalConfiguration<ImmutableNode> fromConfig(ISpoofaxProjectConfig config)
get
public ISpoofaxProjectConfig get(IProject project)
getConfigFile
protected FileObject getConfigFile(FileObject rootFolder)
getRootDirectory
protected FileObject getRootDirectory(IProject project)
toConfig
protected ConfigRequest<ISpoofaxProjectConfig> toConfig(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)

org.metaborg.spoofax.core.config.language

NaBL2ConfigReaderWriter

public final class NaBL2ConfigReaderWriter
Methods
read
public static NaBL2Config read(HierarchicalConfiguration<ImmutableNode> config)
validate
public static Collection<IMessage> validate(ImmutableConfiguration config, MessageBuilder mb)
write
public static void write(NaBL2Config nabl2Config, HierarchicalConfiguration<ImmutableNode> config)

org.metaborg.spoofax.core.context

ContextFacetFromESV

public class ContextFacetFromESV
Methods
hasContext
public static boolean hasContext(IStrategoAppl esv)
type
public static String type(IStrategoAppl esv)

IIndexTaskContext

public interface IIndexTaskContext extends IContext, IIndexContext, ITaskEngineContext

IndexTaskContext

public class IndexTaskContext implements IContext, IContextInternal, IIndexTaskContext
Constructors
IndexTaskContext
public IndexTaskContext(Injector injector, ITermFactoryService termFactoryService, ContextIdentifier identifier)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
identifier
public ContextIdentifier identifier()
index
public IIndex index()
init
public void init()
injector
public Injector injector()
language
public ILanguageImpl language()
load
public void load()
location
public FileObject location()
persist
public void persist()
project
public IProject project()
read
public IClosableLock read()
reset
public void reset()
taskEngine
public ITaskEngine taskEngine()
toString
public String toString()
unload
public void unload()
write
public IClosableLock write()

IndexTaskContextFactory

public class IndexTaskContextFactory implements IContextFactory
Fields
name
public static final String name
Constructors
IndexTaskContextFactory
public IndexTaskContextFactory(Injector injector, ITermFactoryService termFactoryService)
Methods
create
public IndexTaskContext create(ContextIdentifier identifier)
createTemporary
public IndexTaskTemporaryContext createTemporary(ContextIdentifier identifier)

IndexTaskTemporaryContext

public class IndexTaskTemporaryContext implements ITemporaryContextInternal, IIndexTaskContext
Constructors
IndexTaskTemporaryContext
public IndexTaskTemporaryContext(IndexTaskContext context)
Methods
close
public void close()
identifier
public ContextIdentifier identifier()
index
public IIndex index()
init
public void init()
injector
public Injector injector()
language
public ILanguageImpl language()
load
public void load()
location
public FileObject location()
persist
public void persist()
project
public IProject project()
read
public IClosableLock read()
reset
public void reset()
taskEngine
public ITaskEngine taskEngine()
unload
public void unload()
write
public IClosableLock write()

LegacyContext

public class LegacyContext implements IContext, IContextInternal, ITemporaryContextInternal
Constructors
LegacyContext
public LegacyContext(Injector injector, ContextIdentifier identifier)
Methods
close
public void close()
identifier
public ContextIdentifier identifier()
init
public void init()
injector
public Injector injector()
language
public ILanguageImpl language()
load
public void load()
location
public FileObject location()
persist
public void persist()
project
public IProject project()
read
public IClosableLock read()
reset
public void reset()
unload
public void unload()
write
public IClosableLock write()

LegacyContextFactory

public class LegacyContextFactory implements IContextFactory
Fields
name
public static final String name
Constructors
LegacyContextFactory
public LegacyContextFactory(Injector injector)
Methods
create
public LegacyContext create(ContextIdentifier identifier)
createTemporary
public LegacyContext createTemporary(ContextIdentifier identifier)

org.metaborg.spoofax.core.context.constraint

ConstraintContext

public class ConstraintContext implements IConstraintContext
Constructors
ConstraintContext
public ConstraintContext(Mode mode, Injector injector, ContextIdentifier identifier)
Methods
clear
public void clear()
entrySet
public Set<Entry<String, FileResult>> entrySet()
equals
public boolean equals(Object obj)
getAnalysis
public IStrategoTerm getAnalysis(FileObject resource)
getFinal
public FinalResult getFinal()
getInitial
public InitialResult getInitial()
getUnit
public FileResult getUnit(FileObject resource)
guard
public IClosableLock guard()
hasAnalysis
public boolean hasAnalysis(FileObject resource)
hasFinal
public boolean hasFinal()
hasInitial
public boolean hasInitial()
hasUnit
public boolean hasUnit(FileObject resource)
hashCode
public int hashCode()
identifier
public ContextIdentifier identifier()
init
public void init()
injector
public Injector injector()
isRoot
public boolean isRoot(FileObject resource)
keyResource
public FileObject keyResource(String resource)
language
public ILanguageImpl language()
load
public void load()
location
public FileObject location()
mode
public Mode mode()
persist
public void persist()
project
public IProject project()
read
public IClosableLock read()
remove
public boolean remove(FileObject resource)
reset
public void reset()
resourceKey
public String resourceKey(FileObject resource)
setFinal
public void setFinal(FinalResult value)
setInitial
public void setInitial(InitialResult value)
setUnit
public boolean setUnit(FileObject resource, FileResult value)
toString
public String toString()
unload
public void unload()
write
public IClosableLock write()

IConstraintContext

public interface IConstraintContext extends IContextInternal
Methods
clear
void clear()
entrySet
Set<Entry<String, FileResult>> entrySet()
getAnalysis
IStrategoTerm getAnalysis(String resource)
getAnalysis
IStrategoTerm getAnalysis(FileObject resource)
getFinal
FinalResult getFinal()
getInitial
InitialResult getInitial()
getUnit
FileResult getUnit(String resource)
getUnit
FileResult getUnit(FileObject resource)
hasAnalysis
boolean hasAnalysis(String resource)
hasAnalysis
boolean hasAnalysis(FileObject resource)
hasFinal
boolean hasFinal()
hasInitial
boolean hasInitial()
hasUnit
boolean hasUnit(String resource)
hasUnit
boolean hasUnit(FileObject resource)
isRoot
boolean isRoot(String resource)
isRoot
boolean isRoot(FileObject resource)
keyResource
FileObject keyResource(String resource)
mode
Mode mode()
remove
boolean remove(String resource)
remove
boolean remove(FileObject resource)
resourceKey
String resourceKey(String resource)
resourceKey
String resourceKey(FileObject resource)
setFinal
void setFinal(FinalResult value)
setInitial
void setInitial(InitialResult value)
setUnit
boolean setUnit(String resource, FileResult value)
setUnit
boolean setUnit(FileObject resource, FileResult value)

IConstraintContext.FileResult

class FileResult implements Serializable
Fields
analysis
public final IStrategoTerm analysis
ast
public final IStrategoTerm ast
messages
public final Collection<IMessage> messages
Constructors
FileResult
public FileResult(IStrategoTerm ast, IStrategoTerm analysis, Collection<IMessage> messages)

IConstraintContext.FinalResult

class FinalResult implements Serializable
Fields
analysis
public final IStrategoTerm analysis
messages
public final Collection<IMessage> messages
Constructors
FinalResult
public FinalResult(IStrategoTerm analysis, Collection<IMessage> messages)

IConstraintContext.InitialResult

class InitialResult implements Serializable
Fields
analysis
public final IStrategoTerm analysis
Constructors
InitialResult
public InitialResult(IStrategoTerm analysis)

IConstraintContext.Mode

enum Mode
Enum Constants
MULTI_FILE
public static final IConstraintContext.Mode MULTI_FILE
SINGLE_FILE
public static final IConstraintContext.Mode SINGLE_FILE

MultiFileConstraintContextFactory

public class MultiFileConstraintContextFactory implements IContextFactory
Fields
name
public static final String name
Constructors
MultiFileConstraintContextFactory
public MultiFileConstraintContextFactory(Injector injector)
Methods
create
public IConstraintContext create(ContextIdentifier identifier)
createTemporary
public TemporaryConstraintContext createTemporary(ContextIdentifier identifier)

SingleFileConstraintContextFactory

public class SingleFileConstraintContextFactory implements IContextFactory
Fields
name
public static final String name
Constructors
SingleFileConstraintContextFactory
public SingleFileConstraintContextFactory(Injector injector)
Methods
create
public IConstraintContext create(ContextIdentifier identifier)
createTemporary
public TemporaryConstraintContext createTemporary(ContextIdentifier identifier)

TemporaryConstraintContext

public class TemporaryConstraintContext implements IConstraintContext, ITemporaryContextInternal
Constructors
TemporaryConstraintContext
public TemporaryConstraintContext(IConstraintContext context)
Methods
clear
public void clear()
close
public void close()
entrySet
public Set<Entry<String, FileResult>> entrySet()
equals
public boolean equals(Object other)
getAnalysis
public IStrategoTerm getAnalysis(FileObject resource)
getFinal
public FinalResult getFinal()
getInitial
public InitialResult getInitial()
getUnit
public FileResult getUnit(FileObject resource)
hasAnalysis
public boolean hasAnalysis(FileObject resource)
hasFinal
public boolean hasFinal()
hasInitial
public boolean hasInitial()
hasUnit
public boolean hasUnit(FileObject resource)
hashCode
public int hashCode()
identifier
public ContextIdentifier identifier()
init
public void init()
injector
public Injector injector()
isRoot
public boolean isRoot(FileObject resource)
keyResource
public FileObject keyResource(String resource)
language
public ILanguageImpl language()
load
public void load()
location
public FileObject location()
mode
public Mode mode()
persist
public void persist()
project
public IProject project()
read
public IClosableLock read()
remove
public boolean remove(FileObject resource)
reset
public void reset()
resourceKey
public String resourceKey(FileObject resource)
setFinal
public void setFinal(FinalResult value)
setInitial
public void setInitial(InitialResult value)
setUnit
public boolean setUnit(FileObject resource, FileResult value)
unload
public void unload()
write
public IClosableLock write()

org.metaborg.spoofax.core.esv

ESVReader

public class ESVReader

Term reading utility class for ESV abstract syntax.

Methods
collectTerms
public static ArrayList<IStrategoAppl> collectTerms(IStrategoAppl term, String... constructors)
concatTermStrings
public static String concatTermStrings(IStrategoList values)
cons
public static String cons(IStrategoTerm t)
findTerm
public static IStrategoAppl findTerm(IStrategoTerm term, String constructor)
getProperty
public static String getProperty(IStrategoAppl document, String name)
getProperty
public static String getProperty(IStrategoAppl document, String name, String defaultValue)
termContents
public static String termContents(IStrategoTerm t)
termListContents
public static List<String> termListContents(IStrategoTerm t)

org.metaborg.spoofax.core.language

ComponentFactoryRequest

public class ComponentFactoryRequest implements IComponentCreationConfigRequest
Constructors
ComponentFactoryRequest
public ComponentFactoryRequest(FileObject location, ILanguageComponentConfig config, IStrategoAppl esvTerm, SyntaxFacet syntaxFacet, StrategoRuntimeFacet strategoRuntimeFacet)

Initializes a new instance for a successful request.

Parameters:
  • location – The location of the language component.
  • config – The configuration of the language component.
  • esvTerm – The ESV term.
  • syntaxFacet – The syntax facet.
  • strategoRuntimeFacet – The Stratego runtime facet.
ComponentFactoryRequest
public ComponentFactoryRequest(FileObject location, Collection<String> errors, Collection<Throwable> exceptions)

Initializes a new instance for a failed request.

Parameters:
  • location – The location of the language component.
  • errors – The error messages that were raised during the request.
  • exceptions – The exceptions that were raised during the request.
ComponentFactoryRequest
public ComponentFactoryRequest(FileObject location, Collection<String> errors)

Initializes a new instance for a failed request.

Parameters:
  • location – The location of the language component.
  • errors – The error messages that were raised during the request.
ComponentFactoryRequest
public ComponentFactoryRequest(FileObject location, String error)

Initializes a new instance for a failed request.

Parameters:
  • location – The location of the language component.
  • error – The error message that was raised during the request.
ComponentFactoryRequest
public ComponentFactoryRequest(FileObject location, Throwable exception)

Initializes a new instance for a failed request.

Parameters:
  • location – The location of the language component.
  • exception – The exception that was raised during the request.
Methods
config
public ILanguageComponentConfig config()

{@inheritDoc}

errors
public Collection<String> errors()

{@inheritDoc}

esvTerm
public IStrategoAppl esvTerm()

Gets the ESV term.

Returns:The ESV term; or null when there is no ESV term.
exceptions
public Collection<Throwable> exceptions()

{@inheritDoc}

location
public FileObject location()

{@inheritDoc}

strategoRuntimeFacet
public StrategoRuntimeFacet strategoRuntimeFacet()

Gets the Stratego runtime facet.

Returns:The Stratego runtime facet; or null when there is no Stratego runtime facet.
syntaxFacet
public SyntaxFacet syntaxFacet()

Gets the syntax facet.

Returns:The syntax facet; or null when there is no Syntax facet.
toString
public String toString()

{@inheritDoc}

valid
public boolean valid()

{@inheritDoc}

LanguageComponentFactory

public class LanguageComponentFactory implements ILanguageComponentFactory
Constructors
LanguageComponentFactory
public LanguageComponentFactory(IResourceService resourceService, ILanguageComponentConfigService componentConfigService, ITermFactoryService termFactoryService, Map<String, IContextFactory> contextFactories, Map<String, IContextStrategy> contextStrategies, Map<String, ISpoofaxAnalyzer> analyzers)
Methods
createConfig
public ComponentCreationConfig createConfig(IComponentCreationConfigRequest configRequest)
createConfigs
public Collection<ComponentCreationConfig> createConfigs(Iterable<IComponentCreationConfigRequest> requests)
requestAllInDirectory
public Collection<IComponentCreationConfigRequest> requestAllInDirectory(FileObject directory)
requestFromArchive
public IComponentCreationConfigRequest requestFromArchive(FileObject archiveFile)
requestFromDirectory
public IComponentCreationConfigRequest requestFromDirectory(FileObject directory)

LanguageDiscoveryService

public class LanguageDiscoveryService implements ILanguageDiscoveryService
Constructors
LanguageDiscoveryService
public LanguageDiscoveryService(ILanguageService languageService, ILanguageComponentFactory componentFactory)
Methods
componentFromArchive
public ILanguageComponent componentFromArchive(FileObject archiveFile)
componentFromDirectory
public ILanguageComponent componentFromDirectory(FileObject directory)
discover
public ILanguageComponent discover(ILanguageDiscoveryRequest request)
discover
public Iterable<ILanguageComponent> discover(Iterable<ILanguageDiscoveryRequest> requests)
languageFromArchive
public ILanguageImpl languageFromArchive(FileObject archiveFile)
languageFromDirectory
public ILanguageImpl languageFromDirectory(FileObject directory)
languagesFromArchive
public Set<ILanguageImpl> languagesFromArchive(FileObject archiveFile)
languagesFromDirectory
public Set<ILanguageImpl> languagesFromDirectory(FileObject directory)
request
public Iterable<ILanguageDiscoveryRequest> request(FileObject location)
scanComponentsInDirectory
public Set<ILanguageComponent> scanComponentsInDirectory(FileObject directory)
scanLanguagesInDirectory
public Set<ILanguageImpl> scanLanguagesInDirectory(FileObject directory)

LanguageFileScanSelector

public class LanguageFileScanSelector implements FileSelector
Methods
includeFile
public boolean includeFile(FileSelectInfo fileInfo)
traverseDescendents
public boolean traverseDescendents(FileSelectInfo fileInfo)

org.metaborg.spoofax.core.language.dialect

DialectIdentifier

public class DialectIdentifier implements IDialectIdentifier
Constructors
DialectIdentifier
public DialectIdentifier(ILanguageService languageService, IDialectService dialectService, ITermFactoryService termFactoryService)
Methods
identify
public IdentifiedDialect identify(FileObject resource)
identify
public boolean identify(FileObject resource, ILanguageImpl dialect)
metaResource
public static FileObject metaResource(FileObject resource)

DialectProcessor

public class DialectProcessor implements IDialectProcessor
Constructors
DialectProcessor
public DialectProcessor(ILanguageService languageService, IDialectService dialectService)
Methods
update
public void update(FileObject location, Iterable<ResourceChange> changes)
update
public void update(LanguageImplChange change)

DialectService

public class DialectService implements IDialectService

Default implementation for the dialect service. It is mostly generic, but contains some logic for .meta files, which are Spoofax-specific. A dialect is simply a language implementation, with a single component, that mimics its base language, but has a different name and a few different facets. Dialects are created by copying over all facets from a language implementation into a new language implementation, except that:

Constructors
DialectService
public DialectService(ILanguageService languageService)
Methods
add
public ILanguageImpl add(String name, FileObject location, ILanguageImpl base, IFacet syntaxFacet)
dialectName
public String dialectName(ILanguageImpl dialect)
getBase
public ILanguageImpl getBase(ILanguageImpl dialect)
getDialect
public ILanguageImpl getDialect(String name)
getDialects
public Iterable<ILanguageImpl> getDialects(ILanguageImpl base)
hasDialect
public boolean hasDialect(String name)
remove
public ILanguageImpl remove(String name)
remove
public Iterable<ILanguageImpl> remove(ILanguageImpl base)
update
public ILanguageImpl update(String name, IFacet syntaxFacet)
update
public Iterable<ILanguageImpl> update(ILanguageImpl base)

MetaFileIdentifier

public class MetaFileIdentifier implements Func1<FileObject, Boolean>
Constructors
MetaFileIdentifier
public MetaFileIdentifier(IdentificationFacet identification)
Methods
call
public Boolean call(FileObject resource)

org.metaborg.spoofax.core.menu

org.metaborg.spoofax.core.outline

ISpoofaxOutlineService

public interface ISpoofaxOutlineService extends IOutlineService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>

Typedef interface for IResolverService with Spoofax interfaces.

OutlineFacet

public class OutlineFacet implements IFacet
Fields
expandTo
public final int expandTo
strategyName
public final String strategyName
Constructors
OutlineFacet
public OutlineFacet(String strategyName, int expandTo)

OutlineFacetFromESV

public class OutlineFacetFromESV
Methods
create
public static OutlineFacet create(IStrategoAppl esv)

OutlineService

public class OutlineService implements ISpoofaxOutlineService
Constructors
OutlineService
public OutlineService(IProjectService projectService, IContextService contextService, IStrategoRuntimeService strategoRuntimeService, ISpoofaxTracingService tracingService, IStrategoCommon common)
Methods
available
public boolean available(ILanguageImpl language)
outline
public IOutline outline(ISpoofaxParseUnit result)
outline
public IOutline outline(ISpoofaxAnalyzeUnit result)

org.metaborg.spoofax.core.processing

ISpoofaxProcessor

public interface ISpoofaxProcessor extends IProcessor<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>

Typedef interface for IProcessor with Spoofax interfaces.

Methods
build
ITask<ISpoofaxBuildOutput> build(BuildInput input, IProgress progress, ICancel cancel)

{@inheritDoc}

ISpoofaxProcessorRunner

public interface ISpoofaxProcessorRunner extends IProcessorRunner<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>

Typedef interface for IProcessorRunner with Spoofax interfaces.

Methods
build
ITask<ISpoofaxBuildOutput> build(BuildInput input, IProgress progress, ICancel cancel)

{@inheritDoc}

SpoofaxBlockingProcessor

public class SpoofaxBlockingProcessor extends BlockingProcessor<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>> implements ISpoofaxProcessor

Typedef class for BlockingProcessor with Spoofax interfaces.

Constructors
SpoofaxBlockingProcessor
public SpoofaxBlockingProcessor(IDialectProcessor dialectProcessor, ISpoofaxBuilder builder, ILanguageChangeProcessor languageChangeProcessor)
Methods
build
public ITask<ISpoofaxBuildOutput> build(BuildInput input, IProgress progress, ICancel cancel)

SpoofaxProcessorRunner

public class SpoofaxProcessorRunner extends ProcessorRunner<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>> implements ISpoofaxProcessorRunner

Typedef class for ProcessorRunner with Spoofax interfaces.

Constructors
SpoofaxProcessorRunner
public SpoofaxProcessorRunner(ISpoofaxProcessor processor, ILanguageService languageService)
Methods
build
public ITask<ISpoofaxBuildOutput> build(BuildInput input, IProgress progress, ICancel cancel)

org.metaborg.spoofax.core.processing.analyze

ISpoofaxAnalysisResultProcessor

public interface ISpoofaxAnalysisResultProcessor extends IAnalysisResultProcessor<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>, ISpoofaxAnalysisResultRequester, ISpoofaxAnalysisResultUpdater

Typedef interface for IAnalysisResultProcessor with Spoofax interfaces.

ISpoofaxAnalysisResultRequester

public interface ISpoofaxAnalysisResultRequester extends IAnalysisResultRequester<ISpoofaxInputUnit, ISpoofaxAnalyzeUnit>

Typedef interface for IAnalysisResultRequester with Spoofax interfaces.

ISpoofaxAnalysisResultUpdater

public interface ISpoofaxAnalysisResultUpdater extends IAnalysisResultUpdater<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>

Typedef interface for IAnalysisResultUpdater with Spoofax interfaces.

SpoofaxAnalysisResultProcessor

public class SpoofaxAnalysisResultProcessor extends AnalysisResultProcessor<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate> implements ISpoofaxAnalysisResultProcessor

Typedef class for AnalysisResultProcessor with Spoofax interfaces.

Constructors
SpoofaxAnalysisResultProcessor
public SpoofaxAnalysisResultProcessor(ISpoofaxAnalysisService analysisService, ISpoofaxParseResultRequester parseResultRequester)

org.metaborg.spoofax.core.processing.parse

ISpoofaxParseResultProcessor

public interface ISpoofaxParseResultProcessor extends IParseResultProcessor<ISpoofaxInputUnit, ISpoofaxParseUnit>, ISpoofaxParseResultRequester, ISpoofaxParseResultUpdater

Typedef interface for IParseResultProcessor with Spoofax interfaces.

ISpoofaxParseResultRequester

public interface ISpoofaxParseResultRequester extends IParseResultRequester<ISpoofaxInputUnit, ISpoofaxParseUnit>

Typedef interface for IParseResultRequester with Spoofax interfaces.

ISpoofaxParseResultUpdater

public interface ISpoofaxParseResultUpdater extends IParseResultUpdater<ISpoofaxParseUnit>

Typedef interface for IParseResultUpdater with Spoofax interfaces.

SpoofaxParseResultProcessor

public class SpoofaxParseResultProcessor extends ParseResultProcessor<ISpoofaxInputUnit, ISpoofaxParseUnit> implements ISpoofaxParseResultProcessor

Typedef class for ParseResultProcessor with Spoofax interfaces.

Constructors
SpoofaxParseResultProcessor
public SpoofaxParseResultProcessor(ISpoofaxSyntaxService syntaxService)

org.metaborg.spoofax.core.resource

SpoofaxIgnoresSelector

public class SpoofaxIgnoresSelector implements FileSelector
Methods
includeFile
public boolean includeFile(FileSelectInfo fileInfo)
traverseDescendents
public boolean traverseDescendents(FileSelectInfo fileInfo)

org.metaborg.spoofax.core.shell

CLIUtils

public class CLIUtils
Fields
SPOOFAXPATH
public static final String SPOOFAXPATH
Constructors
CLIUtils
public CLIUtils(Spoofax spoofax)
Methods
getCWD
public FileObject getCWD()

Get the current working directory

getLanguage
public ILanguageImpl getLanguage(String languageName)

Get a already loaded language by language name

getOrCreateCWDProject
public IProject getOrCreateCWDProject()

Get or create the project in the current working directory

getOrCreateProject
public IProject getOrCreateProject(FileObject resource)

Get or create project for the given resource

getProject
public IProject getProject(FileObject location)

Get project for the given resource

loadLanguage
public ILanguageImpl loadLanguage(FileObject location)

Load a language from the directory or archive indicated by location

loadLanguagesFromPath
public void loadLanguagesFromPath()

Load languages from the SPOOFAXPATH environment variable

printMessages
public void printMessages(OutputStream os, Iterable<IMessage> messages)

Print formatted messages to the given output stream

ShellFacet

public class ShellFacet implements IFacet

Facet for the interactive shell of a language.

Constructors
ShellFacet
public ShellFacet(String commandPrefix, String evaluationMethod, String shellStartSymbol)
Methods
getCommandPrefix
public String getCommandPrefix()
Returns:The prefix for all commands entered in the REPL.
getEvaluationMethod
public String getEvaluationMethod()
Returns:The evaluation method to use.
getShellStartSymbol
public String getShellStartSymbol()
Returns:The start symbol for shell-specific language syntax.
toString
public String toString()

ShellFacetFromESV

public class ShellFacetFromESV
Methods
create
public static ShellFacet create(IStrategoAppl esv)

org.metaborg.spoofax.core.stratego

IStrategoCommon

public interface IStrategoCommon
Methods
builderInputTerm
IStrategoTerm builderInputTerm(IStrategoTerm ast, FileObject resource, FileObject location)

Creates an input term for a builder.

Parameters:
  • ast – Term to use as the AST.
  • resource – Location of the input resource.
  • location – Location of the input context.
Returns:

A 5-tuple input term (selected, position, ast, path, project-path).

invoke
IStrategoTerm invoke(ILanguageComponent component, IContext context, IStrategoTerm input, String strategy)

Invokes a Stratego strategy in given component.

Parameters:
  • component – Component to invoke the strategy in.
  • context – Context to initialize the runtime with.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

invoke
IStrategoTerm invoke(ILanguageImpl impl, IContext context, IStrategoTerm input, String strategy)

Invokes a Stratego strategy in components of given language implementation. Returns the first result that succeeds.

Parameters:
  • impl – Language implementation to invoke the strategy in.
  • context – Context to initialize the runtime with.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

invoke
IStrategoTerm invoke(ILanguageImpl impl, FileObject location, IStrategoTerm input, String strategy)

Invokes a Stratego strategy in components of given language implementation. Returns the first result that succeeds.

Parameters:
  • impl – Language implementation to invoke the strategy in.
  • location – Location to initialize the Stratego runtime with.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

invoke
IStrategoTerm invoke(HybridInterpreter runtime, IStrategoTerm input, String strategy)

Invokes a Strategy strategy in given runtime.

Parameters:
  • runtime – Stratego runtime to invoke the strategy in.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

locationTerm
IStrategoString locationTerm(FileObject location)

Converts a location into a Stratego string.

Parameters:
  • localLocation – Location to convert.
Returns:

Stratego string with location.

prettyPrint
IStrategoString prettyPrint(IStrategoTerm term)

Pretty prints an ATerm.

Parameters:
  • term – ATerm to pretty print.
Returns:

Pretty printed ATerm as a Stratego string.

resourceTerm
IStrategoString resourceTerm(FileObject resource, FileObject location)

Converts a resource relative to a location into a Stratego string.

Parameters:
  • localResource – Resource to convert.
  • localLocation – Location to convert relative to.
Returns:

Stratego string with resource.

toString
String toString(IStrategoTerm term)

Turns given term into a string. If the term is a string, return the string. Otherwise, return a pretty-printed term.

Parameters:
  • term – Term to convert to a string.
Returns:

Result as a string.

IStrategoRuntimeService

public interface IStrategoRuntimeService extends ILanguageCache

Interface for a service that returns Stratego runtimes. Runtimes are created once and then cached, subsequent calls are faster.

Methods
genericRuntime
HybridInterpreter genericRuntime()
Returns:Generic Stratego runtime, with just the standard libraries loaded.
runtime
HybridInterpreter runtime(ILanguageComponent component, IContext context, boolean typesmart)

Returns a new Stratego runtime for given component, initialized with given context.

Parameters:
  • component – Language component to load the Stratego CTree and JAR files from.
  • context – Context to initialize the runtime with.
  • typesmart – Whether the runtime should do typesmart analysis.
Throws:
Returns:

New Stratego runtime.

runtime
HybridInterpreter runtime(ILanguageComponent component, FileObject location, boolean typesmart)

Returns a new Stratego runtime for given component, initialized without a context.

Parameters:
  • component – Language component to load the Stratego CTree and JAR files from.
  • location – Location to initialize the runtime with.
  • typesmart – Whether the runtime should do typesmart analysis.
Throws:
Returns:

New Stratego runtime.

ResourceAgent

public class ResourceAgent extends IOAgent
Constructors
ResourceAgent
public ResourceAgent(IResourceService resourceService)
ResourceAgent
public ResourceAgent(IResourceService resourceService, FileObject initialDir)
ResourceAgent
public ResourceAgent(IResourceService resourceService, FileObject initialDir, OutputStream stdout)
ResourceAgent
public ResourceAgent(IResourceService resourceService, FileObject initialDir, OutputStream stdout, OutputStream stderr)
Methods
closeAllFiles
public void closeAllFiles()
closeRandomAccessFile
public boolean closeRandomAccessFile(int fd)
createTempDir
public String createTempDir(String prefix)
createTempFile
public String createTempFile(String prefix)
defaultStderr
public static OutputStream defaultStderr(String... excludePatterns)
defaultStdout
public static OutputStream defaultStdout(String... excludePatterns)
exists
public boolean exists(String fn)
getDefinitionDir
public String getDefinitionDir()
getDefinitionDirResource
public FileObject getDefinitionDirResource()
getReader
public Reader getReader(int fd)
getTempDir
public String getTempDir()
getTempDirResource
public FileObject getTempDirResource()
getWorkingDir
public String getWorkingDir()
getWorkingDirResource
public FileObject getWorkingDirResource()
getWriter
public Writer getWriter(int fd)
internalGetInputStream
public InputStream internalGetInputStream(int fd)
internalGetOutputStream
public OutputStream internalGetOutputStream(int fd)
isDirectory
public boolean isDirectory(String fn)
mkDirs
public boolean mkDirs(String dn)
mkdir
public boolean mkdir(String dn)
openFile
public File openFile(String fn)
openFileOutputStream
public OutputStream openFileOutputStream(String fn)
openInputStream
public InputStream openInputStream(String fn, boolean isDefinitionFile)
openRandomAccessFile
public int openRandomAccessFile(String fn, String mode)
printError
public void printError(String error)
readString
public String readString(int fd)
readable
public boolean readable(String fn)
readdir
public String[] readdir(String fn)
rmdir
public boolean rmdir(String dn)
setAbsoluteDefinitionDir
public void setAbsoluteDefinitionDir(FileObject dir)
setAbsoluteWorkingDir
public void setAbsoluteWorkingDir(FileObject dir)
setDefinitionDir
public void setDefinitionDir(String newDefinitionDir)
setWorkingDir
public void setWorkingDir(String newWorkingDir)
writable
public boolean writable(String fn)
writeChar
public void writeChar(int fd, int c)

StrategoCommon

public class StrategoCommon implements IStrategoCommon

Common code for using Stratego transformations in Spoofax.

Constructors
StrategoCommon
public StrategoCommon(IStrategoRuntimeService strategoRuntimeService, ITermFactoryService termFactoryService)
Methods
builderInputTerm
public IStrategoTerm builderInputTerm(IStrategoTerm ast, FileObject resource, FileObject location)
invoke
public IStrategoTerm invoke(ILanguageComponent component, IContext context, IStrategoTerm input, String strategy)
invoke
public IStrategoTerm invoke(ILanguageImpl impl, IContext context, IStrategoTerm input, String strategy)
invoke
public IStrategoTerm invoke(ILanguageImpl impl, FileObject location, IStrategoTerm input, String strategy)
invoke
public IStrategoTerm invoke(HybridInterpreter runtime, IStrategoTerm input, String strategy)
locationTerm
public IStrategoString locationTerm(FileObject location)
prettyPrint
public IStrategoString prettyPrint(IStrategoTerm term)
resourceTerm
public IStrategoString resourceTerm(FileObject resource, FileObject location)
toString
public String toString(IStrategoTerm term)

StrategoRuntimeClassLoader

public class StrategoRuntimeClassLoader extends ClassLoader
Constructors
StrategoRuntimeClassLoader
public StrategoRuntimeClassLoader(Iterable<ClassLoader> additionalClassLoaders)
Methods
loadClass
protected Class<?> loadClass(String name, boolean resolve)

StrategoRuntimeFacet

public class StrategoRuntimeFacet implements IFacet

Represents the Stratego runtime facet of a language.

Fields
ctreeFiles
public final Iterable<FileObject> ctreeFiles
jarFiles
public final Iterable<FileObject> jarFiles
Constructors
StrategoRuntimeFacet
public StrategoRuntimeFacet(Iterable<FileObject> ctreeFiles, Iterable<FileObject> jarFiles)
Methods
available
public Iterable<String> available(IResourceService resourceService)

Checks if all CTree and JAR files exist, returns errors if not.

Throws:
  • IOException – When a file operation fails.
Returns:

Errors, or empty if there are no errors.

StrategoRuntimeFacetFromESV

public class StrategoRuntimeFacetFromESV
Methods
create
public static StrategoRuntimeFacet create(IStrategoAppl esv, FileObject location)

StrategoRuntimeService

public class StrategoRuntimeService implements IStrategoRuntimeService
Constructors
StrategoRuntimeService
public StrategoRuntimeService(IResourceService resourceService, ITermFactoryService termFactoryService, Set<IOperatorRegistry> strategoLibraries, ParseStrategoFileStrategy parseStrategoFileStrategy, IProjectService projectService, Set<ClassLoader> additionalClassLoaders)
Methods
genericRuntime
public HybridInterpreter genericRuntime()
invalidateCache
public void invalidateCache(ILanguageComponent component)
invalidateCache
public void invalidateCache(ILanguageImpl impl)
runtime
public HybridInterpreter runtime(ILanguageComponent component, IContext context, boolean typesmart)
runtime
public HybridInterpreter runtime(ILanguageComponent component, FileObject location, boolean typesmart)

org.metaborg.spoofax.core.stratego.primitive

AbsolutePathPrimitive

public class AbsolutePathPrimitive extends ASpoofaxPrimitive
Constructors
AbsolutePathPrimitive
public AbsolutePathPrimitive(IResourceService resourceService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

CallStrategyPrimitive

public class CallStrategyPrimitive extends ASpoofaxContextPrimitive
Constructors
CallStrategyPrimitive
public CallStrategyPrimitive(IDependencyService dependencyService, IContextService contextService, IStrategoCommon common)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext currentContext)

DigestPrimitive

public class DigestPrimitive extends ASpoofaxPrimitive
Constructors
DigestPrimitive
public DigestPrimitive()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

GetSortNamePrimitive

public class GetSortNamePrimitive extends AbstractPrimitive
Constructors
GetSortNamePrimitive
public GetSortNamePrimitive()
Methods
call
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)

IsLanguageActivePrimitive

public class IsLanguageActivePrimitive extends ASpoofaxContextPrimitive
Constructors
IsLanguageActivePrimitive
public IsLanguageActivePrimitive(IDependencyService dependencyService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext currentContext)

LanguageComponentsPrimitive

public class LanguageComponentsPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageComponentsPrimitive
public LanguageComponentsPrimitive()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageImplementationPrimitive

public class LanguageImplementationPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageImplementationPrimitive
public LanguageImplementationPrimitive()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageIncludeDirectoriesPrimitive

public class LanguageIncludeDirectoriesPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageIncludeDirectoriesPrimitive
public LanguageIncludeDirectoriesPrimitive(ILanguagePathService languagePathService, IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageIncludeFilesPrimitive

public class LanguageIncludeFilesPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageIncludeFilesPrimitive
public LanguageIncludeFilesPrimitive(ILanguageService languageService, ILanguagePathService languagePathService, IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguagePrimitive

public class LanguagePrimitive extends ASpoofaxContextPrimitive
Constructors
LanguagePrimitive
public LanguagePrimitive()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageSourceDirectoriesPrimitive

public class LanguageSourceDirectoriesPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageSourceDirectoriesPrimitive
public LanguageSourceDirectoriesPrimitive(ILanguagePathService languagePathService, IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageSourceFilesPrimitive

public class LanguageSourceFilesPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageSourceFilesPrimitive
public LanguageSourceFilesPrimitive(ILanguageService languageService, ILanguagePathService languagePathService, IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LocalPathPrimitive

public class LocalPathPrimitive extends ASpoofaxPrimitive
Constructors
LocalPathPrimitive
public LocalPathPrimitive(IResourceService resourceService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LocalReplicatePrimitive

public class LocalReplicatePrimitive extends ASpoofaxPrimitive
Constructors
LocalReplicatePrimitive
public LocalReplicatePrimitive(IResourceService resourceService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

ParsePrimitive

public class ParsePrimitive extends ASpoofaxPrimitive
Constructors
ParsePrimitive
public ParsePrimitive(IResourceService resourceService, ILanguageService languageService, ILanguageIdentifierService languageIdentifierService, IDialectIdentifier dialectIdentifier, ISpoofaxUnitService unitService, ISourceTextService sourceTextService, ISpoofaxSyntaxService syntaxService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, org.spoofax.interpreter.core.IContext strategoContext)

ProjectPathPrimitive

public class ProjectPathPrimitive extends ASpoofaxContextPrimitive
Constructors
ProjectPathPrimitive
public ProjectPathPrimitive()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

RelativeSourceOrIncludePath

public class RelativeSourceOrIncludePath extends ASpoofaxContextPrimitive
Constructors
RelativeSourceOrIncludePath
public RelativeSourceOrIncludePath(ILanguagePathService languagePathService, IResourceService resourceService, IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

RelativeSourcePath

public class RelativeSourcePath extends ASpoofaxContextPrimitive
Constructors
RelativeSourcePath
public RelativeSourcePath(ILanguagePathService languagePathService, IResourceService resourceService, IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

SpoofaxPrimitiveLibrary

public class SpoofaxPrimitiveLibrary extends GenericPrimitiveLibrary
Fields
name
public static final String name
Constructors
SpoofaxPrimitiveLibrary
public SpoofaxPrimitiveLibrary(Set<AbstractPrimitive> primitives)

StatixLibrary

public class StatixLibrary extends GenericPrimitiveLibrary
Fields
REGISTRY_NAME
public static final String REGISTRY_NAME
name
public static final String name
Constructors
StatixLibrary
public StatixLibrary(Set<AbstractPrimitive> primitives)

org.metaborg.spoofax.core.stratego.primitive.constraint

C_get_resource_analysis

public class C_get_resource_analysis extends ConstraintContextPrimitive
Constructors
C_get_resource_analysis
public C_get_resource_analysis()
Methods
call
protected Optional<? extends IStrategoTerm> call(IConstraintContext context, IStrategoTerm sterm, List<IStrategoTerm> sterms, ITermFactory factory)

C_get_resource_partial_analysis

public class C_get_resource_partial_analysis extends ConstraintContextPrimitive
Constructors
C_get_resource_partial_analysis
public C_get_resource_partial_analysis()
Methods
call
protected Optional<? extends IStrategoTerm> call(IConstraintContext context, IStrategoTerm sterm, List<IStrategoTerm> sterms, ITermFactory factory)

ConstraintContextPrimitive

public abstract class ConstraintContextPrimitive extends AbstractPrimitive
Fields
tvars
protected final int tvars
Constructors
ConstraintContextPrimitive
public ConstraintContextPrimitive(String name)
ConstraintContextPrimitive
public ConstraintContextPrimitive(String name, int tvars)
Methods
call
public final boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)
call
protected abstract Optional<? extends IStrategoTerm> call(IConstraintContext context, IStrategoTerm term, List<IStrategoTerm> terms, ITermFactory factory)

org.metaborg.spoofax.core.stratego.primitive.flowspec

FS_solve

public class FS_solve extends AbstractPrimitive implements ILanguageCache
Fields
resourceService
protected final IResourceService resourceService
strategoTerms
protected final StrategoTerms strategoTerms
termFactory
protected final ITermFactory termFactory
Constructors
FS_solve
public FS_solve(IResourceService resourceService, ITermFactoryService termFactoryService)
Methods
call
public boolean call(org.spoofax.interpreter.core.IContext env, Strategy[] svars, IStrategoTerm[] tvars)
getFlowSpecStaticInfo
protected Optional<StaticInfo> getFlowSpecStaticInfo(ILanguageComponent component)
getFlowSpecStaticInfo
protected StaticInfo getFlowSpecStaticInfo(ILanguageImpl impl)
getFlowSpecStaticInfo
public static StaticInfo getFlowSpecStaticInfo(ILanguageImpl impl, Function<ILanguageComponent, Optional<StaticInfo>> getStaticInfo)
getFlowSpecStaticInfo
public static Optional<StaticInfo> getFlowSpecStaticInfo(ILanguageComponent component, IResourceService resourceService, ITermFactory termFactory, StrategoTerms strategoTerms)
invalidateCache
public void invalidateCache(ILanguageComponent component)
invalidateCache
public void invalidateCache(ILanguageImpl impl)

FlowSpecLibrary

public class FlowSpecLibrary extends GenericPrimitiveLibrary
Fields
REGISTRY_NAME
public static final String REGISTRY_NAME
name
public static final String name
Constructors
FlowSpecLibrary
public FlowSpecLibrary(Set<AbstractPrimitive> primitives)

org.metaborg.spoofax.core.stratego.primitive.generic

ASpoofaxContextPrimitive

public abstract class ASpoofaxContextPrimitive extends ASpoofaxPrimitive

A primitive base class that requires a Spoofax context to be available.

Constructors
ASpoofaxContextPrimitive
public ASpoofaxContextPrimitive(String name, int svars, int tvars)
Methods
call
protected abstract IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, org.spoofax.interpreter.core.IContext strategoContext)

ASpoofaxPrimitive

public abstract class ASpoofaxPrimitive extends AbstractPrimitive

An improved primitive base class.

Constructors
ASpoofaxPrimitive
public ASpoofaxPrimitive(String name, int svars, int tvars)
Methods
call
protected abstract IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)
call
public boolean call(IContext context, Strategy[] svars, IStrategoTerm[] tvars)
metaborgContext
protected org.metaborg.core.context.IContext metaborgContext(IContext strategoContext)

DummyPrimitive

public class DummyPrimitive extends AbstractPrimitive
Constructors
DummyPrimitive
public DummyPrimitive(String name, int strategyArity, int termArity)
Methods
call
public boolean call(IContext env, Strategy[] strategies, IStrategoTerm[] terms)

GenericPrimitiveLibrary

public class GenericPrimitiveLibrary extends AbstractStrategoOperatorRegistry
Constructors
GenericPrimitiveLibrary
public GenericPrimitiveLibrary(Iterable<AbstractPrimitive> primitives, String name)
Methods
getOperatorRegistryName
public String getOperatorRegistryName()

RedirectingPrimitive

public class RedirectingPrimitive extends AbstractPrimitive
Constructors
RedirectingPrimitive
public RedirectingPrimitive(String name, AbstractPrimitive redirectTo)
Methods
call
public boolean call(IContext env, Strategy[] strategies, IStrategoTerm[] terms)

org.metaborg.spoofax.core.stratego.primitive.legacy

LegacyForeignCallPrimitive

public class LegacyForeignCallPrimitive extends ASpoofaxContextPrimitive
Constructors
LegacyForeignCallPrimitive
public LegacyForeignCallPrimitive(ILanguageService languageService, IContextService contextService, IProjectService projectService, IStrategoCommon common)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext currentContext)

LegacyLanguageIncludeFilesPrimitive

public class LegacyLanguageIncludeFilesPrimitive extends RedirectingPrimitive
Constructors
LegacyLanguageIncludeFilesPrimitive
public LegacyLanguageIncludeFilesPrimitive(LanguageIncludeFilesPrimitive prim)

LegacyLanguageIncludeLocationsPrimitive

public class LegacyLanguageIncludeLocationsPrimitive extends RedirectingPrimitive
Constructors
LegacyLanguageIncludeLocationsPrimitive
public LegacyLanguageIncludeLocationsPrimitive(LanguageIncludeDirectoriesPrimitive prim)

LegacyLanguageIncludeLocationsPrimitive2

public class LegacyLanguageIncludeLocationsPrimitive2 extends RedirectingPrimitive
Constructors
LegacyLanguageIncludeLocationsPrimitive2
public LegacyLanguageIncludeLocationsPrimitive2(LanguageIncludeDirectoriesPrimitive prim)

LegacyLanguageSourceFilesPrimitive

public class LegacyLanguageSourceFilesPrimitive extends RedirectingPrimitive
Constructors
LegacyLanguageSourceFilesPrimitive
public LegacyLanguageSourceFilesPrimitive(LanguageSourceFilesPrimitive prim)

LegacyLanguageSourceLocationsPrimitive

public class LegacyLanguageSourceLocationsPrimitive extends RedirectingPrimitive
Constructors
LegacyLanguageSourceLocationsPrimitive
public LegacyLanguageSourceLocationsPrimitive(LanguageSourceDirectoriesPrimitive prim)

LegacyLanguageSourceLocationsPrimitive2

public class LegacyLanguageSourceLocationsPrimitive2 extends RedirectingPrimitive
Constructors
LegacyLanguageSourceLocationsPrimitive2
public LegacyLanguageSourceLocationsPrimitive2(LanguageSourceDirectoriesPrimitive prim)

LegacyProjectPathPrimitive

public class LegacyProjectPathPrimitive extends RedirectingPrimitive
Constructors
LegacyProjectPathPrimitive
public LegacyProjectPathPrimitive(ProjectPathPrimitive prim)

LegacySpoofaxPrimitiveLibrary

public class LegacySpoofaxPrimitiveLibrary extends GenericPrimitiveLibrary
Fields
name
public static final String name
Constructors
LegacySpoofaxPrimitiveLibrary
public LegacySpoofaxPrimitiveLibrary(Set<AbstractPrimitive> primitives)

org.metaborg.spoofax.core.stratego.primitive.legacy.parse

LegacyParseFilePrimitive

public class LegacyParseFilePrimitive extends AbstractPrimitive
Constructors
LegacyParseFilePrimitive
public LegacyParseFilePrimitive(IResourceService resourceService, ILanguageIdentifierService languageIdentifierService, ISpoofaxUnitService unitService, ISourceTextService sourceTextService, ISpoofaxSyntaxService syntaxService)
LegacyParseFilePrimitive
protected LegacyParseFilePrimitive(String name, IResourceService resourceService, ILanguageIdentifierService languageIdentifierService, ISpoofaxUnitService unitService, ISourceTextService sourceTextService, ISpoofaxSyntaxService syntaxService)
Methods
call
public boolean call(IContext env, Strategy[] strategies, IStrategoTerm[] terms)

LegacyParseFilePtPrimitive

public class LegacyParseFilePtPrimitive extends LegacyParseFilePrimitive
Constructors
LegacyParseFilePtPrimitive
public LegacyParseFilePtPrimitive(IResourceService resourceService, ILanguageIdentifierService languageIdentifierService, ISpoofaxUnitService unitService, ISourceTextService sourceTextService, SpoofaxSyntaxService syntaxService)

LegacySpoofaxJSGLRLibrary

public class LegacySpoofaxJSGLRLibrary extends GenericPrimitiveLibrary
Fields
injectionName
public static final String injectionName
Constructors
LegacySpoofaxJSGLRLibrary
public LegacySpoofaxJSGLRLibrary(Set<AbstractPrimitive> primitives)

org.metaborg.spoofax.core.stratego.primitive.nabl2

SG_is_debug_collection_enabled

public class SG_is_debug_collection_enabled extends ScopeGraphConfigPrimitive
Constructors
SG_is_debug_collection_enabled
public SG_is_debug_collection_enabled(ISpoofaxProjectConfigService configService)
Methods
call
protected IStrategoTerm call(NaBL2Config config, IStrategoTerm term)

SG_is_debug_custom_enabled

public class SG_is_debug_custom_enabled extends ScopeGraphConfigPrimitive
Constructors
SG_is_debug_custom_enabled
public SG_is_debug_custom_enabled(ISpoofaxProjectConfigService configService)
Methods
call
public IStrategoTerm call(NaBL2Config config, IStrategoTerm term)

SG_is_debug_resolution_enabled

public class SG_is_debug_resolution_enabled extends ScopeGraphConfigPrimitive
Constructors
SG_is_debug_resolution_enabled
public SG_is_debug_resolution_enabled(ISpoofaxProjectConfigService configService)
Methods
call
protected IStrategoTerm call(NaBL2Config config, IStrategoTerm term)

ScopeGraphConfigPrimitive

public abstract class ScopeGraphConfigPrimitive extends ASpoofaxPrimitive
Constructors
ScopeGraphConfigPrimitive
public ScopeGraphConfigPrimitive(String name, ISpoofaxProjectConfigService configService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)
call
protected abstract IStrategoTerm call(NaBL2Config config, IStrategoTerm term)

ScopeGraphLibrary

public class ScopeGraphLibrary extends GenericPrimitiveLibrary
Fields
REGISTRY_NAME
public static final String REGISTRY_NAME
name
public static final String name
Constructors
ScopeGraphLibrary
public ScopeGraphLibrary(Set<AbstractPrimitive> primitives)

org.metaborg.spoofax.core.stratego.strategies

ParseFileStrategy

public class ParseFileStrategy extends Strategy
Constructors
ParseFileStrategy
public ParseFileStrategy(IResourceService resourceService, ILanguageIdentifierService languageIdentifierService, ISpoofaxUnitService unitService, ISourceTextService sourceTextService, ISpoofaxSyntaxService syntaxService)
Methods
invoke
public IStrategoTerm invoke(Context context, IStrategoTerm current)

ParseStrategoFileStrategy

public class ParseStrategoFileStrategy extends parse_stratego_file_0_0
Constructors
ParseStrategoFileStrategy
public ParseStrategoFileStrategy(ParseFileStrategy parseFileStrategy)
Methods
invoke
public IStrategoTerm invoke(Context context, IStrategoTerm current)

org.metaborg.spoofax.core.style

CategorizerService

public class CategorizerService implements ISpoofaxCategorizerService
Methods
categorize
public Iterable<IRegionCategory<IStrategoTerm>> categorize(ILanguageImpl language, ISpoofaxParseUnit parseResult)
categorize
public Iterable<IRegionCategory<IStrategoTerm>> categorize(ILanguageImpl language, ISpoofaxAnalyzeUnit analysisResult)

CategorizerValidator

public class CategorizerValidator
Methods
validate
public static <T> Iterable<IRegionCategory<T>> validate(Iterable<IRegionCategory<T>> categorization)

ConsCategory

public class ConsCategory implements ICategory
Fields
cons
public final String cons
Constructors
ConsCategory
public ConsCategory(String cons)
Methods
name
public String name()
toString
public String toString()

ISpoofaxCategorizerService

public interface ISpoofaxCategorizerService extends ICategorizerService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, IStrategoTerm>

Typedef interface for ICategorizerService with Spoofax interfaces.

ISpoofaxStylerService

public interface ISpoofaxStylerService extends IStylerService<IStrategoTerm>

Typedef interface for IStylerService with Spoofax interfaces.

SortCategory

public class SortCategory implements ICategory
Fields
sort
public final String sort
Constructors
SortCategory
public SortCategory(String sort)
Methods
name
public String name()
toString
public String toString()

SortConsCategory

public class SortConsCategory implements ICategory
Fields
cons
public final String cons
sort
public final String sort
Constructors
SortConsCategory
public SortConsCategory(String sort, String cons)
Methods
name
public String name()
toString
public String toString()

StylerFacet

public class StylerFacet implements IFacet
Methods
consStyle
public IStyle consStyle(String cons)
hasConsStyle
public boolean hasConsStyle(String cons)
hasSortConsStyle
public boolean hasSortConsStyle(String sort, String cons)
hasSortStyle
public boolean hasSortStyle(String sort)
hasTokenStyle
public boolean hasTokenStyle(String builtin)
mapConsToStyle
public void mapConsToStyle(String cons, IStyle style)
mapSortConsToStyle
public void mapSortConsToStyle(String sort, String cons, IStyle style)
mapSortToStyle
public void mapSortToStyle(String sort, IStyle style)
mapTokenToStyle
public void mapTokenToStyle(String builtin, IStyle style)
sortConsStyle
public IStyle sortConsStyle(String sort, String cons)
sortStyle
public IStyle sortStyle(String sort)
tokenStyle
public IStyle tokenStyle(String builtin)

StylerFacetFromESV

public class StylerFacetFromESV
Methods
create
public static StylerFacet create(IStrategoAppl esv)

StylerService

public class StylerService implements ISpoofaxStylerService
Methods
styleAnalyzed
public Iterable<IRegionStyle<IStrategoTerm>> styleAnalyzed(ILanguageImpl language, Iterable<IRegionCategory<IStrategoTerm>> categorization)
styleParsed
public Iterable<IRegionStyle<IStrategoTerm>> styleParsed(ILanguageImpl language, Iterable<IRegionCategory<IStrategoTerm>> categorization)

TokenCategory

public class TokenCategory implements ICategory
Fields
token
public final String token
Constructors
TokenCategory
public TokenCategory(String token)
Methods
name
public String name()
toString
public String toString()

org.metaborg.spoofax.core.syntax

IParseTableProvider

public interface IParseTableProvider
Methods
parseTable
Object parseTable()

IParserConfig

public interface IParserConfig
Methods
getImploderSetting
ImploderImplementation getImploderSetting()
getParseTableProvider
IParseTableProvider getParseTableProvider()
getStartSymbol
String getStartSymbol()

ISpoofaxParser

public interface ISpoofaxParser extends IParser<ISpoofaxInputUnit, ISpoofaxParseUnit>

Typedef interface for IParser with Spoofax interfaces.

ISpoofaxSyntaxService

public interface ISpoofaxSyntaxService extends ISyntaxService<ISpoofaxInputUnit, ISpoofaxParseUnit>

Typedef interface for ISyntaxService with Spoofax interfaces.

ImploderImplementation

public enum ImploderImplementation
Enum Constants
java
public static final ImploderImplementation java
stratego
public static final ImploderImplementation stratego

IncrementalParserConfig

public class IncrementalParserConfig implements IParserConfig
Constructors
IncrementalParserConfig
public IncrementalParserConfig(String startSymbol, IParseTableProvider provider, ParseTable pt, ImploderImplementation imploder)
Methods
getImploderSetting
public ImploderImplementation getImploderSetting()
getParseTableProvider
public IParseTableProvider getParseTableProvider()
getReferenceParseTable
public ParseTable getReferenceParseTable()
getStartSymbol
public String getStartSymbol()

JSGLR1FileParseTableProvider

public class JSGLR1FileParseTableProvider implements IParseTableProvider
Constructors
JSGLR1FileParseTableProvider
public JSGLR1FileParseTableProvider(FileObject resource, ITermFactory termFactory)
Methods
parseTable
public ParseTable parseTable()

JSGLR1I

public class JSGLR1I extends JSGLRI<ParseTable>
Constructors
JSGLR1I
public JSGLR1I(IParserConfig config, ITermFactory termFactory, ILanguageImpl language, ILanguageImpl dialect, FileObject resource, String input)
Methods
actuallyParse
public SGLRParseResult actuallyParse(String text, String filename, JSGLRParserConfiguration parserConfig)
getCollectedErrors
public Set<BadTokenException> getCollectedErrors()
parse
public ParseContrib parse(JSGLRParserConfiguration parserConfig)
parseAndRecover
public SGLRParseResult parseAndRecover(String text, String filename, Disambiguator disambiguator, String startSymbol)

JSGLR1IncrementalParseTableProvider

public class JSGLR1IncrementalParseTableProvider implements IParseTableProvider
Constructors
JSGLR1IncrementalParseTableProvider
public JSGLR1IncrementalParseTableProvider(FileObject resource, ITermFactory termFactory, org.metaborg.sdf2table.parsetable.ParseTable referenceTable)
Methods
parseTable
public ParseTable parseTable()

JSGLR2FileParseTableProvider

public class JSGLR2FileParseTableProvider implements IParseTableProvider
Constructors
JSGLR2FileParseTableProvider
public JSGLR2FileParseTableProvider(FileObject resource, ITermFactory termFactory)
Methods
parseTable
public IParseTable parseTable()

JSGLR2I

public class JSGLR2I extends JSGLRI<IParseTable>
Constructors
JSGLR2I
public JSGLR2I(IParserConfig config, ITermFactory termFactory, ILanguageImpl language, ILanguageImpl dialect, FileObject resource, String input, boolean dataDependent, boolean layoutSensitive)
Methods
getCollectedErrors
public Set<BadTokenException> getCollectedErrors()
parse
public ParseContrib parse(JSGLRParserConfiguration parserConfig)

JSGLRI

public abstract class JSGLRI<PT>
Fields
config
protected final IParserConfig config
dialect
protected final ILanguageImpl dialect
input
protected final String input
language
protected final ILanguageImpl language
resource
protected final FileObject resource
termFactory
protected final ITermFactory termFactory
Constructors
JSGLRI
public JSGLRI(IParserConfig config, ITermFactory termFactory, ILanguageImpl language, ILanguageImpl dialect, FileObject resource, String input)
Methods
getCollectedErrors
public abstract Set<BadTokenException> getCollectedErrors()
getConfig
public IParserConfig getConfig()
getDialect
public ILanguageImpl getDialect()
getInput
public String getInput()
getLanguage
public ILanguageImpl getLanguage()
getOrDefaultStartSymbol
protected String getOrDefaultStartSymbol(JSGLRParserConfiguration parserConfig)
getParseTable
protected PT getParseTable(IParseTableProvider parseTableProvider)
getResource
public FileObject getResource()
parse
public abstract ParseContrib parse(JSGLRParserConfiguration parserConfig)

JSGLRParseErrorHandler

public class JSGLRParseErrorHandler
Constructors
JSGLRParseErrorHandler
public JSGLRParseErrorHandler(JSGLRI<?> parser, FileObject resource, boolean hasRecoveryRules)
Methods
gatherNonFatalErrors
public void gatherNonFatalErrors(IStrategoTerm top)
messages
public Iterable<IMessage> messages()
processFatalException
public void processFatalException(ITokens tokenizer, Exception exception)
setRecoveryFailed
public void setRecoveryFailed(boolean recoveryFailed)

JSGLRParseService

public class JSGLRParseService implements ISpoofaxParser, ILanguageCache
Fields
name
public static final String name
Constructors
JSGLRParseService
public JSGLRParseService(ISpoofaxUnitService unitService, ITermFactoryService termFactoryService, JSGLRParserConfiguration defaultParserConfig)
Methods
getCompletionParserConfig
public IParserConfig getCompletionParserConfig(ILanguageImpl lang, ISpoofaxInputUnit input)
getParserConfig
public IParserConfig getParserConfig(ILanguageImpl lang, ISpoofaxInputUnit input)
invalidateCache
public void invalidateCache(ILanguageImpl impl)
invalidateCache
public void invalidateCache(ILanguageComponent component)
parse
public ISpoofaxParseUnit parse(ISpoofaxInputUnit input, IProgress progress, ICancel cancel)
parseAll
public Collection<ISpoofaxParseUnit> parseAll(Iterable<ISpoofaxInputUnit> inputs, IProgress progress, ICancel cancel)

JSGLRParserConfiguration

public class JSGLRParserConfiguration
Fields
completion
public final boolean completion
cursorPosition
public final int cursorPosition
defaultCompletion
public static final boolean defaultCompletion
defaultCursorPosition
public static final int defaultCursorPosition
defaultImplode
public static final boolean defaultImplode
defaultOverridingStartSymbol
public static final String defaultOverridingStartSymbol
defaultRecovery
public static final boolean defaultRecovery
defaultTimeout
public static final int defaultTimeout
implode
public final boolean implode
overridingStartSymbol
public final String overridingStartSymbol
recovery
public final boolean recovery
timeout
public final int timeout
Constructors
JSGLRParserConfiguration
public JSGLRParserConfiguration()
JSGLRParserConfiguration
public JSGLRParserConfiguration(boolean implode, boolean recovery)
JSGLRParserConfiguration
public JSGLRParserConfiguration(boolean implode, boolean recovery, boolean completion, int timeout, int cursorPosition)
JSGLRParserConfiguration
public JSGLRParserConfiguration(String startSymbol)
JSGLRParserConfiguration
public JSGLRParserConfiguration(boolean implode, boolean recovery, boolean completion, int timeout, int cursorPosition, String startSymbol)

JSGLRSourceRegionFactory

public class JSGLRSourceRegionFactory
Methods
fromToken
public static ISourceRegion fromToken(IToken token)
fromTokens
public static ISourceRegion fromTokens(IToken left, IToken right)
fromTokensLayout
public static ISourceRegion fromTokensLayout(IToken left, IToken right, boolean isNullable)

ParseFacetFromESV

public class ParseFacetFromESV
Methods
create
public static ParseFacet create(IStrategoAppl esv)
hasParser
public static boolean hasParser(IStrategoAppl esv)

ParserConfig

public class ParserConfig implements IParserConfig
Constructors
ParserConfig
public ParserConfig(String startSymbol, IParseTableProvider provider, ImploderImplementation imploder)
Methods
getImploderSetting
public ImploderImplementation getImploderSetting()
getParseTableProvider
public IParseTableProvider getParseTableProvider()
getStartSymbol
public String getStartSymbol()

SourceAttachment

public class SourceAttachment extends AbstractTermAttachment

A tree-wide source resource and parse controller attachment. Uses ParentAttachment to identify the root of a tree, where this attachment is stored.

Fields
TYPE
public static final TermAttachmentType<SourceAttachment> TYPE
Methods
getAttachmentType
public TermAttachmentType<SourceAttachment> getAttachmentType()
getFile
public FileObject getFile()
getResource
public static FileObject getResource(ISimpleTerm term, IResourceService resourceService)
putSource
public static void putSource(ISimpleTerm term, FileObject resource)

Sets the resource for a term tree. Should only be applied to the root of a tree.

SpoofaxSyntaxService

public class SpoofaxSyntaxService extends SyntaxService<ISpoofaxInputUnit, ISpoofaxParseUnit> implements ISpoofaxSyntaxService
Constructors
SpoofaxSyntaxService
public SpoofaxSyntaxService(Map<String, ISpoofaxParser> parsers)
Methods
fenceCharacters
public Iterable<FenceCharacters> fenceCharacters(ILanguageImpl language)
multiLineCommentCharacters
public Iterable<MultiLineCommentCharacters> multiLineCommentCharacters(ILanguageImpl language)
singleLineCommentPrefixes
public Iterable<String> singleLineCommentPrefixes(ILanguageImpl language)

SyntaxFacet

public class SyntaxFacet implements IFacet

Represents the syntax (or parsing) facet of a language.

Fields
completionParseTable
public final FileObject completionParseTable
fenceCharacters
public final Iterable<FenceCharacters> fenceCharacters
imploder
public final ImploderImplementation imploder
multiLineCommentCharacters
public final Iterable<MultiLineCommentCharacters> multiLineCommentCharacters
parseTable
public final FileObject parseTable
singleLineCommentPrefixes
public final Iterable<String> singleLineCommentPrefixes
startSymbols
public final Iterable<String> startSymbols
Constructors
SyntaxFacet
public SyntaxFacet(FileObject parseTable, FileObject completionParseTable, Iterable<String> startSymbols)

Creates a syntax facet from a parse table provider and start symbols.

Parameters:
  • parseTable – Parse table.
  • startSymbols – Set of start symbols.
SyntaxFacet
public SyntaxFacet(FileObject parseTable, FileObject completionParseTable, Iterable<String> startSymbols, Iterable<String> singleLineCommentPrefixes, Iterable<MultiLineCommentCharacters> multiLineCommentCharacters, Iterable<FenceCharacters> fenceCharacters, ImploderImplementation imploder)

Creates a syntax facet from syntax configuration.

Parameters:
  • parseTable – Parse table.
  • startSymbols – Set of start symbols.
  • singleLineCommentPrefixes – Single line comment prefixes.
  • multiLineCommentCharacters – Multi line comment characters.
  • fenceCharacters – Fence characters.
Methods
available
public Iterable<String> available()

Checks if the parse table file exists, returns errors if not.

Throws:
  • FileSystemException – When an error occurs while checking if the parse table file exists.
Returns:

Errors, or empty if there are no errors.

withImploderSetting
public SyntaxFacet withImploderSetting(ImploderImplementation imploder)

Creates a syntax facet from another syntax facet, only overriding the imploder setting

Parameters:
  • imploder – The imploder setting.

SyntaxFacetFromESV

public class SyntaxFacetFromESV
Methods
create
public static SyntaxFacet create(IStrategoAppl esv, FileObject location)

org.metaborg.spoofax.core.terms

ITermFactoryService

public interface ITermFactoryService

Interface for retrieving term factories for languages and generic use.

Methods
get
ITermFactory get(ILanguageImpl impl, IProject project, boolean supportsTypesmart)

Return the term factory to be used when constructing new terms for given language implementation.

Parameters:
  • impl – Implementation to get the term factory for.
  • project – The current project through which the user can require typesmart analysis.
  • supportsTypesmart – Whether the caller supports typesmart analysis.
Returns:

Language-specific term factory.

get
ITermFactory get(ILanguageComponent component, IProject project, boolean supportsTypesmart)

Return the term factory to be used when constructing new terms for given language component.

Parameters:
  • component – Component to get the term factory for.
  • project – The current project through which the user can require typesmart analysis.
  • supportsTypesmart – Whether the caller supports typesmart analysis.
Returns:

Language-specific term factory.

getGeneric
ITermFactory getGeneric()

Returns the generic term factory.

Returns:Generic term factory.

TermFactoryService

public class TermFactoryService implements ITermFactoryService, ILanguageCache
Constructors
TermFactoryService
public TermFactoryService(IDependencyService dependencyService, ISpoofaxProjectConfigService configService)
Methods
get
public ITermFactory get(ILanguageImpl impl, IProject project, boolean supportsTypesmart)
get
public ITermFactory get(ILanguageComponent component, IProject project, boolean supportsTypesmart)
getGeneric
public ITermFactory getGeneric()
invalidateCache
public void invalidateCache(ILanguageImpl impl)
invalidateCache
public void invalidateCache(ILanguageComponent component)

org.metaborg.spoofax.core.tracing

HoverFacet

public class HoverFacet implements IFacet
Fields
strategyName
public final String strategyName
Constructors
HoverFacet
public HoverFacet(String strategyName)

HoverService

public class HoverService implements ISpoofaxHoverService
Constructors
HoverService
public HoverService(IProjectService projectService, IContextService contextService, ITermFactoryService termFactoryService, IStrategoRuntimeService strategoRuntimeService, ISpoofaxTracingService tracingService, TracingCommon common)
Methods
available
public boolean available(ILanguageImpl language)
hover
public Hover hover(int offset, ISpoofaxParseUnit result)
hover
public Hover hover(int offset, ISpoofaxAnalyzeUnit result)

ISpoofaxHoverService

public interface ISpoofaxHoverService extends IHoverService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>

Typedef interface for IHoverService with Spoofax interfaces.

ISpoofaxResolverService

public interface ISpoofaxResolverService extends IResolverService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>

Typedef interface for IResolverService with Spoofax interfaces.

ISpoofaxTracingService

public interface ISpoofaxTracingService extends ITracingService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<?>, IStrategoTerm>

Typedef interface for ITracingService with Spoofax interfaces.

ResolverFacet

public class ResolverFacet implements IFacet
Fields
strategyName
public final String strategyName
Constructors
ResolverFacet
public ResolverFacet(String strategyName)

ResolverFacetFromESV

public class ResolverFacetFromESV
Methods
createHover
public static HoverFacet createHover(IStrategoAppl esv)
createResolver
public static ResolverFacet createResolver(IStrategoAppl esv)

ResolverService

public class ResolverService implements ISpoofaxResolverService
Constructors
ResolverService
public ResolverService(IProjectService projectService, IContextService contextService, ITermFactoryService termFactoryService, IStrategoRuntimeService strategoRuntimeService, ISpoofaxTracingService tracingService, TracingCommon common)
Methods
available
public boolean available(ILanguageImpl language)
resolve
public Resolution resolve(int offset, ISpoofaxParseUnit result)
resolve
public Resolution resolve(int offset, ISpoofaxAnalyzeUnit result)

TracingCommon

public class TracingCommon
Constructors
TracingCommon
public TracingCommon(ISpoofaxTracingService tracingService, IStrategoCommon common)
Methods
getTargetLocation
public ISourceLocation getTargetLocation(IStrategoTerm term)
outputs
public TermWithRegion outputs(ITermFactory termFactory, HybridInterpreter runtime, FileObject location, FileObject resource, IStrategoTerm result, Iterable<IStrategoTerm> inRegion, String strategy)

TracingCommon.TermWithRegion

public static class TermWithRegion

Data class representing a term with its corresponding region in the source text.

Fields
region
public final ISourceRegion region
term
public final IStrategoTerm term
Constructors
TermWithRegion
public TermWithRegion(IStrategoTerm term, ISourceRegion region)

TracingService

public class TracingService implements ISpoofaxTracingService
Constructors
TracingService
public TracingService(IResourceService resourceService)
Methods
fragments
public Iterable<IStrategoTerm> fragments(ISpoofaxParseUnit result, ISourceRegion region)
fragments
public Iterable<IStrategoTerm> fragments(ISpoofaxAnalyzeUnit result, ISourceRegion region)
fragments
public Iterable<IStrategoTerm> fragments(ISpoofaxTransformUnit<?> result, ISourceRegion region)
fragmentsWithin
public Iterable<IStrategoTerm> fragmentsWithin(ISpoofaxParseUnit result, ISourceRegion region)
fragmentsWithin
public Iterable<IStrategoTerm> fragmentsWithin(ISpoofaxAnalyzeUnit result, ISourceRegion region)
fragmentsWithin
public Iterable<IStrategoTerm> fragmentsWithin(ISpoofaxTransformUnit<?> result, ISourceRegion region)
location
public ISourceLocation location(IStrategoTerm fragment)
origin
public IStrategoTerm origin(IStrategoTerm fragment)

org.metaborg.spoofax.core.transform

ISpoofaxTransformService

public interface ISpoofaxTransformService extends ITransformService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>

Typedef interface for ITransformService with Spoofax interfaces.

IStrategoTransformer

public interface IStrategoTransformer extends ITransformer<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>

Typedef interface for ITransformer with Spoofax interfaces.

SpoofaxTransformService

public class SpoofaxTransformService extends TransformService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> implements ISpoofaxTransformService

Typedef class for TransformService with IStrategoTerm.

Constructors
SpoofaxTransformService
public SpoofaxTransformService(IActionService actionService, ISpoofaxAnalysisService analysisService, IStrategoTransformer transformer)

StrategoTransformer

public class StrategoTransformer implements IStrategoTransformer
Constructors
StrategoTransformer
public StrategoTransformer(IResourceService resourceService, ISpoofaxUnitService unitService, IEditorRegistry editorRegistry, IStrategoRuntimeService strategoRuntimeService, IStrategoCommon common)
Methods
transformAllAnalyzed
public Collection<ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> transformAllAnalyzed(Iterable<ISpoofaxAnalyzeUnit> inputs, IContext context, TransformActionContrib action, ITransformConfig config)
transformAllParsed
public Collection<ISpoofaxTransformUnit<ISpoofaxParseUnit>> transformAllParsed(Iterable<ISpoofaxParseUnit> inputs, IContext context, TransformActionContrib action, ITransformConfig config)

org.metaborg.spoofax.core.unit

AnalyzeContrib

public class AnalyzeContrib implements IUnitContrib
Fields
ast
public final IStrategoTerm ast
duration
public final long duration
hasAst
public final boolean hasAst
messages
public final Iterable<IMessage> messages
success
public final boolean success
valid
public final boolean valid
Constructors
AnalyzeContrib
public AnalyzeContrib(boolean valid, boolean success, boolean hasAst, IStrategoTerm ast, Iterable<IMessage> messages, long duration)
AnalyzeContrib
public AnalyzeContrib()
Methods
id
public String id()

AnalyzeUnit

public class AnalyzeUnit extends UnitWrapper implements ISpoofaxAnalyzeUnit
Constructors
AnalyzeUnit
public AnalyzeUnit(Unit unit, AnalyzeContrib contrib, ISpoofaxParseUnit parseUnit, IContext context)
Methods
ast
public IStrategoTerm ast()
context
public IContext context()
duration
public long duration()
hasAst
public boolean hasAst()
input
public ISpoofaxParseUnit input()
messages
public Iterable<IMessage> messages()
success
public boolean success()
valid
public boolean valid()

AnalyzeUnitUpdate

public class AnalyzeUnitUpdate implements ISpoofaxAnalyzeUnitUpdate
Constructors
AnalyzeUnitUpdate
public AnalyzeUnitUpdate(FileObject source, AnalyzeUpdateData data)
Methods
messages
public Iterable<IMessage> messages()
source
public FileObject source()

AnalyzeUpdateData

public class AnalyzeUpdateData
Fields
messages
public final Iterable<IMessage> messages
Constructors
AnalyzeUpdateData
public AnalyzeUpdateData(Iterable<IMessage> messages)
AnalyzeUpdateData
public AnalyzeUpdateData()

ISpoofaxAnalyzeUnit

public interface ISpoofaxAnalyzeUnit extends IAnalyzeUnit

Spoofax-specific extension of an IAnalyzeUnit that adds an IStrategoTerm AST.

Methods
ast
IStrategoTerm ast()
Returns:Analyzed AST, or null if valid() or hasAst() returns false. If success() returns false, this AST may still represent an error recovered AST.
hasAst
boolean hasAst()
Returns:True if the analyzer that created this unit attempted to make an AST. False otherwise.

ISpoofaxAnalyzeUnitUpdate

public interface ISpoofaxAnalyzeUnitUpdate extends IAnalyzeUnitUpdate

Spoofax-specific extension of an analyze unit update.

ISpoofaxInputUnit

public interface ISpoofaxInputUnit extends IInputUnit

Spoofax-specific extension of an input unit.

Methods
config
JSGLRParserConfiguration config()
Returns:Parser-specific configuration, or null when no configuration has been set.

ISpoofaxInputUnitService

public interface ISpoofaxInputUnitService extends IInputUnitService<ISpoofaxInputUnit>
Methods
inputUnit
ISpoofaxInputUnit inputUnit(FileObject source, String text, ILanguageImpl langImpl, ILanguageImpl dialect, JSGLRParserConfiguration config)
inputUnit
ISpoofaxInputUnit inputUnit(String text, ILanguageImpl langImpl, ILanguageImpl dialect, JSGLRParserConfiguration config)

ISpoofaxParseUnit

public interface ISpoofaxParseUnit extends IParseUnit

Spoofax-specific extension of a parse unit that adds an IStrategoTerm AST.

Methods
ast
IStrategoTerm ast()
Returns:Parsed AST, or null if valid() return false. If success() returns false, this AST may still represent an error recovered AST.

ISpoofaxTransformOutput

public interface ISpoofaxTransformOutput extends ITransformOutput
Methods
ast
IStrategoTerm ast()

The output term of the transformation.

ISpoofaxTransformUnit

public interface ISpoofaxTransformUnit<I extends IUnit> extends ITransformUnit<I>

Spoofax-specific extension of an ITransformUnit that adds an String AST.

Parameters:
  • <I> – Type of input unit.
Methods
ast
IStrategoTerm ast()
Returns:Transformed AST, or null if valid() return false. If success() returns false, this AST may still represent an error recovered AST.
outputs
Iterable<? extends ISpoofaxTransformOutput> outputs()

ISpoofaxUnitService

public interface ISpoofaxUnitService extends IUnitService<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>, ISpoofaxInputUnitService

Typedef interface for IUnitService with Spoofax interfaces, extended with methods to create new parse, analyze, and transform units.

Methods
analyzeUnit
ISpoofaxAnalyzeUnit analyzeUnit(ISpoofaxParseUnit input, AnalyzeContrib contrib, IContext context)
analyzeUnitUpdate
ISpoofaxAnalyzeUnitUpdate analyzeUnitUpdate(FileObject source, AnalyzeUpdateData contrib, IContext context)
parseUnit
ISpoofaxParseUnit parseUnit(ISpoofaxInputUnit input, ParseContrib contrib)
transformUnit
<I extends IUnit> ISpoofaxTransformUnit<I> transformUnit(I input, TransformContrib contrib, IContext context, TransformActionContrib action)

InputContrib

public class InputContrib implements IUnitContrib
Fields
config
public final JSGLRParserConfiguration config
dialect
public final ILanguageImpl dialect
langImpl
public final ILanguageImpl langImpl
text
public final String text
Constructors
InputContrib
public InputContrib(String text, ILanguageImpl langImpl, ILanguageImpl dialect, JSGLRParserConfiguration config)
InputContrib
public InputContrib(String text, ILanguageImpl langImpl, ILanguageImpl dialect)
InputContrib
public InputContrib(ILanguageImpl langImpl, ILanguageImpl dialect)
InputContrib
public InputContrib(ILanguageImpl langImpl)
Methods
id
public String id()

InputUnit

public class InputUnit extends UnitWrapper implements ISpoofaxInputUnit

Wraps a Unit and InputContrib as ISpoofaxInputUnit.

Constructors
InputUnit
public InputUnit(Unit unit, InputContrib contrib)
Methods
config
public JSGLRParserConfiguration config()
dialect
public ILanguageImpl dialect()
langImpl
public ILanguageImpl langImpl()
text
public String text()

ParseContrib

public class ParseContrib implements IUnitContrib
Fields
ast
public final IStrategoTerm ast
duration
public final long duration
messages
public final Iterable<IMessage> messages
success
public final boolean success
valid
public final boolean valid
Constructors
ParseContrib
public ParseContrib(boolean valid, boolean success, IStrategoTerm ast, Iterable<IMessage> messages, long duration)
ParseContrib
public ParseContrib(IStrategoTerm emptyAst)
Methods
id
public String id()

ParseUnit

public class ParseUnit extends UnitWrapper implements ISpoofaxParseUnit

Wraps a Unit and ParseContrib as ISpoofaxParseUnit.

Constructors
ParseUnit
public ParseUnit(Unit unit, ParseContrib contrib, ISpoofaxInputUnit inputUnit)
Methods
ast
public IStrategoTerm ast()
duration
public long duration()
input
public ISpoofaxInputUnit input()
messages
public Iterable<IMessage> messages()
success
public boolean success()
valid
public boolean valid()

TransformContrib

public class TransformContrib implements IUnitContrib
Fields
ast
public final IStrategoTerm ast
duration
public final long duration
messages
public final Iterable<IMessage> messages
outputs
public final Iterable<TransformOutput> outputs
success
public final boolean success
valid
public final boolean valid
Constructors
TransformContrib
public TransformContrib(boolean valid, boolean success, IStrategoTerm ast, Iterable<TransformOutput> outputs, Iterable<IMessage> messages, long duration)
TransformContrib
public TransformContrib()
Methods
id
public String id()

TransformOutput

public class TransformOutput implements ISpoofaxTransformOutput
Fields
ast
public final IStrategoTerm ast
name
public final String name
resource
public final FileObject resource
Constructors
TransformOutput
public TransformOutput(String name, FileObject output, IStrategoTerm ast)
Methods
ast
public IStrategoTerm ast()
name
public String name()
output
public FileObject output()

TransformUnit

public class TransformUnit<I extends IUnit> extends UnitWrapper implements ISpoofaxTransformUnit<I>
Constructors
TransformUnit
public TransformUnit(Unit unit, TransformContrib contrib, I inputUnit, IContext context, TransformActionContrib action)
Methods
action
public TransformActionContrib action()
ast
public IStrategoTerm ast()
context
public IContext context()
duration
public long duration()
input
public I input()
messages
public Iterable<IMessage> messages()
outputs
public Iterable<TransformOutput> outputs()
success
public boolean success()
valid
public boolean valid()

Unit

public class Unit implements IUnit
Constructors
Unit
public Unit(FileObject source, Map<String, IUnitContrib> contribs)
Unit
public Unit(FileObject source)
Unit
public Unit()
Methods
addUnitContrib
public void addUnitContrib(IUnitContrib contrib)
detached
public boolean detached()
source
public FileObject source()
unitContrib
public IUnitContrib unitContrib(String id)
unitContribs
public Iterable<IUnitContrib> unitContribs()

UnitService

public class UnitService implements ISpoofaxUnitService
Constructors
UnitService
public UnitService(ITermFactoryService termFactoryService)
Methods
analyzeUnit
public ISpoofaxAnalyzeUnit analyzeUnit(ISpoofaxParseUnit input, AnalyzeContrib contrib, IContext context)
analyzeUnitUpdate
public ISpoofaxAnalyzeUnitUpdate analyzeUnitUpdate(FileObject source, AnalyzeUpdateData contrib, IContext context)
emptyAnalyzeUnit
public ISpoofaxAnalyzeUnit emptyAnalyzeUnit(ISpoofaxParseUnit input, IContext context)
emptyAnalyzeUnitUpdate
public ISpoofaxAnalyzeUnitUpdate emptyAnalyzeUnitUpdate(FileObject source, IContext context)
emptyInputUnit
public ISpoofaxInputUnit emptyInputUnit(FileObject source, ILanguageImpl langImpl, ILanguageImpl dialect)
emptyInputUnit
public ISpoofaxInputUnit emptyInputUnit(ILanguageImpl langImpl, ILanguageImpl dialect)
emptyParseUnit
public ISpoofaxParseUnit emptyParseUnit(ISpoofaxInputUnit input)
emptyTransformUnit
public ISpoofaxTransformUnit<ISpoofaxParseUnit> emptyTransformUnit(ISpoofaxParseUnit input, IContext context, TransformActionContrib action)
emptyTransformUnit
public ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit> emptyTransformUnit(ISpoofaxAnalyzeUnit input, IContext context, TransformActionContrib action)
inputUnit
public ISpoofaxInputUnit inputUnit(FileObject source, String text, ILanguageImpl langImpl, ILanguageImpl dialect, JSGLRParserConfiguration config)
inputUnit
public ISpoofaxInputUnit inputUnit(String text, ILanguageImpl langImpl, ILanguageImpl dialect, JSGLRParserConfiguration config)
inputUnit
public ISpoofaxInputUnit inputUnit(FileObject source, String text, ILanguageImpl langImpl, ILanguageImpl dialect)
inputUnit
public ISpoofaxInputUnit inputUnit(String text, ILanguageImpl langImpl, ILanguageImpl dialect)
parseUnit
public ISpoofaxParseUnit parseUnit(ISpoofaxInputUnit input, ParseContrib contrib)
transformUnit
public <I extends IUnit> ISpoofaxTransformUnit<I> transformUnit(I input, TransformContrib contrib, IContext context, TransformActionContrib action)

UnitWrapper

public class UnitWrapper implements IUnit
Fields
unit
public final Unit unit
Constructors
UnitWrapper
public UnitWrapper(Unit unit)
Methods
addUnitContrib
public void addUnitContrib(IUnitContrib contrib)
detached
public boolean detached()
source
public FileObject source()
unitContrib
public IUnitContrib unitContrib(String id)
unitContribs
public Iterable<IUnitContrib> unitContribs()

Javadoc

org.metaborg.meta.core

Meta

public @interface Meta

MetaBorgMeta

public class MetaBorgMeta implements AutoCloseable

Facade for instantiating and accessing the MetaBorg meta API, as an extension of the MetaBorg API.

Fields
autoCloseables
public final Set<AutoCloseable> autoCloseables
injector
public final Injector injector
languageSpecConfigService
public final ILanguageSpecConfigService languageSpecConfigService
languageSpecService
public final ILanguageSpecService languageSpecService
parent
public final MetaBorg parent
Constructors
MetaBorgMeta
public MetaBorgMeta(MetaBorg metaborg, IModulePluginLoader loader, MetaborgMetaModule module, Module... additionalModules)

Instantiate the MetaBorg meta API.

Parameters:
  • metaborg – MetaBorg API to extend.
  • loader – Meta-module plugin loader to use.
  • module – MetaBorg meta-module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorgMeta
public MetaBorgMeta(MetaBorg metaborg, MetaborgMetaModule module, Module... additionalModules)

Instantiate the MetaBorg meta API.

Parameters:
  • metaborg – MetaBorg API to extend.
  • module – MetaBorg meta-module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorgMeta
public MetaBorgMeta(MetaBorg metaborg, IModulePluginLoader loader, Module... additionalModules)

Instantiate the MetaBorg meta API.

Parameters:
  • metaborg – MetaBorg API to extend.
  • loader – Meta-module plugin loader to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
MetaBorgMeta
public MetaBorgMeta(MetaBorg metaborg, Module... additionalModules)

Instantiate the MetaBorg meta API.

Parameters:
  • metaborg – MetaBorg API to extend.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Methods
close
public void close()

Closes the MetaBorg meta API, closing any resources and services created by the API. The parent MetaBorg (non-meta) API is NOT closed.

defaultModule
protected static MetaborgMetaModule defaultModule()
defaultPluginLoader
protected static IModulePluginLoader defaultPluginLoader()

MetaborgMetaModule

public class MetaborgMetaModule extends AbstractModule
Fields
autoClosableBinder
protected Multibinder<AutoCloseable> autoClosableBinder
Methods
bindLanguageSpec
protected void bindLanguageSpec()
bindLanguageSpecConfig
protected void bindLanguageSpecConfig()
configure
protected void configure()

org.metaborg.meta.core.config

ILanguageSpecConfig

public interface ILanguageSpecConfig extends ILanguageComponentConfig

Configuration of a language specification at build time, an extension of the ILanguageComponentConfig runtime configuration. To create a new instance of this interface, use an ILanguageSpecConfigBuilder interface.

Methods
pardonedLanguages
Collection<String> pardonedLanguages()

Gets a sequence of languages whose errors are ignored.

Returns:The pardoned languages.
useBuildSystemSpec
boolean useBuildSystemSpec()

Use the build system (Maven/Gradle) specification for building this language specification.

Returns:True to use the build system specification, false otherwise.

ILanguageSpecConfigBuilder

public interface ILanguageSpecConfigBuilder extends ILanguageComponentConfigBuilder

Builder for ILanguageSpecConfig objects.

Methods
addGenerates
ILanguageSpecConfigBuilder addGenerates(Iterable<IGenerateConfig> generates)

{@inheritDoc}

addPardonedLanguages
ILanguageSpecConfigBuilder addPardonedLanguages(Iterable<String> languages)

Adds pardoned languages.

Parameters:
  • languages – The pardoned languages.
Returns:

This builder.

copyFrom
ILanguageSpecConfigBuilder copyFrom(ILanguageSpecConfig obj)

Copies the values from the specified configuration.

Parameters:
  • config – The configuration to copy values from.
withGenerates
ILanguageSpecConfigBuilder withGenerates(Iterable<IGenerateConfig> generates)

{@inheritDoc}

withIdentifier
ILanguageSpecConfigBuilder withIdentifier(LanguageIdentifier identifier)

{@inheritDoc}

withMetaborgVersion
ILanguageSpecConfigBuilder withMetaborgVersion(String metaborgVersion)

{@inheritDoc}

withPardonedLanguages
ILanguageSpecConfigBuilder withPardonedLanguages(Iterable<String> languages)

Sets the pardoned languages.

Parameters:
  • languages – The pardoned languages.
Returns:

This builder.

withUseBuildSystemSpec
ILanguageSpecConfigBuilder withUseBuildSystemSpec(boolean useBuildSystemSpec)

Sets the flag to use the build system specification.

Parameters:
  • useBuildSystemSpec – True to use the build system specification, false otherwise.
Returns:

This builder.

ILanguageSpecConfigService

public interface ILanguageSpecConfigService

Stores and retrieves language specification configurations.

Methods
available
boolean available(FileObject rootFolder)

Checks if a configuration exists for the language specification at the given location.

Parameters:
  • rootFolder – The language specification root folder.
Returns:

True if a configuration exists, false otherwise.

get
ConfigRequest<? extends ILanguageSpecConfig> get(FileObject rootFolder)

Gets the configuration for the language specification at the given location.

Parameters:
  • rootFolder – The language specification root folder.
Returns:

Configuration request, either with a valid configuration, or a collection of error messages.

ILanguageSpecConfigWriter

public interface ILanguageSpecConfigWriter

Writes a configuration for the specified ILanguageSpec.

Methods
write
void write(ILanguageSpec languageSpec, ILanguageSpecConfig config, IFileAccess access)

Writes the specified configuration for the specified language specification.

Parameters:
  • languageSpec – The language specification.
  • config – The configuration to write.
  • access

LanguageSpecConfig

public class LanguageSpecConfig extends LanguageComponentConfig implements ILanguageSpecConfig, IConfig

An implementation of the ILanguageSpecConfig interface that is backed by an ImmutableConfiguration object.

Constructors
LanguageSpecConfig
public LanguageSpecConfig(HierarchicalConfiguration<ImmutableNode> config, ProjectConfig projectConfig)
LanguageSpecConfig
protected LanguageSpecConfig(HierarchicalConfiguration<ImmutableNode> config, ProjectConfig projectConfig, LanguageIdentifier id, String name, Boolean sdfEnabled, Sdf2tableVersion sdf2tableVersion, Boolean dataDependent, String parseTable, String completionsParseTable, JSGLRVersion jsglrVersion, Collection<LanguageContributionIdentifier> langContribs, Collection<IGenerateConfig> generates, Collection<IExportConfig> exports, Collection<String> pardonedLanguages, Boolean useBuildSystemSpec)
Methods
pardonedLanguages
public Collection<String> pardonedLanguages()
useBuildSystemSpec
public boolean useBuildSystemSpec()
validate
public Collection<IMessage> validate(MessageBuilder mb)

LanguageSpecConfigBuilder

public class LanguageSpecConfigBuilder extends LanguageComponentConfigBuilder implements ILanguageSpecConfigBuilder

Configuration-based builder for ILanguageSpecConfig objects.

Fields
pardonedLanguages
protected Set<String> pardonedLanguages
useBuildSystemSpec
protected Boolean useBuildSystemSpec
Constructors
LanguageSpecConfigBuilder
public LanguageSpecConfigBuilder(AConfigurationReaderWriter configReaderWriter)
Methods
addCompileDeps
public ILanguageSpecConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> dependencies)
addExports
public ILanguageSpecConfigBuilder addExports(Iterable<IExportConfig> exports)
addGenerates
public ILanguageSpecConfigBuilder addGenerates(Iterable<IGenerateConfig> generates)
addJavaDeps
public ILanguageSpecConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)
addLangContribs
public ILanguageSpecConfigBuilder addLangContribs(Iterable<LanguageContributionIdentifier> contribs)
addPardonedLanguages
public ILanguageSpecConfigBuilder addPardonedLanguages(Iterable<String> languages)
addSourceDeps
public ILanguageSpecConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> dependencies)
build
public ILanguageSpecConfig build(FileObject rootFolder)
copyFrom
public ILanguageSpecConfigBuilder copyFrom(ILanguageSpecConfig config)
reset
public ILanguageSpecConfigBuilder reset()
withCompileDeps
public ILanguageSpecConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> dependencies)
withExports
public ILanguageSpecConfigBuilder withExports(Iterable<IExportConfig> exports)
withGenerates
public ILanguageSpecConfigBuilder withGenerates(Iterable<IGenerateConfig> generates)
withIdentifier
public ILanguageSpecConfigBuilder withIdentifier(LanguageIdentifier identifier)
withJavaDeps
public ILanguageSpecConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)
withLangContribs
public ILanguageSpecConfigBuilder withLangContribs(Iterable<LanguageContributionIdentifier> contribs)
withMetaborgVersion
public ILanguageSpecConfigBuilder withMetaborgVersion(String metaborgVersion)
withName
public ILanguageSpecConfigBuilder withName(String name)
withPardonedLanguages
public ILanguageSpecConfigBuilder withPardonedLanguages(Iterable<String> languages)
withSourceDeps
public ILanguageSpecConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> dependencies)
withUseBuildSystemSpec
public ILanguageSpecConfigBuilder withUseBuildSystemSpec(boolean useBuildSystemSpec)

LanguageSpecConfigService

public class LanguageSpecConfigService extends AConfigService<ILanguageSpec, ILanguageSpecConfig> implements ILanguageSpecConfigService, ILanguageSpecConfigWriter
Constructors
LanguageSpecConfigService
public LanguageSpecConfigService(AConfigurationReaderWriter configReaderWriter, LanguageSpecConfigBuilder configBuilder)
Methods
fromConfig
protected HierarchicalConfiguration<ImmutableNode> fromConfig(ILanguageSpecConfig config)
getConfigFile
protected FileObject getConfigFile(FileObject rootFolder)
getRootDirectory
protected FileObject getRootDirectory(ILanguageSpec languageSpec)
toConfig
protected ConfigRequest<ILanguageSpecConfig> toConfig(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)

org.metaborg.meta.core.plugin

IServiceMetaModulePlugin

public interface IServiceMetaModulePlugin extends IServiceModulePlugin

Plugin that creates Modules that are passed to MetaBorg meta’s Guice Injector at startup.

Methods
modules
Iterable<Module> modules()
Returns:All meta modules provided by this plugin.

org.metaborg.meta.core.project

ILanguageSpec

public interface ILanguageSpec extends IProject

A language specification project. A language specification is compiled into a language implementation.

Methods
config
ILanguageSpecConfig config()

Gets the configuration of the language specification. The configuration is read only once when this class is instantiated. To get a new configuration, get a new instance of this class.

Returns:Configuration of the language specification.

ILanguageSpecService

public interface ILanguageSpecService

Service for getting a language specification.

Methods
available
boolean available(IProject project)

Checks if given project is a language specification.

Parameters:
  • project – Project to check.
Returns:

True if project is a language specification, false otherwise.

get
ILanguageSpec get(IProject project)

Gets a language specification from the specified project.

Parameters:
  • project – The project.
Throws:
  • ConfigException – When reading language specification configuration fails.
Returns:

The language specification, or null when the project is not a language specification.

LanguageSpec

public class LanguageSpec extends Project implements ILanguageSpec
Constructors
LanguageSpec
public LanguageSpec(FileObject location, ILanguageSpecConfig config)
Methods
config
public ILanguageSpecConfig config()

org.metaborg.meta.core.wizard

CreateLanguageSpecWizard

public abstract class CreateLanguageSpecWizard extends UpgradeLanguageSpecWizard

Helps with the validation and UI of a ‘create language specification’ wizard.

Methods
distributeLanguageName
public void distributeLanguageName()
distributeProjectName
public void distributeProjectName()
extensions
public Collection<String> extensions()
inputExtensions
protected abstract String inputExtensions()
inputExtensionsModified
protected abstract boolean inputExtensionsModified()
inputProjectName
protected abstract String inputProjectName()
inputProjectNameModified
protected abstract boolean inputProjectNameModified()
projectName
public String projectName()
setExtensions
protected abstract void setExtensions(String extensions)
setId
protected abstract void setId(String id)
setName
protected abstract void setName(String name)
splitExtensions
public static Collection<String> splitExtensions(String extensions)
toExtension
public static String toExtension(String name)

Converts a language name to an extension.

Parameters:
  • name – Language name.
Returns:

Extension.

toId
public static String toId(String name)

Converts a project name to a language identifier.

Parameters:
  • name – Project name.
Returns:

Language identifier.

toName
public static String toName(String name)

Converts a project name to a language name.

Parameters:
  • name – Project name.
Returns:

Language name.

validate
public ValidationResult validate()

UpgradeLanguageSpecWizard

public abstract class UpgradeLanguageSpecWizard

Helps with the validation and UI of an ‘upgrade language specification’ wizard.

Methods
groupId
public String groupId()
id
public String id()
inputGroupId
protected abstract String inputGroupId()
inputGroupIdModified
protected abstract boolean inputGroupIdModified()
inputId
protected abstract String inputId()
inputIdModified
protected abstract boolean inputIdModified()
inputName
protected abstract String inputName()
inputNameModified
protected abstract boolean inputNameModified()
inputVersion
protected abstract String inputVersion()
inputVersionModified
protected abstract boolean inputVersionModified()
languageIdentifier
public LanguageIdentifier languageIdentifier()
languageName
public String languageName()
setDefaults
public void setDefaults()
setGroupId
protected abstract void setGroupId(String groupId)
setVersion
protected abstract void setVersion(String version)
validate
public ValidationResult validate()
version
public String version()

UpgradeLanguageSpecWizard.ValidationResult

public static class ValidationResult
Fields
complete
public final boolean complete
errors
public final List<String> errors
Constructors
ValidationResult
public ValidationResult(boolean complete, List<String> errors)

Javadoc

org.metaborg.spoofax.meta.core

SpoofaxExtensionModule

public class SpoofaxExtensionModule extends AbstractModule

Module for extending Spoofax. Note that this module is loaded together with a SpoofaxModule, so only those bindings are available. Bindings from SpoofaxMetaModule are NOT available. To inject bindings from SpoofaxMetaModule, use static injection and request injection in the SpoofaxMetaModule.

Methods
configure
protected void configure()

SpoofaxExtensionModulePlugin

public class SpoofaxExtensionModulePlugin implements IServiceModulePlugin

Module plugin service provider for SpoofaxExtensionModule.

Methods
modules
public Iterable<Module> modules()

SpoofaxMeta

public class SpoofaxMeta extends MetaBorgMeta

Facade for instantiating and accessing the MetaBorg meta API, as an extension of the MetaBorg API, instantiated with the Spoofax implementation.

Fields
languageSpecConfigService
public final ISpoofaxLanguageSpecConfigService languageSpecConfigService
languageSpecService
public final ISpoofaxLanguageSpecService languageSpecService
metaBuilder
public final LanguageSpecBuilder metaBuilder
parent
public final Spoofax parent
Constructors
SpoofaxMeta
public SpoofaxMeta(Spoofax spoofax, IModulePluginLoader loader, SpoofaxMetaModule module, Module... additionalModules)

Instantiate the MetaBorg meta API, with a Spoofax implementation.

Parameters:
  • spoofax – MetaBorg API, implemented by Spoofax, to extend.
  • loader – Meta-module plugin loader to use.
  • module – Spoofax meta-module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
SpoofaxMeta
public SpoofaxMeta(Spoofax spoofax, SpoofaxMetaModule module, Module... additionalModules)

Instantiate the MetaBorg meta API, with a Spoofax implementation.

Parameters:
  • spoofax – MetaBorg API, implemented by Spoofax, to extend.
  • module – Spoofax meta-module to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
SpoofaxMeta
public SpoofaxMeta(Spoofax spoofax, IModulePluginLoader loader, Module... additionalModules)

Instantiate the MetaBorg meta API, with a Spoofax implementation.

Parameters:
  • spoofax – MetaBorg API, implemented by Spoofax, to extend.
  • loader – Meta-module plugin loader to use.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
SpoofaxMeta
public SpoofaxMeta(Spoofax spoofax, Module... additionalModules)

Instantiate the MetaBorg meta API, with a Spoofax implementation.

Parameters:
  • spoofax – MetaBorg API, implemented by Spoofax, to extend.
  • additionalModules – Additional modules to use.
Throws:
  • MetaborgException – When loading plugins or dependency injection fails.
Methods
defaultModule
protected static SpoofaxMetaModule defaultModule()
languageSpecConfigBuilder
public ISpoofaxLanguageSpecConfigBuilder languageSpecConfigBuilder()
Returns:Fresh language specification configuration builder.

SpoofaxMetaModule

public class SpoofaxMetaModule extends MetaborgMetaModule
Methods
bindAnt
protected void bindAnt()
bindLanguageSpec
protected void bindLanguageSpec()

Overrides MetaborgMetaModule.bindLanguageSpec() for Spoofax implementation of language specifications.

bindLanguageSpecConfig
protected void bindLanguageSpecConfig()

Overrides MetaborgMetaModule.bindLanguageSpecConfig() for Spoofax implementation of language specification configuration.

configure
protected void configure()

org.metaborg.spoofax.meta.core.ant

AntRunner

public class AntRunner implements IAntRunner
Constructors
AntRunner
public AntRunner(IResourceService resourceService, FileObject antFile, FileObject baseDir, Map<String, String> properties, URL[] classpaths, BuildListener listener)
Methods
execute
public void execute(String target, ICancel cancel)

AntRunnerService

public class AntRunnerService implements IAntRunnerService
Constructors
AntRunnerService
public AntRunnerService(IResourceService resourceService)
Methods
get
public IAntRunner get(FileObject antFile, FileObject baseDir, Map<String, String> properties, URL[] classpaths, BuildListener listener)

AntSLF4JLogger

public class AntSLF4JLogger implements BuildListener
Constructors
AntSLF4JLogger
public AntSLF4JLogger()
AntSLF4JLogger
public AntSLF4JLogger(Logger log)
Methods
buildFinished
public void buildFinished(BuildEvent event)
buildStarted
public void buildStarted(BuildEvent event)
messageLogged
public void messageLogged(BuildEvent event)
targetFinished
public void targetFinished(BuildEvent event)
targetStarted
public void targetStarted(BuildEvent event)
taskFinished
public void taskFinished(BuildEvent event)
taskStarted
public void taskStarted(BuildEvent event)

IAntRunner

public interface IAntRunner
Methods
execute
void execute(String target, ICancel cancel)

IAntRunnerService

public interface IAntRunnerService
Methods
get
IAntRunner get(FileObject antFile, FileObject baseDir, Map<String, String> properties, URL[] classpaths, BuildListener listener)

org.metaborg.spoofax.meta.core.build

AConfigBuildStep

public abstract class AConfigBuildStep<T> implements IBuildStep
Constructors
AConfigBuildStep
public AConfigBuildStep(Class<T> clazz)
Methods
execute
public void execute(LanguageSpecBuildPhase phase, LanguageSpecBuildInput input)
execute
protected abstract void execute(T config, LanguageSpecBuildPhase phase, LanguageSpecBuildInput input)

AntBuildStep

public class AntBuildStep extends AConfigBuildStep<AntBuildStepConfig>
Constructors
AntBuildStep
public AntBuildStep(IResourceService resourceService, IAntRunnerService antRunnerService)
Methods
execute
protected void execute(AntBuildStepConfig config, LanguageSpecBuildPhase phase, LanguageSpecBuildInput input)
toString
public String toString()

IBuildStep

public interface IBuildStep
Methods
execute
void execute(LanguageSpecBuildPhase phase, LanguageSpecBuildInput input)

Executes the build step.

Parameters:
  • phase – Phase in which the build step is executed.
  • input – Build input

LanguageSpecBuildInput

public class LanguageSpecBuildInput extends ProjectBuildInput

Language specification build input arguments.

Constructors
LanguageSpecBuildInput
public LanguageSpecBuildInput(ISpoofaxLanguageSpec languageSpec)
Methods
languageSpec
public ISpoofaxLanguageSpec languageSpec()

LanguageSpecBuilder

public class LanguageSpecBuilder
Constructors
LanguageSpecBuilder
public LanguageSpecBuilder(Injector injector, IResourceService resourceService, ISourceTextService sourceTextService, ILanguageIdentifierService languageIdentifierService, IDependencyService dependencyService, ILanguagePathService languagePathService, ISpoofaxProcessorRunner runner, Set<IBuildStep> buildSteps, ILanguageComponentConfigBuilder componentConfigBuilder, ILanguageComponentConfigWriter componentConfigWriter)
Methods
archive
public FileObject archive(LanguageSpecBuildInput input)
clean
public void clean(LanguageSpecBuildInput input)
compile
public void compile(LanguageSpecBuildInput input)
generateSources
public void generateSources(LanguageSpecBuildInput input, IFileAccess access)
initialize
public void initialize(LanguageSpecBuildInput input)
pkg
public void pkg(LanguageSpecBuildInput input)

ProjectBuildInput

public class ProjectBuildInput

Project build input arguments.

Constructors
ProjectBuildInput
public ProjectBuildInput(IProject project)
Methods
project
public IProject project()

SpoofaxLangSpecCommonPaths

public class SpoofaxLangSpecCommonPaths extends SpoofaxCommonPaths
Constructors
SpoofaxLangSpecCommonPaths
public SpoofaxLangSpecCommonPaths(FileObject root)
Methods
dsTargetClassesGenerateDir
public FileObject dsTargetClassesGenerateDir()
Returns:Target output directory for compiled generated DynSem interpreter classes.
dsTargetClassesManualDir
public FileObject dsTargetClassesManualDir()
Returns:Target output directory for compiled manual DynSem interpreter classes.
javaSrcDirs
public Collection<FileObject> javaSrcDirs(String languageId)
plutoBuildInfoDir
public FileObject plutoBuildInfoDir()
Returns:Target output directory for pluto build information.
strSrcGenJavaTransDir
public FileObject strSrcGenJavaTransDir(String languageId)
Returns:Generated Stratego Java directory, generated from Stratego definition.
strTargetClassesJavaStratDir
public FileObject strTargetClassesJavaStratDir(String languageId)
Parameters:
  • languageId – Identifier of the language.
Returns:

Target output directory for compiled Stratego Java strategy classes.

strTargetClassesTransDir
public FileObject strTargetClassesTransDir(String languageId)
Returns:Target output directory for compiled Stratego Java classes.
targetClassesDir
public FileObject targetClassesDir()
Returns:Target output directory for compiled Java classes.
targetTestClassesDir
public FileObject targetTestClassesDir()
Returns:Target output directory for compiled Java classes.

StrategoBuildStep

public class StrategoBuildStep extends AConfigBuildStep<StrategoBuildStepConfig>
Constructors
StrategoBuildStep
public StrategoBuildStep(IResourceService resourceService)
Methods
execute
protected void execute(StrategoBuildStepConfig config, LanguageSpecBuildPhase phase, LanguageSpecBuildInput input)

org.metaborg.spoofax.meta.core.config

AntBuildStepConfig

public class AntBuildStepConfig implements IBuildStepConfig
Fields
file
public final String file
phase
public final LanguageSpecBuildPhase phase
target
public final String target
Constructors
AntBuildStepConfig
public AntBuildStepConfig(LanguageSpecBuildPhase phase, String file, String target)
Methods
accept
public void accept(IBuildStepVisitor visitor)
accept
public void accept(IBuildStepVisitor visitor, LanguageSpecBuildPhase phase)
phase
public LanguageSpecBuildPhase phase()

IBuildStepConfig

public interface IBuildStepConfig extends Serializable

Configuration for additional build steps. Use the visitor pattern access implementations.

Methods
accept
void accept(IBuildStepVisitor visitor)

Accepts a build step visitor.

Parameters:
  • visitor – Visitor to accept.
accept
void accept(IBuildStepVisitor visitor, LanguageSpecBuildPhase phase)

Accepts a build step visitor, only visiting configurations for given phase.

Parameters:
  • visitor – Visitor to accept.
  • phase – Phase of build step configurations to visit.
phase
LanguageSpecBuildPhase phase()
Returns:The phase in which the build step is configured to run.

IBuildStepVisitor

public interface IBuildStepVisitor

Visitor for IBuildStepConfigs.

Methods
visit
void visit(StrategoBuildStepConfig buildStep)

Visit a Stratego build step configuration.

Parameters:
  • buildStep – Stratego build step configuration
visit
void visit(AntBuildStepConfig buildStep)

Visit an Ant build step configuration.

Parameters:
  • buildStep – Ant build step configuration.

ISpoofaxLanguageSpecConfig

public interface ISpoofaxLanguageSpecConfig extends ISpoofaxProjectConfig, ILanguageSpecConfig

Spoofax-specific configuration for a language specification. To create a new instance of this interface, use the ILanguageSpecConfigBuilder interface.

Methods
buildSteps
Collection<IBuildStepConfig> buildSteps()

Gets additional build step configurations.

Returns:Additional build step configurations.
esvName
String esvName()

Gets the ESV name.

Returns:The ESV name.
javaName
String javaName()

Gets the Java name.

Returns:The Java name.
metaSdfName
String metaSdfName()

Gets the meta SDF name.

Returns:The meta SDF name.
packageName
String packageName()

Gets the package name.

Returns:The package name.
placeholderChars
PlaceholderCharacters placeholderChars()

Gets the Placeholder fences.

Returns:Placeholder fences
prettyPrintLanguage
String prettyPrintLanguage()

Gets the language to be pretty printed.

Returns:Language to be pretty printed
sdfArgs
Arguments sdfArgs()

Gets SDF arguments.

Returns:An iterable of SDF arguments.
sdfExternalDef
String sdfExternalDef()

Gets the external def.

Returns:The external def.
sdfMainFile
String sdfMainFile()

Gets the (relative) path to the sdf main file.

Returns:path to the parse table.
sdfMetaFiles
List<String> sdfMetaFiles()

Gets the (relative) path to the sdf meta files.

Returns:path to the sdf meta files.
sdfName
String sdfName()

Gets the SDF name.

Returns:The SDF name.
sdfVersion
SdfVersion sdfVersion()

Gets the SDF version to use.

Returns:Sdf version to use.
strArgs
Arguments strArgs()

Gets the Stratego arguments.

Returns:The Stratego arguments.
strBuildSetting
StrategoBuildSetting strBuildSetting()

Gets the project artifact build setting.

Returns:A member of the StrategoBuildSetting enumeration.
strExternalJar
String strExternalJar()

Gets the external JAR.

Returns:The external JAR.
strExternalJarFlags
String strExternalJarFlags()

Gets the external JAR flags.

Returns:The external JAR flags.
strFormat
StrategoFormat strFormat()

Gets the project artifact format.

Returns:A member of the StrategoFormat enumeration.
strategoName
String strategoName()

Gets the Stratego name.

Returns:The Stratego name.

ISpoofaxLanguageSpecConfigBuilder

public interface ISpoofaxLanguageSpecConfigBuilder extends ILanguageSpecConfigBuilder

Builder for ISpoofaxLanguageSpecConfig objects.

Methods
addBuildSteps
ISpoofaxLanguageSpecConfigBuilder addBuildSteps(Iterable<IBuildStepConfig> buildSteps)

Adds build step configurations.

Parameters:
  • buildSteps – Build step configurations.
Returns:

This builder.

addCompileDeps
ISpoofaxLanguageSpecConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> dependencies)

{@inheritDoc}

addPardonedLanguages
ISpoofaxLanguageSpecConfigBuilder addPardonedLanguages(Iterable<String> languages)

{@inheritDoc}

build
ISpoofaxLanguageSpecConfig build(FileObject rootFolder)

Builds the object.

Parameters:
  • rootFolder – The root folder.
Throws:
Returns:

The built object.

copyFrom
ISpoofaxLanguageSpecConfigBuilder copyFrom(ISpoofaxLanguageSpecConfig obj)

Copies the values from the specified object.

Parameters:
  • obj – The object to copy values from.
withBuildSteps
ISpoofaxLanguageSpecConfigBuilder withBuildSteps(Iterable<IBuildStepConfig> buildSteps)

Sets the build step configurations.

Parameters:
  • buildSteps – Build step configurations.
Returns:

This builder.

withCompileDeps
ISpoofaxLanguageSpecConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> dependencies)

{@inheritDoc}

withIdentifier
ISpoofaxLanguageSpecConfigBuilder withIdentifier(LanguageIdentifier identifier)

{@inheritDoc}

withMetaborgVersion
ISpoofaxLanguageSpecConfigBuilder withMetaborgVersion(String metaborgVersion)

{@inheritDoc}

withNaBL2Config
ISpoofaxLanguageSpecConfigBuilder withNaBL2Config(NaBL2Config config)

{@see ISpoofaxProjectConfigBuilder#withNaBL2Config(NaBL2Config)}

withPardonedLanguages
ISpoofaxLanguageSpecConfigBuilder withPardonedLanguages(Iterable<String> languages)

{@inheritDoc}

withPlaceholderPostfix
ISpoofaxLanguageSpecConfigBuilder withPlaceholderPostfix(String placeholderPostfix)

Sets the placeholder postfix.

Parameters:
  • placeholderPostfix – The placeholder postfix.
Returns:

This builder.

withPlaceholderPrefix
ISpoofaxLanguageSpecConfigBuilder withPlaceholderPrefix(String placeholderPrefix)

Sets the placeholder prefix.

Parameters:
  • placeholderPrefix – The placeholder prefix.
Returns:

This builder.

withPrettyPrintLanguage
ISpoofaxLanguageSpecConfigBuilder withPrettyPrintLanguage(String prettyPrintLanguage)

Sets the language to be pretty printed.

Parameters:
  • prettyPrintLanguage – The language to be pretty printed.
Returns:

This builder.

withSdfArgs
ISpoofaxLanguageSpecConfigBuilder withSdfArgs(Arguments args)

Sets the SDF arguments.

Parameters:
  • args – An iterable of SDF arguments.
Returns:

This builder.

withSdfExternalDef
ISpoofaxLanguageSpecConfigBuilder withSdfExternalDef(String def)

Sets the external def.

Parameters:
  • def – The external def.
Returns:

This builder.

withSdfMainFile
ISpoofaxLanguageSpecConfigBuilder withSdfMainFile(String sdfMainFile)

Sets the path to the main SDF file.

Parameters:
  • sdfMainFile – The path to the main SDF file.
Returns:

This builder.

withSdfMetaFiles
ISpoofaxLanguageSpecConfigBuilder withSdfMetaFiles(List<String> sdfMetaFiles)

Sets the name of SDF meta files.

Parameters:
  • sdfMetaFile – The name of the SDF meta files.
Returns:

This builder.

withSdfVersion
ISpoofaxLanguageSpecConfigBuilder withSdfVersion(SdfVersion sdfversion)

Sets the SDF version.

Parameters:
  • sdfVersion – The SDF version.
Returns:

This builder.

withSourceDeps
ISpoofaxLanguageSpecConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> dependencies)

{@inheritDoc}

withStrArgs
ISpoofaxLanguageSpecConfigBuilder withStrArgs(Arguments args)

Sets the Stratego arguments.

Parameters:
  • args – The Stratego arguments.
Returns:

This builder.

withStrBuildSetting
ISpoofaxLanguageSpecConfigBuilder withStrBuildSetting(StrategoBuildSetting format)

Sets the project artifact format.

Parameters:
Returns:

This builder.

withStrExternalJar
ISpoofaxLanguageSpecConfigBuilder withStrExternalJar(String jar)

Sets the external JAR.

Parameters:
  • jar – The external JAR.
Returns:

This builder.

withStrExternalJarFlags
ISpoofaxLanguageSpecConfigBuilder withStrExternalJarFlags(String flags)

Sets the external JAR flags.

Parameters:
  • flags – The external JAR flags.
Returns:

This builder.

withStrFormat
ISpoofaxLanguageSpecConfigBuilder withStrFormat(StrategoFormat format)

Sets the project artifact format.

Parameters:
Returns:

This builder.

withStrTypesmart
ISpoofaxLanguageSpecConfigBuilder withStrTypesmart(boolean typesmart)

Sets the Stratego typesmart property.

Parameters:
  • args – The Stratego typesmart property.
Returns:

This builder.

withTypesmart
ISpoofaxLanguageSpecConfigBuilder withTypesmart(boolean typesmart)

{@see ISpoofaxProjectConfigBuilder#withTypesmart(boolean)}

withUseBuildSystemSpec
ISpoofaxLanguageSpecConfigBuilder withUseBuildSystemSpec(boolean useBuildSystemSpec)

{@inheritDoc}

ISpoofaxLanguageSpecConfigService

public interface ISpoofaxLanguageSpecConfigService extends ILanguageSpecConfigService

Stores and retrieves Spoofax language specification configurations.

Methods
available
boolean available(FileObject rootFolder)

Checks if a configuration exists for the Spoofax language specification at the given location.

Parameters:
  • rootFolder – The language specification root folder.
Throws:
  • IOException – When location the configuration fails.
Returns:

True if a configuration exists, false otherwise.

get
ConfigRequest<ISpoofaxLanguageSpecConfig> get(FileObject rootFolder)

Gets the configuration for the Spoofax language specification at the given location.

Parameters:
  • rootFolder – The language specification root folder.
Returns:

Configuration request, either with a valid configuration, or a collection of error messages.

ISpoofaxLanguageSpecConfigWriter

public interface ISpoofaxLanguageSpecConfigWriter

Writes a configuration for the specified ILanguageSpec.

Methods
exists
boolean exists(ILanguageSpec languageSpec)

Checks if a configuration file already exists for given language specification project.

Parameters:
  • languageSpec – Language specification project.
Returns:

True if configuration file exists, false otherwise.

write
void write(ILanguageSpec languageSpec, ISpoofaxLanguageSpecConfig config, IFileAccess access)

Writes the specified configuration for the specified language specification.

Parameters:
  • languageSpec – The language specification.
  • config – The configuration to write.
  • access

LanguageSpecBuildPhase

public enum LanguageSpecBuildPhase
Enum Constants
clean
public static final LanguageSpecBuildPhase clean
compile
public static final LanguageSpecBuildPhase compile
generateSources
public static final LanguageSpecBuildPhase generateSources
initialize
public static final LanguageSpecBuildPhase initialize
pkg
public static final LanguageSpecBuildPhase pkg

PlaceholderCharacters

public class PlaceholderCharacters
Fields
prefix
public String prefix
suffix
public String suffix
Constructors
PlaceholderCharacters
public PlaceholderCharacters(String prefix, String postfix)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

SdfVersion

public enum SdfVersion
Enum Constants
sdf2
public static final SdfVersion sdf2
sdf3
public static final SdfVersion sdf3

SpoofaxLanguageSpecConfig

public class SpoofaxLanguageSpecConfig extends LanguageSpecConfig implements ISpoofaxLanguageSpecConfig

An implementation of the ISpoofaxLanguageSpecConfig interface that is backed by an ImmutableConfiguration object.

Constructors
SpoofaxLanguageSpecConfig
public SpoofaxLanguageSpecConfig(HierarchicalConfiguration<ImmutableNode> config, SpoofaxProjectConfig projectConfig)
SpoofaxLanguageSpecConfig
protected SpoofaxLanguageSpecConfig(HierarchicalConfiguration<ImmutableNode> config, SpoofaxProjectConfig projectConfig, LanguageIdentifier id, String name, Collection<LanguageContributionIdentifier> langContribs, Collection<IGenerateConfig> generates, Collection<IExportConfig> exports, Collection<String> pardonedLanguages, Boolean useBuildSystemSpec, SdfVersion sdfVersion, Boolean sdfEnabled, Sdf2tableVersion sdf2tableVersion, Boolean dataDependent, String parseTable, String completionsParseTable, JSGLRVersion jsglrVersion, String sdfMainFile, PlaceholderCharacters placeholderCharacters, String prettyPrint, List<String> sdfMetaFile, String externalDef, Arguments sdfArgs, StrategoBuildSetting buildSetting, StrategoFormat format, String externalJar, String externalJarFlags, Arguments strategoArgs, Collection<IBuildStepConfig> buildSteps)
Methods
buildSteps
public Collection<IBuildStepConfig> buildSteps()
esvName
public String esvName()
javaName
public String javaName()
metaSdfName
public String metaSdfName()
nabl2Config
public NaBL2Config nabl2Config()
packageName
public String packageName()
placeholderChars
public PlaceholderCharacters placeholderChars()
prettyPrintLanguage
public String prettyPrintLanguage()
sdfArgs
public Arguments sdfArgs()
sdfExternalDef
public String sdfExternalDef()
sdfMainFile
public String sdfMainFile()
sdfMetaFiles
public List<String> sdfMetaFiles()
sdfName
public String sdfName()
sdfVersion
public SdfVersion sdfVersion()
strArgs
public Arguments strArgs()
strBuildSetting
public StrategoBuildSetting strBuildSetting()
strExternalJar
public String strExternalJar()
strExternalJarFlags
public String strExternalJarFlags()
strFormat
public StrategoFormat strFormat()
strategoName
public String strategoName()
typesmart
public boolean typesmart()
validate
public Collection<IMessage> validate(MessageBuilder mb)

SpoofaxLanguageSpecConfigBuilder

public class SpoofaxLanguageSpecConfigBuilder extends LanguageSpecConfigBuilder implements ISpoofaxLanguageSpecConfigBuilder

Configuration-based builder for ILanguageSpecConfig objects.

Fields
buildSteps
protected Collection<IBuildStepConfig> buildSteps
placeholderCharacters
protected PlaceholderCharacters placeholderCharacters
prettyPrint
protected String prettyPrint
projectConfigBuilder
protected final SpoofaxProjectConfigBuilder projectConfigBuilder
sdfArgs
protected Arguments sdfArgs
sdfExternalDef
protected String sdfExternalDef
sdfMainFile
protected String sdfMainFile
sdfMetaFile
protected List<String> sdfMetaFile
sdfVersion
protected SdfVersion sdfVersion
strArgs
protected Arguments strArgs
strBuildSetting
protected StrategoBuildSetting strBuildSetting
strExternalJar
protected String strExternalJar
strExternalJarFlags
protected String strExternalJarFlags
strFormat
protected StrategoFormat strFormat
Constructors
SpoofaxLanguageSpecConfigBuilder
public SpoofaxLanguageSpecConfigBuilder(AConfigurationReaderWriter configReaderWriter)
Methods
addBuildSteps
public ISpoofaxLanguageSpecConfigBuilder addBuildSteps(Iterable<IBuildStepConfig> buildSteps)
addCompileDeps
public ISpoofaxLanguageSpecConfigBuilder addCompileDeps(Iterable<LanguageIdentifier> deps)
addExports
public ISpoofaxLanguageSpecConfigBuilder addExports(Iterable<IExportConfig> exports)
addGenerates
public ISpoofaxLanguageSpecConfigBuilder addGenerates(Iterable<IGenerateConfig> generates)
addJavaDeps
public ISpoofaxLanguageSpecConfigBuilder addJavaDeps(Iterable<LanguageIdentifier> deps)
addLangContribs
public ISpoofaxLanguageSpecConfigBuilder addLangContribs(Iterable<LanguageContributionIdentifier> contribs)
addPardonedLanguages
public ISpoofaxLanguageSpecConfigBuilder addPardonedLanguages(Iterable<String> languages)
addSourceDeps
public ISpoofaxLanguageSpecConfigBuilder addSourceDeps(Iterable<LanguageIdentifier> deps)
build
public ISpoofaxLanguageSpecConfig build(FileObject rootFolder)
withBuildSteps
public ISpoofaxLanguageSpecConfigBuilder withBuildSteps(Iterable<IBuildStepConfig> buildSteps)
withCompileDeps
public ISpoofaxLanguageSpecConfigBuilder withCompileDeps(Iterable<LanguageIdentifier> deps)
withExports
public ISpoofaxLanguageSpecConfigBuilder withExports(Iterable<IExportConfig> exports)
withGenerates
public ISpoofaxLanguageSpecConfigBuilder withGenerates(Iterable<IGenerateConfig> generates)
withIdentifier
public ISpoofaxLanguageSpecConfigBuilder withIdentifier(LanguageIdentifier identifier)
withJavaDeps
public ISpoofaxLanguageSpecConfigBuilder withJavaDeps(Iterable<LanguageIdentifier> deps)
withLangContribs
public ISpoofaxLanguageSpecConfigBuilder withLangContribs(Iterable<LanguageContributionIdentifier> contribs)
withMetaborgVersion
public ISpoofaxLanguageSpecConfigBuilder withMetaborgVersion(String metaborgVersion)
withNaBL2Config
public ISpoofaxLanguageSpecConfigBuilder withNaBL2Config(NaBL2Config config)
withName
public ISpoofaxLanguageSpecConfigBuilder withName(String name)
withPardonedLanguages
public ISpoofaxLanguageSpecConfigBuilder withPardonedLanguages(Iterable<String> languages)
withPlaceholderPostfix
public ISpoofaxLanguageSpecConfigBuilder withPlaceholderPostfix(String placeholderPostfix)
withPlaceholderPrefix
public ISpoofaxLanguageSpecConfigBuilder withPlaceholderPrefix(String placeholderPrefix)
withPrettyPrintLanguage
public ISpoofaxLanguageSpecConfigBuilder withPrettyPrintLanguage(String prettyPrintLanguage)
withSdfArgs
public ISpoofaxLanguageSpecConfigBuilder withSdfArgs(Arguments args)
withSdfExternalDef
public ISpoofaxLanguageSpecConfigBuilder withSdfExternalDef(String def)
withSdfMainFile
public ISpoofaxLanguageSpecConfigBuilder withSdfMainFile(String sdfMainFile)
withSdfMetaFiles
public ISpoofaxLanguageSpecConfigBuilder withSdfMetaFiles(List<String> sdfMetaFile)
withSdfVersion
public ISpoofaxLanguageSpecConfigBuilder withSdfVersion(SdfVersion sdfVersion)
withSourceDeps
public ISpoofaxLanguageSpecConfigBuilder withSourceDeps(Iterable<LanguageIdentifier> deps)
withStrArgs
public ISpoofaxLanguageSpecConfigBuilder withStrArgs(Arguments args)
withStrBuildSetting
public ISpoofaxLanguageSpecConfigBuilder withStrBuildSetting(StrategoBuildSetting buildSetting)
withStrExternalJar
public ISpoofaxLanguageSpecConfigBuilder withStrExternalJar(String jar)
withStrExternalJarFlags
public ISpoofaxLanguageSpecConfigBuilder withStrExternalJarFlags(String flags)
withStrFormat
public ISpoofaxLanguageSpecConfigBuilder withStrFormat(StrategoFormat format)
withStrTypesmart
public ISpoofaxLanguageSpecConfigBuilder withStrTypesmart(boolean typesmart)
withTypesmart
public ISpoofaxLanguageSpecConfigBuilder withTypesmart(boolean typesmart)
withUseBuildSystemSpec
public ISpoofaxLanguageSpecConfigBuilder withUseBuildSystemSpec(boolean useBuildSystemSpec)

SpoofaxLanguageSpecConfigService

public class SpoofaxLanguageSpecConfigService extends AConfigService<ILanguageSpec, ISpoofaxLanguageSpecConfig> implements ISpoofaxLanguageSpecConfigService, ISpoofaxLanguageSpecConfigWriter
Constructors
SpoofaxLanguageSpecConfigService
public SpoofaxLanguageSpecConfigService(AConfigurationReaderWriter configReaderWriter, SpoofaxLanguageSpecConfigBuilder configBuilder)
Methods
exists
public boolean exists(ILanguageSpec languageSpec)
fromConfig
protected HierarchicalConfiguration<ImmutableNode> fromConfig(ISpoofaxLanguageSpecConfig config)
getConfigFile
protected FileObject getConfigFile(FileObject rootFolder)
getRootDirectory
protected FileObject getRootDirectory(ILanguageSpec languageSpec)
toConfig
protected ConfigRequest<ISpoofaxLanguageSpecConfig> toConfig(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)

StrategoBuildSetting

public enum StrategoBuildSetting
Enum Constants
batch
public static final StrategoBuildSetting batch
incremental
public static final StrategoBuildSetting incremental

StrategoBuildStepConfig

public class StrategoBuildStepConfig implements IBuildStepConfig
Fields
args
public final Iterable<String> args
phase
public final LanguageSpecBuildPhase phase
strategy
public final String strategy
Constructors
StrategoBuildStepConfig
public StrategoBuildStepConfig(LanguageSpecBuildPhase phase, String strategy, Iterable<String> args)
Methods
accept
public void accept(IBuildStepVisitor visitor)
accept
public void accept(IBuildStepVisitor visitor, LanguageSpecBuildPhase phase)
arguments
public Arguments arguments()
phase
public LanguageSpecBuildPhase phase()

StrategoFormat

public enum StrategoFormat
Enum Constants
ctree
public static final StrategoFormat ctree
jar
public static final StrategoFormat jar

org.metaborg.spoofax.meta.core.generator

BaseGenerator

public abstract class BaseGenerator
Fields
writer
protected final MustacheWriter writer
Constructors
BaseGenerator
public BaseGenerator(GeneratorSettings scope, IFileAccess access)
BaseGenerator
public BaseGenerator(GeneratorSettings scope)

ClassResolver

public class ClassResolver implements MustacheResolver
Constructors
ClassResolver
public ClassResolver(Class<?> clazz)
Methods
getReader
public Reader getReader(String resourceName)

GeneratorSettings

public class GeneratorSettings

Provides the values that can be used in a generator template, e.g. a Mustache template.

Constructors
GeneratorSettings
public GeneratorSettings(FileObject location, ISpoofaxLanguageSpecConfig config)
GeneratorSettings
public GeneratorSettings(FileObject location, ISpoofaxLanguageSpecConfig config, AnalysisType analysisType)
Methods
analysisType
public AnalysisType analysisType()
eclipseMetaborgVersion
public String eclipseMetaborgVersion()
eclipseVersion
public String eclipseVersion()
format
public StrategoFormat format()
fullIdentifier
public String fullIdentifier()
generateGroupId
public boolean generateGroupId()
generateVersion
public boolean generateVersion()
groupId
public String groupId()
id
public String id()
javaName
public String javaName()
location
public FileObject location()
metaborgVersion
public String metaborgVersion()
name
public String name()
packageName
public String packageName()
ppName
public String ppName()
setMetaborgVersion
public void setMetaborgVersion(String metaborgVersion)
strategiesPackagePath
public String strategiesPackagePath()
strategoName
public String strategoName()
version
public String version()

MustacheWriter

public class MustacheWriter
Constructors
MustacheWriter
public MustacheWriter(FileObject root, Object[] objects, Class<?> clazz, IFileAccess access)
Methods
exists
public boolean exists(String srcNameTemplate)
write
public void write(String nameTemplate, boolean overwrite)
write
public void write(String srcName, String dstNameTemplate, boolean overwrite)
writeResolve
public void writeResolve(String nameTemplate, boolean overwrite)
writeResolve
public void writeResolve(String srcNameTemplate, String dstNameTemplate, boolean overwrite)

StrictMustacheFactory

public class StrictMustacheFactory extends DefaultMustacheFactory
Constructors
StrictMustacheFactory
public StrictMustacheFactory(MustacheResolver mustacheResolver)
Methods
createMustacheVisitor
public MustacheVisitor createMustacheVisitor()

org.metaborg.spoofax.meta.core.generator.eclipse

EclipseFeatureGenerator

public class EclipseFeatureGenerator extends BaseGenerator
Constructors
EclipseFeatureGenerator
public EclipseFeatureGenerator(GeneratorSettings scope, IFileAccess access)
EclipseFeatureGenerator
public EclipseFeatureGenerator(GeneratorSettings scope)
Methods
generateAll
public void generateAll()
generateBuildProperties
public void generateBuildProperties()
generateFeatureXML
public void generateFeatureXML()
generateIgnoreFile
public void generateIgnoreFile()
generatePOM
public void generatePOM()
siblingName
public static String siblingName(String id)

EclipseLangSpecGenerator

public class EclipseLangSpecGenerator extends BaseGenerator

Generates Eclipse support files for language specification projects.

Constructors
EclipseLangSpecGenerator
public EclipseLangSpecGenerator(GeneratorSettings settings, IFileAccess access)
EclipseLangSpecGenerator
public EclipseLangSpecGenerator(GeneratorSettings settings)
Methods
generateAll
public void generateAll()
generateClasspath
public void generateClasspath()

EclipsePluginGenerator

public class EclipsePluginGenerator extends BaseGenerator

Generates a companion Eclipse plugin project for a language specification project, that lifts the language implementation built from the language specification project into an Eclipse plugin that can be installed into Eclipse.

Constructors
EclipsePluginGenerator
public EclipsePluginGenerator(GeneratorSettings scope, IFileAccess access)
EclipsePluginGenerator
public EclipsePluginGenerator(GeneratorSettings scope)
Methods
generateAll
public void generateAll()
generateBuildProperties
public void generateBuildProperties()
generateClasspath
public void generateClasspath()
generateIgnoreFile
public void generateIgnoreFile()
generateManifest
public void generateManifest()
generatePOM
public void generatePOM()
generatePluginXML
public void generatePluginXML()
siblingName
public static String siblingName(String id)

EclipseSiteGenerator

public class EclipseSiteGenerator extends BaseGenerator
Constructors
EclipseSiteGenerator
public EclipseSiteGenerator(GeneratorSettings scope, IFileAccess access)
EclipseSiteGenerator
public EclipseSiteGenerator(GeneratorSettings scope)
Methods
generateAll
public void generateAll()
generateIgnoreFile
public void generateIgnoreFile()
generatePOM
public void generatePOM()
generateUpdatesiteXML
public void generateUpdatesiteXML()
siblingName
public static String siblingName(String id)

org.metaborg.spoofax.meta.core.generator.general

AnalysisType

public enum AnalysisType
Enum Constants
NaBL2
public static final AnalysisType NaBL2
NaBL_TS
public static final AnalysisType NaBL_TS
None
public static final AnalysisType None
Statix
public static final AnalysisType Statix
Stratego
public static final AnalysisType Stratego
Fields
id
public final String id
name
public final String name
Methods
mapping
public static Map<String, AnalysisType> mapping()

ContinuousLanguageSpecGenerator

public class ContinuousLanguageSpecGenerator extends BaseGenerator

Generates project files which need to be generated after each build. Files are not specific to an IDE.

Constructors
ContinuousLanguageSpecGenerator
public ContinuousLanguageSpecGenerator(GeneratorSettings scope, IFileAccess access, boolean sdfEnabled, SdfVersion version)
ContinuousLanguageSpecGenerator
public ContinuousLanguageSpecGenerator(GeneratorSettings scope, boolean sdfEnabled, SdfVersion version)
Methods
generateAll
public void generateAll()
generateCompletionStrategies
public void generateCompletionStrategies()
generatePermissiveAterm
public void generatePermissiveAterm()

LangProjectGenerator

public class LangProjectGenerator extends BaseGenerator

Generates a language-specific project.

Constructors
LangProjectGenerator
public LangProjectGenerator(GeneratorSettings settings, IFileAccess access)
LangProjectGenerator
public LangProjectGenerator(GeneratorSettings settings)
Methods
analysisNabl2
public boolean analysisNabl2()
analysisStatix
public boolean analysisStatix()
generateAll
public void generateAll()
generateConfig
public void generateConfig()
generateIgnoreFile
public void generateIgnoreFile()
generatePOM
public void generatePOM()
siblingName
public static String siblingName(String id)

LangSpecGenerator

public class LangSpecGenerator extends BaseGenerator

Generates language project files that are only generated once when a new language project is created. Files are not specific to an IDE.

Constructors
LangSpecGenerator
public LangSpecGenerator(LangSpecGeneratorSettings config)
Methods
analysisEnabled
public boolean analysisEnabled()
analysisNabl2
public boolean analysisNabl2()
analysisNablTs
public boolean analysisNablTs()
analysisStatix
public boolean analysisStatix()
fileExtension
public String fileExtension()
fileExtensions
public String fileExtensions()
generateAll
public void generateAll()
generateAllMaven
public void generateAllMaven()
generateAllSpoofax
public void generateAllSpoofax()
generateConfig
public void generateConfig()
generateDotMvn
public void generateDotMvn()
generateEditorServices
public void generateEditorServices()
generateGrammar
public void generateGrammar()
generateIgnoreFile
public void generateIgnoreFile()
generateJavaStrategy
public void generateJavaStrategy()
generatePOM
public void generatePOM()
generateTrans
public void generateTrans()
signaturesModule
public String signaturesModule()
startSymbol
public String startSymbol()
syntaxEnabled
public boolean syntaxEnabled()
syntaxOrAnalysisEnabled
public boolean syntaxOrAnalysisEnabled()
syntaxSdf2
public boolean syntaxSdf2()
syntaxSdf3
public boolean syntaxSdf3()
syntaxType
public SyntaxType syntaxType()

LangSpecGeneratorSettings

public class LangSpecGeneratorSettings
Fields
extensions
public final Collection<String> extensions
generatorSettings
public final GeneratorSettings generatorSettings
syntaxType
public final SyntaxType syntaxType
Constructors
LangSpecGeneratorSettings
public LangSpecGeneratorSettings(GeneratorSettings generatorSettings, Collection<String> extensions, SyntaxType syntaxType)

LangSpecGeneratorSettingsBuilder

public class LangSpecGeneratorSettingsBuilder
Fields
standardAnalysisType
public static final AnalysisType standardAnalysisType
standardGroupId
public static final String standardGroupId
standardMetaborgVersion
public static final String standardMetaborgVersion
standardSyntaxType
public static final SyntaxType standardSyntaxType
standardVersionString
public static final String standardVersionString
Methods
build
public LangSpecGeneratorSettings build(FileObject projectLocation, ISpoofaxLanguageSpecConfigBuilder languageSpecConfigBuilder)
canBuild
public boolean canBuild()
configureFromPrompt
public LangSpecGeneratorSettingsBuilder configureFromPrompt(Prompter prompter)
isComplete
public boolean isComplete()
stillMissing
public Iterable<String> stillMissing()
stillRequired
public Iterable<String> stillRequired()
withAnalysisType
public LangSpecGeneratorSettingsBuilder withAnalysisType(AnalysisType analysisType)
withDefaultAnalysisType
public LangSpecGeneratorSettingsBuilder withDefaultAnalysisType(AnalysisType defaultAnalysisType)
withDefaultGroupId
public LangSpecGeneratorSettingsBuilder withDefaultGroupId(String defaultGroupId)
withDefaultMetaborgVersion
public LangSpecGeneratorSettingsBuilder withDefaultMetaborgVersion(String defaultMetaborgVersion)
withDefaultSyntaxType
public LangSpecGeneratorSettingsBuilder withDefaultSyntaxType(SyntaxType defaultSyntaxType)
withDefaultVersion
public LangSpecGeneratorSettingsBuilder withDefaultVersion(String defaultVersionString)
withExtensions
public LangSpecGeneratorSettingsBuilder withExtensions(Collection<String> extensions)
withGroupId
public LangSpecGeneratorSettingsBuilder withGroupId(String groupId)
withId
public LangSpecGeneratorSettingsBuilder withId(String id)
withMetaborgVersion
public LangSpecGeneratorSettingsBuilder withMetaborgVersion(String metaborgVersion)
withName
public LangSpecGeneratorSettingsBuilder withName(String name)
withSyntaxType
public LangSpecGeneratorSettingsBuilder withSyntaxType(SyntaxType syntaxType)
withVersion
public LangSpecGeneratorSettingsBuilder withVersion(LanguageVersion version)
withoutExtensions
public LangSpecGeneratorSettingsBuilder withoutExtensions()

LangTestGenerator

public class LangTestGenerator extends BaseGenerator

Generates a language-specific project.

Constructors
LangTestGenerator
public LangTestGenerator(GeneratorSettings settings, IFileAccess access)
LangTestGenerator
public LangTestGenerator(GeneratorSettings settings)
Methods
generateAll
public void generateAll()
generateConfig
public void generateConfig()
generateIgnoreFile
public void generateIgnoreFile()
generatePOM
public void generatePOM()
generateTest
public void generateTest()
siblingName
public static String siblingName(String id)

SyntaxType

public enum SyntaxType
Enum Constants
None
public static final SyntaxType None
SDF2
public static final SyntaxType SDF2
SDF3
public static final SyntaxType SDF3
Fields
id
public final String id
name
public final String name
Methods
mapping
public static Map<String, SyntaxType> mapping()

org.metaborg.spoofax.meta.core.pluto

SpoofaxBuilder

public abstract class SpoofaxBuilder<In extends SpoofaxInput, Out extends Output> extends Builder<In, Out> implements IFileAccess
Fields
context
protected final SpoofaxContext context
paths
protected transient SpoofaxLangSpecCommonPaths paths
Constructors
SpoofaxBuilder
public SpoofaxBuilder(In input)
Methods
defaultStamper
protected Stamper defaultStamper()
newResourceTracker
protected ResourceAgentTracker newResourceTracker(String... excludePatterns)
read
public void read(FileObject file)
toFile
protected File toFile(FileObject fileObject)
toFileReplicate
protected File toFileReplicate(FileObject fileObject)
write
public void write(FileObject file)

SpoofaxBuilderFactory

public interface SpoofaxBuilderFactory<In extends SpoofaxInput, Out extends Output, B extends Builder<In, Out>> extends BuilderFactory<In, Out, B>

SpoofaxBuilderFactoryFactory

public class SpoofaxBuilderFactoryFactory
Methods
of
public static <In extends SpoofaxInput, Out extends Output, B extends Builder<In, Out>> SpoofaxBuilderFactory<In, Out, B> of(Class<B> builderClass, Class<In> inputClass)

SpoofaxBuilderFactoryFactory.GeneratedSpoofaxBuilderFactory

class GeneratedSpoofaxBuilderFactory implements SpoofaxBuilderFactory<In, Out, B>
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
inputParser
public InputParser<In> inputParser()
isOverlappingGeneratedFileCompatible
public boolean isOverlappingGeneratedFileCompatible(File overlap, Serializable input, BuilderFactory<?, ?, ?> otherFactory, Serializable otherInput)
makeBuilder
public B makeBuilder(In input)
toString
public String toString()

SpoofaxContext

public class SpoofaxContext implements Serializable
Fields
BETTER_STAMPERS
public static final boolean BETTER_STAMPERS
base
public transient FileObject base
baseDir
public final File baseDir
baseURI
public final URI baseURI
depDir
public final File depDir
languageSpec
public transient ISpoofaxLanguageSpec languageSpec
Constructors
SpoofaxContext
public SpoofaxContext(FileObject baseDir, FileObject depDir)
Methods
basePath
public File basePath(String relative)
contextService
public IContextService contextService()
depPath
public File depPath(String relative)
dialectService
public IDialectService dialectService()
init
public static void init(Injector newInjector)
init
public void init()
languageIdentifierService
public ILanguageIdentifierService languageIdentifierService()
languagePathService
public ILanguagePathService languagePathService()
languageService
public ILanguageService languageService()
newResourceTracker
public ResourceAgentTracker newResourceTracker(String... excludePatterns)
parse
public IStrategoTerm parse(File file)
project
public IProject project()
resourceService
public IResourceService resourceService()
sourceTextService
public ISourceTextService sourceTextService()
strategoCommon
public IStrategoCommon strategoCommon()
syntaxService
public ISpoofaxSyntaxService syntaxService()
termFactory
public ITermFactory termFactory()
termFactoryService
public ITermFactoryService termFactoryService()
toFile
public File toFile(FileObject fileObject)
toFileReplicate
public File toFileReplicate(FileObject fileObject)
transformService
public ISpoofaxTransformService transformService()
unitService
public ISpoofaxUnitService unitService()

SpoofaxInput

public class SpoofaxInput implements Serializable
Fields
context
public final SpoofaxContext context
Constructors
SpoofaxInput
public SpoofaxInput(SpoofaxContext context)

SpoofaxReporting

public class SpoofaxReporting implements IReporting
Methods
buildRequirement
public <O extends Output> void buildRequirement(BuildRequest<?, O, ?, ?> req)
canceledBuilderCycle
public <O extends Output> void canceledBuilderCycle(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit, BuildCycleException t)
canceledBuilderException
public <O extends Output> void canceledBuilderException(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit, Throwable t)
canceledBuilderFailure
public <O extends Output> void canceledBuilderFailure(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit)
canceledBuilderInterrupt
public <O extends Output> void canceledBuilderInterrupt(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit)
canceledBuilderRequiredBuilderFailed
public <O extends Output> void canceledBuilderRequiredBuilderFailed(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit, RequiredBuilderFailed e)
cancelledBuildCycleException
public void cancelledBuildCycleException(BuildCycle cycle, CycleHandler cycleSupport, Throwable t)
finishedBuildCycle
public void finishedBuildCycle(BuildCycle cycle, CycleHandler cycleSupport, Set<BuildUnit<?>> units)
finishedBuildRequirement
public <O extends Output> void finishedBuildRequirement(BuildRequest<?, O, ?, ?> req)
finishedBuilder
public <O extends Output> void finishedBuilder(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit)
inconsistentRequirement
public void inconsistentRequirement(Requirement req)
messageFromBuilder
public void messageFromBuilder(String message, boolean isError, Builder<?, ?> from)
messageFromSystem
public void messageFromSystem(String message, boolean isError, int verbosity)
skippedBuilder
public <O extends Output> void skippedBuilder(BuildRequest<?, O, ?, ?> req, BuildUnit<O> unit)
startBuildCycle
public void startBuildCycle(BuildCycle cycle, CycleHandler cycleSupport)
startedBuilder
public <O extends Output> void startedBuilder(BuildRequest<?, O, ?, ?> req, Builder<?, ?> b, BuildUnit<O> oldUnit, Set<BuildReason> reasons)

org.metaborg.spoofax.meta.core.pluto.build

MakePermissive

public class MakePermissive extends SpoofaxBuilder<MakePermissive.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, MakePermissive> factory
Constructors
MakePermissive
public MakePermissive(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, MakePermissive, SpoofaxBuilderFactory<Input, OutputPersisted<File>, MakePermissive>> request(Input input)

MakePermissive.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
module
public final String module
origin
public final Origin origin
outputFile
public final File outputFile
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, String module, Origin origin)

PackSdf

public class PackSdf extends SpoofaxBuilder<PackSdf.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, PackSdf> factory
Constructors
PackSdf
public PackSdf(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, PackSdf, SpoofaxBuilderFactory<Input, OutputPersisted<File>, PackSdf>> request(Input input)

PackSdf.Input

public static class Input extends SpoofaxInput
Fields
extraArgs
public final Arguments extraArgs
includePaths
public final List<File> includePaths
inputFile
public final File inputFile
module
public final String module
origin
public final Origin origin
outputFile
public final File outputFile
Constructors
Input
public Input(SpoofaxContext context, String module, File inputFile, File outputFile, List<File> includePaths, Arguments extraArgs, Origin origin)

Rtg2Sig

public class Rtg2Sig extends SpoofaxBuilder<Rtg2Sig.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, Rtg2Sig> factory
Constructors
Rtg2Sig
public Rtg2Sig(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, Rtg2Sig, SpoofaxBuilderFactory<Input, OutputPersisted<File>, Rtg2Sig>> request(Input input)

Rtg2Sig.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
module
public final String module
origin
public final Origin origin
outputFile
public final File outputFile
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, String module, Origin origin)

Sdf2Parenthesize

public class Sdf2Parenthesize extends SpoofaxBuilder<Sdf2Parenthesize.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2Parenthesize> factory
Constructors
Sdf2Parenthesize
public Sdf2Parenthesize(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, Sdf2Parenthesize, SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2Parenthesize>> request(Input input)

Sdf2Parenthesize.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
inputModule
public final String inputModule
outputFile
public final File outputFile
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, String inputModule)

Sdf2ParenthesizeLegacy

public class Sdf2ParenthesizeLegacy extends SpoofaxBuilder<Sdf2ParenthesizeLegacy.Input, None>
Fields
factory
public static SpoofaxBuilderFactory<Input, None, Sdf2ParenthesizeLegacy> factory
Constructors
Sdf2ParenthesizeLegacy
public Sdf2ParenthesizeLegacy(Input input)
Methods
build
public None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)

Sdf2ParenthesizeLegacy.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
inputModule
public final String inputModule
origin
public final Origin origin
outputFile
public final File outputFile
outputModule
public final String outputModule
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, String inputModule, String outputModule, Origin origin)

Sdf2Rtg

public class Sdf2Rtg extends SpoofaxBuilder<Sdf2Rtg.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2Rtg> factory
Constructors
Sdf2Rtg
public Sdf2Rtg(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, Sdf2Rtg, SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2Rtg>> request(Input input)

Sdf2Rtg.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
module
public final String module
origin
public final Origin origin
outputFile
public final File outputFile
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, String module, Origin origin)

Sdf2Table

public class Sdf2Table extends SpoofaxBuilder<Sdf2Table.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2Table> factory
Constructors
Sdf2Table
public Sdf2Table(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, Sdf2Table, SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2Table>> request(Input input)

Sdf2Table.Input

public static class Input extends SpoofaxInput
Fields
dataDependent
public final boolean dataDependent
dynamic
public final boolean dynamic
inputFile
public final File inputFile
layoutSensitive
public final boolean layoutSensitive
outputContextGrammarFile
public final File outputContextGrammarFile
outputFile
public final File outputFile
outputNormGrammarFile
public final File outputNormGrammarFile
paths
public final List<String> paths
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, File outputNormGrammarFile, File outputContextGrammarFile, List<String> paths, boolean dynamic, boolean dataDependent, boolean layoutSensitive)

Sdf2TableLegacy

public class Sdf2TableLegacy extends SpoofaxBuilder<Sdf2TableLegacy.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2TableLegacy> factory
Constructors
Sdf2TableLegacy
public Sdf2TableLegacy(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, Sdf2TableLegacy, SpoofaxBuilderFactory<Input, OutputPersisted<File>, Sdf2TableLegacy>> request(Input input)

Sdf2TableLegacy.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
module
public final String module
origin
public final Origin origin
outputFile
public final File outputFile
Constructors
Input
public Input(SpoofaxContext context, File inputFile, File outputFile, String module, Origin origin)

StrIncr

public class StrIncr extends SpoofaxBuilder<StrIncr.Input, None>
Fields
factory
public static SpoofaxBuilderFactory<Input, None, StrIncr> factory
Constructors
StrIncr
public StrIncr(Input input)
Methods
build
protected None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
projectName
public static String projectName(File inputFile)
request
public static BuildRequest request(Input input)

StrIncr.BuildRequest

public static class BuildRequest extends build.pluto.builder.BuildRequest<Input, None, StrIncr, SpoofaxBuilderFactory<Input, None, StrIncr>>
Constructors
BuildRequest
public BuildRequest(SpoofaxBuilderFactory<Input, None, StrIncr> factory, Input input)

StrIncr.Input

public static class Input extends SpoofaxInput
Fields
cacheDir
public final File cacheDir
extraArgs
public final Arguments extraArgs
includeDirs
public final List<File> includeDirs
includeFiles
public final List<File> includeFiles
inputFile
public final File inputFile
javaPackageName
public final String javaPackageName
origin
public final Origin origin
outputPath
public final File outputPath
Constructors
Input
public Input(SpoofaxContext context, File inputFile, String javaPackageName, List<File> includeDirs, List<File> includeFiles, File cacheDir, Arguments extraArgs, File outputPath, Origin origin)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()

StrIncrBackEnd

public class StrIncrBackEnd extends SpoofaxBuilder<StrIncrBackEnd.Input, None>
Fields
factory
public static SpoofaxBuilderFactory<Input, None, StrIncrBackEnd> factory
Constructors
StrIncrBackEnd
public StrIncrBackEnd(Input input)
Methods
build
protected None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest request(Input input)

StrIncrBackEnd.BuildRequest

public static class BuildRequest extends build.pluto.builder.BuildRequest<Input, None, StrIncrBackEnd, SpoofaxBuilderFactory<Input, None, StrIncrBackEnd>>
Constructors
BuildRequest
public BuildRequest(SpoofaxBuilderFactory<Input, None, StrIncrBackEnd> factory, Input input)

StrIncrBackEnd.Input

public static class Input extends SpoofaxInput
Fields
cacheDir
public final File cacheDir
extraArgs
public final Arguments extraArgs
frontEndTasks
public final Origin frontEndTasks
isBoilerplate
public final boolean isBoilerplate
outputPath
public final File outputPath
packageName
public final String packageName
strategyContributions
public final Collection<File> strategyContributions
strategyDir
public final File strategyDir
strategyName
public final String strategyName
Constructors
Input
public Input(SpoofaxContext context, Origin frontEndTasks, String strategyName, File strategyDir, Collection<File> strategyContributions, String packageName, File outputPath, File cacheDir, Arguments extraArgs, boolean isBoilerplate)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

StrIncrFrontEnd

public class StrIncrFrontEnd extends SpoofaxBuilder<StrIncrFrontEnd.Input, StrIncrFrontEnd.Output>
Fields
factory
public static SpoofaxBuilderFactory<Input, Output, StrIncrFrontEnd> factory
Constructors
StrIncrFrontEnd
public StrIncrFrontEnd(Input input)
Methods
build
protected Output build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest request(Input input)
runStrategoCompileBuilder
public IStrategoTerm runStrategoCompileBuilder(FileObject resource, String projectName)

StrIncrFrontEnd.BuildRequest

public static class BuildRequest extends build.pluto.builder.BuildRequest<Input, Output, StrIncrFrontEnd, SpoofaxBuilderFactory<Input, Output, StrIncrFrontEnd>>
Constructors
BuildRequest
public BuildRequest(SpoofaxBuilderFactory<Input, Output, StrIncrFrontEnd> factory, Input input)

StrIncrFrontEnd.Import

public static class Import implements Serializable
Fields
importString
public final String importString
importType
public final ImportType importType
Constructors
Import
protected Import(ImportType importType, String importString)
Methods
equals
public boolean equals(Object obj)
fromTerm
public static Import fromTerm(IStrategoTerm importTerm)
hashCode
public int hashCode()
normal
public static Import normal(String importString)
resolveImport
public Set<File> resolveImport(List<File> includeDirs)
wildcard
public static Import wildcard(String importString)

StrIncrFrontEnd.Import.ImportType

public static enum ImportType
Enum Constants
normal
public static final StrIncrFrontEnd.Import.ImportType normal
wildcard
public static final StrIncrFrontEnd.Import.ImportType wildcard

StrIncrFrontEnd.Input

public static class Input extends SpoofaxInput
Fields
inputFile
public final File inputFile
origin
public final Origin origin
projectName
public final String projectName
Constructors
Input
public Input(SpoofaxContext context, File inputFile, String projectName, Origin origin)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

StrIncrFrontEnd.Output

public static class Output implements build.pluto.output.Output
Fields
generatedFiles
public final Map<String, File> generatedFiles
imports
public final List<Import> imports
moduleName
public final String moduleName
Constructors
Output
public Output(String moduleName, Map<String, File> generatedFiles, List<Import> imports)
Methods
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()

Strj

public class Strj extends SpoofaxBuilder<Strj.Input, None>
Fields
factory
public static SpoofaxBuilderFactory<Input, None, Strj> factory
Constructors
Strj
public Strj(Input input)
Methods
build
public None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, None, Strj, SpoofaxBuilderFactory<Input, None, Strj>> request(Input input)

Strj.Input

public static class Input extends SpoofaxInput
Fields
cacheDir
public final File cacheDir
clean
public final boolean clean
depPath
public final File depPath
extraArgs
public final Arguments extraArgs
includeDirs
public final List<File> includeDirs
includeFiles
public final List<File> includeFiles
includeLibs
public final List<String> includeLibs
inputFile
public final File inputFile
library
public final boolean library
origin
public final Origin origin
outputPath
public final File outputPath
packageName
public final String packageName
Constructors
Input
public Input(SpoofaxContext context, File inputPath, File outputPath, File depPath, String packageName, boolean library, boolean clean, List<File> includeDirs, List<File> includeFiles, List<String> includeLibs, File cacheDir, Arguments extraArgs, Origin origin)

Typesmart

public class Typesmart extends SpoofaxBuilder<Typesmart.Input, None>
Fields
factory
public static final SpoofaxBuilderFactory<Input, None, Typesmart> factory
Constructors
Typesmart
public Typesmart(Input input)
Methods
build
public None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, None, Typesmart, SpoofaxBuilderFactory<Input, None, Typesmart>> request(Input input)

Typesmart.Input

public static class Input extends SpoofaxInput
Fields
origin
public final Origin origin
strFile
public final File strFile
strjIncludeDirs
public final List<File> strjIncludeDirs
typesmartExportedFile
public final File typesmartExportedFile
Constructors
Input
public Input(SpoofaxContext context, File strFile, List<File> strjIncludeDirs, File typesmartExportedFile, Origin origin)

org.metaborg.spoofax.meta.core.pluto.build.main

ArchiveBuilder

public class ArchiveBuilder extends SpoofaxBuilder<ArchiveBuilder.Input, OutputTransient<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputTransient<File>, ArchiveBuilder> factory
Constructors
ArchiveBuilder
public ArchiveBuilder(Input input)
Methods
build
protected OutputTransient<File> build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputTransient<File>, ArchiveBuilder, SpoofaxBuilderFactory<Input, OutputTransient<File>, ArchiveBuilder>> request(Input input)

ArchiveBuilder.Input

public static class Input extends SpoofaxInput
Fields
exports
public final Iterable<IExportConfig> exports
languageIdentifier
public final LanguageIdentifier languageIdentifier
origin
public final Origin origin
Constructors
Input
public Input(SpoofaxContext context, Origin origin, Iterable<IExportConfig> exports, LanguageIdentifier languageIdentifier)

GenerateSourcesBuilder

public class GenerateSourcesBuilder extends SpoofaxBuilder<GenerateSourcesBuilder.Input, None>
Fields
factory
public static SpoofaxBuilderFactory<Input, None, GenerateSourcesBuilder> factory
Constructors
GenerateSourcesBuilder
public GenerateSourcesBuilder(Input input)
Methods
build
public None build(GenerateSourcesBuilder.Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)

GenerateSourcesBuilder.Input

public static class Input extends SpoofaxInput
Fields
jsglrVersion
public final JSGLRVersion jsglrVersion
languageId
public final String languageId
packSdfArgs
public final Arguments packSdfArgs
packSdfIncludePaths
public final List<File> packSdfIncludePaths
sdf2tableVersion
public final Sdf2tableVersion sdf2tableVersion
sdfCompletionFile
public final File sdfCompletionFile
sdfCompletionModule
public final String sdfCompletionModule
sdfEnabled
public final Boolean sdfEnabled
sdfExternalDef
public final File sdfExternalDef
sdfFile
public final File sdfFile
sdfMetaFiles
public final List<File> sdfMetaFiles
sdfMetaModules
public final List<String> sdfMetaModules
sdfModule
public final String sdfModule
sdfVersion
public final SdfVersion sdfVersion
sourceDeps
public final Collection<LanguageIdentifier> sourceDeps
strBuildSetting
public final StrategoBuildSetting strBuildSetting
strExternalJar
public final File strExternalJar
strExternalJarFlags
public final String strExternalJarFlags
strFile
public final File strFile
strFormat
public final StrategoFormat strFormat
strJavaPackage
public final String strJavaPackage
strJavaStratFile
public final File strJavaStratFile
strJavaStratPackage
public final String strJavaStratPackage
strjArgs
public final Arguments strjArgs
strjIncludeDirs
public final List<File> strjIncludeDirs
strjIncludeFiles
public final List<File> strjIncludeFiles
Constructors
Input
public Input(SpoofaxContext context, String languageId, Collection<LanguageIdentifier> sourceDeps, Boolean sdfEnabled, String sdfModule, File sdfFile, JSGLRVersion jsglrVersion, SdfVersion sdfVersion, Sdf2tableVersion sdf2tableVersion, File sdfExternalDef, List<File> packSdfIncludePaths, Arguments packSdfArgs, String sdfCompletionModule, File sdfCompletionFile, List<String> sdfMetaModules, List<File> sdfMetaFiles, File strFile, String strJavaPackage, String strJavaStratPackage, File strJavaStratFile, StrategoFormat strFormat, File strExternalJar, String strExternalJarFlags, List<File> strjIncludeDirs, List<File> strjIncludeFiles, Arguments strjArgs, StrategoBuildSetting strBuildSetting)

PackageBuilder

public class PackageBuilder extends SpoofaxBuilder<PackageBuilder.Input, None>
Fields
factory
public static SpoofaxBuilderFactory<Input, None, PackageBuilder> factory
Constructors
PackageBuilder
public PackageBuilder(Input input)
Methods
build
protected None build(Input input)
description
protected String description(Input input)
jar
public Origin jar(File jarFile, File baseDir, Origin origin, File depPath, File... paths)
jar
public Origin jar(File jarFile, File baseDir, Origin origin, File depPath, Iterable<File> paths)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)

PackageBuilder.Input

public static class Input extends SpoofaxInput
Fields
languageId
public final String languageId
origin
public final Origin origin
strFormat
public final StrategoFormat strFormat
strJavaStratFile
public final File strJavaStratFile
strJavaStratIncludeDirs
public final Iterable<File> strJavaStratIncludeDirs
Constructors
Input
public Input(SpoofaxContext context, String languageId, Origin origin, StrategoFormat strFormat, File strJavaStratFile, Iterable<File> strJavaStratIncludeDirs)

org.metaborg.spoofax.meta.core.pluto.build.misc

Copy

public class Copy extends Builder<Copy.Input, None>
Fields
factory
public static BuilderFactory<Input, None, Copy> factory
Constructors
Copy
public Copy(Input input)
Methods
build
public None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, None, Copy, BuilderFactory<Input, None, Copy>> request(Input input)

Copy.Input

public static class Input implements Serializable
Fields
baseDir
public final File baseDir
depDir
public final File depDir
destination
public final File destination
origin
public final Origin origin
source
public final File source
Constructors
Input
public Input(File source, File destination, Origin origin, File baseDir, File depDir)
Input
public Input(File source, File destination, Origin origin)

CopyPattern

public class CopyPattern extends Builder<CopyPattern.Input, None>
Fields
factory
public static BuilderFactory<Input, None, CopyPattern> factory
Constructors
CopyPattern
public CopyPattern(Input input)
Methods
build
public None build(Input input)
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, None, CopyPattern, BuilderFactory<Input, None, CopyPattern>> request(Input input)

CopyPattern.Input

public static class Input implements Serializable
Fields
baseDir
public final File baseDir
depDir
public final File depDir
dstDir
public final File dstDir
origin
public final Origin origin
pattern
public final String pattern
srcDir
public final File srcDir
Constructors
Input
public Input(File srcDir, File dstDir, String pattern, Origin origin, File baseDir, File depDir)
Input
public Input(File srcDir, File dstDir, String pattern, Origin origin)

GetStrategoMix

public class GetStrategoMix extends SpoofaxBuilder<GetStrategoMix.Input, OutputPersisted<File>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputPersisted<File>, GetStrategoMix> factory
Constructors
GetStrategoMix
public GetStrategoMix(Input input)
Methods
build
public OutputPersisted<File> build(Input input)
description
protected String description(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputPersisted<File>, GetStrategoMix, SpoofaxBuilderFactory<Input, OutputPersisted<File>, GetStrategoMix>> request(Input input)

GetStrategoMix.Input

public static class Input extends SpoofaxInput

Empty input class to ensure that a new input instance is always created, which is always exactly the same, such that this builder is only executed once.

Constructors
Input
public Input(SpoofaxContext context)

ParseFile

public class ParseFile extends SpoofaxBuilder<ParseFile.Input, Out<IStrategoTerm>>
Fields
factory
public static final SpoofaxBuilderFactory<Input, Out<IStrategoTerm>, ParseFile> factory
Constructors
ParseFile
public ParseFile(Input input)
Methods
build
protected Out<IStrategoTerm> build(Input input)
defaultStamper
protected Stamper defaultStamper()
description
protected String description(Input input)
origin
public static Origin origin(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, Out<IStrategoTerm>, ParseFile, SpoofaxBuilderFactory<Input, Out<IStrategoTerm>, ParseFile>> request(Input input)

ParseFile.Input

public static class Input extends SpoofaxInput
Fields
file
public final File file
persistResult
public final boolean persistResult
requiredUnits
public final Origin requiredUnits
silent
public final boolean silent
Constructors
Input
public Input(SpoofaxContext context, File file, boolean persistResult, Origin requiredUnits)
Input
public Input(SpoofaxContext context, File file, boolean persistResult, boolean silent, Origin requiredUnits)

PrepareNativeBundle

public class PrepareNativeBundle extends SpoofaxBuilder<PrepareNativeBundle.Input, OutputTransient<PrepareNativeBundle.Output>>
Fields
factory
public static SpoofaxBuilderFactory<Input, OutputTransient<PrepareNativeBundle.Output>, PrepareNativeBundle> factory
Constructors
PrepareNativeBundle
public PrepareNativeBundle(Input input)
Methods
build
public OutputTransient<Output> build(Input input)
description
protected String description(Input input)
persistentPath
public File persistentPath(Input input)
request
public static BuildRequest<Input, OutputTransient<Output>, PrepareNativeBundle, SpoofaxBuilderFactory<Input, OutputTransient<Output>, PrepareNativeBundle>> request(Input input)

PrepareNativeBundle.Input

public static class Input extends SpoofaxInput

Empty input class to ensure that a new input instance is always created, which is always exactly the same, such that this builder is only executed once.

Constructors
Input
public Input(SpoofaxContext context)

PrepareNativeBundle.Output

public static class Output implements Serializable
Fields
implodePT
public final transient ExecutableCommandStrategy implodePT
sdf2table
public final transient ExecutableCommandStrategy sdf2table
Constructors
Output
public Output(ExecutableCommandStrategy sdf2table, ExecutableCommandStrategy implodePT)

org.metaborg.spoofax.meta.core.pluto.stamp

DirectoryModifiedStamper

public class DirectoryModifiedStamper implements Stamper
Constructors
DirectoryModifiedStamper
public DirectoryModifiedStamper(IOFileFilter filter, Stamper fileStamper)
DirectoryModifiedStamper
public DirectoryModifiedStamper()
Methods
stampOf
public Stamp stampOf(File directory)

Sdf2ParenthesizeStamper

public class Sdf2ParenthesizeStamper implements Stamper
Constructors
Sdf2ParenthesizeStamper
public Sdf2ParenthesizeStamper(SpoofaxContext context)
Methods
stampOf
public Stamp stampOf(File file)

Sdf2RtgStamper

public class Sdf2RtgStamper implements Stamper
Constructors
Sdf2RtgStamper
public Sdf2RtgStamper(SpoofaxContext context)
Methods
stampOf
public Stamp stampOf(File file)

org.metaborg.spoofax.meta.core.pluto.util

ExecutableCommandStrategy

public class ExecutableCommandStrategy extends xtc_command_1_0
Constructors
ExecutableCommandStrategy
public ExecutableCommandStrategy(String command, File executable)
Methods
invoke
public IStrategoTerm invoke(Context context, IStrategoTerm current, Strategy commandStrat)
run
public ExecutionResult run(IStrategoTerm... args)
run
public ExecutionResult run(String... args)

LoggingFilteringIOAgent

public class LoggingFilteringIOAgent extends IOAgent
Constructors
LoggingFilteringIOAgent
public LoggingFilteringIOAgent(String... regexs)
Methods
getErrLog
public String getErrLog()
getErrStream
public OutputStream getErrStream()
getOutLog
public String getOutLog()
getOutStream
public OutputStream getOutStream()
getWriter
public Writer getWriter(int fd)

LoggingFilteringIOAgent.LoggingWriter

public class LoggingWriter extends Writer
Constructors
LoggingWriter
public LoggingWriter(Writer writer)
Methods
close
public void close()
flush
public void flush()
getLog
public String getLog()
getStream
public OutputStream getStream()
write
public void write(char[] cbuf, int off, int len)

OutputIgnoreOriginBuilder

public class OutputIgnoreOriginBuilder extends Origin.Builder

Origin builder that overrides stampers of all added build requests with IgnoreOutputStamper.

Constructors
OutputIgnoreOriginBuilder
public OutputIgnoreOriginBuilder()
Methods
add
public Origin.Builder add(BuildRequest<?, ?, ?, ?>... requests)
add
public Origin.Builder add(Origin origin)
ignoreOutputs
public static Origin ignoreOutputs(Origin origin)

Gives back a new origin where all build requests have their stamper overridden with IgnoreOutputStamper.

ResourceAgentTracker

public class ResourceAgentTracker
Constructors
ResourceAgentTracker
public ResourceAgentTracker(IResourceService resourceService, FileObject initialDir, String... excludePatterns)
ResourceAgentTracker
public ResourceAgentTracker(IResourceService resourceService, FileObject initialDir, OutputStream stdoutStream, OutputStream stderrStream)
Methods
agent
public ResourceAgent agent()
stderr
public String stderr()
stdout
public String stdout()

StrategoExecutor

public class StrategoExecutor
Methods
executeCLI
public ExecutionResult executeCLI(Arguments arguments)
setSilent
public StrategoExecutor setSilent(boolean silent)
withContext
public StrategoExecutor withContext(Context context)
withName
public StrategoExecutor withName(String name)
withPermissiveGrammarsContext
public StrategoExecutor withPermissiveGrammarsContext()
withSdfContext
public StrategoExecutor withSdfContext()
withStrategy
public StrategoExecutor withStrategy(Strategy strategy)
withStrategyName
public StrategoExecutor withStrategyName(String strategyName)
withStrjContext
public StrategoExecutor withStrjContext()
withToolsContext
public StrategoExecutor withToolsContext()
withTracker
public StrategoExecutor withTracker(ResourceAgentTracker tracker)

StrategoExecutor.ExecutionResult

public static class ExecutionResult
Fields
errLog
public final String errLog
outLog
public final String outLog
result
public final IStrategoTerm result
success
public final boolean success
Constructors
ExecutionResult
public ExecutionResult(boolean success, String outLog, String errLog)
ExecutionResult
public ExecutionResult(IStrategoTerm result, String outLog, String errLog)

org.metaborg.spoofax.meta.core.project

ISpoofaxLanguageSpec

public interface ISpoofaxLanguageSpec extends ILanguageSpec

Spoofax specialized version of a language specification project.

ISpoofaxLanguageSpecService

public interface ISpoofaxLanguageSpecService extends ILanguageSpecService

Service for getting a Spoofax language specification.

Methods
available
boolean available(IProject project)

Checks if given project is a Spoofax language specification.

Parameters:
  • project – Project to check.
Returns:

True if project is a language specification, false otherwise.

get
ISpoofaxLanguageSpec get(IProject project)

Gets a Spoofax language specification from the specified project.

Parameters:
  • project – The project.
Throws:
  • ConfigException – When reading Spoofax language specification configuration fails.
Returns:

The Spoofax language specification, or null when the project is not a Spoofax language specification.

SpoofaxLanguageSpecService

public class SpoofaxLanguageSpecService implements ISpoofaxLanguageSpecService
Constructors
SpoofaxLanguageSpecService
public SpoofaxLanguageSpecService(ISourceTextService sourceTextService, ISpoofaxLanguageSpecConfigService configService)
Methods
available
public boolean available(IProject project)
get
public ISpoofaxLanguageSpec get(IProject project)

SpoofaxLanguageSpecWrapper

public class SpoofaxLanguageSpecWrapper implements IProject, ISpoofaxLanguageSpec

Wraps an IProject to use it as an ILanguageSpec

Constructors
SpoofaxLanguageSpecWrapper
public SpoofaxLanguageSpecWrapper(ISpoofaxLanguageSpecConfig config, IProject project)
Methods
config
public ISpoofaxLanguageSpecConfig config()
location
public FileObject location()
toString
public String toString()

org.metaborg.spoofax.meta.core.stratego.primitive

CheckSdf2TablePrimitive

public class CheckSdf2TablePrimitive extends AbstractPrimitive
Constructors
CheckSdf2TablePrimitive
public CheckSdf2TablePrimitive(IProjectService projectService, ILanguagePathService languagePathService)
Methods
call
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)

EditInformation

public class EditInformation
Constructors
EditInformation
public EditInformation(int column, int shift)
Methods
getColumn
public int getColumn()
getShift
public int getShift()
setColumn
public void setColumn(int column)
setShift
public void setShift(int shift)
toString
public String toString()

GetContextualGrammarPrimitive

public class GetContextualGrammarPrimitive extends AbstractPrimitive
Constructors
GetContextualGrammarPrimitive
public GetContextualGrammarPrimitive(IProjectService projectService)
Methods
call
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)

LanguageSpecPpNamePrimitive

public class LanguageSpecPpNamePrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageSpecPpNamePrimitive
public LanguageSpecPpNamePrimitive(IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageSpecSrcGenDirectory

public class LanguageSpecSrcGenDirectory extends ASpoofaxContextPrimitive
Constructors
LanguageSpecSrcGenDirectory
public LanguageSpecSrcGenDirectory()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LanguageSpecificationPrimitive

public class LanguageSpecificationPrimitive extends ASpoofaxContextPrimitive
Constructors
LanguageSpecificationPrimitive
public LanguageSpecificationPrimitive()
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

LayoutSensitivePrettyPrinterPrimitive

public class LayoutSensitivePrettyPrinterPrimitive extends AbstractPrimitive
Constructors
LayoutSensitivePrettyPrinterPrimitive
public LayoutSensitivePrettyPrinterPrimitive(IProjectService projectService)
Methods
call
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)

LegacyLanguageSpecNamePrimitive

public class LegacyLanguageSpecNamePrimitive extends ASpoofaxContextPrimitive
Constructors
LegacyLanguageSpecNamePrimitive
public LegacyLanguageSpecNamePrimitive(IProjectService projectService)
Methods
call
protected IStrategoTerm call(IStrategoTerm current, Strategy[] svars, IStrategoTerm[] tvars, ITermFactory factory, IContext context)

PlaceholderCharsPrimitive

public class PlaceholderCharsPrimitive extends AbstractPrimitive
Constructors
PlaceholderCharsPrimitive
public PlaceholderCharsPrimitive(IProjectService projectService)
Methods
call
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)

org.metaborg.spoofax.meta.core.wizard

CreateSpoofaxLanguageSpecWizard

public abstract class CreateSpoofaxLanguageSpecWizard extends CreateLanguageSpecWizard

Spoofax specialization of the ‘create language specification’ wizard helper.

Methods
analysisType
public AnalysisType analysisType()
generateEclipseFeatureProject
public abstract boolean generateEclipseFeatureProject()
generateEclipsePluginProject
public abstract boolean generateEclipsePluginProject()
generateEclipseUpdatesiteProject
public abstract boolean generateEclipseUpdatesiteProject()
generateExampleProject
public abstract boolean generateExampleProject()
generateTestProject
public abstract boolean generateTestProject()
inputAnalysisTypeModified
protected abstract boolean inputAnalysisTypeModified()
inputAnalysisTypeString
protected abstract String inputAnalysisTypeString()
inputSyntaxTypeModified
protected abstract boolean inputSyntaxTypeModified()
inputSyntaxTypeString
protected abstract String inputSyntaxTypeString()
setAnalysisType
protected abstract void setAnalysisType(String analysisTypeString)
setDefaults
public void setDefaults()
setGenerateEclipseFeatureProject
protected abstract void setGenerateEclipseFeatureProject(boolean generate)
setGenerateEclipsePluginProject
protected abstract void setGenerateEclipsePluginProject(boolean generate)
setGenerateEclipseUpdatesiteProject
protected abstract void setGenerateEclipseUpdatesiteProject(boolean generate)
setGenerateExampleProject
protected abstract void setGenerateExampleProject(boolean generate)
setGenerateTestProject
protected abstract void setGenerateTestProject(boolean generate)
setSyntaxType
protected abstract void setSyntaxType(String syntaxTypeString)
syntaxType
public SyntaxType syntaxType()