fixed bugs
This commit is contained in:
parent
c4a35decba
commit
159413dd7d
@ -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>
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
class Example {
|
||||
public class Example {
|
||||
|
||||
int test;
|
||||
public int test;
|
||||
|
||||
}
|
||||
|
||||
class Test {
|
||||
public class Test {
|
||||
|
||||
char test;
|
||||
public char test;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user