Commit a6666c1e authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya

Added nonterminal for an expression with minus. Last test is passing

parent 89c02085
Pipeline #69086 passed with stages
in 19 minutes and 41 seconds
......@@ -30,7 +30,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnn-arch</artifactId>
<version>0.2.1-SNAPSHOT</version>
<version>0.2.3-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......
......@@ -126,8 +126,8 @@ grammar CNNArch extends de.monticore.CommonExpressions, de.monticore.lang.Math,
| NameExpression
| MathDottedNameExpression
| MathAssignmentDeclarationStatement
| MathAssignmentStatement
| MinusPrefixExpression);
| MathAssignmentStatement);
//| MinusPrefixExpression);
ArchComplexArithmeticExpression implements ArchArithmeticExpression = leftExpression:ArchMathExpression
NEWLINETOKEN*
......@@ -157,6 +157,8 @@ grammar CNNArch extends de.monticore.CommonExpressions, de.monticore.lang.Math,
ArchBracketExpression implements ArchMathExpression, ArchBooleanExpression, ArchArithmeticExpression = "(" ArchMathExpression ")";
ArchPreMinusExpression implements ArchMathExpression, ArchBooleanExpression, ArchArithmeticExpression = "-" ArchMathExpression ;
/* =================================*/
/* ============ ASTRULES ===========*/
......
......@@ -23,10 +23,7 @@ package de.monticore.lang.monticar.cnnarch._symboltable;
import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.math._symboltable.MathSymbolTableCreator;
import de.monticore.lang.math._symboltable.expression.MathArithmeticExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathBooleanExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.MathNameExpressionSymbol;
import de.monticore.lang.math._symboltable.expression.*;
import de.monticore.lang.monticar.cnnarch._ast.*;
import de.monticore.lang.monticar.cnnarch._visitor.CNNArchInheritanceVisitor;
import de.monticore.lang.monticar.cnnarch._visitor.CNNArchVisitor;
......@@ -447,8 +444,6 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
sym = (MathExpressionSymbol) node.getMathAssignmentDeclarationStatement().getSymbolOpt().get();
else if (node.isPresentMathAssignmentStatement())
sym = (MathExpressionSymbol) node.getMathAssignmentStatement().getSymbolOpt().get();
else if (node.isPresentMinusPrefixExpression())
sym = (MathExpressionSymbol) node.getMinusPrefixExpression().getExpression().getSymbolOpt().get();
addToScopeAndLinkWithNode(sym, node);
}
......@@ -499,4 +494,12 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
MathExpressionSymbol sym = (MathExpressionSymbol) node.getArchMathExpression().getSymbolOpt().get();
addToScopeAndLinkWithNode(sym, node);
}
@Override
public void endVisit(ASTArchPreMinusExpression node) {
MathPreOperatorExpressionSymbol symbol = new MathPreOperatorExpressionSymbol();
symbol.setMathExpressionSymbol((MathExpressionSymbol) node.getArchMathExpression().getSymbolOpt().get());
symbol.setOperator("-");
addToScopeAndLinkWithNode(symbol, node);
}
}
\ No newline at end of file
......@@ -24,7 +24,6 @@ import de.monticore.lang.monticar.cnnarch._cocos.*;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static de.monticore.lang.monticar.cnnarch.ParserTest.ENABLE_FAIL_QUICK;
......@@ -159,7 +158,6 @@ public class AllCoCoTest extends AbstractCoCoTest {
new ExpectedErrorInfo(1, ErrorCodes.ILLEGAL_ASSIGNMENT));
}
@Ignore
@Test
public void testArgumentConstraintTest2(){
checkInvalid(new CNNArchCoCoChecker(),
......
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