moved Eample to resources

This commit is contained in:
Bruder John 2024-05-08 15:04:57 +02:00
parent c0b30f9620
commit b2e86ca631
4 changed files with 8 additions and 2 deletions

BIN
classFileOutput/Test.class Normal file

Binary file not shown.

View File

@ -17,7 +17,7 @@ public class Main {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
CharStream codeCharStream = null; CharStream codeCharStream = null;
try { try {
codeCharStream = CharStreams.fromPath(Paths.get("src/main/java/Example.txt")); codeCharStream = CharStreams.fromPath(Paths.get("src/main/resources/Example.txt"));
parsefile(codeCharStream); parsefile(codeCharStream);
} catch (IOException e) { } catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage()); System.err.println("Error reading the file: " + e.getMessage());

View File

@ -32,7 +32,8 @@ public class SemanticAnalyzer {
FieldNode fieldNode = (FieldNode) node; FieldNode fieldNode = (FieldNode) node;
if(identifierAlreadyUsed(fieldNode.identifier)){ 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); usedIdentifier.add(fieldNode.identifier);

View File

@ -1,6 +1,11 @@
class Example { class Example {
int test; int test;
}
class Test {
char test; char test;
} }