Commit 501bfe28 authored by Christoph Richter's avatar Christoph Richter
Browse files

EmbeddedMontiArcMathOpt.mc4: Removed unnessesary non-terminal (fixes #1)

parent ad92c0bb
Pipeline #69822 passed with stage
in 20 minutes and 16 seconds
...@@ -2,6 +2,6 @@ package de.monticore.lang; ...@@ -2,6 +2,6 @@ package de.monticore.lang;
grammar EmbeddedMontiArcMathOpt extends de.monticore.lang.embeddedmontiarc.EmbeddedMontiArcMath, de.monticore.lang.MathOpt{ grammar EmbeddedMontiArcMathOpt extends de.monticore.lang.embeddedmontiarc.EmbeddedMontiArcMath, de.monticore.lang.MathOpt{
EMAMOptCompilationUnit = EMAMCompilationUnit; start EMAMCompilationUnit;
} }
\ No newline at end of file
...@@ -23,15 +23,8 @@ ...@@ -23,15 +23,8 @@
package de.monticore.lang.embeddedmontiarcmathopt._symboltable; package de.monticore.lang.embeddedmontiarcmathopt._symboltable;
import de.monticore.ModelingLanguageFamily; import de.monticore.ModelingLanguageFamily;
import de.monticore.io.paths.ModelPath;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ConstantPortSymbol;
import de.monticore.lang.embeddedmontiarcmathopt._ast.ASTEMAMOptCompilationUnit;
import de.monticore.lang.monticar.stream._symboltable.StreamLanguage; import de.monticore.lang.monticar.stream._symboltable.StreamLanguage;
import de.monticore.lang.monticar.struct._symboltable.StructLanguage; import de.monticore.lang.monticar.struct._symboltable.StructLanguage;
import de.monticore.symboltable.GlobalScope;
import de.monticore.symboltable.Scope;
import java.nio.file.Paths;
/** /**
* @author Christoph Richter * @author Christoph Richter
......
package de.monticore.lang.embeddedmontiarcmathopt._symboltable; package de.monticore.lang.embeddedmontiarcmathopt._symboltable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._ast.ASTEMAMCompilationUnit;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathModelLoader; import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathModelLoader;
import de.monticore.lang.embeddedmontiarcmathopt._ast.ASTEMAMOptCompilationUnit;
import de.monticore.modelloader.ModelingLanguageModelLoader; import de.monticore.modelloader.ModelingLanguageModelLoader;
import de.monticore.symboltable.ArtifactScope; import de.monticore.symboltable.ArtifactScope;
import de.monticore.symboltable.MutableScope; import de.monticore.symboltable.MutableScope;
...@@ -9,14 +9,14 @@ import de.monticore.symboltable.ResolvingConfiguration; ...@@ -9,14 +9,14 @@ import de.monticore.symboltable.ResolvingConfiguration;
import de.monticore.symboltable.Scope; import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log; import de.se_rwth.commons.logging.Log;
public class EmbeddedMontiArcMathOptModelLoader extends ModelingLanguageModelLoader<ASTEMAMOptCompilationUnit> { public class EmbeddedMontiArcMathOptModelLoader extends ModelingLanguageModelLoader<ASTEMAMCompilationUnit> {
public EmbeddedMontiArcMathOptModelLoader(EmbeddedMontiArcMathOptLanguage language) { public EmbeddedMontiArcMathOptModelLoader(EmbeddedMontiArcMathOptLanguage language) {
super(language); super(language);
} }
@Override @Override
protected void createSymbolTableFromAST(ASTEMAMOptCompilationUnit ast, String modelName, MutableScope enclosingScope, ResolvingConfiguration resolvingConfiguration) { protected void createSymbolTableFromAST(ASTEMAMCompilationUnit ast, String modelName, MutableScope enclosingScope, ResolvingConfiguration resolvingConfiguration) {
final EmbeddedMontiArcMathOptSymbolTableCreator stc = getModelingLanguage().getSymbolTableCreator(resolvingConfiguration, enclosingScope).orElse(null); final EmbeddedMontiArcMathOptSymbolTableCreator stc = getModelingLanguage().getSymbolTableCreator(resolvingConfiguration, enclosingScope).orElse(null);
if (stc != null) { if (stc != null) {
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
package de.monticore.lang.embeddedmontiarcmathopt._symboltable; package de.monticore.lang.embeddedmontiarcmathopt._symboltable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathSymbolTableCreator; import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._symboltable.EmbeddedMontiArcMathSymbolTableCreator;
import de.monticore.lang.embeddedmontiarcmathopt._ast.ASTEMAMOptCompilationUnit;
import de.monticore.lang.embeddedmontiarcmathopt._visitor.EmbeddedMontiArcMathOptDelegatorVisitor; import de.monticore.lang.embeddedmontiarcmathopt._visitor.EmbeddedMontiArcMathOptDelegatorVisitor;
import de.monticore.lang.embeddedmontiarcmathopt._visitor.EmbeddedMontiArcMathOptVisitor; import de.monticore.lang.embeddedmontiarcmathopt._visitor.EmbeddedMontiArcMathOptVisitor;
import de.monticore.lang.mathopt._symboltable.MathOptSymbolTableCreator; import de.monticore.lang.mathopt._symboltable.MathOptSymbolTableCreator;
...@@ -91,11 +90,5 @@ public class EmbeddedMontiArcMathOptSymbolTableCreator extends EmbeddedMontiArcM ...@@ -91,11 +90,5 @@ public class EmbeddedMontiArcMathOptSymbolTableCreator extends EmbeddedMontiArcM
return mathOptSTC; return mathOptSTC;
} }
public Scope createFromAST(ASTEMAMOptCompilationUnit rootNode) {
Log.errorIfNull(rootNode, "0xA7004_184 Error by creating of the EmbeddedMontiArcMathOptSymbolTableCreator symbol table: top ast node is null");
rootNode.getEMAMCompilationUnit().accept(visitorOpt);
return getFirstCreatedScope();
}
} }
...@@ -2,6 +2,7 @@ package de.monticore.lang.embeddedmontiarcmathopt._ast; ...@@ -2,6 +2,7 @@ package de.monticore.lang.embeddedmontiarcmathopt._ast;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcbehavior._ast.ASTBehaviorImplementation; import de.monticore.lang.embeddedmontiarc.embeddedmontiarcbehavior._ast.ASTBehaviorImplementation;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._ast.ASTBehaviorEmbedding; import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._ast.ASTBehaviorEmbedding;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath._ast.ASTEMAMCompilationUnit;
import de.monticore.lang.embeddedmontiarcmathopt._parser.EmbeddedMontiArcMathOptParser; import de.monticore.lang.embeddedmontiarcmathopt._parser.EmbeddedMontiArcMathOptParser;
import de.monticore.lang.math._ast.ASTStatement; import de.monticore.lang.math._ast.ASTStatement;
import de.monticore.lang.mathopt._ast.ASTOptimizationStatement; import de.monticore.lang.mathopt._ast.ASTOptimizationStatement;
...@@ -20,10 +21,10 @@ public class ASTEmbeddedMontiArcMathOptNodesTest { ...@@ -20,10 +21,10 @@ public class ASTEmbeddedMontiArcMathOptNodesTest {
@Test @Test
public void testEMAMOptCompilationUnit() throws IOException { public void testEMAMOptCompilationUnit() throws IOException {
EmbeddedMontiArcMathOptParser parser = new EmbeddedMontiArcMathOptParser(); EmbeddedMontiArcMathOptParser parser = new EmbeddedMontiArcMathOptParser();
ASTEMAMOptCompilationUnit astNode = parser.parse("src/test/resources/test/emam/optimization/MinimizePortsTest.emam").orElse(null); ASTEMAMCompilationUnit astNode = parser.parse("src/test/resources/test/emam/optimization/MinimizePortsTest.emam").orElse(null);
assertNotNull(astNode); assertNotNull(astNode);
assertEquals(ASTBehaviorImplementation.class, astNode.getEMAMCompilationUnit().getEMACompilationUnit().getComponent().getBody().getElement(1).getClass()); assertEquals(ASTBehaviorImplementation.class, astNode.getEMACompilationUnit().getComponent().getBody().getElement(1).getClass());
ASTBehaviorImplementation behaviour = (ASTBehaviorImplementation) astNode.getEMAMCompilationUnit().getEMACompilationUnit().getComponent().getBody().getElement(1); ASTBehaviorImplementation behaviour = (ASTBehaviorImplementation) astNode.getEMACompilationUnit().getComponent().getBody().getElement(1);
ASTStatement astOptStatement = ((ASTBehaviorEmbedding) behaviour.getBehavior()).getStatement(0); ASTStatement astOptStatement = ((ASTBehaviorEmbedding) behaviour.getBehavior()).getStatement(0);
assertEquals(ASTOptimizationStatement.class, astOptStatement.getClass()); assertEquals(ASTOptimizationStatement.class, astOptStatement.getClass());
} }
......
Supports Markdown
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