From b2e86ca63169369cb7ec9fc9986483dd31c019df Mon Sep 17 00:00:00 2001 From: Bruder John Date: Wed, 8 May 2024 15:04:57 +0200 Subject: [PATCH] moved Eample to resources --- classFileOutput/Test.class | Bin 0 -> 79 bytes src/main/java/Main.java | 2 +- src/main/java/semantic/SemanticAnalyzer.java | 3 ++- src/main/{java => resources}/Example.txt | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 classFileOutput/Test.class rename src/main/{java => resources}/Example.txt (73%) diff --git a/classFileOutput/Test.class b/classFileOutput/Test.class new file mode 100644 index 0000000000000000000000000000000000000000..25dfaa7f52c62b3d76c6566f24637981ad684def GIT binary patch literal 79 zcmX^0Z`VEs1_l!bc18x4kksN5b_Pa927#=^vPAuy#JqHU|D>$cWS}TBBLkaFW?p8A d9U}v?hGrN8BLfoy3s5Tqkj2Qr%D@I<0s!^v4lw`# literal 0 HcmV?d00001 diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 165c82d..5a54215 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -17,7 +17,7 @@ public class Main { public static void main(String[] args) throws Exception { CharStream codeCharStream = null; try { - codeCharStream = CharStreams.fromPath(Paths.get("src/main/java/Example.txt")); + codeCharStream = CharStreams.fromPath(Paths.get("src/main/resources/Example.txt")); parsefile(codeCharStream); } catch (IOException e) { System.err.println("Error reading the file: " + e.getMessage()); diff --git a/src/main/java/semantic/SemanticAnalyzer.java b/src/main/java/semantic/SemanticAnalyzer.java index 5e405e5..315a51e 100644 --- a/src/main/java/semantic/SemanticAnalyzer.java +++ b/src/main/java/semantic/SemanticAnalyzer.java @@ -32,7 +32,8 @@ public class SemanticAnalyzer { FieldNode fieldNode = (FieldNode) node; if(identifierAlreadyUsed(fieldNode.identifier)){ - throw new RuntimeException("Error: Identifier already used"); + //throw new RuntimeException("Error: Identifier already used"); + System.out.println("Error: Identifier already used"); } usedIdentifier.add(fieldNode.identifier); diff --git a/src/main/java/Example.txt b/src/main/resources/Example.txt similarity index 73% rename from src/main/java/Example.txt rename to src/main/resources/Example.txt index 8c28495..4d17aa6 100644 --- a/src/main/java/Example.txt +++ b/src/main/resources/Example.txt @@ -1,6 +1,11 @@ class Example { int test; + +} + +class Test { + char test; }