summaryrefslogtreecommitdiff
path: root/src/Main.java
diff options
context:
space:
mode:
authorgeno <gabriele.genovese2@studio.unibo.it>2024-06-27 13:08:54 +0200
committergeno <gabriele.genovese2@studio.unibo.it>2024-06-27 13:08:54 +0200
commit673117132daa9c4fdd103189b5cd9a32a3731f5a (patch)
tree5ff72841ca65e07a2c8ee70525bb8dabbc93c7d6 /src/Main.java
parent8101f3f591f025c808084093d3f84b0eca0e67e5 (diff)
remove duplicates
Diffstat (limited to 'src/Main.java')
-rw-r--r--src/Main.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Main.java b/src/Main.java
index 24f4c4e..04f7183 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -1,3 +1,4 @@
+
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
@@ -11,6 +12,7 @@ import ast.*;
import ast.nodes.*;
import parser.*;
import semanticanalysis.*;
+import semanticanalysis.Share;
public class Main {
@@ -53,7 +55,8 @@ public class Main {
Python3VisitorImpl visitor = new Python3VisitorImpl();
SymbolTable ST = new SymbolTable();
Node ast = visitor.visit(tree);
- ArrayList<SemanticError> errors = ast.checkSemantics(ST, 0);
+ ArrayList<SemanticError> errorsWithDup = ast.checkSemantics(ST, 0);
+ ArrayList<SemanticError> errors = Share.removeDuplicates(errorsWithDup);
if (errors.size() > 0) {
System.out.println("You had " + errors.size() + " errors:");
for (SemanticError e : errors) {