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<VariableDeclaration,Resolver,ExpressionStatement>
-
- de.uni_hildesheim.sse.vil.templatelang.templateLanguageTranslation.ExpressionTranslator
-
- All Implemented Interfaces:
IMessageReceiver,ResolutionListener,StringResolver.IExpressionTranslator<VariableDeclaration,Resolver>
public class ExpressionTranslator extends ExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>
A specific expression translator for the template language.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.uni_hildesheim.sse.vil.expressions.translation.ExpressionTranslator
ExpressionTranslator.CallType
-
-
Constructor Summary
Constructors Constructor Description ExpressionTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringcannotAssignHint()A hint if an assignment is not allowed.protected ExpressionStatementcreateExpressionStatement(Expression expression, Resolver resolver)Creates an expression statement.protected ExpressionVersionRestrictioncreateExpressionVersionRestriction(Expression expr, VariableDeclaration decl, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature feature)Creates an expression version restriction matching this class.protected VariableDeclarationcreateImplicitVariableDeclaration(java.lang.String name, TypeDescriptor<?> type, boolean isConstant, Expression expression, Resolver resolver)Creates a new implicit variable declaration.protected VariableDeclarationcreateVariableDeclaration(java.lang.String name, TypeDescriptor<?> type, boolean isConstant, Expression expression, Resolver resolver)Creates a new variable declaration.ExpressionparseExpression(java.lang.String expression, Resolver resolver, java.lang.StringBuilder warnings)Parse the given expression.protected ExpressionprocessCall(Expression firstParam, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Call call, ExpressionTranslator.CallType type, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Expression arrayEx, Resolver resolver)Processes a function call.-
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, processPrimaryExpression, processQualifiedValue, processRelationalExpression, processRestriction, processSubCalls, processType, processTypeParameter, processUnaryExpression, processVariableDeclaration, reProcessVariableDeclaration, resolveCallArguments, resolved, resolveIteratorDeclarations, setIvmlMessageAdapter, warning, warnVersionRestrictions
-
Methods inherited from class net.ssehub.easy.dslCore.translation.ExpressionTranslator
clearMessages, clearMessages, collect, error, error, getErrorCount, getMessage, getMessageCount, warning
-
Methods inherited from class net.ssehub.easy.dslCore.translation.MessageReceiver
error
-
-
-
-
Method Detail
-
processCall
protected Expression processCall(Expression firstParam, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Call call, ExpressionTranslator.CallType type, de.uni_hildesheim.sse.vil.expressions.expressionDsl.Expression arrayEx, Resolver resolver) throws TranslatorException
Processes a function call.- Specified by:
processCallin classExpressionTranslator<VariableDeclaration,Resolver,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:
TranslatorException- in case that the translation fails for some reason
-
createVariableDeclaration
protected VariableDeclaration createVariableDeclaration(java.lang.String name, TypeDescriptor<?> type, boolean isConstant, Expression expression, Resolver resolver)
Description copied from class:ExpressionTranslatorCreates a new variable declaration.- Specified by:
createVariableDeclarationin classExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>- Parameters:
name- the name of the variabletype- the type of the variableisConstant- whether this variable is a constantexpression- an expression denoting the initial value (may be null)resolver- the resolver instance
-
createImplicitVariableDeclaration
protected VariableDeclaration createImplicitVariableDeclaration(java.lang.String name, TypeDescriptor<?> type, boolean isConstant, Expression expression, Resolver resolver)
Description copied from class:ExpressionTranslatorCreates a new implicit variable declaration.- Specified by:
createImplicitVariableDeclarationin classExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>- Parameters:
name- the name of the variabletype- the type of the variableisConstant- whether this variable is a constantexpression- an expression denoting the initial value (may be null)resolver- the resolver instance
-
createExpressionVersionRestriction
protected ExpressionVersionRestriction createExpressionVersionRestriction(Expression expr, VariableDeclaration decl, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature feature) throws RestrictionEvaluationException
Description copied from class:ExpressionTranslatorCreates an expression version restriction matching this class.- Specified by:
createExpressionVersionRestrictionin classExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>- Parameters:
expr- the expression for the restrictiondecl- the version variablecause- the grammar cause for this callfeature- the causing feature- Returns:
- the created instance
- Throws:
RestrictionEvaluationException- in case of any type related problems
-
parseExpression
public Expression parseExpression(java.lang.String expression, Resolver resolver, java.lang.StringBuilder warnings) throws VilException
Description copied from class:ExpressionTranslatorParse the given expression.- Specified by:
parseExpressionin interfaceStringResolver.IExpressionTranslator<VariableDeclaration,Resolver>- Specified by:
parseExpressionin classExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>- Parameters:
expression- the expression as stringresolver- the resolverwarnings- a collector for warnings- Returns:
- the resulting expression
- Throws:
VilException- if problems occur while parsing / resolving
-
createExpressionStatement
protected ExpressionStatement createExpressionStatement(Expression expression, Resolver resolver)
Description copied from class:ExpressionTranslatorCreates an expression statement.- Specified by:
createExpressionStatementin classExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>- Parameters:
expression- the expressionresolver- the resolver instance- Returns:
- the expression statement
-
cannotAssignHint
protected java.lang.String cannotAssignHint()
Description copied from class:ExpressionTranslatorA hint if an assignment is not allowed.- Specified by:
cannotAssignHintin classExpressionTranslator<VariableDeclaration,Resolver,ExpressionStatement>- Returns:
- the hint (must not be null)
-
-