correction bug Op

This commit is contained in:
trochas
2025-04-01 18:17:52 +02:00
parent 3f9072c7bd
commit bef2073599
4 changed files with 11 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
// Generated from /home/tuanvu/Desktop/M1/S8/PDS/tp2-vsl-pds/src/main/antlr/VSLLexer.g by ANTLR 4.13.1
// Generated from c:/Users/Thibaut/Documents/Git/PDS/tp2-vsl-pds/src/main/antlr/VSLLexer.g by ANTLR 4.13.1
package TP2;

View File

@@ -1,4 +1,4 @@
// Generated from /home/tuanvu/Desktop/M1/S8/PDS/tp2-vsl-pds/src/main/antlr/VSLParser.g by ANTLR 4.13.1
// Generated from c:/Users/Thibaut/Documents/Git/PDS/tp2-vsl-pds/src/main/antlr/VSLParser.g by ANTLR 4.13.1
package TP2;
import TP2.asd.Program.*;
@@ -383,8 +383,8 @@ public class VSLParser extends Parser {
((ExpressionContext)_localctx).out = new BinopExpression(
switch(((ExpressionContext)_localctx).op.getType()) {
case PLUS -> PLUS;
case MINUS -> MINUS;
case PLUS -> Op.PLUS;
case MINUS -> Op.MINUS;
default -> throw new IllegalArgumentException("Unknown operator");
},
((ExpressionContext)_localctx).left.out,
@@ -476,8 +476,8 @@ public class VSLParser extends Parser {
((Td_expressionContext)_localctx).out = new Program.BinopExpression(
switch(((Td_expressionContext)_localctx).op.getType()) {
case TIMES -> TIMES;
case DIV -> DIV;
case TIMES -> Op.TIMES;
case DIV -> Op.DIV;
default -> throw new IllegalArgumentException("Unknown operator");
},
((Td_expressionContext)_localctx).left.out,

View File

@@ -67,8 +67,8 @@ expression [SymTable table] returns [Type return_Type, Expression out]:
(op=(PLUS | MINUS) right=td_expression[table] {
$out = new BinopExpression(
switch($op.getType()) {
case PLUS -> PLUS;
case MINUS -> MINUS;
case PLUS -> Op.PLUS;
case MINUS -> Op.MINUS;
default -> throw new IllegalArgumentException("Unknown operator");
},
$left.out,
@@ -86,8 +86,8 @@ td_expression [SymTable table] returns [Type return_Type, Expression out]:
(op=(TIMES | DIV) right=lit {
$out = new Program.BinopExpression(
switch($op.getType()) {
case TIMES -> TIMES;
case DIV -> DIV;
case TIMES -> Op.TIMES;
case DIV -> Op.DIV;
default -> throw new IllegalArgumentException("Unknown operator");
},
$left.out,

View File

@@ -29,7 +29,7 @@ public interface Interface{
public String prettyprinter();
}
public enum Op {PLUS, MINUS, TIMES,DIV}
public enum Op {PLUS, MINUS, TIMES, DIV}
//Eval
public interface ExprEval extends ExprVisitor<Map<String, Integer>, Integer> {