From c48a3671fb62760646ee912c3b2c3b20fad8a31a Mon Sep 17 00:00:00 2001 From: i22011 <89882946+notbad3500@users.noreply.github.com> Date: Wed, 8 May 2024 11:42:34 +0200 Subject: [PATCH] Structure --- src/main/java/Example.java | 3 +++ src/main/java/{parser => }/Main.java | 7 ++++--- src/main/java/parser/Test.txt | 1 - src/main/test/java/SimpleJavaFeatureTest.java | 5 +++++ 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 src/main/java/Example.java rename src/main/java/{parser => }/Main.java (89%) delete mode 100644 src/main/java/parser/Test.txt diff --git a/src/main/java/Example.java b/src/main/java/Example.java new file mode 100644 index 0000000..6f34d6e --- /dev/null +++ b/src/main/java/Example.java @@ -0,0 +1,3 @@ +public class Example { +} + diff --git a/src/main/java/parser/Main.java b/src/main/java/Main.java similarity index 89% rename from src/main/java/parser/Main.java rename to src/main/java/Main.java index b6a3855..ab4a4fe 100644 --- a/src/main/java/parser/Main.java +++ b/src/main/java/Main.java @@ -1,10 +1,11 @@ -package parser; - import bytecode.ByteCodeGenerator; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTree; +import parser.ASTBuilder; +import parser.ClassDeclarationNode; +import parser.ProgramNode; import parser.generated.SimpleJavaLexer; import parser.generated.SimpleJavaParser; @@ -15,7 +16,7 @@ public class Main { public static void main(String[] args) throws Exception { CharStream codeCharStream = null; try { - codeCharStream = CharStreams.fromPath(Paths.get("path/to/your/file.txt")); + codeCharStream = CharStreams.fromPath(Paths.get("src/main/java/Example.java")); parsefile(codeCharStream); } catch (IOException e) { System.err.println("Error reading the file: " + e.getMessage()); diff --git a/src/main/java/parser/Test.txt b/src/main/java/parser/Test.txt deleted file mode 100644 index 5a0c977..0000000 --- a/src/main/java/parser/Test.txt +++ /dev/null @@ -1 +0,0 @@ -class Test { } \ No newline at end of file diff --git a/src/main/test/java/SimpleJavaFeatureTest.java b/src/main/test/java/SimpleJavaFeatureTest.java index 4854fb7..b71f63b 100644 --- a/src/main/test/java/SimpleJavaFeatureTest.java +++ b/src/main/test/java/SimpleJavaFeatureTest.java @@ -9,6 +9,11 @@ public class SimpleJavaFeatureTest { this.b = b; this.c = c; } + private class InnerClass { + void innerMethod() { + System.out.println("Inner class method"); + } + } // Methode zur Demonstration von Kontrollstrukturen void controlStructures() {