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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
     
    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)
     
    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)
     
    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)
     
    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)
     
    net.ssehub.easy.instantiation.core.model.expressions.Expression
    parseExpression(String expression, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver, StringBuilder warnings)
     
    private net.ssehub.easy.instantiation.core.model.buildlangModel.AlternativeExpression
    processAlternative(Alternative alt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes an alternative expression.
    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)
    Processes a function call.
    net.ssehub.easy.instantiation.core.model.buildlangModel.ExpressionStatement
    processExpressionStatement(ExpressionStatement expr, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes an expression statement.
    private net.ssehub.easy.instantiation.core.model.buildlangModel.ForStatement
    processForStatement(For stmt, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes a "for" statement.
    private net.ssehub.easy.instantiation.core.model.buildlangModel.InstantiateExpression
    processInstantiate(Instantiate inst, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes an instantiate expression.
    protected net.ssehub.easy.instantiation.core.model.buildlangModel.JoinExpression
    processJoin(Join join, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes a join.
    protected net.ssehub.easy.instantiation.core.model.buildlangModel.JoinVariableDeclaration
    processJoinVariable(JoinVariable var, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes a join variable.
    private net.ssehub.easy.instantiation.core.model.buildlangModel.MapExpression
    processMap(Map map, net.ssehub.easy.instantiation.core.model.buildlangModel.Resolver resolver)
    Processes a "map" expression.
    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)
    Processes a primary expression.
    private net.ssehub.easy.instantiation.core.model.buildlangModel.WhileStatement
    processWhileStatement(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.IRuleElement
    resolveRuleElement(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.IRuleBlock
    resolveStatementOrBlock(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, warnVersionRestrictions

    Methods inherited from class net.ssehub.easy.dslCore.translation.ExpressionTranslator

    addMessage, clearMessages, clearMessages, collect, error, error, getErrorCount, getMessage, getMessageCount, warning

    Methods inherited from class net.ssehub.easy.dslCore.translation.MessageReceiver

    error

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      processPrimaryExpression in class 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>
      Parameters:
      ex - the expression to be processed
      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
    • 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 expression
      resolver - 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 statement
      resolver - 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 statement
      resolver - 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 expression
      resolver - 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 resolved
      resolver - 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 resolved
      resolver - 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 element
      resolver - 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:
      createExpressionStatement in class 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>
    • 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 processed
      resolver - 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 processed
      resolver - 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 processed
      resolver - 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:
      processCall in class 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>
      Parameters:
      firstParam - the first parameter (may be null)
      call - the function all (may be null, but then arrayEx is required)
      arrayEx - an array access expression (may be null, but then call is 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:
      createVariableDeclaration in class 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>
    • 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:
      createImplicitVariableDeclaration in class 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>
    • 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:
      createExpressionVersionRestriction in class 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>
      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:
      parseExpression in interface 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>
      Specified by:
      parseExpression in class 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>
      Throws:
      net.ssehub.easy.instantiation.core.model.common.VilException
    • cannotAssignHint

      protected String cannotAssignHint()
      Specified by:
      cannotAssignHint in class 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>