Commit 3bfb1407 authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya
Browse files

moved to monticore 5.0.0 and newer math, tests are not passing yet

parent 6b193247
Pipeline #67559 failed with stages
in 13 minutes and 46 seconds
#
#
# ******************************************************************************
# MontiCAR Modeling Family, www.se-rwth.de
# Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
# All rights reserved.
#
# This project is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this project. If not, see <http://www.gnu.org/licenses/>.
# *******************************************************************************
#
stages:
- windows
- linux
......
......@@ -37,12 +37,12 @@
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>4.5.4.08.11.2017</monticore.version>
<se-commons.version>1.7.7</se-commons.version>
<monticore.version>5.0.0</monticore.version>
<se-commons.version>1.7.8</se-commons.version>
<mc.grammars.assembly.version>0.0.6</mc.grammars.assembly.version>
<SIUnit.version>0.0.10-SNAPSHOT</SIUnit.version>
<Common-MontiCar.version>0.0.12</Common-MontiCar.version>
<Math.version>0.0.11</Math.version>
<SIUnit.version>0.0.11</SIUnit.version>
<Common-MontiCar.version>0.0.14-SNAPSHOT</Common-MontiCar.version>
<Math.version>0.0.19-SNAPSHOT</Math.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
......@@ -52,7 +52,7 @@
<commons-cli.version>1.4</commons-cli.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>4.5.3.1</monticore.plugin>
<monticore.plugin>5.0.0</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
******************************************************************************
MontiCAR Modeling Family, www.se-rwth.de
Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
All rights reserved.
This project is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this project. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
......
package de.monticore.lang.monticar;
grammar CNNArch extends de.monticore.lang.math.Math {
grammar CNNArch extends de.monticore.lang.Math, de.monticore.lang.monticar.Common2,
de.monticore.CommonExpressions, de.monticore.SetExpressions {
token NEWLINETOKEN =
('\r' '\n' |
......@@ -113,12 +114,12 @@ grammar CNNArch extends de.monticore.lang.math.Math {
/**
Expressions for variable values.
*/
ArchSimpleExpression = (arithmeticExpression:MathArithmeticExpression
| booleanExpression:MathBooleanExpression
ArchSimpleExpression = (arithmeticExpression:Expression
| booleanExpression:Expression
| tupleExpression:TupleExpression
| string:StringLiteral);
TupleExpression = "(" expressions:MathArithmeticExpression "," expressions:(MathArithmeticExpression || ",")* ")";
TupleExpression = "(" expressions:Expression "," expressions:(Expression || ",")* ")";
/* =================================*/
......
......@@ -23,25 +23,26 @@ package de.monticore.lang.monticar.cnnarch._ast;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
import java.util.List;
import java.util.Optional;
public class ASTArchSpecialArgument extends ASTArchSpecialArgumentTOP {
public ASTArchSpecialArgument() {
}
public ASTArchSpecialArgument(ASTArchExpression rhs, List<String> nEWLINETOKENs, String serial, String parallel, String conditional) {
public ASTArchSpecialArgument(ASTArchExpression rhs, List<String> nEWLINETOKENs, Optional<String> serial, Optional<String> parallel, Optional<String> conditional) {
super(rhs, nEWLINETOKENs, serial, parallel, conditional);
}
@Override
public String getName() {
if (getParallel().isPresent()){
if (isPresentParallel()){
return AllPredefinedVariables.PARALLEL_ARG_NAME;
}
else if (getSerial().isPresent()) {
else if (isPresentSerial()) {
return AllPredefinedVariables.SERIAL_ARG_NAME;
}
else if (getConditional().isPresent()){
else if (isPresentConditional()){
return AllPredefinedVariables.CONDITIONAL_ARG_NAME;
}
else {
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.*;
import de.monticore.symboltable.Symbol;
......
......@@ -20,8 +20,8 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
......
......@@ -41,7 +41,7 @@ public class CheckIOType extends CNNArchSymbolCoCo {
public void checkIO(IODeclarationSymbol ioDeclaration) {
ArchTypeSymbol type = ioDeclaration.getType();
if (type.getDomain().isIsComplex() || type.getDomain().isIsBoolean()){
if (type.getDomain().isComplex() || type.getDomain().isBoolean()){
Log.error("0" + ErrorCodes.INVALID_IO_TYPE + " Invalid IO element type. " +
"Type has to be rational or whole number.");
}
......
......@@ -38,7 +38,7 @@ public class CheckLayer implements CNNArchASTLayerCoCo{
@Override
public void check(ASTLayer node) {
Set<String> nameSet = new HashSet<>();
for (ASTArchArgument argument : node.getArguments()){
for (ASTArchArgument argument : node.getArgumentsList()){
String name = argument.getName();
if (nameSet.contains(name)){
Log.error("0" + ErrorCodes.DUPLICATED_ARG + " Duplicated name: " + name +
......@@ -65,7 +65,7 @@ public class CheckLayer implements CNNArchASTLayerCoCo{
requiredArguments.add(param.getName());
}
}
for (ASTArchArgument argument : node.getArguments()){
for (ASTArchArgument argument : node.getArgumentsList()){
requiredArguments.remove(argument.getName());
}
......
......@@ -28,13 +28,13 @@ public class CheckRangeOperators implements CNNArchASTArchValueRangeCoCo {
@Override
public void check(ASTArchValueRange node) {
if (node.getParallel().isPresent()){
if (!node.getParallel2().isPresent()){
if (node.isPresentParallel()){
if (!node.isPresentParallel2()){
differentOperatorError(node);
}
}
else {
if (node.getParallel2().isPresent()){
if (node.isPresentParallel2()){
differentOperatorError(node);
}
}
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._symboltable;
import de.monticore.lang.math.math._symboltable.expression.*;
import de.monticore.lang.math._symboltable.expression.*;
import de.monticore.lang.monticar.cnnarch.helper.Calculator;
import de.monticore.lang.monticar.cnnarch.helper.Utils;
import de.monticore.symboltable.Scope;
......
......@@ -45,7 +45,7 @@ public class ArchTypeSymbol extends CommonSymbol {
public ArchTypeSymbol() {
super("", KIND);
ASTElementType elementType = new ASTElementType();
elementType.setTElementType(DEFAULT_ELEMENT_TYPE);
elementType.setName(DEFAULT_ELEMENT_TYPE);
setDomain(elementType);
}
......@@ -244,7 +244,7 @@ public class ArchTypeSymbol extends CommonSymbol {
}
public Builder elementType(String start, String end){
domain = new ASTElementType();
domain.setTElementType("Q(" + start + ":" + end +")");
domain.setName("Q(" + start + ":" + end +")");
return this;
}
......@@ -257,7 +257,7 @@ public class ArchTypeSymbol extends CommonSymbol {
if (domain == null){
domain = new ASTElementType();
domain.setTElementType(DEFAULT_ELEMENT_TYPE);
domain.setName(DEFAULT_ELEMENT_TYPE);
}
sym.setDomain(domain);
return sym;
......
......@@ -21,13 +21,13 @@
package de.monticore.lang.monticar.cnnarch._symboltable;
import de.monticore.lang.math.math._ast.ASTMathExpression;
import de.monticore.lang.math.math._symboltable.MathSymbolTableCreator;
import de.monticore.lang.math.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.math._symboltable.MathSymbolTableCreator;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._ast.*;
import de.monticore.lang.monticar.cnnarch._visitor.CNNArchInheritanceVisitor;
import de.monticore.lang.monticar.cnnarch._visitor.CNNArchVisitor;
import de.monticore.lang.monticar.cnnarch._visitor.CommonCNNArchDelegatorVisitor;
import de.monticore.lang.monticar.cnnarch._visitor.CNNArchDelegatorVisitor;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedLayers;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
import de.monticore.symboltable.*;
......@@ -58,9 +58,9 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
private void initSuperSTC(final ResolvingConfiguration resolvingConfig) {
this.mathSTC = new ModifiedMathSymbolTableCreator(resolvingConfig, scopeStack);
CommonCNNArchDelegatorVisitor visitor = new CommonCNNArchDelegatorVisitor();
visitor.set_de_monticore_lang_monticar_cnnarch__visitor_CNNArchVisitor(this);
visitor.set_de_monticore_lang_math_math__visitor_MathVisitor(mathSTC);
CNNArchDelegatorVisitor visitor = new CNNArchDelegatorVisitor();
visitor.setCNNArchVisitor(this);
visitor.setMathVisitor(mathSTC);
setRealThis(visitor);
}
......@@ -116,18 +116,18 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTCNNArchCompilationUnit ast) {
CNNArchCompilationUnitSymbol compilationUnitSymbol = (CNNArchCompilationUnitSymbol) ast.getSymbol().get();
compilationUnitSymbol.setArchitecture((ArchitectureSymbol) ast.getArchitecture().getSymbol().get());
CNNArchCompilationUnitSymbol compilationUnitSymbol = (CNNArchCompilationUnitSymbol) ast.getSymbolOpt().get();
compilationUnitSymbol.setArchitecture((ArchitectureSymbol) ast.getArchitecture().getSymbolOpt().get());
List<VariableSymbol> parameters = new ArrayList<>(ast.getArchitectureParameters().size());
for (ASTArchitectureParameter astParameter : ast.getArchitectureParameters()){
parameters.add((VariableSymbol) astParameter.getSymbol().get());
List<VariableSymbol> parameters = new ArrayList<>(ast.getArchitectureParameterList().size());
for (ASTArchitectureParameter astParameter : ast.getArchitectureParameterList()){
parameters.add((VariableSymbol) astParameter.getSymbolOpt().get());
}
compilationUnitSymbol.setParameters(parameters);
List<IODeclarationSymbol> ioDeclarations = new ArrayList<>();
for (ASTIODeclaration astIODeclaration : ast.getIoDeclarations()){
ioDeclarations.add((IODeclarationSymbol) astIODeclaration.getSymbol().get());
for (ASTIODeclaration astIODeclaration : ast.getIoDeclarationsList()){
ioDeclarations.add((IODeclarationSymbol) astIODeclaration.getSymbolOpt().get());
}
compilationUnitSymbol.setIoDeclarations(ioDeclarations);
......@@ -145,7 +145,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
public void endVisit(final ASTArchitecture node) {
//ArchitectureSymbol architecture = (ArchitectureSymbol) node.getSymbol().get();
architecture.setBody((ArchitectureElementSymbol) node.getBody().getSymbol().get());
architecture.setBody((ArchitectureElementSymbol) node.getBody().getSymbolOpt().get());
removeCurrentScope();
}
......@@ -165,8 +165,8 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
public void endVisit(ASTArchitectureParameter node) {
VariableSymbol variable = new VariableSymbol(node.getName());
variable.setType(VariableType.ARCHITECTURE_PARAMETER);
if (node.getDefault().isPresent()){
variable.setDefaultExpression((ArchSimpleExpressionSymbol) node.getDefault().get().getSymbol().get());
if (node.isPresentDefault()){
variable.setDefaultExpression((ArchSimpleExpressionSymbol) node.getDefault().getSymbolOpt().get());
}
addToScopeAndLinkWithNode(variable, node);
......@@ -180,12 +180,12 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTIODeclaration ast) {
IODeclarationSymbol iODeclaration = (IODeclarationSymbol) ast.getSymbol().get();
if (ast.getArrayDeclaration().isPresent()){
iODeclaration.setArrayLength(ast.getArrayDeclaration().get().getIntLiteral().getNumber().get().getDividend().intValue());
IODeclarationSymbol iODeclaration = (IODeclarationSymbol) ast.getSymbolOpt().get();
if (ast.isPresentArrayDeclaration()){
iODeclaration.setArrayLength(ast.getArrayDeclaration().getIntLiteral().getNumber().get().intValue());
}
iODeclaration.setInput(ast.getIn().isPresent());
iODeclaration.setType((ArchTypeSymbol) ast.getType().getSymbol().get());
iODeclaration.setInput(ast.isPresentIn());
iODeclaration.setType((ArchTypeSymbol) ast.getType().getSymbolOpt().get());
}
@Override
......@@ -196,8 +196,8 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArchType node) {
ArchTypeSymbol sym = (ArchTypeSymbol) node.getSymbol().get();
List<ASTArchSimpleExpression> astDimensions = node.getShape().getDimensions();
ArchTypeSymbol sym = (ArchTypeSymbol) node.getSymbolOpt().get();
List<ASTArchSimpleExpression> astDimensions = node.getShape().getDimensionsList();
if (astDimensions.size() >= 1){
sym.setChannelIndex(0);
......@@ -210,7 +210,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
}
List<ArchSimpleExpressionSymbol> dimensionList = new ArrayList<>(3);
for (ASTArchSimpleExpression astExp : astDimensions){
dimensionList.add((ArchSimpleExpressionSymbol) astExp.getSymbol().get());
dimensionList.add((ArchSimpleExpressionSymbol) astExp.getSymbolOpt().get());
}
sym.setDimensionSymbols(dimensionList);
sym.setDomain(node.getElementType());
......@@ -225,11 +225,11 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTLayerDeclaration ast) {
LayerDeclarationSymbol layerDeclaration = (LayerDeclarationSymbol) ast.getSymbol().get();
layerDeclaration.setBody((CompositeElementSymbol) ast.getBody().getSymbol().get());
layerDeclaration.setBody((CompositeElementSymbol) ast.getBody().getSymbolOpt().get());
List<VariableSymbol> parameters = new ArrayList<>(4);
for (ASTLayerParameter astParam : ast.getParameters()){
VariableSymbol parameter = (VariableSymbol) astParam.getSymbol().get();
for (ASTLayerParameter astParam : ast.getParametersList()){
VariableSymbol parameter = (VariableSymbol) astParam.getSymbolOpt().get();
parameters.add(parameter);
}
layerDeclaration.setParameters(parameters);
......@@ -246,9 +246,9 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTLayerParameter ast) {
VariableSymbol variable = (VariableSymbol) ast.getSymbol().get();
if (ast.getDefault().isPresent()){
variable.setDefaultExpression((ArchSimpleExpressionSymbol) ast.getDefault().get().getSymbol().get());
VariableSymbol variable = (VariableSymbol) ast.getSymbolOpt().get();
if (ast.isPresentDefault()){
variable.setDefaultExpression((ArchSimpleExpressionSymbol) ast.getDefault().getSymbolOpt().get());
}
}
......@@ -256,17 +256,20 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
public void endVisit(ASTArchSimpleExpression ast) {
ArchSimpleExpressionSymbol sym = new ArchSimpleExpressionSymbol();
MathExpressionSymbol mathExp = null;
if (ast.getArithmeticExpression().isPresent()) {
mathExp = (MathExpressionSymbol) ast.getArithmeticExpression().get().getSymbol().get();
if (ast.isPresentArithmeticExpression()) {
ASTExpression arithmeticExpression = ast.getArithmeticExpression();
if (arithmeticExpression.isPresentSymbol()) {
mathExp = (MathExpressionSymbol) arithmeticExpression.getSymbol().get();
}
}
else if (ast.getBooleanExpression().isPresent()) {
mathExp = (MathExpressionSymbol) ast.getBooleanExpression().get().getSymbol().get();
else if (ast.isPresentBooleanExpression()) {
mathExp = (MathExpressionSymbol) ast.getBooleanExpression().getSymbolOpt().get();
}
else if (ast.getTupleExpression().isPresent()){
mathExp = (MathExpressionSymbol) ast.getTupleExpression().get().getSymbol().get();
else if (ast.isPresentTupleExpression()){
mathExp = (MathExpressionSymbol) ast.getTupleExpression().getSymbolOpt().get();
}
else{
sym.setValue(ast.getString().get().getValue());
sym.setValue(ast.getString().getValue());
}
sym.setMathExpression(mathExp);
addToScopeAndLinkWithNode(sym, ast);
......@@ -274,11 +277,11 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArchExpression node) {
if (node.getExpression().isPresent()){
addToScopeAndLinkWithNode(node.getExpression().get().getSymbol().get(), node);
if (node.isPresentExpression()){
addToScopeAndLinkWithNode(node.getExpression().getSymbolOpt().get(), node);
}
else {
addToScopeAndLinkWithNode(node.getSequence().get().getSymbol().get(), node);
addToScopeAndLinkWithNode(node.getSequence().getSymbolOpt().get(), node);
}
}
......@@ -290,10 +293,10 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArchValueRange node) {
ArchRangeExpressionSymbol sym = (ArchRangeExpressionSymbol) node.getSymbol().get();
sym.setParallel(node.getParallel().isPresent());
sym.setStartSymbol((ArchSimpleExpressionSymbol) node.getStart().getSymbol().get());
sym.setEndSymbol((ArchSimpleExpressionSymbol) node.getEnd().getSymbol().get());
ArchRangeExpressionSymbol sym = (ArchRangeExpressionSymbol) node.getSymbolOpt().get();
sym.setParallel(node.isPresentParallel());
sym.setStartSymbol((ArchSimpleExpressionSymbol) node.getStart().getSymbolOpt().get());
sym.setEndSymbol((ArchSimpleExpressionSymbol) node.getEnd().getSymbolOpt().get());
}
@Override
......@@ -304,13 +307,13 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArchParallelSequence node) {
ArchSequenceExpressionSymbol sym = (ArchSequenceExpressionSymbol) node.getSymbol().get();
ArchSequenceExpressionSymbol sym = (ArchSequenceExpressionSymbol) node.getSymbolOpt().get();
List<List<ArchSimpleExpressionSymbol>> elements = new ArrayList<>();
for (ASTArchSerialSequence serialSequenceAST : node.getParallelValues()) {
for (ASTArchSerialSequence serialSequenceAST : node.getParallelValuesList()) {
List<ArchSimpleExpressionSymbol> serialElements = new ArrayList<>();
for (ASTArchSimpleExpression astExpression : serialSequenceAST.getSerialValues()) {
serialElements.add((ArchSimpleExpressionSymbol) astExpression.getSymbol().get());
for (ASTArchSimpleExpression astExpression : serialSequenceAST.getSerialValuesList()) {
serialElements.add((ArchSimpleExpressionSymbol) astExpression.getSymbolOpt().get());
}
elements.add(serialElements);
}
......@@ -326,11 +329,11 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTParallelBlock node) {
CompositeElementSymbol compositeElement = (CompositeElementSymbol) node.getSymbol().get();
CompositeElementSymbol compositeElement = (CompositeElementSymbol) node.getSymbolOpt().get();
List<ArchitectureElementSymbol> elements = new ArrayList<>();
for (ASTArchBody astBody : node.getGroups()){
elements.add((CompositeElementSymbol) astBody.getSymbol().get());
for (ASTArchBody astBody : node.getGroupsList()){
elements.add((CompositeElementSymbol) astBody.getSymbolOpt().get());
}
compositeElement.setElements(elements);
......@@ -346,11 +349,11 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArchBody ast) {
CompositeElementSymbol compositeElement = (CompositeElementSymbol) ast.getSymbol().get();
CompositeElementSymbol compositeElement = (CompositeElementSymbol) ast.getSymbolOpt().get();
List<ArchitectureElementSymbol> elements = new ArrayList<>();
for (ASTArchitectureElement astElement : ast.getElements()){
elements.add((ArchitectureElementSymbol) astElement.getSymbol().get());
for (ASTArchitectureElement astElement : ast.getElementsList()){
elements.add((ArchitectureElementSymbol) astElement.getSymbolOpt().get());
}
compositeElement.setElements(elements);
......@@ -365,11 +368,11 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTLayer ast) {
LayerSymbol layer = (LayerSymbol) ast.getSymbol().get();
LayerSymbol layer = (LayerSymbol) ast.getSymbolOpt().get();
List<ArgumentSymbol> arguments = new ArrayList<>(6);
for (ASTArchArgument astArgument : ast.getArguments()){
Optional<ArgumentSymbol> optArgument = astArgument.getSymbol().map(e -> (ArgumentSymbol)e);
for (ASTArchArgument astArgument : ast.getArgumentsList()){
Optional<ArgumentSymbol> optArgument = astArgument.getSymbolOpt().map(e -> (ArgumentSymbol)e);
optArgument.ifPresent(arguments::add);
}
layer.setArguments(arguments);
......@@ -380,7 +383,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArchArgument node) {
ArchExpressionSymbol value;
value = (ArchExpressionSymbol) node.getRhs().getSymbol().get();
value = (ArchExpressionSymbol) node.getRhs().getSymbolOpt().get();
ArgumentSymbol argument = new ArgumentSymbol(node.getName());
argument.setRhs(value);
......@@ -394,9 +397,9 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTIOElement node) {
IOSymbol sym = (IOSymbol) node.getSymbol().get();
if (node.getIndex().isPresent()){
sym.setArrayAccess((ArchSimpleExpressionSymbol) node.getIndex().get().getSymbol().get());
IOSymbol sym = (IOSymbol) node.getSymbolOpt().get();
if (node.isPresentIndex()){
sym.setArrayAccess((ArchSimpleExpressionSymbol) node.getIndex().getSymbolOpt().get());
}
removeCurrentScope();
}
......@@ -409,10 +412,10 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public void endVisit(ASTArrayAccessLayer node) {
LayerSymbol layer = (LayerSymbol) node.getSymbol().get();
LayerSymbol layer = (LayerSymbol) node.getSymbolOpt().get();
ArgumentSymbol indexArgument = new ArgumentSymbol.Builder()
.parameter(layer.getDeclaration().getParameter(AllPredefinedLayers.INDEX_NAME).get())
.value((ArchSimpleExpressionSymbol) node.getIndex().getSymbol().get())
.value((ArchSimpleExpressionSymbol) node.getIndex().getSymbolOpt().get())
.build();
indexArgument.setAstNode(node.getIndex());
addToScope(indexArgument);
......@@ -425,8 +428,10 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
public void endVisit(ASTTupleExpression node) {
TupleExpressionSymbol symbol = new TupleExpressionSymbol();
for (ASTMathExpression expression : node.getExpressions()){
symbol.add((MathExpressionSymbol)expression.getSymbol().get());
for (ASTExpression expression : node.getExpressionsList()){
if (expression.isPresentSymbol()) {
symbol.add((MathExpressionSymbol) expression.getSymbolOpt().get());
}
}
addToScopeAndLinkWithNode(symbol, node);
......
......@@ -228,8 +228,8 @@ public class IOSymbol extends ArchitectureElementSymbol {
if (!Utils.equals(inputType, getDefinition().getType().getDomain())) {
Log.error("0" + ErrorCodes.INVALID_ELEMENT_INPUT_DOMAIN + " " +
"The declared output type of '" + name + "' does not match with the actual type. " +
"Declared type: " + getDefinition().getType().getDomain().getTElementType().get() + ". " +
"Actual type: " + inputType.getTElementType().get() + ".");
"Declared type: " + getDefinition().getType().getDomain().getName() + ". " +
"Actual type: " + inputType.getName() + ".");
}
}
......