Commit b62ace06 authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Fix: BehaviorEmbedding Format and SymbolTable creation

parent f07412bc
Pipeline #100610 failed with stages
in 38 seconds
......@@ -42,7 +42,7 @@
<mc.grammars.assembly.version>0.0.6</mc.grammars.assembly.version>
<Common-MontiCar.version>0.0.14-20180704.113055-2</Common-MontiCar.version>
<Embedded-MontiArc.version>0.1.9-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Math.version>0.1.6-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-Math.version>0.1.7-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-Behaviour.version>0.0.15-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<CNNArch.version>0.2.7</CNNArch.version>
<Math.version>0.0.19-SNAPSHOT</Math.version>
......
......@@ -5,9 +5,7 @@ grammar EMADL extends de.monticore.lang.embeddedmontiarc.EmbeddedMontiArcMath,
start EMACompilationUnit;
BehaviorEmbedding = Architecture | MathStatements;
MathStatements = Statement+;
BehaviorEmbedding = Architecture | Statement+;
BehaviorName = name:"CNN" | name:"Math";
}
\ No newline at end of file
......@@ -46,8 +46,8 @@ public class CheckBehaviorName implements EMADLASTBehaviorNameCoCo, EMADLASTBeha
}
private void checkBehavior() {
if (behaviorName.getNameOpt().get().equals("Math")){
if (!behaviorEmbedding.isPresentMathStatements()){
if (behaviorName.getName().equals("Math")){
if (behaviorEmbedding.getStatementList() == null){
Log.error("Implementation Name 'Math' is incorrect."
, behaviorName.get_SourcePositionStart());
}
......
......@@ -22,9 +22,9 @@ package de.monticore.lang.monticar.emadl._symboltable;
import de.monticore.EmbeddingModelingLanguage;
import de.monticore.antlr4.MCConcreteParser;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EmbeddedMontiArcLanguage;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath.adapter.PortArraySymbol2MathVariableDeclarationSymbolTypeFilter;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath.adapter.ResolutionDeclarationSymbol2MathVariableDeclarationTypeFilter;
import de.monticore.lang.embeddedmontiarcdynamic.embeddedmontiarcdynamic._symboltable.EmbeddedMontiArcDynamicLanguage;
import de.monticore.lang.mathopt._symboltable.MathOptLanguage;
import de.monticore.lang.monticar.cnnarch._symboltable.CNNArchLanguage;
import de.monticore.lang.monticar.emadl._parser.EMADLParser;
......@@ -40,7 +40,7 @@ public class EMADLLanguage extends EmbeddingModelingLanguage {
public static final String FILE_ENDING = "emadl";
public static final EmbeddedMontiArcLanguage HOST_LANGUAGE = new EmbeddedMontiArcLanguage();
public static final EmbeddedMontiArcDynamicLanguage HOST_LANGUAGE = new EmbeddedMontiArcDynamicLanguage();
public static final CNNArchLanguage CNNARCH_LANGUAGE = new CNNArchLanguage();
public static final MathOptLanguage MATH_LANGUAGE = new MathOptLanguage();
......
......@@ -23,7 +23,6 @@ package de.monticore.lang.monticar.emadl._symboltable;
import de.monticore.lang.math._ast.ASTStatement;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.monticar.emadl._ast.ASTMathStatements;
import java.util.ArrayList;
import java.util.List;
......@@ -32,12 +31,10 @@ import java.util.List;
public class EMADLMathStatementsSymbol extends MathStatementsSymbol {
protected List<MathExpressionSymbol> emadlMathExpressionSymbols = null;
public EMADLMathStatementsSymbol(String name, ASTMathStatements ast) {
public EMADLMathStatementsSymbol(String name, ASTStatement astStatement) {
super(name, null);
this.emadlMathExpressionSymbols = new ArrayList<>();
for (ASTStatement astStatement : ast.getStatementList()) {
emadlMathExpressionSymbols.add((MathExpressionSymbol) astStatement.getSymbolOpt().get());
}
emadlMathExpressionSymbols.add((MathExpressionSymbol) astStatement.getSymbolOpt().get());
}
@Override
......
......@@ -21,12 +21,14 @@
package de.monticore.lang.monticar.emadl._symboltable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMACompilationUnit;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EmbeddedMontiArcSymbolTableCreator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcbehavior._symboltable.EmbeddedMontiArcBehaviorSymbolTableCreator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcbehavior._visitor.EmbeddedMontiArcBehaviorVisitor;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathSymbolTableCreatorTOP;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.instanceStructure.ModifiedEMAComponentInstanceSymbolCreator;
import de.monticore.lang.embeddedmontiarcdynamic.embeddedmontiarcdynamic._symboltable.EmbeddedMontiArcDynamicSymbolTableCreator;
import de.monticore.lang.math._ast.ASTStatement;
import de.monticore.lang.mathopt._symboltable.MathOptSymbolTableCreator;
import de.monticore.lang.monticar.cnnarch._symboltable.CNNArchSymbolTableCreator;
import de.monticore.lang.monticar.emadl._ast.ASTMathStatements;
import de.monticore.lang.monticar.emadl._visitor.EMADLDelegatorVisitor;
import de.monticore.lang.monticar.emadl._visitor.EMADLVisitor;
import de.monticore.symboltable.MutableScope;
......@@ -41,10 +43,11 @@ public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymb
private final EMADLDelegatorVisitor visitor = new EMADLDelegatorVisitor();
private EmbeddedMontiArcSymbolTableCreator emaSTC;
private EmbeddedMontiArcMathSymbolTableCreatorTOP emamSTC;
private CNNArchSymbolTableCreator cnnArchSTC;
private MathOptSymbolTableCreator mathOptSTC;
private EmbeddedMontiArcDynamicSymbolTableCreator emadSTC;
private EmbeddedMontiArcBehaviorVisitor emaBehaviorSTC;
public EMADLSymbolTableCreator(
final ResolvingConfiguration resolvingConfig, final MutableScope enclosingScope) {
......@@ -58,28 +61,30 @@ public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymb
}
private void initSuperSTC(final ResolvingConfiguration resolvingConfig) {
this.emaSTC = new ModifiedEMASymbolTableCreator(resolvingConfig, scopeStack);//new ModifiedEMASymbolTableCreator(resolvingConfig, scopeStack);
this.cnnArchSTC = new CNNArchSymbolTableCreator(resolvingConfig, scopeStack);
this.emamSTC = new EmbeddedMontiArcMathSymbolTableCreatorTOP(resolvingConfig, scopeStack);
this.mathOptSTC = new MathOptSymbolTableCreator(resolvingConfig, scopeStack);
visitor.setEmbeddedMontiArcVisitor(emaSTC);
visitor.setEmbeddedMontiArcBehaviorVisitor(
new EmbeddedMontiArcBehaviorSymbolTableCreator(resolvingConfig, scopeStack));
visitor.setEmbeddedMontiArcMathVisitor(emamSTC);
this.emadSTC = new ModifiedEMADynamicSymbolTableCreator(resolvingConfig, scopeStack);
this.emadSTC.setInstanceSymbolCreator(new ModifiedEMAComponentInstanceSymbolCreator()); //Use an instance symbo, creator that adds math statement to instances
this.emaBehaviorSTC = new EmbeddedMontiArcBehaviorSymbolTableCreator(resolvingConfig, scopeStack);
visitor.setEMADLVisitor(this);
visitor.setCNNArchVisitor(cnnArchSTC);
visitor.setMathOptVisitor(mathOptSTC);
visitor.setEmbeddedMontiArcMathVisitor(emamSTC);
visitor.setEmbeddedMontiArcVisitor(emadSTC);
visitor.setEmbeddedMontiArcDynamicVisitor(emadSTC);
visitor.setEmbeddedMontiArcBehaviorVisitor(emaBehaviorSTC);
visitor.setMathVisitor(mathOptSTC);
visitor.setMatrixVisitor(mathOptSTC);
visitor.setMatrixExpressionsVisitor(mathOptSTC);
visitor.setExpressionsBasisVisitor(mathOptSTC);
visitor.setCommonExpressionsVisitor(mathOptSTC);
visitor.setTypes2Visitor(mathOptSTC);
visitor.setAssignmentExpressionsVisitor(mathOptSTC);
visitor.setMatrixExpressionsVisitor(mathOptSTC);
visitor.setMatrixVisitor(mathOptSTC);
visitor.setTypes2Visitor(mathOptSTC);
visitor.setMathOptVisitor(mathOptSTC);
visitor.setCommon2Visitor(emamSTC);
}
/**
......@@ -99,7 +104,7 @@ public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymb
@Override
public MutableScope getFirstCreatedScope() {
return emaSTC.getFirstCreatedScope();
return emadSTC.getFirstCreatedScope();
}
private EMADLVisitor realThis = this;
......@@ -116,7 +121,9 @@ public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymb
}
}
public void endVisit(ASTMathStatements ast) {
public void endVisit(ASTStatement ast) {
addToScopeAndLinkWithNode(new EMADLMathStatementsSymbol("MathStatements", ast), ast);
}
}
\ No newline at end of file
......@@ -23,21 +23,22 @@ package de.monticore.lang.monticar.emadl._symboltable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._ast.ASTEMACompilationUnit;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.EmbeddedMontiArcSymbolTableCreator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAComponentSymbol;
import de.monticore.lang.embeddedmontiarcdynamic.embeddedmontiarcdynamic._symboltable.EmbeddedMontiArcDynamicSymbolTableCreator;
import de.monticore.symboltable.MutableScope;
import de.monticore.symboltable.ResolvingConfiguration;
import de.se_rwth.commons.logging.Log;
import java.util.Deque;
public class ModifiedEMASymbolTableCreator extends EmbeddedMontiArcSymbolTableCreator {
public class ModifiedEMADynamicSymbolTableCreator extends EmbeddedMontiArcDynamicSymbolTableCreator {
private ModifiedExpandedInstanceSymbolCreator instanceSymbolCreator = new ModifiedExpandedInstanceSymbolCreator();
public ModifiedEMASymbolTableCreator(ResolvingConfiguration resolverConfig, MutableScope enclosingScope) {
public ModifiedEMADynamicSymbolTableCreator(ResolvingConfiguration resolverConfig, MutableScope enclosingScope) {
super(resolverConfig, enclosingScope);
}
public ModifiedEMASymbolTableCreator(ResolvingConfiguration resolvingConfig, Deque<MutableScope> scopeStack) {
public ModifiedEMADynamicSymbolTableCreator(ResolvingConfiguration resolvingConfig, Deque<MutableScope> scopeStack) {
super(resolvingConfig, scopeStack);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment