Class LoadResolver
java.lang.Object
ca.mcscert.jpipe.compiler.model.Transformation<List<Command>, List<Command>>
ca.mcscert.jpipe.compiler.steps.transformations.LoadResolver
Eliminates all
LoadResolver.LoadDirectives from the command list by recursively
parsing each referenced file and splicing its prefixed commands in place.
LoadResolver runs after ActionListProvider and before
ActionListInterpretation, so the
ExecutionEngine always receives a flat list
that contains no LoadResolver.LoadDirectives.
Algorithm for each load "path" as ns directive found in the list:
- Resolve
pathrelative to the directory of the file currently being compiled (taken from theCompilationContext.sourcePath()). - Detect cycles: if the resolved path is already being compiled in the current call stack, report a FATAL and skip.
- Parse the referenced file up to and including
ActionListProviderusing a freshCompilationContexttied to the sub-file. - Recursively resolve any
LoadResolver.LoadDirectives found in that sub-list. - Prefix every model name in the expanded sub-list with
ns + ":"viaprefix(String, List). - Splice the prefixed commands into the result in place of the
LoadResolver.LoadDirective.
Diagnostics produced while compiling a sub-file are always forwarded to the
parent CompilationContext, so the caller sees a unified error report.
-
Nested Class Summary
Nested classes/interfaces inherited from class Transformation
Transformation.Step<I,O> -
Constructor Summary
ConstructorsConstructorDescriptionLoadResolver(OperatorRegistry operators, UnificationEquivalenceRegistry unificationEquivalences) -
Method Summary
-
Constructor Details
-
LoadResolver
public LoadResolver(OperatorRegistry operators, UnificationEquivalenceRegistry unificationEquivalences)
-
-
Method Details
-
run
Description copied from class:TransformationBusiness logic of this step. Must not returnnull; may throw any exception. Usectxto report non-fatal diagnostics or inspect previously accumulated errors.
-