Class TemplateLangExecution
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.expressions.EvaluationVisitor
-
- net.ssehub.easy.instantiation.core.model.common.ExecutionVisitor<Template,Def,VariableDeclaration,Resolver>
-
- net.ssehub.easy.instantiation.core.model.templateModel.TemplateLangExecution
-
- All Implemented Interfaces:
ITerminatable,IVisitor,IExpressionVisitor,ITemplateLangVisitor,IVisitor
- Direct Known Subclasses:
TemplateSubstitutionExecution
public class TemplateLangExecution extends ExecutionVisitor<Template,Def,VariableDeclaration,Resolver> implements ITemplateLangVisitor, ITerminatable
Implements the execution of the template language.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.ssehub.easy.instantiation.core.model.common.ExecutionVisitor
ExecutionVisitor.ConditionTest
-
-
Field Summary
Fields Modifier and Type Field Description private intcontentNestingLevelprivate static java.util.List<JavaExtension>DEFAULT_EXTENSIONSstatic java.lang.StringDEFAULT_MAIN_TEMPLATEThe name of the default main template (called "main").private java.util.Stack<java.lang.String>defContentStackprivate static java.lang.StringEMPTY_CONTENTprivate RuntimeEnvironmentenvironmentstatic java.lang.StringINTERNAL_PARAM_PREFIXDenotes a prefix for internal parameter which must be set in addition.static ExpressionParserRegistry.ILanguage<Resolver>LANGUAGEprivate ContentStatementlastContentprivate booleanlastContentFormattedprivate ContentStatement.LineEndTypelastContentLineEndTypeprivate intlastContentNestingLevelprivate java.lang.StringmainNameprivate java.io.WritermainOutprivate java.io.PrintWriteroutstatic java.lang.StringPARAM_CONFIGDenotes the default name of the configuration parameter (may be overwritten by user values).static java.lang.StringPARAM_CONFIG_SUREDenotes the default name of the configuration parameter always containing the source configuration.static java.lang.StringPARAM_TARGETDenotes the default name of the target artifact parameter (may be overwritten by user values).static java.lang.StringPARAM_TARGET_SUREDenotes the default name of the target artifact parameter always containing the target artifact.private booleanstopprivate ITracertracer
-
Constructor Summary
Constructors Constructor Description TemplateLangExecution(ITracer tracer, java.io.Writer out, java.lang.String mainName, java.util.Map<java.lang.String,java.lang.Object> parameter)Creates a new evaluation visitor.TemplateLangExecution(ITracer tracer, java.io.Writer out, java.util.Map<java.lang.String,java.lang.Object> parameter)Creates a new evaluation visitor.TemplateLangExecution(RuntimeEnvironment environment)Creates a new execution visitor for import expression evaluation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappendContent(java.lang.String string)Adds content to the current top element ofdefContentStack.protected java.lang.StringappendInCompositeExpression(java.lang.String s1, Expression e1, java.lang.Object v1, java.lang.String s2, Expression e2)Appendss2tos2originating from the respective expressions.protected voidassignModelParameter(IResolvableModel<VariableDeclaration,Template> targetModel, IResolvableModel<VariableDeclaration,Template> srcModel)Assigns the model parameters.private java.lang.ObjectcheckContentStatement(java.lang.Object currentValue, java.lang.Object noValue, boolean isContentStatement)Checks the current value for the need of correction with respect to the last content statement.private java.lang.ObjectcheckContentStatement(java.lang.Object currentValue, java.lang.Object noValue, ITemplateElement check)Checks the current value for the need of correction with respect to the last content statement.private static java.lang.StringcleanLineEnd(java.lang.String content, boolean includeIndentation)Removes the empty line markerEMPTY_CONTENTand considers surrounding indentation for removal.protected ModelCallExpression<VariableDeclaration,Template,Def>createModelCall(Template model, Def operation, CallArgument... arguments)Creates a model call expression instance.private voiddecreaseIndentation(ITemplateElement element)Decreases the current indentation level depending on the specifiedelement.protected DefdynamicDispatch(Def operation, java.lang.Object[] args, IArgumentProvider argumentProvider, boolean enableParentScope)Performs the dynamic dispatch on the operation type.private booleanequals(java.lang.Object condValue, java.lang.Object exprValue)Checks for equality among the givencondValue(condition value) and the givenexprValue, wherebyexprValuemay be anIvmlElementand, thus, implicitly casted to the right value.private java.lang.StringevaluateSeparator(Expression ex, java.lang.String deflt)Evaluates a separator expression.protected java.lang.ObjectexecuteModelCall(Def def)Actually executes a model call.private intgetAdditionalIndentation()Returns the additional indentation as configured.static JavaExtensiongetDefaultExtension(int index)Returns the specified default extension.static intgetDefaultExtensionCount()Returns the number of default extensions.protected IExpressionParser<Resolver>getExpressionParser()Returns the actual expression parser.protected java.net.URIgetFallbackBaseURI()Returns the base URI for template resolution in this execution if there is no template to obtain it from.private intgetIndentationStep()private java.lang.StringgetLineEnd()Returns the current line end based on the formatting configuration of the actual context model.private java.lang.StringgetSeparatorFromExpression(Expression expression)Turns theexpressioninto a separator.private intgetTabEmulation()protected voidhandleParameterInSequence(IResolvableModel<VariableDeclaration,Template> model, java.util.Map<java.lang.String,VariableDeclaration> varMap)Handles model parameters in sequence if appropriate.private voidincreaseIndentation(ITemplateElement element)Increases the current indentation level depending on the specifiedelement.private static booleanisContentStatement(ITemplateElement elt)Returns whether the template element or the last statement within is a content statement.protected booleanlastContentReplaceEmptyLine()Returns whether the last content commands that empty lines (itself empty, following line breaks) shall be removed.static voidregisterDefaultExtension(java.lang.Class<?> extension)Register a default Java extension.voidrelease(boolean releaseDefault)Releases the resources allocated by this execution.voidstop()Terminate this.voidstoreContent()Explicitly stores the concatenated results of the content statements to the target artifact.static voidstoreContent(IArtifact target, java.io.StringWriter out)Explicitly stores the concatenated results of the content statements to the target artifact.java.lang.ObjectvisitAlternative(AlternativeStatement alternative)Visits an alternative statement.java.lang.ObjectvisitCompound(Compound compound)Visits a compound.java.lang.ObjectvisitConstantExpression(ConstantExpression cst)Visits a constant node.java.lang.ObjectvisitContentAlternativeExpression(ContentAlternativeExpression ex)Visits a content alternative expression.java.lang.ObjectvisitContentImportExpression(ContentImportExpression ex)Visits a content import expression.java.lang.ObjectvisitContentLoopExpression(ContentLoopExpression ex)Visits a content loop expression.java.lang.ObjectvisitContentStatement(ContentStatement cnt)Visits a content statement.java.lang.ObjectvisitContentVarDeclExpression(ContentVarDeclExpression ex)Visits a content variable declaration expression.java.lang.ObjectvisitDef(Def def)Visits a sub-template definition.java.lang.ObjectvisitFlush(FlushStatement stmt)Visits a flush statement.java.lang.ObjectvisitJavaExtension(JavaExtension ext)Visits a java extension.java.lang.ObjectvisitLoop(LoopStatement loop)Visits a loop statement.java.lang.ObjectvisitResolvableOperationCallExpression(ResolvableOperationCallExpression ex)Visits resolvable operation call expression (function pointer call).java.lang.ObjectvisitSwitch(SwitchStatement swtch)Visits a switch statement.java.lang.ObjectvisitTemplate(Template template)Visits a template.java.lang.ObjectvisitTemplateBlock(TemplateBlock block)Visits a template block.java.lang.ObjectvisitTemplateCallExpression(TemplateCallExpression call)Visits a template call expression.java.lang.ObjectvisitTypedef(Typedef typedef)Visits a typedef.java.lang.ObjectvisitWhile(WhileStatement stmt)Visits a while statement.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.common.ExecutionVisitor
checkConditionResult, convertToContainer, determineScriptParam, doAssignmentConversions, enableArtifactAutoStoreOnParameters, evaluateModelParameter, executeMain, getParameter, getParameterCount, getRuntimeEnvironment, getTracer, hasParameter, initializeImplicitVariables, mayFail, notifyValueDefined, proceedModelCall, processModelParameter, replaceParameter, setModelArgument, visitAdvice, visitExpressionStatement, visitModelCallExpression, visitModelHeader, visitVariableDeclaration
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.expressions.EvaluationVisitor
addImplicitParamters, evaluateContentExpression, visitCallExpression, visitCompositeExpression, visitContainerInitializerExpression, visitExpression, visitExpressionEvaluator, visitFieldAccessExpression, visitMultiAndExpression, visitParenthesisExpression, visitResolvableOperationExpression, visitStringExpression, visitValueAssignmentExpression, visitVariableExpression, visitVarModelIdentifierExpression, visitVilTypeExpression
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.expressions.IExpressionVisitor
visitCallExpression, visitCompositeExpression, visitContainerInitializerExpression, visitExpression, visitExpressionEvaluator, visitFieldAccessExpression, visitMultiAndExpression, visitParenthesisExpression, visitResolvableOperationExpression, visitStringExpression, visitValueAssignmentExpression, visitVariableExpression, visitVarModelIdentifierExpression, visitVilTypeExpression
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.common.IVisitor
visitAdvice, visitExpressionStatement, visitVariableDeclaration
-
-
-
-
Field Detail
-
LANGUAGE
public static final ExpressionParserRegistry.ILanguage<Resolver> LANGUAGE
-
DEFAULT_MAIN_TEMPLATE
public static final java.lang.String DEFAULT_MAIN_TEMPLATE
The name of the default main template (called "main").- See Also:
- Constant Field Values
-
PARAM_CONFIG
public static final java.lang.String PARAM_CONFIG
Denotes the default name of the configuration parameter (may be overwritten by user values).- See Also:
- Constant Field Values
-
PARAM_TARGET
public static final java.lang.String PARAM_TARGET
Denotes the default name of the target artifact parameter (may be overwritten by user values).- See Also:
- Constant Field Values
-
INTERNAL_PARAM_PREFIX
public static final java.lang.String INTERNAL_PARAM_PREFIX
Denotes a prefix for internal parameter which must be set in addition.- See Also:
- Constant Field Values
-
PARAM_CONFIG_SURE
public static final java.lang.String PARAM_CONFIG_SURE
Denotes the default name of the configuration parameter always containing the source configuration.- See Also:
- Constant Field Values
-
PARAM_TARGET_SURE
public static final java.lang.String PARAM_TARGET_SURE
Denotes the default name of the target artifact parameter always containing the target artifact.- See Also:
- Constant Field Values
-
DEFAULT_EXTENSIONS
private static final java.util.List<JavaExtension> DEFAULT_EXTENSIONS
-
EMPTY_CONTENT
private static final java.lang.String EMPTY_CONTENT
- See Also:
- Constant Field Values
-
environment
private RuntimeEnvironment environment
-
mainOut
private java.io.Writer mainOut
-
out
private java.io.PrintWriter out
-
mainName
private java.lang.String mainName
-
tracer
private ITracer tracer
-
stop
private boolean stop
-
contentNestingLevel
private int contentNestingLevel
-
lastContentNestingLevel
private int lastContentNestingLevel
-
lastContentFormatted
private boolean lastContentFormatted
-
defContentStack
private java.util.Stack<java.lang.String> defContentStack
-
lastContent
private ContentStatement lastContent
-
lastContentLineEndType
private ContentStatement.LineEndType lastContentLineEndType
-
-
Constructor Detail
-
TemplateLangExecution
public TemplateLangExecution(ITracer tracer, java.io.Writer out, java.util.Map<java.lang.String,java.lang.Object> parameter)
Creates a new evaluation visitor.- Parameters:
tracer- the tracer instance for testingout- where to put the output toparameter- the top-level parameter for the script to be executed
-
TemplateLangExecution
public TemplateLangExecution(ITracer tracer, java.io.Writer out, java.lang.String mainName, java.util.Map<java.lang.String,java.lang.Object> parameter)
Creates a new evaluation visitor.- Parameters:
tracer- the tracer instance for testingout- where to put the output tomainName- the name of the sub-template to be executedparameter- the top-level parameter for the script to be executed
-
TemplateLangExecution
TemplateLangExecution(RuntimeEnvironment environment)
Creates a new execution visitor for import expression evaluation.- Parameters:
environment- the runtime environment to be used for expression evaluation
-
-
Method Detail
-
release
public void release(boolean releaseDefault)
Description copied from class:ExecutionVisitorReleases the resources allocated by this execution.- Overrides:
releasein classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Parameters:
releaseDefault- shall also default artifacts, i.e., artifacts that cannot be assigned to a source / target artifact model be released? May affect execution of other VIL models.
-
registerDefaultExtension
public static void registerDefaultExtension(java.lang.Class<?> extension)
Register a default Java extension.- Parameters:
extension- the extension to be registered
-
getDefaultExtensionCount
public static int getDefaultExtensionCount()
Returns the number of default extensions.- Returns:
- the number of default extensions
-
getDefaultExtension
public static JavaExtension getDefaultExtension(int index)
Returns the specified default extension.- Parameters:
index- the 0-based index of the default extension- Returns:
- the default extension
- Throws:
java.lang.IndexOutOfBoundsException- in case thatindex < 0 || index >=getDefaultExtensionCount()
-
visitTemplate
public java.lang.Object visitTemplate(Template template) throws VilException
Description copied from interface:IVisitorVisits a template.- Specified by:
visitTemplatein interfaceIVisitor- Parameters:
template- the template to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitDef
public java.lang.Object visitDef(Def def) throws VilException
Description copied from interface:IVisitorVisits a sub-template definition.- Specified by:
visitDefin interfaceIVisitor- Parameters:
def- the sub-template definition to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
increaseIndentation
private void increaseIndentation(ITemplateElement element)
Increases the current indentation level depending on the specifiedelement. This information is required for content formatting.- Parameters:
element- the element to be considered
-
decreaseIndentation
private void decreaseIndentation(ITemplateElement element)
Decreases the current indentation level depending on the specifiedelement. This information is required for content formatting.- Parameters:
element- the element to be considered
-
visitTemplateBlock
public java.lang.Object visitTemplateBlock(TemplateBlock block) throws VilException
Description copied from interface:IVisitorVisits a template block.- Specified by:
visitTemplateBlockin interfaceIVisitor- Parameters:
block- the template block to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitAlternative
public java.lang.Object visitAlternative(AlternativeStatement alternative) throws VilException
Description copied from interface:IVisitorVisits an alternative statement.- Specified by:
visitAlternativein interfaceIVisitor- Parameters:
alternative- the alternative to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
getSeparatorFromExpression
private java.lang.String getSeparatorFromExpression(Expression expression) throws VilException
Turns theexpressioninto a separator.- Parameters:
expression- the expression (may be null)- Returns:
- the separator (or null)
- Throws:
VilException- in case of evaluation problems
-
visitLoop
public java.lang.Object visitLoop(LoopStatement loop) throws VilException
Description copied from interface:IVisitorVisits a loop statement.- Specified by:
visitLoopin interfaceIVisitor- Parameters:
loop- the loop statement to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
checkContentStatement
private java.lang.Object checkContentStatement(java.lang.Object currentValue, java.lang.Object noValue, ITemplateElement check)Checks the current value for the need of correction with respect to the last content statement.- Parameters:
currentValue- the current valuenoValue- the object indicating no value in this contextcheck- the template element/statement to check for a content statement- Returns:
currentValueorEMPTY_CONTENT
-
checkContentStatement
private java.lang.Object checkContentStatement(java.lang.Object currentValue, java.lang.Object noValue, boolean isContentStatement)Checks the current value for the need of correction with respect to the last content statement.- Parameters:
currentValue- the current valuenoValue- the object indicating no value in this contextisContentStatement- whether the relevant element is a content statement- Returns:
currentValueorEMPTY_CONTENT
-
isContentStatement
private static final boolean isContentStatement(ITemplateElement elt)
Returns whether the template element or the last statement within is a content statement.- Parameters:
elt- the element (may be null)- Returns:
truefor content statement,falseelse (also ifeltis null)
-
appendContent
private void appendContent(java.lang.String string)
Adds content to the current top element ofdefContentStack.- Parameters:
string- the string to add to the current content.
-
visitSwitch
public java.lang.Object visitSwitch(SwitchStatement swtch) throws VilException
Description copied from interface:IVisitorVisits a switch statement.- Specified by:
visitSwitchin interfaceIVisitor- Parameters:
swtch- the switch statement to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
equals
private boolean equals(java.lang.Object condValue, java.lang.Object exprValue)Checks for equality among the givencondValue(condition value) and the givenexprValue, wherebyexprValuemay be anIvmlElementand, thus, implicitly casted to the right value. This method is intended where common object values need to be compared and no VIL/VTL casts may happen.- Parameters:
condValue- the condition valueexprValue- the expression value- Returns:
trueif the values are equalfalseelse
-
visitContentStatement
public java.lang.Object visitContentStatement(ContentStatement cnt) throws VilException
Description copied from interface:IVisitorVisits a content statement.- Specified by:
visitContentStatementin interfaceIVisitor- Parameters:
cnt- the content statement- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
lastContentReplaceEmptyLine
protected boolean lastContentReplaceEmptyLine()
Description copied from class:EvaluationVisitorReturns whether the last content commands that empty lines (itself empty, following line breaks) shall be removed.- Overrides:
lastContentReplaceEmptyLinein classEvaluationVisitor- Returns:
truefor remove,falseelse
-
cleanLineEnd
private static java.lang.String cleanLineEnd(java.lang.String content, boolean includeIndentation)Removes the empty line markerEMPTY_CONTENTand considers surrounding indentation for removal.- Parameters:
content- the content to be consideredincludeIndentation- whether indentation shall be taken into account- Returns:
- the modified content
-
appendInCompositeExpression
protected java.lang.String appendInCompositeExpression(java.lang.String s1, Expression e1, java.lang.Object v1, java.lang.String s2, Expression e2)Description copied from class:EvaluationVisitorAppendss2tos2originating from the respective expressions. This allows to potentially consider indentation formatting.- Overrides:
appendInCompositeExpressionin classEvaluationVisitor- Parameters:
s1- the first stringe1- the expression causings1v1- the value caustings1s2- the string to appende2- the expression causings2- Returns:
- the appended string
-
getAdditionalIndentation
private int getAdditionalIndentation()
Returns the additional indentation as configured.- Returns:
- the additional indentation or
0if no configuration is present
-
getTabEmulation
private int getTabEmulation()
-
getIndentationStep
private int getIndentationStep()
-
getLineEnd
private java.lang.String getLineEnd()
Returns the current line end based on the formatting configuration of the actual context model.- Returns:
- the actual line end (fallback is the Java line end)
-
visitConstantExpression
public java.lang.Object visitConstantExpression(ConstantExpression cst) throws VilException
Description copied from interface:IExpressionVisitorVisits a constant node.- Specified by:
visitConstantExpressionin interfaceIExpressionVisitor- Overrides:
visitConstantExpressionin classEvaluationVisitor- Parameters:
cst- the node- Returns:
- the result of visiting this expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitJavaExtension
public java.lang.Object visitJavaExtension(JavaExtension ext) throws VilException
Description copied from interface:IVisitorVisits a java extension.- Specified by:
visitJavaExtensionin interfaceIVisitor- Parameters:
ext- the java extension- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitTemplateCallExpression
public java.lang.Object visitTemplateCallExpression(TemplateCallExpression call) throws VilException
Description copied from interface:IVisitorVisits a template call expression.- Specified by:
visitTemplateCallExpressionin interfaceIVisitor- Parameters:
call- the call expression- Returns:
- the result of visiting the given expression (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
executeModelCall
protected java.lang.Object executeModelCall(Def def) throws VilException
Description copied from class:ExecutionVisitorActually executes a model call. Basically, a subclassing visitor shall call the related visit method. Currently, this method is intended to facilitate reuse and not declared in the visitor in order to avoid further template parameters etc.- Specified by:
executeModelCallin classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Parameters:
def- the operation to be executed- Returns:
- the execution result
- Throws:
VilException- in case that execution fails
-
createModelCall
protected ModelCallExpression<VariableDeclaration,Template,Def> createModelCall(Template model, Def operation, CallArgument... arguments) throws VilException
Description copied from class:ExecutionVisitorCreates a model call expression instance.- Specified by:
createModelCallin classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Parameters:
model- the modeloperation- the operation to be called onmodelarguments- the arguments- Returns:
- the call expression instance
- Throws:
VilException- in case of an erroneously qualified name
-
dynamicDispatch
protected Def dynamicDispatch(Def operation, java.lang.Object[] args, IArgumentProvider argumentProvider, boolean enableParentScope)
Description copied from class:ExecutionVisitorPerforms the dynamic dispatch on the operation type.- Specified by:
dynamicDispatchin classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Parameters:
operation- the operation to be dispatchedargs- the actual argumentsargumentProvider- access to the argument expressionsenableParentScope- enable the parent declaration scopes for dynamic dispatch, shall not be done in case of explicit super calls due to potential endless recursion- Returns:
operationor the more actual operation
-
handleParameterInSequence
protected void handleParameterInSequence(IResolvableModel<VariableDeclaration,Template> model, java.util.Map<java.lang.String,VariableDeclaration> varMap) throws VilException
Description copied from class:ExecutionVisitorHandles model parameters in sequence if appropriate. If and only if mapping is possible, this method shall modifyvarMapby removing assigned parameters. Otherwise, no error shall be emitted by this method. Implemented empty in this class as intended for overriding.- Overrides:
handleParameterInSequencein classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Parameters:
model- the model to be processedvarMap- a mapping of parameter names to implementing variable declarations, to be modified as a side effect if parameters are bound- Throws:
VilException- in case of execution errors
-
assignModelParameter
protected void assignModelParameter(IResolvableModel<VariableDeclaration,Template> targetModel, IResolvableModel<VariableDeclaration,Template> srcModel) throws VilException
Description copied from class:ExecutionVisitorAssigns the model parameters. Allows to use model-specific code.- Specified by:
assignModelParameterin classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Parameters:
targetModel- the target model to be executedsrcModel- the source model to take the (named, optional) parameters from- Throws:
VilException- if accessing parameters / assigning values fails
-
getExpressionParser
protected IExpressionParser<Resolver> getExpressionParser()
Description copied from class:ExecutionVisitorReturns the actual expression parser.- Specified by:
getExpressionParserin classExecutionVisitor<Template,Def,VariableDeclaration,Resolver>- Returns:
- the actual expression parser
-
visitResolvableOperationCallExpression
public java.lang.Object visitResolvableOperationCallExpression(ResolvableOperationCallExpression ex) throws VilException
Description copied from interface:IExpressionVisitorVisits resolvable operation call expression (function pointer call).- Specified by:
visitResolvableOperationCallExpressionin interfaceIExpressionVisitor- Overrides:
visitResolvableOperationCallExpressionin classEvaluationVisitor- Parameters:
ex- the expression- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitTypedef
public java.lang.Object visitTypedef(Typedef typedef) throws VilException
Description copied from interface:IVisitorVisits a typedef.- Specified by:
visitTypedefin interfaceIVisitor- Parameters:
typedef- the typedef- Returns:
- the result of visiting (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitWhile
public java.lang.Object visitWhile(WhileStatement stmt) throws VilException
Description copied from interface:IVisitorVisits a while statement.- Specified by:
visitWhilein interfaceIVisitor- Parameters:
stmt- the while statement to visit- Returns:
- the result of visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
stop
public void stop()
Description copied from interface:ITerminatableTerminate this.- Specified by:
stopin interfaceITerminatable
-
visitFlush
public java.lang.Object visitFlush(FlushStatement stmt) throws VilException
Description copied from interface:IVisitorVisits a flush statement.- Specified by:
visitFlushin interfaceIVisitor- Parameters:
stmt- the flush statement- Returns:
- the result visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
storeContent
public void storeContent() throws VilExceptionExplicitly stores the concatenated results of the content statements to the target artifact.- Throws:
VilException- if storing the content fails for some reason
-
storeContent
public static void storeContent(IArtifact target, java.io.StringWriter out) throws VilException
Explicitly stores the concatenated results of the content statements to the target artifact.- Parameters:
target- the target artifactout- the output writer to take the produced content from- Throws:
VilException- if storing the content fails for some reason
-
visitContentAlternativeExpression
public java.lang.Object visitContentAlternativeExpression(ContentAlternativeExpression ex) throws VilException
Description copied from interface:IVisitorVisits a content alternative expression.- Specified by:
visitContentAlternativeExpressionin interfaceIVisitor- Parameters:
ex- the expression- Returns:
- the result visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
evaluateSeparator
private java.lang.String evaluateSeparator(Expression ex, java.lang.String deflt) throws VilException
Evaluates a separator expression.- Parameters:
ex- the expression (may be null)deflt- the default value to be used as result ifexis null- Returns:
- the separator,
defltifexis null or the evaluation leads to undefined, the separator string else - Throws:
VilException- in case that the evaluation fails
-
visitContentLoopExpression
public java.lang.Object visitContentLoopExpression(ContentLoopExpression ex) throws VilException
Description copied from interface:IVisitorVisits a content loop expression.- Specified by:
visitContentLoopExpressionin interfaceIVisitor- Parameters:
ex- the expression- Returns:
- the result visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitContentVarDeclExpression
public java.lang.Object visitContentVarDeclExpression(ContentVarDeclExpression ex) throws VilException
Description copied from interface:IVisitorVisits a content variable declaration expression.- Specified by:
visitContentVarDeclExpressionin interfaceIVisitor- Parameters:
ex- the expression- Returns:
- the result visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
visitContentImportExpression
public java.lang.Object visitContentImportExpression(ContentImportExpression ex) throws VilException
Description copied from interface:IVisitorVisits a content import expression.- Specified by:
visitContentImportExpressionin interfaceIVisitor- Parameters:
ex- the expression- Returns:
- the result visiting the given statement (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
getFallbackBaseURI
protected java.net.URI getFallbackBaseURI()
Returns the base URI for template resolution in this execution if there is no template to obtain it from.- Returns:
- the base URI
-
visitCompound
public java.lang.Object visitCompound(Compound compound) throws VilException
Description copied from interface:IVisitorVisits a compound.- Specified by:
visitCompoundin interfaceIVisitor- Parameters:
compound- the compound- Returns:
- the result of visiting (may be null)
- Throws:
VilException- in case that visiting fails (e.g., execution)
-
-