Class ExpressionTranslator
java.lang.Object
net.ssehub.easy.dslCore.translation.MessageReceiver
net.ssehub.easy.dslCore.translation.ExpressionTranslator
de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver,net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement>
de.uni_hildesheim.sse.buildLanguageTranslation.ExpressionTranslator
- All Implemented Interfaces:
net.ssehub.easy.dslCore.translation.IMessageReceiver,net.ssehub.easy.instantiation.core.model.expressions.ResolutionListener,net.ssehub.easy.instantiation.core.model.expressions.StringResolver.IExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver>
public class ExpressionTranslator
extends de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver,net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement>
A specific expression translator for the build language.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested classes/interfaces inherited from class de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator
de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator.CallType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatementcreateExpressionStatement(net.ssehub.easy.instantiation.core.model.expressions.Expression expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) protected net.ssehub.easy.instantiation.core.model.expressions.ExpressionVersionRestrictioncreateExpressionVersionRestriction(net.ssehub.easy.instantiation.core.model.expressions.Expression expr, net.ssehub.easy.instantiation.core.model.common.VariableDeclaration decl, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature feature) protected net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclarationcreateImplicitVariableDeclaration(String name, net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?> type, boolean isConstant, net.ssehub.easy.instantiation.core.model.expressions.Expression expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) protected net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclarationcreateVariableDeclaration(String name, net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?> type, boolean isConstant, net.ssehub.easy.instantiation.core.model.expressions.Expression expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) net.ssehub.easy.instantiation.core.model.expressions.ExpressionparseExpression(String expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver, StringBuilder warnings) private net.ssehub.easy.instantiation.core.model.buildlangModel.AlternativeExpressionprocessAlternative(Alternative alt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes an alternative expression.protected net.ssehub.easy.instantiation.core.model.expressions.ExpressionprocessCall(net.ssehub.easy.instantiation.core.model.expressions.Expression firstParam, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Call call, de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator.CallType type, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Expression arrayEx, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a function call.net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatementprocessExpressionStatement(ExpressionStatement expr, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes an expression statement.private net.ssehub.easy.instantiation.core.model.buildlangModel.ForStatementprocessForStatement(For stmt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a "for" statement.private net.ssehub.easy.instantiation.core.model.buildlangModel.InstantiateExpressionprocessInstantiate(Instantiate inst, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes an instantiate expression.protected net.ssehub.easy.instantiation.core.model.buildlangModel.JoinExpressionprocessJoin(Join join, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a join.protected net.ssehub.easy.instantiation.core.model.buildlangModel.JoinVariableDeclarationprocessJoinVariable(JoinVariable var, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a join variable.private net.ssehub.easy.instantiation.core.model.buildlangModel.MapExpressionprocessMap(Map map, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a "map" expression.net.ssehub.easy.instantiation.core.model.expressions.ExpressionprocessPrimaryExpression(de.uni_hildesheim.sse.vil.expressions.expressionDsl.PrimaryExpression ex, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a primary expression.private net.ssehub.easy.instantiation.core.model.buildlangModel.WhileStatementprocessWhileStatement(While stmt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Processes a "while" statement.net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleElement[]resolveBlock(RuleElementBlock block, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Resolves a block of rule elements.net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleElement[]resolveBlock(List<? extends RuleElement> block, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Resolves a block of rule elements.protected net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleElementresolveRuleElement(RuleElement elt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Called if the default processing of rule elements cannot be applied.private net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleBlockresolveStatementOrBlock(StatementOrBlock part, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Resolves a statement-or-block part.Methods inherited from class de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator
assertBooleanExpression, checkCallExpression, checkSemantics, continueResolution, createConstant, enactIvmlWarnings, error, getIvmlMessageAdapter, processAdditiveExpression, processArguments, processAssignment, processConstant, processEqualityExpression, processExpression, processExpressionStatement, processLogicalExpression, processMultiplicativeExpression, processPostfixExpression, processQualifiedValue, processRelationalExpression, processRestriction, processSubCall, processSubCalls, processType, processTypeParameter, processUnaryExpression, processVariableDeclaration, reProcessVariableDeclaration, resolveCallArguments, resolved, resolveIteratorDeclarations, setIvmlMessageAdapter, warning, warnVersionRestrictionsMethods inherited from class net.ssehub.easy.dslCore.translation.ExpressionTranslator
addMessage, clearMessages, clearMessages, collect, error, error, getErrorCount, getMessage, getMessageCount, warningMethods inherited from class net.ssehub.easy.dslCore.translation.MessageReceiver
error
-
Constructor Details
-
ExpressionTranslator
public ExpressionTranslator()
-
-
Method Details
-
processPrimaryExpression
public net.ssehub.easy.instantiation.core.model.expressions.Expression processPrimaryExpression(de.uni_hildesheim.sse.vil.expressions.expressionDsl.PrimaryExpression ex, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a primary expression.- Overrides:
processPrimaryExpressionin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement> - Parameters:
ex- the expression to be processedresolver- a resolver instance for resolving variables etc.- Returns:
- the resulting expression node
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails for some reason
-
processInstantiate
private net.ssehub.easy.instantiation.core.model.buildlangModel.InstantiateExpression processInstantiate(Instantiate inst, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes an instantiate expression. Here, many must be deferred to runtime as the main parameter determining the rule to be executed can only be determined at runtime.- Parameters:
inst-resolver-- Returns:
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException
-
processAlternative
private net.ssehub.easy.instantiation.core.model.buildlangModel.AlternativeExpression processAlternative(Alternative alt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes an alternative expression.- Parameters:
alt- the ECore object representing the alternative expressionresolver- a resolver instance for resolving variables etc.- Returns:
- the translated object in terms of the build language model
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails
-
processWhileStatement
private net.ssehub.easy.instantiation.core.model.buildlangModel.WhileStatement processWhileStatement(While stmt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a "while" statement.- Parameters:
stmt- the ECore object representing the statementresolver- a resolver instance for resolving variables etc.- Returns:
- the translated object in terms of the build language model
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails
-
processForStatement
private net.ssehub.easy.instantiation.core.model.buildlangModel.ForStatement processForStatement(For stmt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a "for" statement.- Parameters:
stmt- the ECore object representing the statementresolver- a resolver instance for resolving variables etc.- Returns:
- the translated object in terms of the build language model
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails
-
processMap
private net.ssehub.easy.instantiation.core.model.buildlangModel.MapExpression processMap(Map map, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a "map" expression.- Parameters:
map- the ECore object representing the expressionresolver- a resolver instance for resolving variables etc.- Returns:
- the translated object in terms of the build language model
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails
-
resolveStatementOrBlock
private net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleBlock resolveStatementOrBlock(StatementOrBlock part, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Resolves a statement-or-block part.- Parameters:
part- the ECore part object to be resolved (may be null)resolver- the resolver- Returns:
- the resolved element (may be null)
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case of translation problems
-
resolveBlock
public net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleElement[] resolveBlock(RuleElementBlock block, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Resolves a block of rule elements.- Parameters:
block- the block to be resolvedresolver- a resolver instance for resolving variables etc.- Returns:
- the resolved elements
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails due to semantic reasons
-
resolveBlock
public net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleElement[] resolveBlock(List<? extends RuleElement> block, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) Resolves a block of rule elements.- Parameters:
block- the block to be resolvedresolver- a resolver instance for resolving variables etc.- Returns:
- the resolved elements
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails due to semantic reasons
-
resolveRuleElement
protected net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleElement resolveRuleElement(RuleElement elt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Called if the default processing of rule elements cannot be applied.- Parameters:
elt- the rule elementresolver- the resolver- Returns:
- the resolved element (may be null, is ignored then)
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that resolving the rule element fails for some reason
-
createExpressionStatement
protected net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement createExpressionStatement(net.ssehub.easy.instantiation.core.model.expressions.Expression expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) - Specified by:
createExpressionStatementin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement>
-
processExpressionStatement
public net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement processExpressionStatement(ExpressionStatement expr, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes an expression statement.- Parameters:
expr- the expression to be processedresolver- a resolver instance for resolving variables etc.- Returns:
- the expression statement
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails due to semantic reasons
-
processJoin
protected net.ssehub.easy.instantiation.core.model.buildlangModel.JoinExpression processJoin(Join join, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a join.- Parameters:
join- the join to be processedresolver- a resolver instance for resolving variables etc.- Returns:
- the join model representation
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails for some reason
-
processJoinVariable
protected net.ssehub.easy.instantiation.core.model.buildlangModel.JoinVariableDeclaration processJoinVariable(JoinVariable var, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a join variable.- Parameters:
var- the variable to be processedresolver- a resolver instance for resolving variables etc.- Returns:
- the join variable
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails for some reason
-
processCall
protected net.ssehub.easy.instantiation.core.model.expressions.Expression processCall(net.ssehub.easy.instantiation.core.model.expressions.Expression firstParam, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Call call, de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator.CallType type, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Expression arrayEx, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) throws net.ssehub.easy.dslCore.translation.TranslatorException Processes a function call.- Specified by:
processCallin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement> - Parameters:
firstParam- the first parameter (may be null)call- the function all (may be null, but thenarrayExis required)arrayEx- an array access expression (may be null, but thencallis required)resolver- a resolver instance for resolving variables etc.- Returns:
- the resulting expression node
- Throws:
net.ssehub.easy.dslCore.translation.TranslatorException- in case that the translation fails for some reason
-
createVariableDeclaration
protected net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration createVariableDeclaration(String name, net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?> type, boolean isConstant, net.ssehub.easy.instantiation.core.model.expressions.Expression expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) - Specified by:
createVariableDeclarationin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement>
-
createImplicitVariableDeclaration
protected net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration createImplicitVariableDeclaration(String name, net.ssehub.easy.instantiation.core.model.vilTypes.TypeDescriptor<?> type, boolean isConstant, net.ssehub.easy.instantiation.core.model.expressions.Expression expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver) - Specified by:
createImplicitVariableDeclarationin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement>
-
createExpressionVersionRestriction
protected net.ssehub.easy.instantiation.core.model.expressions.ExpressionVersionRestriction createExpressionVersionRestriction(net.ssehub.easy.instantiation.core.model.expressions.Expression expr, net.ssehub.easy.instantiation.core.model.common.VariableDeclaration decl, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature feature) throws net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException - Specified by:
createExpressionVersionRestrictionin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement> - Throws:
net.ssehub.easy.basics.modelManagement.RestrictionEvaluationException
-
parseExpression
public net.ssehub.easy.instantiation.core.model.expressions.Expression parseExpression(String expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver, StringBuilder warnings) throws net.ssehub.easy.instantiation.core.model.common.VilException - Specified by:
parseExpressionin interfacenet.ssehub.easy.instantiation.core.model.expressions.StringResolver.IExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver> - Specified by:
parseExpressionin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement> - Throws:
net.ssehub.easy.instantiation.core.model.common.VilException
-
cannotAssignHint
- Specified by:
cannotAssignHintin classde.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator<net.ssehub.easy.instantiation.core.model.buildlangModel.VariableDeclaration,net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver, net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement>
-