fixed bugs

This commit is contained in:
Bruder John 2024-05-08 23:44:17 +02:00
parent c4a35decba
commit 159413dd7d
5 changed files with 6 additions and 9 deletions

View File

@ -40,7 +40,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -21,7 +21,6 @@ public class Main {
CharStream codeCharStream = null;
try {
codeCharStream = CharStreams.fromPath(Paths.get("src/main/resources/Example.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());

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
public class MethodNode extends MemberNode{
public TypeNode visibility;
public Identifier identifier;
public AccessTypeNode visibility;
public TypeNode type;

View File

@ -19,9 +19,8 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
@Override
public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) {
ClassNode classNode = new ClassNode();
classNode.identifier = new Identifier(ctx.IDENTIFIER().getText());
ClassNode classNode = new ClassNode((AccessTypeNode) visit(ctx.accessType()),ctx.IDENTIFIER().getText());
classNode.identifier = new Identifier(ctx.IDENTIFIER().getText());
for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) {
classNode.addMember((MemberNode) visit(member));
}

View File

@ -1,12 +1,12 @@
class Example {
public class Example {
int test;
public int test;
}
class Test {
public class Test {
char test;
public char test;
}