From 8fbe7d08002d0a6f148f7e8c85fc47deaee53739 Mon Sep 17 00:00:00 2001 From: Purplumbi Date: Wed, 8 May 2024 14:41:08 +0200 Subject: [PATCH 1/6] TypeNodeEnum and AccessTypeNode --- src/main/java/Main.java | 4 +- src/main/java/ast/AccessTypeNode.java | 9 + src/main/java/ast/EnumAccessTypeNode.java | 5 + src/main/java/ast/EnumTypeNode.java | 5 + src/main/java/ast/TypeNode.java | 8 +- src/main/java/parser/ASTBuilder.java | 25 +- src/main/java/parser/SimpleJava.g4 | 7 +- .../java/parser/generated/SimpleJava.interp | 7 +- .../java/parser/generated/SimpleJava.tokens | 68 +- .../generated/SimpleJavaBaseListener.java | 12 + .../generated/SimpleJavaBaseVisitor.java | 13 +- .../parser/generated/SimpleJavaLexer.interp | 7 +- .../parser/generated/SimpleJavaLexer.java | 258 +++---- .../parser/generated/SimpleJavaLexer.tokens | 68 +- .../parser/generated/SimpleJavaListener.java | 10 + .../parser/generated/SimpleJavaParser.java | 704 ++++++++++-------- .../parser/generated/SimpleJavaVisitor.java | 6 + src/main/test/java/MainTest.java | 4 - 18 files changed, 688 insertions(+), 532 deletions(-) create mode 100644 src/main/java/ast/AccessTypeNode.java create mode 100644 src/main/java/ast/EnumAccessTypeNode.java create mode 100644 src/main/java/ast/EnumTypeNode.java diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 87d9828..65c9921 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -3,8 +3,6 @@ import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTree; import parser.ASTBuilder; -import parser.generated.SimpleJavaLexer; -import parser.generated.SimpleJavaParser; import ast.ClassNode; import ast.ProgramNode; import bytecode.ByteCodeGenerator; @@ -16,7 +14,7 @@ public class Main { public static void main(String[] args) throws Exception { CharStream codeCharStream = null; try { - codeCharStream = CharStreams.fromPath(Paths.get("./Example.java")); + 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/ast/AccessTypeNode.java b/src/main/java/ast/AccessTypeNode.java new file mode 100644 index 0000000..2ed2e55 --- /dev/null +++ b/src/main/java/ast/AccessTypeNode.java @@ -0,0 +1,9 @@ +package ast; + +public class AccessTypeNode extends ASTNode { + public EnumAccessTypeNode enumAccessTypeNode; + + public AccessTypeNode(EnumAccessTypeNode enumAccessTypeNode) { + this.enumAccessTypeNode = enumAccessTypeNode; + } +} diff --git a/src/main/java/ast/EnumAccessTypeNode.java b/src/main/java/ast/EnumAccessTypeNode.java new file mode 100644 index 0000000..2e6ffba --- /dev/null +++ b/src/main/java/ast/EnumAccessTypeNode.java @@ -0,0 +1,5 @@ +package ast; + +public enum EnumAccessTypeNode { + PUBLIC, PRIVATE +} diff --git a/src/main/java/ast/EnumTypeNode.java b/src/main/java/ast/EnumTypeNode.java new file mode 100644 index 0000000..b80cd57 --- /dev/null +++ b/src/main/java/ast/EnumTypeNode.java @@ -0,0 +1,5 @@ +package ast; + +public enum EnumTypeNode { + INT, BOOLEAN, CHAR +} diff --git a/src/main/java/ast/TypeNode.java b/src/main/java/ast/TypeNode.java index 51a3dc7..fd921b6 100644 --- a/src/main/java/ast/TypeNode.java +++ b/src/main/java/ast/TypeNode.java @@ -1,9 +1,9 @@ package ast; public class TypeNode extends ASTNode { - public String typeName; + public EnumTypeNode enumTypeNode; - public TypeNode(String typeName) { - this.typeName = typeName; + public TypeNode(EnumTypeNode enumTypeNode) { + this.enumTypeNode = enumTypeNode; } -} +} \ No newline at end of file diff --git a/src/main/java/parser/ASTBuilder.java b/src/main/java/parser/ASTBuilder.java index 6519cc1..2e5ef72 100644 --- a/src/main/java/parser/ASTBuilder.java +++ b/src/main/java/parser/ASTBuilder.java @@ -52,7 +52,30 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { @Override public ASTNode visitType(SimpleJavaParser.TypeContext ctx) { - return new TypeNode(ctx.getText()); + String typeStr = ctx.getText(); // Get the text of the type from the context + switch (typeStr) { + case "int": + return new TypeNode(EnumTypeNode.INT); + case "boolean": + return new TypeNode(EnumTypeNode.BOOLEAN); + case "char": + return new TypeNode(EnumTypeNode.CHAR); + default: + throw new IllegalArgumentException("Unsupported type: " + typeStr); + } + } + + @Override + public ASTNode visitAccessType(SimpleJavaParser.TypeContext ctx) { + String typeStr = ctx.getText(); + switch (typeStr) { + case "public": + return new AccessTypeNode(EnumAccessTypeNode.PUBLIC); + case "private": + return new AccessTypeNode(EnumAccessTypeNode.PRIVATE); + default: + throw new IllegalArgumentException("Unsupported type: " + typeStr); + } } @Override diff --git a/src/main/java/parser/SimpleJava.g4 b/src/main/java/parser/SimpleJava.g4 index 122da44..1990892 100644 --- a/src/main/java/parser/SimpleJava.g4 +++ b/src/main/java/parser/SimpleJava.g4 @@ -2,18 +2,19 @@ grammar SimpleJava; program : classDeclaration+; -classDeclaration : 'class' IDENTIFIER '{' memberDeclaration* '}'; +classDeclaration : accessType 'class' IDENTIFIER '{' memberDeclaration* '}'; memberDeclaration : fieldDeclaration | methodDeclaration; -fieldDeclaration : type IDENTIFIER ';'; +fieldDeclaration : accessType type IDENTIFIER ';'; -methodDeclaration : 'public' 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ; +methodDeclaration : accessType 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ; parameterList : parameter (',' parameter)* ; parameter : type IDENTIFIER ; type : 'int' | 'boolean' | 'char' ; +accessType : 'public' | 'private' ; statement : variableDeclarationStatement diff --git a/src/main/java/parser/generated/SimpleJava.interp b/src/main/java/parser/generated/SimpleJava.interp index 2e4f97b..bfbefcd 100644 --- a/src/main/java/parser/generated/SimpleJava.interp +++ b/src/main/java/parser/generated/SimpleJava.interp @@ -4,7 +4,6 @@ null '{' '}' ';' -'public' 'static' '(' ')' @@ -12,6 +11,8 @@ null 'int' 'boolean' 'char' +'public' +'private' '=' 'if' 'else' @@ -74,6 +75,7 @@ null null null null +null INTEGERLITERAL IDENTIFIER WS @@ -87,6 +89,7 @@ methodDeclaration parameterList parameter type +accessType statement variableDeclarationStatement assignmentStatement @@ -101,4 +104,4 @@ charLiteral atn: -[4, 1, 37, 183, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 1, 0, 4, 0, 40, 8, 0, 11, 0, 12, 0, 41, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 48, 8, 1, 10, 1, 12, 1, 51, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 2, 57, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 69, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 74, 8, 4, 10, 4, 12, 4, 77, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 5, 5, 84, 8, 5, 10, 5, 12, 5, 87, 9, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 100, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 106, 8, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 122, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 3, 13, 132, 8, 13, 1, 13, 1, 13, 1, 14, 1, 14, 5, 14, 138, 8, 14, 10, 14, 12, 14, 141, 9, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 156, 8, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 5, 15, 167, 8, 15, 10, 15, 12, 15, 170, 9, 15, 1, 16, 1, 16, 1, 16, 3, 16, 175, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 0, 1, 30, 19, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 0, 5, 1, 0, 10, 12, 1, 0, 18, 19, 1, 0, 20, 25, 1, 0, 26, 30, 1, 0, 32, 33, 187, 0, 39, 1, 0, 0, 0, 2, 43, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 58, 1, 0, 0, 0, 8, 62, 1, 0, 0, 0, 10, 80, 1, 0, 0, 0, 12, 88, 1, 0, 0, 0, 14, 91, 1, 0, 0, 0, 16, 99, 1, 0, 0, 0, 18, 101, 1, 0, 0, 0, 20, 109, 1, 0, 0, 0, 22, 114, 1, 0, 0, 0, 24, 123, 1, 0, 0, 0, 26, 129, 1, 0, 0, 0, 28, 135, 1, 0, 0, 0, 30, 155, 1, 0, 0, 0, 32, 174, 1, 0, 0, 0, 34, 176, 1, 0, 0, 0, 36, 178, 1, 0, 0, 0, 38, 40, 3, 2, 1, 0, 39, 38, 1, 0, 0, 0, 40, 41, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 1, 1, 0, 0, 0, 43, 44, 5, 1, 0, 0, 44, 45, 5, 36, 0, 0, 45, 49, 5, 2, 0, 0, 46, 48, 3, 4, 2, 0, 47, 46, 1, 0, 0, 0, 48, 51, 1, 0, 0, 0, 49, 47, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 52, 1, 0, 0, 0, 51, 49, 1, 0, 0, 0, 52, 53, 5, 3, 0, 0, 53, 3, 1, 0, 0, 0, 54, 57, 3, 6, 3, 0, 55, 57, 3, 8, 4, 0, 56, 54, 1, 0, 0, 0, 56, 55, 1, 0, 0, 0, 57, 5, 1, 0, 0, 0, 58, 59, 3, 14, 7, 0, 59, 60, 5, 36, 0, 0, 60, 61, 5, 4, 0, 0, 61, 7, 1, 0, 0, 0, 62, 63, 5, 5, 0, 0, 63, 64, 5, 6, 0, 0, 64, 65, 3, 14, 7, 0, 65, 66, 5, 36, 0, 0, 66, 68, 5, 7, 0, 0, 67, 69, 3, 10, 5, 0, 68, 67, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 71, 5, 8, 0, 0, 71, 75, 5, 2, 0, 0, 72, 74, 3, 16, 8, 0, 73, 72, 1, 0, 0, 0, 74, 77, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 78, 1, 0, 0, 0, 77, 75, 1, 0, 0, 0, 78, 79, 5, 3, 0, 0, 79, 9, 1, 0, 0, 0, 80, 85, 3, 12, 6, 0, 81, 82, 5, 9, 0, 0, 82, 84, 3, 12, 6, 0, 83, 81, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 11, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 88, 89, 3, 14, 7, 0, 89, 90, 5, 36, 0, 0, 90, 13, 1, 0, 0, 0, 91, 92, 7, 0, 0, 0, 92, 15, 1, 0, 0, 0, 93, 100, 3, 18, 9, 0, 94, 100, 3, 20, 10, 0, 95, 100, 3, 22, 11, 0, 96, 100, 3, 24, 12, 0, 97, 100, 3, 26, 13, 0, 98, 100, 3, 28, 14, 0, 99, 93, 1, 0, 0, 0, 99, 94, 1, 0, 0, 0, 99, 95, 1, 0, 0, 0, 99, 96, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 99, 98, 1, 0, 0, 0, 100, 17, 1, 0, 0, 0, 101, 102, 3, 14, 7, 0, 102, 105, 5, 36, 0, 0, 103, 104, 5, 13, 0, 0, 104, 106, 3, 30, 15, 0, 105, 103, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 108, 5, 4, 0, 0, 108, 19, 1, 0, 0, 0, 109, 110, 5, 36, 0, 0, 110, 111, 5, 13, 0, 0, 111, 112, 3, 30, 15, 0, 112, 113, 5, 4, 0, 0, 113, 21, 1, 0, 0, 0, 114, 115, 5, 14, 0, 0, 115, 116, 5, 7, 0, 0, 116, 117, 3, 30, 15, 0, 117, 118, 5, 8, 0, 0, 118, 121, 3, 16, 8, 0, 119, 120, 5, 15, 0, 0, 120, 122, 3, 16, 8, 0, 121, 119, 1, 0, 0, 0, 121, 122, 1, 0, 0, 0, 122, 23, 1, 0, 0, 0, 123, 124, 5, 16, 0, 0, 124, 125, 5, 7, 0, 0, 125, 126, 3, 30, 15, 0, 126, 127, 5, 8, 0, 0, 127, 128, 3, 16, 8, 0, 128, 25, 1, 0, 0, 0, 129, 131, 5, 17, 0, 0, 130, 132, 3, 30, 15, 0, 131, 130, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 5, 4, 0, 0, 134, 27, 1, 0, 0, 0, 135, 139, 5, 2, 0, 0, 136, 138, 3, 16, 8, 0, 137, 136, 1, 0, 0, 0, 138, 141, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 139, 140, 1, 0, 0, 0, 140, 142, 1, 0, 0, 0, 141, 139, 1, 0, 0, 0, 142, 143, 5, 3, 0, 0, 143, 29, 1, 0, 0, 0, 144, 145, 6, 15, -1, 0, 145, 146, 5, 27, 0, 0, 146, 156, 3, 30, 15, 5, 147, 148, 5, 31, 0, 0, 148, 156, 3, 30, 15, 4, 149, 150, 5, 7, 0, 0, 150, 151, 3, 30, 15, 0, 151, 152, 5, 8, 0, 0, 152, 156, 1, 0, 0, 0, 153, 156, 3, 32, 16, 0, 154, 156, 5, 36, 0, 0, 155, 144, 1, 0, 0, 0, 155, 147, 1, 0, 0, 0, 155, 149, 1, 0, 0, 0, 155, 153, 1, 0, 0, 0, 155, 154, 1, 0, 0, 0, 156, 168, 1, 0, 0, 0, 157, 158, 10, 8, 0, 0, 158, 159, 7, 1, 0, 0, 159, 167, 3, 30, 15, 9, 160, 161, 10, 7, 0, 0, 161, 162, 7, 2, 0, 0, 162, 167, 3, 30, 15, 8, 163, 164, 10, 6, 0, 0, 164, 165, 7, 3, 0, 0, 165, 167, 3, 30, 15, 7, 166, 157, 1, 0, 0, 0, 166, 160, 1, 0, 0, 0, 166, 163, 1, 0, 0, 0, 167, 170, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 31, 1, 0, 0, 0, 170, 168, 1, 0, 0, 0, 171, 175, 5, 35, 0, 0, 172, 175, 3, 34, 17, 0, 173, 175, 3, 36, 18, 0, 174, 171, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 173, 1, 0, 0, 0, 175, 33, 1, 0, 0, 0, 176, 177, 7, 4, 0, 0, 177, 35, 1, 0, 0, 0, 178, 179, 5, 34, 0, 0, 179, 180, 9, 0, 0, 0, 180, 181, 5, 34, 0, 0, 181, 37, 1, 0, 0, 0, 15, 41, 49, 56, 68, 75, 85, 99, 105, 121, 131, 139, 155, 166, 168, 174] \ No newline at end of file +[4, 1, 38, 189, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 1, 0, 4, 0, 42, 8, 0, 11, 0, 12, 0, 43, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 51, 8, 1, 10, 1, 12, 1, 54, 9, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 2, 60, 8, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 73, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 78, 8, 4, 10, 4, 12, 4, 81, 9, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 5, 5, 88, 8, 5, 10, 5, 12, 5, 91, 9, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 106, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 112, 8, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 128, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 3, 14, 138, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 5, 15, 144, 8, 15, 10, 15, 12, 15, 147, 9, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 162, 8, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 173, 8, 16, 10, 16, 12, 16, 176, 9, 16, 1, 17, 1, 17, 1, 17, 3, 17, 181, 8, 17, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 0, 1, 32, 20, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 0, 6, 1, 0, 9, 11, 1, 0, 12, 13, 1, 0, 19, 20, 1, 0, 21, 26, 1, 0, 27, 31, 1, 0, 33, 34, 192, 0, 41, 1, 0, 0, 0, 2, 45, 1, 0, 0, 0, 4, 59, 1, 0, 0, 0, 6, 61, 1, 0, 0, 0, 8, 66, 1, 0, 0, 0, 10, 84, 1, 0, 0, 0, 12, 92, 1, 0, 0, 0, 14, 95, 1, 0, 0, 0, 16, 97, 1, 0, 0, 0, 18, 105, 1, 0, 0, 0, 20, 107, 1, 0, 0, 0, 22, 115, 1, 0, 0, 0, 24, 120, 1, 0, 0, 0, 26, 129, 1, 0, 0, 0, 28, 135, 1, 0, 0, 0, 30, 141, 1, 0, 0, 0, 32, 161, 1, 0, 0, 0, 34, 180, 1, 0, 0, 0, 36, 182, 1, 0, 0, 0, 38, 184, 1, 0, 0, 0, 40, 42, 3, 2, 1, 0, 41, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 1, 1, 0, 0, 0, 45, 46, 3, 16, 8, 0, 46, 47, 5, 1, 0, 0, 47, 48, 5, 37, 0, 0, 48, 52, 5, 2, 0, 0, 49, 51, 3, 4, 2, 0, 50, 49, 1, 0, 0, 0, 51, 54, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 55, 1, 0, 0, 0, 54, 52, 1, 0, 0, 0, 55, 56, 5, 3, 0, 0, 56, 3, 1, 0, 0, 0, 57, 60, 3, 6, 3, 0, 58, 60, 3, 8, 4, 0, 59, 57, 1, 0, 0, 0, 59, 58, 1, 0, 0, 0, 60, 5, 1, 0, 0, 0, 61, 62, 3, 16, 8, 0, 62, 63, 3, 14, 7, 0, 63, 64, 5, 37, 0, 0, 64, 65, 5, 4, 0, 0, 65, 7, 1, 0, 0, 0, 66, 67, 3, 16, 8, 0, 67, 68, 5, 5, 0, 0, 68, 69, 3, 14, 7, 0, 69, 70, 5, 37, 0, 0, 70, 72, 5, 6, 0, 0, 71, 73, 3, 10, 5, 0, 72, 71, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 75, 5, 7, 0, 0, 75, 79, 5, 2, 0, 0, 76, 78, 3, 18, 9, 0, 77, 76, 1, 0, 0, 0, 78, 81, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 82, 1, 0, 0, 0, 81, 79, 1, 0, 0, 0, 82, 83, 5, 3, 0, 0, 83, 9, 1, 0, 0, 0, 84, 89, 3, 12, 6, 0, 85, 86, 5, 8, 0, 0, 86, 88, 3, 12, 6, 0, 87, 85, 1, 0, 0, 0, 88, 91, 1, 0, 0, 0, 89, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 11, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 92, 93, 3, 14, 7, 0, 93, 94, 5, 37, 0, 0, 94, 13, 1, 0, 0, 0, 95, 96, 7, 0, 0, 0, 96, 15, 1, 0, 0, 0, 97, 98, 7, 1, 0, 0, 98, 17, 1, 0, 0, 0, 99, 106, 3, 20, 10, 0, 100, 106, 3, 22, 11, 0, 101, 106, 3, 24, 12, 0, 102, 106, 3, 26, 13, 0, 103, 106, 3, 28, 14, 0, 104, 106, 3, 30, 15, 0, 105, 99, 1, 0, 0, 0, 105, 100, 1, 0, 0, 0, 105, 101, 1, 0, 0, 0, 105, 102, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 105, 104, 1, 0, 0, 0, 106, 19, 1, 0, 0, 0, 107, 108, 3, 14, 7, 0, 108, 111, 5, 37, 0, 0, 109, 110, 5, 14, 0, 0, 110, 112, 3, 32, 16, 0, 111, 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 114, 5, 4, 0, 0, 114, 21, 1, 0, 0, 0, 115, 116, 5, 37, 0, 0, 116, 117, 5, 14, 0, 0, 117, 118, 3, 32, 16, 0, 118, 119, 5, 4, 0, 0, 119, 23, 1, 0, 0, 0, 120, 121, 5, 15, 0, 0, 121, 122, 5, 6, 0, 0, 122, 123, 3, 32, 16, 0, 123, 124, 5, 7, 0, 0, 124, 127, 3, 18, 9, 0, 125, 126, 5, 16, 0, 0, 126, 128, 3, 18, 9, 0, 127, 125, 1, 0, 0, 0, 127, 128, 1, 0, 0, 0, 128, 25, 1, 0, 0, 0, 129, 130, 5, 17, 0, 0, 130, 131, 5, 6, 0, 0, 131, 132, 3, 32, 16, 0, 132, 133, 5, 7, 0, 0, 133, 134, 3, 18, 9, 0, 134, 27, 1, 0, 0, 0, 135, 137, 5, 18, 0, 0, 136, 138, 3, 32, 16, 0, 137, 136, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 139, 1, 0, 0, 0, 139, 140, 5, 4, 0, 0, 140, 29, 1, 0, 0, 0, 141, 145, 5, 2, 0, 0, 142, 144, 3, 18, 9, 0, 143, 142, 1, 0, 0, 0, 144, 147, 1, 0, 0, 0, 145, 143, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 148, 1, 0, 0, 0, 147, 145, 1, 0, 0, 0, 148, 149, 5, 3, 0, 0, 149, 31, 1, 0, 0, 0, 150, 151, 6, 16, -1, 0, 151, 152, 5, 28, 0, 0, 152, 162, 3, 32, 16, 5, 153, 154, 5, 32, 0, 0, 154, 162, 3, 32, 16, 4, 155, 156, 5, 6, 0, 0, 156, 157, 3, 32, 16, 0, 157, 158, 5, 7, 0, 0, 158, 162, 1, 0, 0, 0, 159, 162, 3, 34, 17, 0, 160, 162, 5, 37, 0, 0, 161, 150, 1, 0, 0, 0, 161, 153, 1, 0, 0, 0, 161, 155, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 160, 1, 0, 0, 0, 162, 174, 1, 0, 0, 0, 163, 164, 10, 8, 0, 0, 164, 165, 7, 2, 0, 0, 165, 173, 3, 32, 16, 9, 166, 167, 10, 7, 0, 0, 167, 168, 7, 3, 0, 0, 168, 173, 3, 32, 16, 8, 169, 170, 10, 6, 0, 0, 170, 171, 7, 4, 0, 0, 171, 173, 3, 32, 16, 7, 172, 163, 1, 0, 0, 0, 172, 166, 1, 0, 0, 0, 172, 169, 1, 0, 0, 0, 173, 176, 1, 0, 0, 0, 174, 172, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 33, 1, 0, 0, 0, 176, 174, 1, 0, 0, 0, 177, 181, 5, 36, 0, 0, 178, 181, 3, 36, 18, 0, 179, 181, 3, 38, 19, 0, 180, 177, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 180, 179, 1, 0, 0, 0, 181, 35, 1, 0, 0, 0, 182, 183, 7, 5, 0, 0, 183, 37, 1, 0, 0, 0, 184, 185, 5, 35, 0, 0, 185, 186, 9, 0, 0, 0, 186, 187, 5, 35, 0, 0, 187, 39, 1, 0, 0, 0, 15, 43, 52, 59, 72, 79, 89, 105, 111, 127, 137, 145, 161, 172, 174, 180] \ No newline at end of file diff --git a/src/main/java/parser/generated/SimpleJava.tokens b/src/main/java/parser/generated/SimpleJava.tokens index d96b83f..fa21229 100644 --- a/src/main/java/parser/generated/SimpleJava.tokens +++ b/src/main/java/parser/generated/SimpleJava.tokens @@ -32,40 +32,42 @@ T__30=31 T__31=32 T__32=33 T__33=34 -INTEGERLITERAL=35 -IDENTIFIER=36 -WS=37 +T__34=35 +INTEGERLITERAL=36 +IDENTIFIER=37 +WS=38 'class'=1 '{'=2 '}'=3 ';'=4 -'public'=5 -'static'=6 -'('=7 -')'=8 -','=9 -'int'=10 -'boolean'=11 -'char'=12 -'='=13 -'if'=14 -'else'=15 -'while'=16 -'return'=17 -'&&'=18 -'||'=19 -'=='=20 -'!='=21 -'<'=22 -'<='=23 -'>'=24 -'>='=25 -'+'=26 -'-'=27 -'*'=28 -'/'=29 -'%'=30 -'!'=31 -'true'=32 -'false'=33 -'\''=34 +'static'=5 +'('=6 +')'=7 +','=8 +'int'=9 +'boolean'=10 +'char'=11 +'public'=12 +'private'=13 +'='=14 +'if'=15 +'else'=16 +'while'=17 +'return'=18 +'&&'=19 +'||'=20 +'=='=21 +'!='=22 +'<'=23 +'<='=24 +'>'=25 +'>='=26 +'+'=27 +'-'=28 +'*'=29 +'/'=30 +'%'=31 +'!'=32 +'true'=33 +'false'=34 +'\''=35 diff --git a/src/main/java/parser/generated/SimpleJavaBaseListener.java b/src/main/java/parser/generated/SimpleJavaBaseListener.java index 6458396..a7c55f8 100644 --- a/src/main/java/parser/generated/SimpleJavaBaseListener.java +++ b/src/main/java/parser/generated/SimpleJavaBaseListener.java @@ -108,6 +108,18 @@ public class SimpleJavaBaseListener implements SimpleJavaListener { *

The default implementation does nothing.

*/ @Override public void exitType(SimpleJavaParser.TypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAccessType(SimpleJavaParser.AccessTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAccessType(SimpleJavaParser.AccessTypeContext ctx) { } /** * {@inheritDoc} * diff --git a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java index bb44046..b7ea4bf 100644 --- a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java +++ b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java @@ -1,5 +1,6 @@ // Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 package parser.generated; +import ast.ASTNode; import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; /** @@ -11,7 +12,7 @@ import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; * operations with no return type. */ @SuppressWarnings("CheckReturnValue") -public class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implements SimpleJavaVisitor { +public abstract class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implements SimpleJavaVisitor { /** * {@inheritDoc} * @@ -68,6 +69,16 @@ public class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implem * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitType(SimpleJavaParser.TypeContext ctx) { return visitChildren(ctx); } + /** + * {@inheritDoc} + * + *

The default implementation returns the result of calling + * {@link #visitChildren} on {@code ctx}.

+ */ + @Override public T visitAccessType(SimpleJavaParser.AccessTypeContext ctx) { return visitChildren(ctx); } + + public abstract ASTNode visitAccessType(SimpleJavaParser.TypeContext ctx); + /** * {@inheritDoc} * diff --git a/src/main/java/parser/generated/SimpleJavaLexer.interp b/src/main/java/parser/generated/SimpleJavaLexer.interp index b0c00d2..e2f453d 100644 --- a/src/main/java/parser/generated/SimpleJavaLexer.interp +++ b/src/main/java/parser/generated/SimpleJavaLexer.interp @@ -4,7 +4,6 @@ null '{' '}' ';' -'public' 'static' '(' ')' @@ -12,6 +11,8 @@ null 'int' 'boolean' 'char' +'public' +'private' '=' 'if' 'else' @@ -74,6 +75,7 @@ null null null null +null INTEGERLITERAL IDENTIFIER WS @@ -113,6 +115,7 @@ T__30 T__31 T__32 T__33 +T__34 INTEGERLITERAL IDENTIFIER WS @@ -125,4 +128,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 37, 213, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 4, 34, 196, 8, 34, 11, 34, 12, 34, 197, 1, 35, 1, 35, 5, 35, 202, 8, 35, 10, 35, 12, 35, 205, 9, 35, 1, 36, 4, 36, 208, 8, 36, 11, 36, 12, 36, 209, 1, 36, 1, 36, 0, 0, 37, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 1, 0, 4, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 215, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 1, 75, 1, 0, 0, 0, 3, 81, 1, 0, 0, 0, 5, 83, 1, 0, 0, 0, 7, 85, 1, 0, 0, 0, 9, 87, 1, 0, 0, 0, 11, 94, 1, 0, 0, 0, 13, 101, 1, 0, 0, 0, 15, 103, 1, 0, 0, 0, 17, 105, 1, 0, 0, 0, 19, 107, 1, 0, 0, 0, 21, 111, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, 124, 1, 0, 0, 0, 27, 126, 1, 0, 0, 0, 29, 129, 1, 0, 0, 0, 31, 134, 1, 0, 0, 0, 33, 140, 1, 0, 0, 0, 35, 147, 1, 0, 0, 0, 37, 150, 1, 0, 0, 0, 39, 153, 1, 0, 0, 0, 41, 156, 1, 0, 0, 0, 43, 159, 1, 0, 0, 0, 45, 161, 1, 0, 0, 0, 47, 164, 1, 0, 0, 0, 49, 166, 1, 0, 0, 0, 51, 169, 1, 0, 0, 0, 53, 171, 1, 0, 0, 0, 55, 173, 1, 0, 0, 0, 57, 175, 1, 0, 0, 0, 59, 177, 1, 0, 0, 0, 61, 179, 1, 0, 0, 0, 63, 181, 1, 0, 0, 0, 65, 186, 1, 0, 0, 0, 67, 192, 1, 0, 0, 0, 69, 195, 1, 0, 0, 0, 71, 199, 1, 0, 0, 0, 73, 207, 1, 0, 0, 0, 75, 76, 5, 99, 0, 0, 76, 77, 5, 108, 0, 0, 77, 78, 5, 97, 0, 0, 78, 79, 5, 115, 0, 0, 79, 80, 5, 115, 0, 0, 80, 2, 1, 0, 0, 0, 81, 82, 5, 123, 0, 0, 82, 4, 1, 0, 0, 0, 83, 84, 5, 125, 0, 0, 84, 6, 1, 0, 0, 0, 85, 86, 5, 59, 0, 0, 86, 8, 1, 0, 0, 0, 87, 88, 5, 112, 0, 0, 88, 89, 5, 117, 0, 0, 89, 90, 5, 98, 0, 0, 90, 91, 5, 108, 0, 0, 91, 92, 5, 105, 0, 0, 92, 93, 5, 99, 0, 0, 93, 10, 1, 0, 0, 0, 94, 95, 5, 115, 0, 0, 95, 96, 5, 116, 0, 0, 96, 97, 5, 97, 0, 0, 97, 98, 5, 116, 0, 0, 98, 99, 5, 105, 0, 0, 99, 100, 5, 99, 0, 0, 100, 12, 1, 0, 0, 0, 101, 102, 5, 40, 0, 0, 102, 14, 1, 0, 0, 0, 103, 104, 5, 41, 0, 0, 104, 16, 1, 0, 0, 0, 105, 106, 5, 44, 0, 0, 106, 18, 1, 0, 0, 0, 107, 108, 5, 105, 0, 0, 108, 109, 5, 110, 0, 0, 109, 110, 5, 116, 0, 0, 110, 20, 1, 0, 0, 0, 111, 112, 5, 98, 0, 0, 112, 113, 5, 111, 0, 0, 113, 114, 5, 111, 0, 0, 114, 115, 5, 108, 0, 0, 115, 116, 5, 101, 0, 0, 116, 117, 5, 97, 0, 0, 117, 118, 5, 110, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 99, 0, 0, 120, 121, 5, 104, 0, 0, 121, 122, 5, 97, 0, 0, 122, 123, 5, 114, 0, 0, 123, 24, 1, 0, 0, 0, 124, 125, 5, 61, 0, 0, 125, 26, 1, 0, 0, 0, 126, 127, 5, 105, 0, 0, 127, 128, 5, 102, 0, 0, 128, 28, 1, 0, 0, 0, 129, 130, 5, 101, 0, 0, 130, 131, 5, 108, 0, 0, 131, 132, 5, 115, 0, 0, 132, 133, 5, 101, 0, 0, 133, 30, 1, 0, 0, 0, 134, 135, 5, 119, 0, 0, 135, 136, 5, 104, 0, 0, 136, 137, 5, 105, 0, 0, 137, 138, 5, 108, 0, 0, 138, 139, 5, 101, 0, 0, 139, 32, 1, 0, 0, 0, 140, 141, 5, 114, 0, 0, 141, 142, 5, 101, 0, 0, 142, 143, 5, 116, 0, 0, 143, 144, 5, 117, 0, 0, 144, 145, 5, 114, 0, 0, 145, 146, 5, 110, 0, 0, 146, 34, 1, 0, 0, 0, 147, 148, 5, 38, 0, 0, 148, 149, 5, 38, 0, 0, 149, 36, 1, 0, 0, 0, 150, 151, 5, 124, 0, 0, 151, 152, 5, 124, 0, 0, 152, 38, 1, 0, 0, 0, 153, 154, 5, 61, 0, 0, 154, 155, 5, 61, 0, 0, 155, 40, 1, 0, 0, 0, 156, 157, 5, 33, 0, 0, 157, 158, 5, 61, 0, 0, 158, 42, 1, 0, 0, 0, 159, 160, 5, 60, 0, 0, 160, 44, 1, 0, 0, 0, 161, 162, 5, 60, 0, 0, 162, 163, 5, 61, 0, 0, 163, 46, 1, 0, 0, 0, 164, 165, 5, 62, 0, 0, 165, 48, 1, 0, 0, 0, 166, 167, 5, 62, 0, 0, 167, 168, 5, 61, 0, 0, 168, 50, 1, 0, 0, 0, 169, 170, 5, 43, 0, 0, 170, 52, 1, 0, 0, 0, 171, 172, 5, 45, 0, 0, 172, 54, 1, 0, 0, 0, 173, 174, 5, 42, 0, 0, 174, 56, 1, 0, 0, 0, 175, 176, 5, 47, 0, 0, 176, 58, 1, 0, 0, 0, 177, 178, 5, 37, 0, 0, 178, 60, 1, 0, 0, 0, 179, 180, 5, 33, 0, 0, 180, 62, 1, 0, 0, 0, 181, 182, 5, 116, 0, 0, 182, 183, 5, 114, 0, 0, 183, 184, 5, 117, 0, 0, 184, 185, 5, 101, 0, 0, 185, 64, 1, 0, 0, 0, 186, 187, 5, 102, 0, 0, 187, 188, 5, 97, 0, 0, 188, 189, 5, 108, 0, 0, 189, 190, 5, 115, 0, 0, 190, 191, 5, 101, 0, 0, 191, 66, 1, 0, 0, 0, 192, 193, 5, 39, 0, 0, 193, 68, 1, 0, 0, 0, 194, 196, 7, 0, 0, 0, 195, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 70, 1, 0, 0, 0, 199, 203, 7, 1, 0, 0, 200, 202, 7, 2, 0, 0, 201, 200, 1, 0, 0, 0, 202, 205, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 72, 1, 0, 0, 0, 205, 203, 1, 0, 0, 0, 206, 208, 7, 3, 0, 0, 207, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 207, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 1, 0, 0, 0, 211, 212, 6, 36, 0, 0, 212, 74, 1, 0, 0, 0, 4, 0, 197, 203, 209, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 38, 223, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 4, 35, 206, 8, 35, 11, 35, 12, 35, 207, 1, 36, 1, 36, 5, 36, 212, 8, 36, 10, 36, 12, 36, 215, 9, 36, 1, 37, 4, 37, 218, 8, 37, 11, 37, 12, 37, 219, 1, 37, 1, 37, 0, 0, 38, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 1, 0, 4, 1, 0, 48, 57, 2, 0, 65, 90, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 225, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 1, 77, 1, 0, 0, 0, 3, 83, 1, 0, 0, 0, 5, 85, 1, 0, 0, 0, 7, 87, 1, 0, 0, 0, 9, 89, 1, 0, 0, 0, 11, 96, 1, 0, 0, 0, 13, 98, 1, 0, 0, 0, 15, 100, 1, 0, 0, 0, 17, 102, 1, 0, 0, 0, 19, 106, 1, 0, 0, 0, 21, 114, 1, 0, 0, 0, 23, 119, 1, 0, 0, 0, 25, 126, 1, 0, 0, 0, 27, 134, 1, 0, 0, 0, 29, 136, 1, 0, 0, 0, 31, 139, 1, 0, 0, 0, 33, 144, 1, 0, 0, 0, 35, 150, 1, 0, 0, 0, 37, 157, 1, 0, 0, 0, 39, 160, 1, 0, 0, 0, 41, 163, 1, 0, 0, 0, 43, 166, 1, 0, 0, 0, 45, 169, 1, 0, 0, 0, 47, 171, 1, 0, 0, 0, 49, 174, 1, 0, 0, 0, 51, 176, 1, 0, 0, 0, 53, 179, 1, 0, 0, 0, 55, 181, 1, 0, 0, 0, 57, 183, 1, 0, 0, 0, 59, 185, 1, 0, 0, 0, 61, 187, 1, 0, 0, 0, 63, 189, 1, 0, 0, 0, 65, 191, 1, 0, 0, 0, 67, 196, 1, 0, 0, 0, 69, 202, 1, 0, 0, 0, 71, 205, 1, 0, 0, 0, 73, 209, 1, 0, 0, 0, 75, 217, 1, 0, 0, 0, 77, 78, 5, 99, 0, 0, 78, 79, 5, 108, 0, 0, 79, 80, 5, 97, 0, 0, 80, 81, 5, 115, 0, 0, 81, 82, 5, 115, 0, 0, 82, 2, 1, 0, 0, 0, 83, 84, 5, 123, 0, 0, 84, 4, 1, 0, 0, 0, 85, 86, 5, 125, 0, 0, 86, 6, 1, 0, 0, 0, 87, 88, 5, 59, 0, 0, 88, 8, 1, 0, 0, 0, 89, 90, 5, 115, 0, 0, 90, 91, 5, 116, 0, 0, 91, 92, 5, 97, 0, 0, 92, 93, 5, 116, 0, 0, 93, 94, 5, 105, 0, 0, 94, 95, 5, 99, 0, 0, 95, 10, 1, 0, 0, 0, 96, 97, 5, 40, 0, 0, 97, 12, 1, 0, 0, 0, 98, 99, 5, 41, 0, 0, 99, 14, 1, 0, 0, 0, 100, 101, 5, 44, 0, 0, 101, 16, 1, 0, 0, 0, 102, 103, 5, 105, 0, 0, 103, 104, 5, 110, 0, 0, 104, 105, 5, 116, 0, 0, 105, 18, 1, 0, 0, 0, 106, 107, 5, 98, 0, 0, 107, 108, 5, 111, 0, 0, 108, 109, 5, 111, 0, 0, 109, 110, 5, 108, 0, 0, 110, 111, 5, 101, 0, 0, 111, 112, 5, 97, 0, 0, 112, 113, 5, 110, 0, 0, 113, 20, 1, 0, 0, 0, 114, 115, 5, 99, 0, 0, 115, 116, 5, 104, 0, 0, 116, 117, 5, 97, 0, 0, 117, 118, 5, 114, 0, 0, 118, 22, 1, 0, 0, 0, 119, 120, 5, 112, 0, 0, 120, 121, 5, 117, 0, 0, 121, 122, 5, 98, 0, 0, 122, 123, 5, 108, 0, 0, 123, 124, 5, 105, 0, 0, 124, 125, 5, 99, 0, 0, 125, 24, 1, 0, 0, 0, 126, 127, 5, 112, 0, 0, 127, 128, 5, 114, 0, 0, 128, 129, 5, 105, 0, 0, 129, 130, 5, 118, 0, 0, 130, 131, 5, 97, 0, 0, 131, 132, 5, 116, 0, 0, 132, 133, 5, 101, 0, 0, 133, 26, 1, 0, 0, 0, 134, 135, 5, 61, 0, 0, 135, 28, 1, 0, 0, 0, 136, 137, 5, 105, 0, 0, 137, 138, 5, 102, 0, 0, 138, 30, 1, 0, 0, 0, 139, 140, 5, 101, 0, 0, 140, 141, 5, 108, 0, 0, 141, 142, 5, 115, 0, 0, 142, 143, 5, 101, 0, 0, 143, 32, 1, 0, 0, 0, 144, 145, 5, 119, 0, 0, 145, 146, 5, 104, 0, 0, 146, 147, 5, 105, 0, 0, 147, 148, 5, 108, 0, 0, 148, 149, 5, 101, 0, 0, 149, 34, 1, 0, 0, 0, 150, 151, 5, 114, 0, 0, 151, 152, 5, 101, 0, 0, 152, 153, 5, 116, 0, 0, 153, 154, 5, 117, 0, 0, 154, 155, 5, 114, 0, 0, 155, 156, 5, 110, 0, 0, 156, 36, 1, 0, 0, 0, 157, 158, 5, 38, 0, 0, 158, 159, 5, 38, 0, 0, 159, 38, 1, 0, 0, 0, 160, 161, 5, 124, 0, 0, 161, 162, 5, 124, 0, 0, 162, 40, 1, 0, 0, 0, 163, 164, 5, 61, 0, 0, 164, 165, 5, 61, 0, 0, 165, 42, 1, 0, 0, 0, 166, 167, 5, 33, 0, 0, 167, 168, 5, 61, 0, 0, 168, 44, 1, 0, 0, 0, 169, 170, 5, 60, 0, 0, 170, 46, 1, 0, 0, 0, 171, 172, 5, 60, 0, 0, 172, 173, 5, 61, 0, 0, 173, 48, 1, 0, 0, 0, 174, 175, 5, 62, 0, 0, 175, 50, 1, 0, 0, 0, 176, 177, 5, 62, 0, 0, 177, 178, 5, 61, 0, 0, 178, 52, 1, 0, 0, 0, 179, 180, 5, 43, 0, 0, 180, 54, 1, 0, 0, 0, 181, 182, 5, 45, 0, 0, 182, 56, 1, 0, 0, 0, 183, 184, 5, 42, 0, 0, 184, 58, 1, 0, 0, 0, 185, 186, 5, 47, 0, 0, 186, 60, 1, 0, 0, 0, 187, 188, 5, 37, 0, 0, 188, 62, 1, 0, 0, 0, 189, 190, 5, 33, 0, 0, 190, 64, 1, 0, 0, 0, 191, 192, 5, 116, 0, 0, 192, 193, 5, 114, 0, 0, 193, 194, 5, 117, 0, 0, 194, 195, 5, 101, 0, 0, 195, 66, 1, 0, 0, 0, 196, 197, 5, 102, 0, 0, 197, 198, 5, 97, 0, 0, 198, 199, 5, 108, 0, 0, 199, 200, 5, 115, 0, 0, 200, 201, 5, 101, 0, 0, 201, 68, 1, 0, 0, 0, 202, 203, 5, 39, 0, 0, 203, 70, 1, 0, 0, 0, 204, 206, 7, 0, 0, 0, 205, 204, 1, 0, 0, 0, 206, 207, 1, 0, 0, 0, 207, 205, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 72, 1, 0, 0, 0, 209, 213, 7, 1, 0, 0, 210, 212, 7, 2, 0, 0, 211, 210, 1, 0, 0, 0, 212, 215, 1, 0, 0, 0, 213, 211, 1, 0, 0, 0, 213, 214, 1, 0, 0, 0, 214, 74, 1, 0, 0, 0, 215, 213, 1, 0, 0, 0, 216, 218, 7, 3, 0, 0, 217, 216, 1, 0, 0, 0, 218, 219, 1, 0, 0, 0, 219, 217, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 222, 6, 37, 0, 0, 222, 76, 1, 0, 0, 0, 4, 0, 207, 213, 219, 1, 6, 0, 0] \ No newline at end of file diff --git a/src/main/java/parser/generated/SimpleJavaLexer.java b/src/main/java/parser/generated/SimpleJavaLexer.java index 8ed896a..1caaafe 100644 --- a/src/main/java/parser/generated/SimpleJavaLexer.java +++ b/src/main/java/parser/generated/SimpleJavaLexer.java @@ -21,7 +21,8 @@ public class SimpleJavaLexer extends Lexer { T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, - T__31=32, T__32=33, T__33=34, INTEGERLITERAL=35, IDENTIFIER=36, WS=37; + T__31=32, T__32=33, T__33=34, T__34=35, INTEGERLITERAL=36, IDENTIFIER=37, + WS=38; public static String[] channelNames = { "DEFAULT_TOKEN_CHANNEL", "HIDDEN" }; @@ -36,18 +37,18 @@ public class SimpleJavaLexer extends Lexer { "T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16", "T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24", "T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32", - "T__33", "INTEGERLITERAL", "IDENTIFIER", "WS" + "T__33", "T__34", "INTEGERLITERAL", "IDENTIFIER", "WS" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { - null, "'class'", "'{'", "'}'", "';'", "'public'", "'static'", "'('", - "')'", "','", "'int'", "'boolean'", "'char'", "'='", "'if'", "'else'", - "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", "'<='", - "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", "'false'", - "'''" + null, "'class'", "'{'", "'}'", "';'", "'static'", "'('", "')'", "','", + "'int'", "'boolean'", "'char'", "'public'", "'private'", "'='", "'if'", + "'else'", "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", + "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", + "'false'", "'''" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); @@ -55,8 +56,8 @@ public class SimpleJavaLexer extends Lexer { return new String[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, "INTEGERLITERAL", - "IDENTIFIER", "WS" + null, null, null, null, null, null, null, null, null, null, null, null, + "INTEGERLITERAL", "IDENTIFIER", "WS" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -118,7 +119,7 @@ public class SimpleJavaLexer extends Lexer { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\u0004\u0000%\u00d5\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+ + "\u0004\u0000&\u00df\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+ "\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+ "\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+ "\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+ @@ -129,123 +130,128 @@ public class SimpleJavaLexer extends Lexer { "\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+ "\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+ "\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+ - "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0001\u0000\u0001\u0000"+ - "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001"+ - "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+ - "\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005"+ - "\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+ - "\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001"+ + "!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0001\u0000"+ + "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001"+ + "\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004"+ + "\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004"+ + "\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007"+ + "\u0001\b\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001"+ "\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+ - "\u000b\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e"+ - "\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f"+ - "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010"+ - "\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+ - "\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013"+ - "\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+ - "\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0018"+ - "\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a"+ - "\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d"+ - "\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f"+ - "\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001"+ - "\"\u0004\"\u00c4\b\"\u000b\"\f\"\u00c5\u0001#\u0001#\u0005#\u00ca\b#\n"+ - "#\f#\u00cd\t#\u0001$\u0004$\u00d0\b$\u000b$\f$\u00d1\u0001$\u0001$\u0000"+ - "\u0000%\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b"+ - "\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b"+ - "\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016"+ - "-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\""+ - "E#G$I%\u0001\u0000\u0004\u0001\u000009\u0002\u0000AZaz\u0004\u000009A"+ - "Z__az\u0003\u0000\t\n\r\r \u00d7\u0000\u0001\u0001\u0000\u0000\u0000"+ - "\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000"+ - "\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000"+ - "\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f"+ - "\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013"+ - "\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017"+ - "\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b"+ - "\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f"+ - "\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000"+ - "\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000"+ - "\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000"+ - "-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001"+ - "\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000"+ - "\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000"+ - ";\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001"+ - "\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000"+ - "\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000"+ - "I\u0001\u0000\u0000\u0000\u0001K\u0001\u0000\u0000\u0000\u0003Q\u0001"+ - "\u0000\u0000\u0000\u0005S\u0001\u0000\u0000\u0000\u0007U\u0001\u0000\u0000"+ - "\u0000\tW\u0001\u0000\u0000\u0000\u000b^\u0001\u0000\u0000\u0000\re\u0001"+ - "\u0000\u0000\u0000\u000fg\u0001\u0000\u0000\u0000\u0011i\u0001\u0000\u0000"+ - "\u0000\u0013k\u0001\u0000\u0000\u0000\u0015o\u0001\u0000\u0000\u0000\u0017"+ - "w\u0001\u0000\u0000\u0000\u0019|\u0001\u0000\u0000\u0000\u001b~\u0001"+ - "\u0000\u0000\u0000\u001d\u0081\u0001\u0000\u0000\u0000\u001f\u0086\u0001"+ - "\u0000\u0000\u0000!\u008c\u0001\u0000\u0000\u0000#\u0093\u0001\u0000\u0000"+ - "\u0000%\u0096\u0001\u0000\u0000\u0000\'\u0099\u0001\u0000\u0000\u0000"+ - ")\u009c\u0001\u0000\u0000\u0000+\u009f\u0001\u0000\u0000\u0000-\u00a1"+ - "\u0001\u0000\u0000\u0000/\u00a4\u0001\u0000\u0000\u00001\u00a6\u0001\u0000"+ - "\u0000\u00003\u00a9\u0001\u0000\u0000\u00005\u00ab\u0001\u0000\u0000\u0000"+ - "7\u00ad\u0001\u0000\u0000\u00009\u00af\u0001\u0000\u0000\u0000;\u00b1"+ - "\u0001\u0000\u0000\u0000=\u00b3\u0001\u0000\u0000\u0000?\u00b5\u0001\u0000"+ - "\u0000\u0000A\u00ba\u0001\u0000\u0000\u0000C\u00c0\u0001\u0000\u0000\u0000"+ - "E\u00c3\u0001\u0000\u0000\u0000G\u00c7\u0001\u0000\u0000\u0000I\u00cf"+ - "\u0001\u0000\u0000\u0000KL\u0005c\u0000\u0000LM\u0005l\u0000\u0000MN\u0005"+ - "a\u0000\u0000NO\u0005s\u0000\u0000OP\u0005s\u0000\u0000P\u0002\u0001\u0000"+ - "\u0000\u0000QR\u0005{\u0000\u0000R\u0004\u0001\u0000\u0000\u0000ST\u0005"+ - "}\u0000\u0000T\u0006\u0001\u0000\u0000\u0000UV\u0005;\u0000\u0000V\b\u0001"+ - "\u0000\u0000\u0000WX\u0005p\u0000\u0000XY\u0005u\u0000\u0000YZ\u0005b"+ - "\u0000\u0000Z[\u0005l\u0000\u0000[\\\u0005i\u0000\u0000\\]\u0005c\u0000"+ - "\u0000]\n\u0001\u0000\u0000\u0000^_\u0005s\u0000\u0000_`\u0005t\u0000"+ - "\u0000`a\u0005a\u0000\u0000ab\u0005t\u0000\u0000bc\u0005i\u0000\u0000"+ - "cd\u0005c\u0000\u0000d\f\u0001\u0000\u0000\u0000ef\u0005(\u0000\u0000"+ - "f\u000e\u0001\u0000\u0000\u0000gh\u0005)\u0000\u0000h\u0010\u0001\u0000"+ - "\u0000\u0000ij\u0005,\u0000\u0000j\u0012\u0001\u0000\u0000\u0000kl\u0005"+ - "i\u0000\u0000lm\u0005n\u0000\u0000mn\u0005t\u0000\u0000n\u0014\u0001\u0000"+ - "\u0000\u0000op\u0005b\u0000\u0000pq\u0005o\u0000\u0000qr\u0005o\u0000"+ - "\u0000rs\u0005l\u0000\u0000st\u0005e\u0000\u0000tu\u0005a\u0000\u0000"+ - "uv\u0005n\u0000\u0000v\u0016\u0001\u0000\u0000\u0000wx\u0005c\u0000\u0000"+ - "xy\u0005h\u0000\u0000yz\u0005a\u0000\u0000z{\u0005r\u0000\u0000{\u0018"+ - "\u0001\u0000\u0000\u0000|}\u0005=\u0000\u0000}\u001a\u0001\u0000\u0000"+ - "\u0000~\u007f\u0005i\u0000\u0000\u007f\u0080\u0005f\u0000\u0000\u0080"+ - "\u001c\u0001\u0000\u0000\u0000\u0081\u0082\u0005e\u0000\u0000\u0082\u0083"+ - "\u0005l\u0000\u0000\u0083\u0084\u0005s\u0000\u0000\u0084\u0085\u0005e"+ - "\u0000\u0000\u0085\u001e\u0001\u0000\u0000\u0000\u0086\u0087\u0005w\u0000"+ - "\u0000\u0087\u0088\u0005h\u0000\u0000\u0088\u0089\u0005i\u0000\u0000\u0089"+ - "\u008a\u0005l\u0000\u0000\u008a\u008b\u0005e\u0000\u0000\u008b \u0001"+ - "\u0000\u0000\u0000\u008c\u008d\u0005r\u0000\u0000\u008d\u008e\u0005e\u0000"+ - "\u0000\u008e\u008f\u0005t\u0000\u0000\u008f\u0090\u0005u\u0000\u0000\u0090"+ - "\u0091\u0005r\u0000\u0000\u0091\u0092\u0005n\u0000\u0000\u0092\"\u0001"+ - "\u0000\u0000\u0000\u0093\u0094\u0005&\u0000\u0000\u0094\u0095\u0005&\u0000"+ - "\u0000\u0095$\u0001\u0000\u0000\u0000\u0096\u0097\u0005|\u0000\u0000\u0097"+ - "\u0098\u0005|\u0000\u0000\u0098&\u0001\u0000\u0000\u0000\u0099\u009a\u0005"+ - "=\u0000\u0000\u009a\u009b\u0005=\u0000\u0000\u009b(\u0001\u0000\u0000"+ - "\u0000\u009c\u009d\u0005!\u0000\u0000\u009d\u009e\u0005=\u0000\u0000\u009e"+ - "*\u0001\u0000\u0000\u0000\u009f\u00a0\u0005<\u0000\u0000\u00a0,\u0001"+ - "\u0000\u0000\u0000\u00a1\u00a2\u0005<\u0000\u0000\u00a2\u00a3\u0005=\u0000"+ - "\u0000\u00a3.\u0001\u0000\u0000\u0000\u00a4\u00a5\u0005>\u0000\u0000\u00a5"+ - "0\u0001\u0000\u0000\u0000\u00a6\u00a7\u0005>\u0000\u0000\u00a7\u00a8\u0005"+ - "=\u0000\u0000\u00a82\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005+\u0000"+ - "\u0000\u00aa4\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005-\u0000\u0000\u00ac"+ - "6\u0001\u0000\u0000\u0000\u00ad\u00ae\u0005*\u0000\u0000\u00ae8\u0001"+ - "\u0000\u0000\u0000\u00af\u00b0\u0005/\u0000\u0000\u00b0:\u0001\u0000\u0000"+ - "\u0000\u00b1\u00b2\u0005%\u0000\u0000\u00b2<\u0001\u0000\u0000\u0000\u00b3"+ - "\u00b4\u0005!\u0000\u0000\u00b4>\u0001\u0000\u0000\u0000\u00b5\u00b6\u0005"+ - "t\u0000\u0000\u00b6\u00b7\u0005r\u0000\u0000\u00b7\u00b8\u0005u\u0000"+ - "\u0000\u00b8\u00b9\u0005e\u0000\u0000\u00b9@\u0001\u0000\u0000\u0000\u00ba"+ - "\u00bb\u0005f\u0000\u0000\u00bb\u00bc\u0005a\u0000\u0000\u00bc\u00bd\u0005"+ - "l\u0000\u0000\u00bd\u00be\u0005s\u0000\u0000\u00be\u00bf\u0005e\u0000"+ - "\u0000\u00bfB\u0001\u0000\u0000\u0000\u00c0\u00c1\u0005\'\u0000\u0000"+ - "\u00c1D\u0001\u0000\u0000\u0000\u00c2\u00c4\u0007\u0000\u0000\u0000\u00c3"+ - "\u00c2\u0001\u0000\u0000\u0000\u00c4\u00c5\u0001\u0000\u0000\u0000\u00c5"+ - "\u00c3\u0001\u0000\u0000\u0000\u00c5\u00c6\u0001\u0000\u0000\u0000\u00c6"+ - "F\u0001\u0000\u0000\u0000\u00c7\u00cb\u0007\u0001\u0000\u0000\u00c8\u00ca"+ - "\u0007\u0002\u0000\u0000\u00c9\u00c8\u0001\u0000\u0000\u0000\u00ca\u00cd"+ - "\u0001\u0000\u0000\u0000\u00cb\u00c9\u0001\u0000\u0000\u0000\u00cb\u00cc"+ - "\u0001\u0000\u0000\u0000\u00ccH\u0001\u0000\u0000\u0000\u00cd\u00cb\u0001"+ - "\u0000\u0000\u0000\u00ce\u00d0\u0007\u0003\u0000\u0000\u00cf\u00ce\u0001"+ - "\u0000\u0000\u0000\u00d0\u00d1\u0001\u0000\u0000\u0000\u00d1\u00cf\u0001"+ - "\u0000\u0000\u0000\u00d1\u00d2\u0001\u0000\u0000\u0000\u00d2\u00d3\u0001"+ - "\u0000\u0000\u0000\u00d3\u00d4\u0006$\u0000\u0000\u00d4J\u0001\u0000\u0000"+ - "\u0000\u0004\u0000\u00c5\u00cb\u00d1\u0001\u0006\u0000\u0000"; + "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+ + "\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f"+ + "\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001"+ + "\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001"+ + "\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001"+ + "\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+ + "\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001"+ + "\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001"+ + "\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001"+ + "\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001b\u0001"+ + "\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001"+ + "\u001e\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001"+ + "!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001\"\u0001\"\u0001#\u0004#\u00ce"+ + "\b#\u000b#\f#\u00cf\u0001$\u0001$\u0005$\u00d4\b$\n$\f$\u00d7\t$\u0001"+ + "%\u0004%\u00da\b%\u000b%\f%\u00db\u0001%\u0001%\u0000\u0000&\u0001\u0001"+ + "\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f"+ + "\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f"+ + "\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017/\u0018"+ + "1\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\"E#G$I%K&\u0001"+ + "\u0000\u0004\u0001\u000009\u0002\u0000AZaz\u0004\u000009AZ__az\u0003\u0000"+ + "\t\n\r\r \u00e1\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001"+ + "\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001"+ + "\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000"+ + "\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000"+ + "\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000"+ + "\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000"+ + "\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000"+ + "\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000"+ + "\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000\u0000\u0000\u0000"+ + "%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000)\u0001"+ + "\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000-\u0001\u0000\u0000"+ + "\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001\u0000\u0000\u0000\u0000"+ + "3\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000\u0000\u00007\u0001"+ + "\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000;\u0001\u0000\u0000"+ + "\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001\u0000\u0000\u0000\u0000"+ + "A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000\u0000\u0000E\u0001"+ + "\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000I\u0001\u0000\u0000"+ + "\u0000\u0000K\u0001\u0000\u0000\u0000\u0001M\u0001\u0000\u0000\u0000\u0003"+ + "S\u0001\u0000\u0000\u0000\u0005U\u0001\u0000\u0000\u0000\u0007W\u0001"+ + "\u0000\u0000\u0000\tY\u0001\u0000\u0000\u0000\u000b`\u0001\u0000\u0000"+ + "\u0000\rb\u0001\u0000\u0000\u0000\u000fd\u0001\u0000\u0000\u0000\u0011"+ + "f\u0001\u0000\u0000\u0000\u0013j\u0001\u0000\u0000\u0000\u0015r\u0001"+ + "\u0000\u0000\u0000\u0017w\u0001\u0000\u0000\u0000\u0019~\u0001\u0000\u0000"+ + "\u0000\u001b\u0086\u0001\u0000\u0000\u0000\u001d\u0088\u0001\u0000\u0000"+ + "\u0000\u001f\u008b\u0001\u0000\u0000\u0000!\u0090\u0001\u0000\u0000\u0000"+ + "#\u0096\u0001\u0000\u0000\u0000%\u009d\u0001\u0000\u0000\u0000\'\u00a0"+ + "\u0001\u0000\u0000\u0000)\u00a3\u0001\u0000\u0000\u0000+\u00a6\u0001\u0000"+ + "\u0000\u0000-\u00a9\u0001\u0000\u0000\u0000/\u00ab\u0001\u0000\u0000\u0000"+ + "1\u00ae\u0001\u0000\u0000\u00003\u00b0\u0001\u0000\u0000\u00005\u00b3"+ + "\u0001\u0000\u0000\u00007\u00b5\u0001\u0000\u0000\u00009\u00b7\u0001\u0000"+ + "\u0000\u0000;\u00b9\u0001\u0000\u0000\u0000=\u00bb\u0001\u0000\u0000\u0000"+ + "?\u00bd\u0001\u0000\u0000\u0000A\u00bf\u0001\u0000\u0000\u0000C\u00c4"+ + "\u0001\u0000\u0000\u0000E\u00ca\u0001\u0000\u0000\u0000G\u00cd\u0001\u0000"+ + "\u0000\u0000I\u00d1\u0001\u0000\u0000\u0000K\u00d9\u0001\u0000\u0000\u0000"+ + "MN\u0005c\u0000\u0000NO\u0005l\u0000\u0000OP\u0005a\u0000\u0000PQ\u0005"+ + "s\u0000\u0000QR\u0005s\u0000\u0000R\u0002\u0001\u0000\u0000\u0000ST\u0005"+ + "{\u0000\u0000T\u0004\u0001\u0000\u0000\u0000UV\u0005}\u0000\u0000V\u0006"+ + "\u0001\u0000\u0000\u0000WX\u0005;\u0000\u0000X\b\u0001\u0000\u0000\u0000"+ + "YZ\u0005s\u0000\u0000Z[\u0005t\u0000\u0000[\\\u0005a\u0000\u0000\\]\u0005"+ + "t\u0000\u0000]^\u0005i\u0000\u0000^_\u0005c\u0000\u0000_\n\u0001\u0000"+ + "\u0000\u0000`a\u0005(\u0000\u0000a\f\u0001\u0000\u0000\u0000bc\u0005)"+ + "\u0000\u0000c\u000e\u0001\u0000\u0000\u0000de\u0005,\u0000\u0000e\u0010"+ + "\u0001\u0000\u0000\u0000fg\u0005i\u0000\u0000gh\u0005n\u0000\u0000hi\u0005"+ + "t\u0000\u0000i\u0012\u0001\u0000\u0000\u0000jk\u0005b\u0000\u0000kl\u0005"+ + "o\u0000\u0000lm\u0005o\u0000\u0000mn\u0005l\u0000\u0000no\u0005e\u0000"+ + "\u0000op\u0005a\u0000\u0000pq\u0005n\u0000\u0000q\u0014\u0001\u0000\u0000"+ + "\u0000rs\u0005c\u0000\u0000st\u0005h\u0000\u0000tu\u0005a\u0000\u0000"+ + "uv\u0005r\u0000\u0000v\u0016\u0001\u0000\u0000\u0000wx\u0005p\u0000\u0000"+ + "xy\u0005u\u0000\u0000yz\u0005b\u0000\u0000z{\u0005l\u0000\u0000{|\u0005"+ + "i\u0000\u0000|}\u0005c\u0000\u0000}\u0018\u0001\u0000\u0000\u0000~\u007f"+ + "\u0005p\u0000\u0000\u007f\u0080\u0005r\u0000\u0000\u0080\u0081\u0005i"+ + "\u0000\u0000\u0081\u0082\u0005v\u0000\u0000\u0082\u0083\u0005a\u0000\u0000"+ + "\u0083\u0084\u0005t\u0000\u0000\u0084\u0085\u0005e\u0000\u0000\u0085\u001a"+ + "\u0001\u0000\u0000\u0000\u0086\u0087\u0005=\u0000\u0000\u0087\u001c\u0001"+ + "\u0000\u0000\u0000\u0088\u0089\u0005i\u0000\u0000\u0089\u008a\u0005f\u0000"+ + "\u0000\u008a\u001e\u0001\u0000\u0000\u0000\u008b\u008c\u0005e\u0000\u0000"+ + "\u008c\u008d\u0005l\u0000\u0000\u008d\u008e\u0005s\u0000\u0000\u008e\u008f"+ + "\u0005e\u0000\u0000\u008f \u0001\u0000\u0000\u0000\u0090\u0091\u0005w"+ + "\u0000\u0000\u0091\u0092\u0005h\u0000\u0000\u0092\u0093\u0005i\u0000\u0000"+ + "\u0093\u0094\u0005l\u0000\u0000\u0094\u0095\u0005e\u0000\u0000\u0095\""+ + "\u0001\u0000\u0000\u0000\u0096\u0097\u0005r\u0000\u0000\u0097\u0098\u0005"+ + "e\u0000\u0000\u0098\u0099\u0005t\u0000\u0000\u0099\u009a\u0005u\u0000"+ + "\u0000\u009a\u009b\u0005r\u0000\u0000\u009b\u009c\u0005n\u0000\u0000\u009c"+ + "$\u0001\u0000\u0000\u0000\u009d\u009e\u0005&\u0000\u0000\u009e\u009f\u0005"+ + "&\u0000\u0000\u009f&\u0001\u0000\u0000\u0000\u00a0\u00a1\u0005|\u0000"+ + "\u0000\u00a1\u00a2\u0005|\u0000\u0000\u00a2(\u0001\u0000\u0000\u0000\u00a3"+ + "\u00a4\u0005=\u0000\u0000\u00a4\u00a5\u0005=\u0000\u0000\u00a5*\u0001"+ + "\u0000\u0000\u0000\u00a6\u00a7\u0005!\u0000\u0000\u00a7\u00a8\u0005=\u0000"+ + "\u0000\u00a8,\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005<\u0000\u0000\u00aa"+ + ".\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005<\u0000\u0000\u00ac\u00ad\u0005"+ + "=\u0000\u0000\u00ad0\u0001\u0000\u0000\u0000\u00ae\u00af\u0005>\u0000"+ + "\u0000\u00af2\u0001\u0000\u0000\u0000\u00b0\u00b1\u0005>\u0000\u0000\u00b1"+ + "\u00b2\u0005=\u0000\u0000\u00b24\u0001\u0000\u0000\u0000\u00b3\u00b4\u0005"+ + "+\u0000\u0000\u00b46\u0001\u0000\u0000\u0000\u00b5\u00b6\u0005-\u0000"+ + "\u0000\u00b68\u0001\u0000\u0000\u0000\u00b7\u00b8\u0005*\u0000\u0000\u00b8"+ + ":\u0001\u0000\u0000\u0000\u00b9\u00ba\u0005/\u0000\u0000\u00ba<\u0001"+ + "\u0000\u0000\u0000\u00bb\u00bc\u0005%\u0000\u0000\u00bc>\u0001\u0000\u0000"+ + "\u0000\u00bd\u00be\u0005!\u0000\u0000\u00be@\u0001\u0000\u0000\u0000\u00bf"+ + "\u00c0\u0005t\u0000\u0000\u00c0\u00c1\u0005r\u0000\u0000\u00c1\u00c2\u0005"+ + "u\u0000\u0000\u00c2\u00c3\u0005e\u0000\u0000\u00c3B\u0001\u0000\u0000"+ + "\u0000\u00c4\u00c5\u0005f\u0000\u0000\u00c5\u00c6\u0005a\u0000\u0000\u00c6"+ + "\u00c7\u0005l\u0000\u0000\u00c7\u00c8\u0005s\u0000\u0000\u00c8\u00c9\u0005"+ + "e\u0000\u0000\u00c9D\u0001\u0000\u0000\u0000\u00ca\u00cb\u0005\'\u0000"+ + "\u0000\u00cbF\u0001\u0000\u0000\u0000\u00cc\u00ce\u0007\u0000\u0000\u0000"+ + "\u00cd\u00cc\u0001\u0000\u0000\u0000\u00ce\u00cf\u0001\u0000\u0000\u0000"+ + "\u00cf\u00cd\u0001\u0000\u0000\u0000\u00cf\u00d0\u0001\u0000\u0000\u0000"+ + "\u00d0H\u0001\u0000\u0000\u0000\u00d1\u00d5\u0007\u0001\u0000\u0000\u00d2"+ + "\u00d4\u0007\u0002\u0000\u0000\u00d3\u00d2\u0001\u0000\u0000\u0000\u00d4"+ + "\u00d7\u0001\u0000\u0000\u0000\u00d5\u00d3\u0001\u0000\u0000\u0000\u00d5"+ + "\u00d6\u0001\u0000\u0000\u0000\u00d6J\u0001\u0000\u0000\u0000\u00d7\u00d5"+ + "\u0001\u0000\u0000\u0000\u00d8\u00da\u0007\u0003\u0000\u0000\u00d9\u00d8"+ + "\u0001\u0000\u0000\u0000\u00da\u00db\u0001\u0000\u0000\u0000\u00db\u00d9"+ + "\u0001\u0000\u0000\u0000\u00db\u00dc\u0001\u0000\u0000\u0000\u00dc\u00dd"+ + "\u0001\u0000\u0000\u0000\u00dd\u00de\u0006%\u0000\u0000\u00deL\u0001\u0000"+ + "\u0000\u0000\u0004\u0000\u00cf\u00d5\u00db\u0001\u0006\u0000\u0000"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/parser/generated/SimpleJavaLexer.tokens b/src/main/java/parser/generated/SimpleJavaLexer.tokens index d96b83f..fa21229 100644 --- a/src/main/java/parser/generated/SimpleJavaLexer.tokens +++ b/src/main/java/parser/generated/SimpleJavaLexer.tokens @@ -32,40 +32,42 @@ T__30=31 T__31=32 T__32=33 T__33=34 -INTEGERLITERAL=35 -IDENTIFIER=36 -WS=37 +T__34=35 +INTEGERLITERAL=36 +IDENTIFIER=37 +WS=38 'class'=1 '{'=2 '}'=3 ';'=4 -'public'=5 -'static'=6 -'('=7 -')'=8 -','=9 -'int'=10 -'boolean'=11 -'char'=12 -'='=13 -'if'=14 -'else'=15 -'while'=16 -'return'=17 -'&&'=18 -'||'=19 -'=='=20 -'!='=21 -'<'=22 -'<='=23 -'>'=24 -'>='=25 -'+'=26 -'-'=27 -'*'=28 -'/'=29 -'%'=30 -'!'=31 -'true'=32 -'false'=33 -'\''=34 +'static'=5 +'('=6 +')'=7 +','=8 +'int'=9 +'boolean'=10 +'char'=11 +'public'=12 +'private'=13 +'='=14 +'if'=15 +'else'=16 +'while'=17 +'return'=18 +'&&'=19 +'||'=20 +'=='=21 +'!='=22 +'<'=23 +'<='=24 +'>'=25 +'>='=26 +'+'=27 +'-'=28 +'*'=29 +'/'=30 +'%'=31 +'!'=32 +'true'=33 +'false'=34 +'\''=35 diff --git a/src/main/java/parser/generated/SimpleJavaListener.java b/src/main/java/parser/generated/SimpleJavaListener.java index 00a350a..153e20e 100644 --- a/src/main/java/parser/generated/SimpleJavaListener.java +++ b/src/main/java/parser/generated/SimpleJavaListener.java @@ -87,6 +87,16 @@ public interface SimpleJavaListener extends ParseTreeListener { * @param ctx the parse tree */ void exitType(SimpleJavaParser.TypeContext ctx); + /** + * Enter a parse tree produced by {@link SimpleJavaParser#accessType}. + * @param ctx the parse tree + */ + void enterAccessType(SimpleJavaParser.AccessTypeContext ctx); + /** + * Exit a parse tree produced by {@link SimpleJavaParser#accessType}. + * @param ctx the parse tree + */ + void exitAccessType(SimpleJavaParser.AccessTypeContext ctx); /** * Enter a parse tree produced by {@link SimpleJavaParser#statement}. * @param ctx the parse tree diff --git a/src/main/java/parser/generated/SimpleJavaParser.java b/src/main/java/parser/generated/SimpleJavaParser.java index 79f3da8..ea84fe1 100644 --- a/src/main/java/parser/generated/SimpleJavaParser.java +++ b/src/main/java/parser/generated/SimpleJavaParser.java @@ -3,7 +3,6 @@ package parser.generated; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; import org.antlr.v4.runtime.tree.*; import java.util.List; @@ -19,19 +18,21 @@ public class SimpleJavaParser extends Parser { T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17, T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24, T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31, - T__31=32, T__32=33, T__33=34, INTEGERLITERAL=35, IDENTIFIER=36, WS=37; + T__31=32, T__32=33, T__33=34, T__34=35, INTEGERLITERAL=36, IDENTIFIER=37, + WS=38; public static final int RULE_program = 0, RULE_classDeclaration = 1, RULE_memberDeclaration = 2, RULE_fieldDeclaration = 3, RULE_methodDeclaration = 4, RULE_parameterList = 5, - RULE_parameter = 6, RULE_type = 7, RULE_statement = 8, RULE_variableDeclarationStatement = 9, - RULE_assignmentStatement = 10, RULE_ifStatement = 11, RULE_whileStatement = 12, - RULE_returnStatement = 13, RULE_block = 14, RULE_expression = 15, RULE_literal = 16, - RULE_booleanLiteral = 17, RULE_charLiteral = 18; + RULE_parameter = 6, RULE_type = 7, RULE_accessType = 8, RULE_statement = 9, + RULE_variableDeclarationStatement = 10, RULE_assignmentStatement = 11, + RULE_ifStatement = 12, RULE_whileStatement = 13, RULE_returnStatement = 14, + RULE_block = 15, RULE_expression = 16, RULE_literal = 17, RULE_booleanLiteral = 18, + RULE_charLiteral = 19; private static String[] makeRuleNames() { return new String[] { "program", "classDeclaration", "memberDeclaration", "fieldDeclaration", - "methodDeclaration", "parameterList", "parameter", "type", "statement", - "variableDeclarationStatement", "assignmentStatement", "ifStatement", + "methodDeclaration", "parameterList", "parameter", "type", "accessType", + "statement", "variableDeclarationStatement", "assignmentStatement", "ifStatement", "whileStatement", "returnStatement", "block", "expression", "literal", "booleanLiteral", "charLiteral" }; @@ -40,11 +41,11 @@ public class SimpleJavaParser extends Parser { private static String[] makeLiteralNames() { return new String[] { - null, "'class'", "'{'", "'}'", "';'", "'public'", "'static'", "'('", - "')'", "','", "'int'", "'boolean'", "'char'", "'='", "'if'", "'else'", - "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", "'<='", - "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", "'false'", - "'''" + null, "'class'", "'{'", "'}'", "';'", "'static'", "'('", "')'", "','", + "'int'", "'boolean'", "'char'", "'public'", "'private'", "'='", "'if'", + "'else'", "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", + "'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", + "'false'", "'''" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); @@ -52,8 +53,8 @@ public class SimpleJavaParser extends Parser { return new String[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, "INTEGERLITERAL", - "IDENTIFIER", "WS" + null, null, null, null, null, null, null, null, null, null, null, null, + "INTEGERLITERAL", "IDENTIFIER", "WS" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -141,20 +142,20 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(39); + setState(41); _errHandler.sync(this); _la = _input.LA(1); do { { { - setState(38); + setState(40); classDeclaration(); } } - setState(41); + setState(43); _errHandler.sync(this); _la = _input.LA(1); - } while ( _la==T__0 ); + } while ( _la==T__11 || _la==T__12 ); } } catch (RecognitionException re) { @@ -170,6 +171,9 @@ public class SimpleJavaParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class ClassDeclarationContext extends ParserRuleContext { + public AccessTypeContext accessType() { + return getRuleContext(AccessTypeContext.class,0); + } public TerminalNode IDENTIFIER() { return getToken(SimpleJavaParser.IDENTIFIER, 0); } public List memberDeclaration() { return getRuleContexts(MemberDeclarationContext.class); @@ -203,27 +207,29 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(43); - match(T__0); - setState(44); - match(IDENTIFIER); setState(45); + accessType(); + setState(46); + match(T__0); + setState(47); + match(IDENTIFIER); + setState(48); match(T__1); - setState(49); + setState(52); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 7200L) != 0)) { + while (_la==T__11 || _la==T__12) { { { - setState(46); + setState(49); memberDeclaration(); } } - setState(51); + setState(54); _errHandler.sync(this); _la = _input.LA(1); } - setState(52); + setState(55); match(T__2); } } @@ -269,27 +275,23 @@ public class SimpleJavaParser extends Parser { MemberDeclarationContext _localctx = new MemberDeclarationContext(_ctx, getState()); enterRule(_localctx, 4, RULE_memberDeclaration); try { - setState(56); + setState(59); _errHandler.sync(this); - switch (_input.LA(1)) { - case T__9: - case T__10: - case T__11: + switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) { + case 1: enterOuterAlt(_localctx, 1); { - setState(54); + setState(57); fieldDeclaration(); } break; - case T__4: + case 2: enterOuterAlt(_localctx, 2); { - setState(55); + setState(58); methodDeclaration(); } break; - default: - throw new NoViableAltException(this); } } catch (RecognitionException re) { @@ -305,6 +307,9 @@ public class SimpleJavaParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class FieldDeclarationContext extends ParserRuleContext { + public AccessTypeContext accessType() { + return getRuleContext(AccessTypeContext.class,0); + } public TypeContext type() { return getRuleContext(TypeContext.class,0); } @@ -334,11 +339,13 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(58); + setState(61); + accessType(); + setState(62); type(); - setState(59); + setState(63); match(IDENTIFIER); - setState(60); + setState(64); match(T__3); } } @@ -355,6 +362,9 @@ public class SimpleJavaParser extends Parser { @SuppressWarnings("CheckReturnValue") public static class MethodDeclarationContext extends ParserRuleContext { + public AccessTypeContext accessType() { + return getRuleContext(AccessTypeContext.class,0); + } public TypeContext type() { return getRuleContext(TypeContext.class,0); } @@ -394,45 +404,45 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(62); - match(T__4); - setState(63); - match(T__5); - setState(64); - type(); - setState(65); - match(IDENTIFIER); setState(66); - match(T__6); + accessType(); + setState(67); + match(T__4); setState(68); + type(); + setState(69); + match(IDENTIFIER); + setState(70); + match(T__5); + setState(72); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 7168L) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 3584L) != 0)) { { - setState(67); + setState(71); parameterList(); } } - setState(70); - match(T__7); - setState(71); - match(T__1); + setState(74); + match(T__6); setState(75); + match(T__1); + setState(79); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 68719696900L) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 137439383044L) != 0)) { { { - setState(72); + setState(76); statement(); } } - setState(77); + setState(81); _errHandler.sync(this); _la = _input.LA(1); } - setState(78); + setState(82); match(T__2); } } @@ -481,21 +491,21 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(80); + setState(84); parameter(); - setState(85); + setState(89); _errHandler.sync(this); _la = _input.LA(1); - while (_la==T__8) { + while (_la==T__7) { { { - setState(81); - match(T__8); - setState(82); + setState(85); + match(T__7); + setState(86); parameter(); } } - setState(87); + setState(91); _errHandler.sync(this); _la = _input.LA(1); } @@ -543,9 +553,9 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(88); + setState(92); type(); - setState(89); + setState(93); match(IDENTIFIER); } } @@ -588,9 +598,60 @@ public class SimpleJavaParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(91); + setState(95); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 7168L) != 0)) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 3584L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AccessTypeContext extends ParserRuleContext { + public AccessTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_accessType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).enterAccessType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof SimpleJavaListener ) ((SimpleJavaListener)listener).exitAccessType(this); + } + @Override + public T accept(ParseTreeVisitor visitor) { + if ( visitor instanceof SimpleJavaVisitor ) return ((SimpleJavaVisitor)visitor).visitAccessType(this); + else return visitor.visitChildren(this); + } + } + + public final AccessTypeContext accessType() throws RecognitionException { + AccessTypeContext _localctx = new AccessTypeContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_accessType); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(97); + _la = _input.LA(1); + if ( !(_la==T__11 || _la==T__12) ) { _errHandler.recoverInline(this); } else { @@ -652,52 +713,52 @@ public class SimpleJavaParser extends Parser { public final StatementContext statement() throws RecognitionException { StatementContext _localctx = new StatementContext(_ctx, getState()); - enterRule(_localctx, 16, RULE_statement); + enterRule(_localctx, 18, RULE_statement); try { - setState(99); + setState(105); _errHandler.sync(this); switch (_input.LA(1)) { + case T__8: case T__9: case T__10: - case T__11: enterOuterAlt(_localctx, 1); { - setState(93); + setState(99); variableDeclarationStatement(); } break; case IDENTIFIER: enterOuterAlt(_localctx, 2); { - setState(94); + setState(100); assignmentStatement(); } break; - case T__13: + case T__14: enterOuterAlt(_localctx, 3); { - setState(95); + setState(101); ifStatement(); } break; - case T__15: + case T__16: enterOuterAlt(_localctx, 4); { - setState(96); + setState(102); whileStatement(); } break; - case T__16: + case T__17: enterOuterAlt(_localctx, 5); { - setState(97); + setState(103); returnStatement(); } break; case T__1: enterOuterAlt(_localctx, 6); { - setState(98); + setState(104); block(); } break; @@ -746,28 +807,28 @@ public class SimpleJavaParser extends Parser { public final VariableDeclarationStatementContext variableDeclarationStatement() throws RecognitionException { VariableDeclarationStatementContext _localctx = new VariableDeclarationStatementContext(_ctx, getState()); - enterRule(_localctx, 18, RULE_variableDeclarationStatement); + enterRule(_localctx, 20, RULE_variableDeclarationStatement); int _la; try { enterOuterAlt(_localctx, 1); { - setState(101); + setState(107); type(); - setState(102); + setState(108); match(IDENTIFIER); - setState(105); + setState(111); _errHandler.sync(this); _la = _input.LA(1); - if (_la==T__12) { + if (_la==T__13) { { - setState(103); - match(T__12); - setState(104); + setState(109); + match(T__13); + setState(110); expression(0); } } - setState(107); + setState(113); match(T__3); } } @@ -809,17 +870,17 @@ public class SimpleJavaParser extends Parser { public final AssignmentStatementContext assignmentStatement() throws RecognitionException { AssignmentStatementContext _localctx = new AssignmentStatementContext(_ctx, getState()); - enterRule(_localctx, 20, RULE_assignmentStatement); + enterRule(_localctx, 22, RULE_assignmentStatement); try { enterOuterAlt(_localctx, 1); { - setState(109); + setState(115); match(IDENTIFIER); - setState(110); - match(T__12); - setState(111); + setState(116); + match(T__13); + setState(117); expression(0); - setState(112); + setState(118); match(T__3); } } @@ -866,28 +927,28 @@ public class SimpleJavaParser extends Parser { public final IfStatementContext ifStatement() throws RecognitionException { IfStatementContext _localctx = new IfStatementContext(_ctx, getState()); - enterRule(_localctx, 22, RULE_ifStatement); + enterRule(_localctx, 24, RULE_ifStatement); try { enterOuterAlt(_localctx, 1); { - setState(114); - match(T__13); - setState(115); - match(T__6); - setState(116); - expression(0); - setState(117); - match(T__7); - setState(118); - statement(); + setState(120); + match(T__14); setState(121); + match(T__5); + setState(122); + expression(0); + setState(123); + match(T__6); + setState(124); + statement(); + setState(127); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) { case 1: { - setState(119); - match(T__14); - setState(120); + setState(125); + match(T__15); + setState(126); statement(); } break; @@ -934,19 +995,19 @@ public class SimpleJavaParser extends Parser { public final WhileStatementContext whileStatement() throws RecognitionException { WhileStatementContext _localctx = new WhileStatementContext(_ctx, getState()); - enterRule(_localctx, 24, RULE_whileStatement); + enterRule(_localctx, 26, RULE_whileStatement); try { enterOuterAlt(_localctx, 1); { - setState(123); - match(T__15); - setState(124); - match(T__6); - setState(125); + setState(129); + match(T__16); + setState(130); + match(T__5); + setState(131); expression(0); - setState(126); - match(T__7); - setState(127); + setState(132); + match(T__6); + setState(133); statement(); } } @@ -987,24 +1048,24 @@ public class SimpleJavaParser extends Parser { public final ReturnStatementContext returnStatement() throws RecognitionException { ReturnStatementContext _localctx = new ReturnStatementContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_returnStatement); + enterRule(_localctx, 28, RULE_returnStatement); int _la; try { enterOuterAlt(_localctx, 1); { - setState(129); - match(T__16); - setState(131); + setState(135); + match(T__17); + setState(137); _errHandler.sync(this); _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 135425687680L) != 0)) { + if ((((_la) & ~0x3f) == 0 && ((1L << _la) & 270851375168L) != 0)) { { - setState(130); + setState(136); expression(0); } } - setState(133); + setState(139); match(T__3); } } @@ -1048,28 +1109,28 @@ public class SimpleJavaParser extends Parser { public final BlockContext block() throws RecognitionException { BlockContext _localctx = new BlockContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_block); + enterRule(_localctx, 30, RULE_block); int _la; try { enterOuterAlt(_localctx, 1); { - setState(135); + setState(141); match(T__1); - setState(139); + setState(145); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 68719696900L) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 137439383044L) != 0)) { { { - setState(136); + setState(142); statement(); } } - setState(141); + setState(147); _errHandler.sync(this); _la = _input.LA(1); } - setState(142); + setState(148); match(T__2); } } @@ -1124,54 +1185,54 @@ public class SimpleJavaParser extends Parser { int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; - int _startState = 30; - enterRecursionRule(_localctx, 30, RULE_expression, _p); + int _startState = 32; + enterRecursionRule(_localctx, 32, RULE_expression, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); { - setState(155); + setState(161); _errHandler.sync(this); switch (_input.LA(1)) { - case T__26: + case T__27: { - setState(145); - match(T__26); - setState(146); + setState(151); + match(T__27); + setState(152); expression(5); } break; - case T__30: + case T__31: { - setState(147); - match(T__30); - setState(148); + setState(153); + match(T__31); + setState(154); expression(4); } break; - case T__6: + case T__5: { - setState(149); - match(T__6); - setState(150); + setState(155); + match(T__5); + setState(156); expression(0); - setState(151); - match(T__7); + setState(157); + match(T__6); } break; - case T__31: case T__32: case T__33: + case T__34: case INTEGERLITERAL: { - setState(153); + setState(159); literal(); } break; case IDENTIFIER: { - setState(154); + setState(160); match(IDENTIFIER); } break; @@ -1179,7 +1240,7 @@ public class SimpleJavaParser extends Parser { throw new NoViableAltException(this); } _ctx.stop = _input.LT(-1); - setState(168); + setState(174); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,13,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { @@ -1187,58 +1248,18 @@ public class SimpleJavaParser extends Parser { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(166); + setState(172); _errHandler.sync(this); switch ( getInterpreter().adaptivePredict(_input,12,_ctx) ) { case 1: - { - _localctx = new ExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(157); - if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); - setState(158); - _la = _input.LA(1); - if ( !(_la==T__17 || _la==T__18) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(159); - expression(9); - } - break; - case 2: - { - _localctx = new ExpressionContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_expression); - setState(160); - if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); - setState(161); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 66060288L) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(162); - expression(8); - } - break; - case 3: { _localctx = new ExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(163); - if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); + if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); setState(164); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 2080374784L) != 0)) ) { + if ( !(_la==T__18 || _la==T__19) ) { _errHandler.recoverInline(this); } else { @@ -1247,13 +1268,53 @@ public class SimpleJavaParser extends Parser { consume(); } setState(165); + expression(9); + } + break; + case 2: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(166); + if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(167); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 132120576L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(168); + expression(8); + } + break; + case 3: + { + _localctx = new ExpressionContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(169); + if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); + setState(170); + _la = _input.LA(1); + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 4160749568L) != 0)) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(171); expression(7); } break; } } } - setState(170); + setState(176); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,13,_ctx); } @@ -1300,30 +1361,30 @@ public class SimpleJavaParser extends Parser { public final LiteralContext literal() throws RecognitionException { LiteralContext _localctx = new LiteralContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_literal); + enterRule(_localctx, 34, RULE_literal); try { - setState(174); + setState(180); _errHandler.sync(this); switch (_input.LA(1)) { case INTEGERLITERAL: enterOuterAlt(_localctx, 1); { - setState(171); + setState(177); match(INTEGERLITERAL); } break; - case T__31: case T__32: + case T__33: enterOuterAlt(_localctx, 2); { - setState(172); + setState(178); booleanLiteral(); } break; - case T__33: + case T__34: enterOuterAlt(_localctx, 3); { - setState(173); + setState(179); charLiteral(); } break; @@ -1365,14 +1426,14 @@ public class SimpleJavaParser extends Parser { public final BooleanLiteralContext booleanLiteral() throws RecognitionException { BooleanLiteralContext _localctx = new BooleanLiteralContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_booleanLiteral); + enterRule(_localctx, 36, RULE_booleanLiteral); int _la; try { enterOuterAlt(_localctx, 1); { - setState(176); + setState(182); _la = _input.LA(1); - if ( !(_la==T__31 || _la==T__32) ) { + if ( !(_la==T__32 || _la==T__33) ) { _errHandler.recoverInline(this); } else { @@ -1416,16 +1477,16 @@ public class SimpleJavaParser extends Parser { public final CharLiteralContext charLiteral() throws RecognitionException { CharLiteralContext _localctx = new CharLiteralContext(_ctx, getState()); - enterRule(_localctx, 36, RULE_charLiteral); + enterRule(_localctx, 38, RULE_charLiteral); try { enterOuterAlt(_localctx, 1); { - setState(178); - match(T__33); - setState(179); + setState(184); + match(T__34); + setState(185); matchWildcard(); - setState(180); - match(T__33); + setState(186); + match(T__34); } } catch (RecognitionException re) { @@ -1441,7 +1502,7 @@ public class SimpleJavaParser extends Parser { public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { switch (ruleIndex) { - case 15: + case 16: return expression_sempred((ExpressionContext)_localctx, predIndex); } return true; @@ -1459,115 +1520,118 @@ public class SimpleJavaParser extends Parser { } public static final String _serializedATN = - "\u0004\u0001%\u00b7\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0004\u0001&\u00bd\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0002"+ "\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b\u0002"+ "\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007\u000f"+ "\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007\u0012"+ - "\u0001\u0000\u0004\u0000(\b\u0000\u000b\u0000\f\u0000)\u0001\u0001\u0001"+ - "\u0001\u0001\u0001\u0001\u0001\u0005\u00010\b\u0001\n\u0001\f\u00013\t"+ - "\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0003\u00029\b"+ - "\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001"+ - "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0003\u0004E\b"+ - "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0005\u0004J\b\u0004\n\u0004"+ - "\f\u0004M\t\u0004\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001"+ - "\u0005\u0005\u0005T\b\u0005\n\u0005\f\u0005W\t\u0005\u0001\u0006\u0001"+ - "\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001"+ - "\b\u0001\b\u0001\b\u0003\bd\b\b\u0001\t\u0001\t\u0001\t\u0001\t\u0003"+ - "\tj\b\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ - "\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+ - "\u000b\u0003\u000bz\b\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001"+ - "\f\u0001\r\u0001\r\u0003\r\u0084\b\r\u0001\r\u0001\r\u0001\u000e\u0001"+ - "\u000e\u0005\u000e\u008a\b\u000e\n\u000e\f\u000e\u008d\t\u000e\u0001\u000e"+ - "\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ - "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ - "\u0003\u000f\u009c\b\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f"+ - "\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0005\u000f"+ - "\u00a7\b\u000f\n\u000f\f\u000f\u00aa\t\u000f\u0001\u0010\u0001\u0010\u0001"+ - "\u0010\u0003\u0010\u00af\b\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+ - "\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0000\u0001\u001e\u0013\u0000"+ + "\u0002\u0013\u0007\u0013\u0001\u0000\u0004\u0000*\b\u0000\u000b\u0000"+ + "\f\u0000+\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0005\u00013\b\u0001\n\u0001\f\u00016\t\u0001\u0001\u0001\u0001\u0001"+ + "\u0001\u0002\u0001\u0002\u0003\u0002<\b\u0002\u0001\u0003\u0001\u0003"+ + "\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004"+ + "\u0001\u0004\u0001\u0004\u0001\u0004\u0003\u0004I\b\u0004\u0001\u0004"+ + "\u0001\u0004\u0001\u0004\u0005\u0004N\b\u0004\n\u0004\f\u0004Q\t\u0004"+ + "\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0005\u0005"+ + "X\b\u0005\n\u0005\f\u0005[\t\u0005\u0001\u0006\u0001\u0006\u0001\u0006"+ + "\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001"+ + "\t\u0001\t\u0001\t\u0003\tj\b\t\u0001\n\u0001\n\u0001\n\u0001\n\u0003"+ + "\np\b\n\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+ + "\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0003"+ + "\f\u0080\b\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\u000e"+ + "\u0001\u000e\u0003\u000e\u008a\b\u000e\u0001\u000e\u0001\u000e\u0001\u000f"+ + "\u0001\u000f\u0005\u000f\u0090\b\u000f\n\u000f\f\u000f\u0093\t\u000f\u0001"+ + "\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001"+ + "\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001"+ + "\u0010\u0003\u0010\u00a2\b\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001"+ + "\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0005"+ + "\u0010\u00ad\b\u0010\n\u0010\f\u0010\u00b0\t\u0010\u0001\u0011\u0001\u0011"+ + "\u0001\u0011\u0003\u0011\u00b5\b\u0011\u0001\u0012\u0001\u0012\u0001\u0013"+ + "\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0000\u0001 \u0014\u0000"+ "\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014\u0016\u0018\u001a\u001c"+ - "\u001e \"$\u0000\u0005\u0001\u0000\n\f\u0001\u0000\u0012\u0013\u0001\u0000"+ - "\u0014\u0019\u0001\u0000\u001a\u001e\u0001\u0000 !\u00bb\u0000\'\u0001"+ - "\u0000\u0000\u0000\u0002+\u0001\u0000\u0000\u0000\u00048\u0001\u0000\u0000"+ - "\u0000\u0006:\u0001\u0000\u0000\u0000\b>\u0001\u0000\u0000\u0000\nP\u0001"+ - "\u0000\u0000\u0000\fX\u0001\u0000\u0000\u0000\u000e[\u0001\u0000\u0000"+ - "\u0000\u0010c\u0001\u0000\u0000\u0000\u0012e\u0001\u0000\u0000\u0000\u0014"+ - "m\u0001\u0000\u0000\u0000\u0016r\u0001\u0000\u0000\u0000\u0018{\u0001"+ - "\u0000\u0000\u0000\u001a\u0081\u0001\u0000\u0000\u0000\u001c\u0087\u0001"+ - "\u0000\u0000\u0000\u001e\u009b\u0001\u0000\u0000\u0000 \u00ae\u0001\u0000"+ - "\u0000\u0000\"\u00b0\u0001\u0000\u0000\u0000$\u00b2\u0001\u0000\u0000"+ - "\u0000&(\u0003\u0002\u0001\u0000\'&\u0001\u0000\u0000\u0000()\u0001\u0000"+ - "\u0000\u0000)\'\u0001\u0000\u0000\u0000)*\u0001\u0000\u0000\u0000*\u0001"+ - "\u0001\u0000\u0000\u0000+,\u0005\u0001\u0000\u0000,-\u0005$\u0000\u0000"+ - "-1\u0005\u0002\u0000\u0000.0\u0003\u0004\u0002\u0000/.\u0001\u0000\u0000"+ - "\u000003\u0001\u0000\u0000\u00001/\u0001\u0000\u0000\u000012\u0001\u0000"+ - "\u0000\u000024\u0001\u0000\u0000\u000031\u0001\u0000\u0000\u000045\u0005"+ - "\u0003\u0000\u00005\u0003\u0001\u0000\u0000\u000069\u0003\u0006\u0003"+ - "\u000079\u0003\b\u0004\u000086\u0001\u0000\u0000\u000087\u0001\u0000\u0000"+ - "\u00009\u0005\u0001\u0000\u0000\u0000:;\u0003\u000e\u0007\u0000;<\u0005"+ - "$\u0000\u0000<=\u0005\u0004\u0000\u0000=\u0007\u0001\u0000\u0000\u0000"+ - ">?\u0005\u0005\u0000\u0000?@\u0005\u0006\u0000\u0000@A\u0003\u000e\u0007"+ - "\u0000AB\u0005$\u0000\u0000BD\u0005\u0007\u0000\u0000CE\u0003\n\u0005"+ - "\u0000DC\u0001\u0000\u0000\u0000DE\u0001\u0000\u0000\u0000EF\u0001\u0000"+ - "\u0000\u0000FG\u0005\b\u0000\u0000GK\u0005\u0002\u0000\u0000HJ\u0003\u0010"+ - "\b\u0000IH\u0001\u0000\u0000\u0000JM\u0001\u0000\u0000\u0000KI\u0001\u0000"+ - "\u0000\u0000KL\u0001\u0000\u0000\u0000LN\u0001\u0000\u0000\u0000MK\u0001"+ - "\u0000\u0000\u0000NO\u0005\u0003\u0000\u0000O\t\u0001\u0000\u0000\u0000"+ - "PU\u0003\f\u0006\u0000QR\u0005\t\u0000\u0000RT\u0003\f\u0006\u0000SQ\u0001"+ - "\u0000\u0000\u0000TW\u0001\u0000\u0000\u0000US\u0001\u0000\u0000\u0000"+ - "UV\u0001\u0000\u0000\u0000V\u000b\u0001\u0000\u0000\u0000WU\u0001\u0000"+ - "\u0000\u0000XY\u0003\u000e\u0007\u0000YZ\u0005$\u0000\u0000Z\r\u0001\u0000"+ - "\u0000\u0000[\\\u0007\u0000\u0000\u0000\\\u000f\u0001\u0000\u0000\u0000"+ - "]d\u0003\u0012\t\u0000^d\u0003\u0014\n\u0000_d\u0003\u0016\u000b\u0000"+ - "`d\u0003\u0018\f\u0000ad\u0003\u001a\r\u0000bd\u0003\u001c\u000e\u0000"+ - "c]\u0001\u0000\u0000\u0000c^\u0001\u0000\u0000\u0000c_\u0001\u0000\u0000"+ - "\u0000c`\u0001\u0000\u0000\u0000ca\u0001\u0000\u0000\u0000cb\u0001\u0000"+ - "\u0000\u0000d\u0011\u0001\u0000\u0000\u0000ef\u0003\u000e\u0007\u0000"+ - "fi\u0005$\u0000\u0000gh\u0005\r\u0000\u0000hj\u0003\u001e\u000f\u0000"+ - "ig\u0001\u0000\u0000\u0000ij\u0001\u0000\u0000\u0000jk\u0001\u0000\u0000"+ - "\u0000kl\u0005\u0004\u0000\u0000l\u0013\u0001\u0000\u0000\u0000mn\u0005"+ - "$\u0000\u0000no\u0005\r\u0000\u0000op\u0003\u001e\u000f\u0000pq\u0005"+ - "\u0004\u0000\u0000q\u0015\u0001\u0000\u0000\u0000rs\u0005\u000e\u0000"+ - "\u0000st\u0005\u0007\u0000\u0000tu\u0003\u001e\u000f\u0000uv\u0005\b\u0000"+ - "\u0000vy\u0003\u0010\b\u0000wx\u0005\u000f\u0000\u0000xz\u0003\u0010\b"+ - "\u0000yw\u0001\u0000\u0000\u0000yz\u0001\u0000\u0000\u0000z\u0017\u0001"+ - "\u0000\u0000\u0000{|\u0005\u0010\u0000\u0000|}\u0005\u0007\u0000\u0000"+ - "}~\u0003\u001e\u000f\u0000~\u007f\u0005\b\u0000\u0000\u007f\u0080\u0003"+ - "\u0010\b\u0000\u0080\u0019\u0001\u0000\u0000\u0000\u0081\u0083\u0005\u0011"+ - "\u0000\u0000\u0082\u0084\u0003\u001e\u000f\u0000\u0083\u0082\u0001\u0000"+ - "\u0000\u0000\u0083\u0084\u0001\u0000\u0000\u0000\u0084\u0085\u0001\u0000"+ - "\u0000\u0000\u0085\u0086\u0005\u0004\u0000\u0000\u0086\u001b\u0001\u0000"+ - "\u0000\u0000\u0087\u008b\u0005\u0002\u0000\u0000\u0088\u008a\u0003\u0010"+ - "\b\u0000\u0089\u0088\u0001\u0000\u0000\u0000\u008a\u008d\u0001\u0000\u0000"+ - "\u0000\u008b\u0089\u0001\u0000\u0000\u0000\u008b\u008c\u0001\u0000\u0000"+ - "\u0000\u008c\u008e\u0001\u0000\u0000\u0000\u008d\u008b\u0001\u0000\u0000"+ - "\u0000\u008e\u008f\u0005\u0003\u0000\u0000\u008f\u001d\u0001\u0000\u0000"+ - "\u0000\u0090\u0091\u0006\u000f\uffff\uffff\u0000\u0091\u0092\u0005\u001b"+ - "\u0000\u0000\u0092\u009c\u0003\u001e\u000f\u0005\u0093\u0094\u0005\u001f"+ - "\u0000\u0000\u0094\u009c\u0003\u001e\u000f\u0004\u0095\u0096\u0005\u0007"+ - "\u0000\u0000\u0096\u0097\u0003\u001e\u000f\u0000\u0097\u0098\u0005\b\u0000"+ - "\u0000\u0098\u009c\u0001\u0000\u0000\u0000\u0099\u009c\u0003 \u0010\u0000"+ - "\u009a\u009c\u0005$\u0000\u0000\u009b\u0090\u0001\u0000\u0000\u0000\u009b"+ - "\u0093\u0001\u0000\u0000\u0000\u009b\u0095\u0001\u0000\u0000\u0000\u009b"+ - "\u0099\u0001\u0000\u0000\u0000\u009b\u009a\u0001\u0000\u0000\u0000\u009c"+ - "\u00a8\u0001\u0000\u0000\u0000\u009d\u009e\n\b\u0000\u0000\u009e\u009f"+ - "\u0007\u0001\u0000\u0000\u009f\u00a7\u0003\u001e\u000f\t\u00a0\u00a1\n"+ - "\u0007\u0000\u0000\u00a1\u00a2\u0007\u0002\u0000\u0000\u00a2\u00a7\u0003"+ - "\u001e\u000f\b\u00a3\u00a4\n\u0006\u0000\u0000\u00a4\u00a5\u0007\u0003"+ - "\u0000\u0000\u00a5\u00a7\u0003\u001e\u000f\u0007\u00a6\u009d\u0001\u0000"+ - "\u0000\u0000\u00a6\u00a0\u0001\u0000\u0000\u0000\u00a6\u00a3\u0001\u0000"+ - "\u0000\u0000\u00a7\u00aa\u0001\u0000\u0000\u0000\u00a8\u00a6\u0001\u0000"+ - "\u0000\u0000\u00a8\u00a9\u0001\u0000\u0000\u0000\u00a9\u001f\u0001\u0000"+ - "\u0000\u0000\u00aa\u00a8\u0001\u0000\u0000\u0000\u00ab\u00af\u0005#\u0000"+ - "\u0000\u00ac\u00af\u0003\"\u0011\u0000\u00ad\u00af\u0003$\u0012\u0000"+ - "\u00ae\u00ab\u0001\u0000\u0000\u0000\u00ae\u00ac\u0001\u0000\u0000\u0000"+ - "\u00ae\u00ad\u0001\u0000\u0000\u0000\u00af!\u0001\u0000\u0000\u0000\u00b0"+ - "\u00b1\u0007\u0004\u0000\u0000\u00b1#\u0001\u0000\u0000\u0000\u00b2\u00b3"+ - "\u0005\"\u0000\u0000\u00b3\u00b4\t\u0000\u0000\u0000\u00b4\u00b5\u0005"+ - "\"\u0000\u0000\u00b5%\u0001\u0000\u0000\u0000\u000f)18DKUciy\u0083\u008b"+ - "\u009b\u00a6\u00a8\u00ae"; + "\u001e \"$&\u0000\u0006\u0001\u0000\t\u000b\u0001\u0000\f\r\u0001\u0000"+ + "\u0013\u0014\u0001\u0000\u0015\u001a\u0001\u0000\u001b\u001f\u0001\u0000"+ + "!\"\u00c0\u0000)\u0001\u0000\u0000\u0000\u0002-\u0001\u0000\u0000\u0000"+ + "\u0004;\u0001\u0000\u0000\u0000\u0006=\u0001\u0000\u0000\u0000\bB\u0001"+ + "\u0000\u0000\u0000\nT\u0001\u0000\u0000\u0000\f\\\u0001\u0000\u0000\u0000"+ + "\u000e_\u0001\u0000\u0000\u0000\u0010a\u0001\u0000\u0000\u0000\u0012i"+ + "\u0001\u0000\u0000\u0000\u0014k\u0001\u0000\u0000\u0000\u0016s\u0001\u0000"+ + "\u0000\u0000\u0018x\u0001\u0000\u0000\u0000\u001a\u0081\u0001\u0000\u0000"+ + "\u0000\u001c\u0087\u0001\u0000\u0000\u0000\u001e\u008d\u0001\u0000\u0000"+ + "\u0000 \u00a1\u0001\u0000\u0000\u0000\"\u00b4\u0001\u0000\u0000\u0000"+ + "$\u00b6\u0001\u0000\u0000\u0000&\u00b8\u0001\u0000\u0000\u0000(*\u0003"+ + "\u0002\u0001\u0000)(\u0001\u0000\u0000\u0000*+\u0001\u0000\u0000\u0000"+ + "+)\u0001\u0000\u0000\u0000+,\u0001\u0000\u0000\u0000,\u0001\u0001\u0000"+ + "\u0000\u0000-.\u0003\u0010\b\u0000./\u0005\u0001\u0000\u0000/0\u0005%"+ + "\u0000\u000004\u0005\u0002\u0000\u000013\u0003\u0004\u0002\u000021\u0001"+ + "\u0000\u0000\u000036\u0001\u0000\u0000\u000042\u0001\u0000\u0000\u0000"+ + "45\u0001\u0000\u0000\u000057\u0001\u0000\u0000\u000064\u0001\u0000\u0000"+ + "\u000078\u0005\u0003\u0000\u00008\u0003\u0001\u0000\u0000\u00009<\u0003"+ + "\u0006\u0003\u0000:<\u0003\b\u0004\u0000;9\u0001\u0000\u0000\u0000;:\u0001"+ + "\u0000\u0000\u0000<\u0005\u0001\u0000\u0000\u0000=>\u0003\u0010\b\u0000"+ + ">?\u0003\u000e\u0007\u0000?@\u0005%\u0000\u0000@A\u0005\u0004\u0000\u0000"+ + "A\u0007\u0001\u0000\u0000\u0000BC\u0003\u0010\b\u0000CD\u0005\u0005\u0000"+ + "\u0000DE\u0003\u000e\u0007\u0000EF\u0005%\u0000\u0000FH\u0005\u0006\u0000"+ + "\u0000GI\u0003\n\u0005\u0000HG\u0001\u0000\u0000\u0000HI\u0001\u0000\u0000"+ + "\u0000IJ\u0001\u0000\u0000\u0000JK\u0005\u0007\u0000\u0000KO\u0005\u0002"+ + "\u0000\u0000LN\u0003\u0012\t\u0000ML\u0001\u0000\u0000\u0000NQ\u0001\u0000"+ + "\u0000\u0000OM\u0001\u0000\u0000\u0000OP\u0001\u0000\u0000\u0000PR\u0001"+ + "\u0000\u0000\u0000QO\u0001\u0000\u0000\u0000RS\u0005\u0003\u0000\u0000"+ + "S\t\u0001\u0000\u0000\u0000TY\u0003\f\u0006\u0000UV\u0005\b\u0000\u0000"+ + "VX\u0003\f\u0006\u0000WU\u0001\u0000\u0000\u0000X[\u0001\u0000\u0000\u0000"+ + "YW\u0001\u0000\u0000\u0000YZ\u0001\u0000\u0000\u0000Z\u000b\u0001\u0000"+ + "\u0000\u0000[Y\u0001\u0000\u0000\u0000\\]\u0003\u000e\u0007\u0000]^\u0005"+ + "%\u0000\u0000^\r\u0001\u0000\u0000\u0000_`\u0007\u0000\u0000\u0000`\u000f"+ + "\u0001\u0000\u0000\u0000ab\u0007\u0001\u0000\u0000b\u0011\u0001\u0000"+ + "\u0000\u0000cj\u0003\u0014\n\u0000dj\u0003\u0016\u000b\u0000ej\u0003\u0018"+ + "\f\u0000fj\u0003\u001a\r\u0000gj\u0003\u001c\u000e\u0000hj\u0003\u001e"+ + "\u000f\u0000ic\u0001\u0000\u0000\u0000id\u0001\u0000\u0000\u0000ie\u0001"+ + "\u0000\u0000\u0000if\u0001\u0000\u0000\u0000ig\u0001\u0000\u0000\u0000"+ + "ih\u0001\u0000\u0000\u0000j\u0013\u0001\u0000\u0000\u0000kl\u0003\u000e"+ + "\u0007\u0000lo\u0005%\u0000\u0000mn\u0005\u000e\u0000\u0000np\u0003 \u0010"+ + "\u0000om\u0001\u0000\u0000\u0000op\u0001\u0000\u0000\u0000pq\u0001\u0000"+ + "\u0000\u0000qr\u0005\u0004\u0000\u0000r\u0015\u0001\u0000\u0000\u0000"+ + "st\u0005%\u0000\u0000tu\u0005\u000e\u0000\u0000uv\u0003 \u0010\u0000v"+ + "w\u0005\u0004\u0000\u0000w\u0017\u0001\u0000\u0000\u0000xy\u0005\u000f"+ + "\u0000\u0000yz\u0005\u0006\u0000\u0000z{\u0003 \u0010\u0000{|\u0005\u0007"+ + "\u0000\u0000|\u007f\u0003\u0012\t\u0000}~\u0005\u0010\u0000\u0000~\u0080"+ + "\u0003\u0012\t\u0000\u007f}\u0001\u0000\u0000\u0000\u007f\u0080\u0001"+ + "\u0000\u0000\u0000\u0080\u0019\u0001\u0000\u0000\u0000\u0081\u0082\u0005"+ + "\u0011\u0000\u0000\u0082\u0083\u0005\u0006\u0000\u0000\u0083\u0084\u0003"+ + " \u0010\u0000\u0084\u0085\u0005\u0007\u0000\u0000\u0085\u0086\u0003\u0012"+ + "\t\u0000\u0086\u001b\u0001\u0000\u0000\u0000\u0087\u0089\u0005\u0012\u0000"+ + "\u0000\u0088\u008a\u0003 \u0010\u0000\u0089\u0088\u0001\u0000\u0000\u0000"+ + "\u0089\u008a\u0001\u0000\u0000\u0000\u008a\u008b\u0001\u0000\u0000\u0000"+ + "\u008b\u008c\u0005\u0004\u0000\u0000\u008c\u001d\u0001\u0000\u0000\u0000"+ + "\u008d\u0091\u0005\u0002\u0000\u0000\u008e\u0090\u0003\u0012\t\u0000\u008f"+ + "\u008e\u0001\u0000\u0000\u0000\u0090\u0093\u0001\u0000\u0000\u0000\u0091"+ + "\u008f\u0001\u0000\u0000\u0000\u0091\u0092\u0001\u0000\u0000\u0000\u0092"+ + "\u0094\u0001\u0000\u0000\u0000\u0093\u0091\u0001\u0000\u0000\u0000\u0094"+ + "\u0095\u0005\u0003\u0000\u0000\u0095\u001f\u0001\u0000\u0000\u0000\u0096"+ + "\u0097\u0006\u0010\uffff\uffff\u0000\u0097\u0098\u0005\u001c\u0000\u0000"+ + "\u0098\u00a2\u0003 \u0010\u0005\u0099\u009a\u0005 \u0000\u0000\u009a\u00a2"+ + "\u0003 \u0010\u0004\u009b\u009c\u0005\u0006\u0000\u0000\u009c\u009d\u0003"+ + " \u0010\u0000\u009d\u009e\u0005\u0007\u0000\u0000\u009e\u00a2\u0001\u0000"+ + "\u0000\u0000\u009f\u00a2\u0003\"\u0011\u0000\u00a0\u00a2\u0005%\u0000"+ + "\u0000\u00a1\u0096\u0001\u0000\u0000\u0000\u00a1\u0099\u0001\u0000\u0000"+ + "\u0000\u00a1\u009b\u0001\u0000\u0000\u0000\u00a1\u009f\u0001\u0000\u0000"+ + "\u0000\u00a1\u00a0\u0001\u0000\u0000\u0000\u00a2\u00ae\u0001\u0000\u0000"+ + "\u0000\u00a3\u00a4\n\b\u0000\u0000\u00a4\u00a5\u0007\u0002\u0000\u0000"+ + "\u00a5\u00ad\u0003 \u0010\t\u00a6\u00a7\n\u0007\u0000\u0000\u00a7\u00a8"+ + "\u0007\u0003\u0000\u0000\u00a8\u00ad\u0003 \u0010\b\u00a9\u00aa\n\u0006"+ + "\u0000\u0000\u00aa\u00ab\u0007\u0004\u0000\u0000\u00ab\u00ad\u0003 \u0010"+ + "\u0007\u00ac\u00a3\u0001\u0000\u0000\u0000\u00ac\u00a6\u0001\u0000\u0000"+ + "\u0000\u00ac\u00a9\u0001\u0000\u0000\u0000\u00ad\u00b0\u0001\u0000\u0000"+ + "\u0000\u00ae\u00ac\u0001\u0000\u0000\u0000\u00ae\u00af\u0001\u0000\u0000"+ + "\u0000\u00af!\u0001\u0000\u0000\u0000\u00b0\u00ae\u0001\u0000\u0000\u0000"+ + "\u00b1\u00b5\u0005$\u0000\u0000\u00b2\u00b5\u0003$\u0012\u0000\u00b3\u00b5"+ + "\u0003&\u0013\u0000\u00b4\u00b1\u0001\u0000\u0000\u0000\u00b4\u00b2\u0001"+ + "\u0000\u0000\u0000\u00b4\u00b3\u0001\u0000\u0000\u0000\u00b5#\u0001\u0000"+ + "\u0000\u0000\u00b6\u00b7\u0007\u0005\u0000\u0000\u00b7%\u0001\u0000\u0000"+ + "\u0000\u00b8\u00b9\u0005#\u0000\u0000\u00b9\u00ba\t\u0000\u0000\u0000"+ + "\u00ba\u00bb\u0005#\u0000\u0000\u00bb\'\u0001\u0000\u0000\u0000\u000f"+ + "+4;HOYio\u007f\u0089\u0091\u00a1\u00ac\u00ae\u00b4"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/src/main/java/parser/generated/SimpleJavaVisitor.java b/src/main/java/parser/generated/SimpleJavaVisitor.java index adb2560..0e5f589 100644 --- a/src/main/java/parser/generated/SimpleJavaVisitor.java +++ b/src/main/java/parser/generated/SimpleJavaVisitor.java @@ -58,6 +58,12 @@ public interface SimpleJavaVisitor extends ParseTreeVisitor { * @return the visitor result */ T visitType(SimpleJavaParser.TypeContext ctx); + /** + * Visit a parse tree produced by {@link SimpleJavaParser#accessType}. + * @param ctx the parse tree + * @return the visitor result + */ + T visitAccessType(SimpleJavaParser.AccessTypeContext ctx); /** * Visit a parse tree produced by {@link SimpleJavaParser#statement}. * @param ctx the parse tree diff --git a/src/main/test/java/MainTest.java b/src/main/test/java/MainTest.java index 46ad4ee..0b1551e 100644 --- a/src/main/test/java/MainTest.java +++ b/src/main/test/java/MainTest.java @@ -1,13 +1,9 @@ -import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.CharStreams; import org.junit.jupiter.api.Test; 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.generated.SimpleJavaLexer; -import parser.generated.SimpleJavaParser; import ast.ClassNode; import ast.ProgramNode; import bytecode.ByteCodeGenerator; From 5529704693b96d755084d95cd2050ab14ba87c53 Mon Sep 17 00:00:00 2001 From: Purplumbi Date: Wed, 8 May 2024 14:47:41 +0200 Subject: [PATCH 2/6] AccessType Fix --- src/main/java/ast/ClassNode.java | 2 +- src/main/java/ast/ConstructorNode.java | 2 +- src/main/java/ast/MethodNode.java | 8 +++++--- src/main/java/parser/ASTBuilder.java | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/ast/ClassNode.java b/src/main/java/ast/ClassNode.java index 7943b5a..0bf768b 100644 --- a/src/main/java/ast/ClassNode.java +++ b/src/main/java/ast/ClassNode.java @@ -17,7 +17,7 @@ public class ClassNode extends ASTNode{ public void ensureConstructor(){ if(!hasConstructor) { - ConstructorNode constructor = new ConstructorNode(new TypeNode("public"), name); + ConstructorNode constructor = new ConstructorNode(new AccessTypeNode(EnumAccessTypeNode.PUBLIC), name); members.add(0,constructor); } } diff --git a/src/main/java/ast/ConstructorNode.java b/src/main/java/ast/ConstructorNode.java index 4aa194f..a824f5a 100644 --- a/src/main/java/ast/ConstructorNode.java +++ b/src/main/java/ast/ConstructorNode.java @@ -1,7 +1,7 @@ package ast; public class ConstructorNode extends MethodNode{ - public ConstructorNode(TypeNode visibility, String name) { + public ConstructorNode(AccessTypeNode visibility, String name) { super(visibility, name); } } diff --git a/src/main/java/ast/MethodNode.java b/src/main/java/ast/MethodNode.java index b8e15f2..3ab8b2a 100644 --- a/src/main/java/ast/MethodNode.java +++ b/src/main/java/ast/MethodNode.java @@ -4,22 +4,24 @@ import java.util.ArrayList; import java.util.List; public class MethodNode extends MemberNode{ - public TypeNode visibility; + public AccessTypeNode visibility; + public TypeNode type; public String name; public ParameterListNode parameters; public List statements = new ArrayList<>(); - public MethodNode(TypeNode visibility, String name, ParameterListNode parameters, + public MethodNode(AccessTypeNode visibility, TypeNode type, String name, ParameterListNode parameters, List statements){ this.visibility = visibility; + this.type = type; this.name = name; this.parameters = parameters; this.statements = statements; } - public MethodNode(TypeNode visibility, String name){ + public MethodNode(AccessTypeNode visibility, String name){ this.visibility = visibility; this.name = name; } diff --git a/src/main/java/parser/ASTBuilder.java b/src/main/java/parser/ASTBuilder.java index 2e5ef72..48c26a5 100644 --- a/src/main/java/parser/ASTBuilder.java +++ b/src/main/java/parser/ASTBuilder.java @@ -37,6 +37,7 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { @Override public ASTNode visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) { + AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType()); TypeNode returnType = (TypeNode) visit(ctx.type()); String methodName = ctx.IDENTIFIER().getText(); ParameterListNode parameterListNode = (ParameterListNode) visit(ctx.parameterList()); @@ -45,7 +46,7 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { statements.add((StatementNode) visit(stmtCtx)); } - MethodNode method = new MethodNode(returnType, methodName, parameterListNode, statements); + MethodNode method = new MethodNode(accessType,returnType, methodName, parameterListNode, statements); return method; } From 7c54c0f04c47e16dff787a0102e3f44a94718a72 Mon Sep 17 00:00:00 2001 From: Purplumbi Date: Wed, 8 May 2024 15:04:25 +0200 Subject: [PATCH 3/6] FieldAccessType added --- src/main/java/ast/ClassNode.java | 6 ++++ src/main/java/ast/FieldNode.java | 4 ++- src/main/java/parser/ASTBuilder.java | 43 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/main/java/ast/ClassNode.java b/src/main/java/ast/ClassNode.java index 0bf768b..722f1af 100644 --- a/src/main/java/ast/ClassNode.java +++ b/src/main/java/ast/ClassNode.java @@ -4,10 +4,16 @@ import java.util.ArrayList; import java.util.List; public class ClassNode extends ASTNode{ + public AccessTypeNode accessType; public String name; public List members = new ArrayList<>(); public boolean hasConstructor = false; + public ClassNode(AccessTypeNode accessType, String name){ + this.accessType = accessType; + this.name = name; + } + public void addMember(MemberNode member) { if (member instanceof ConstructorNode) { this.hasConstructor = true; diff --git a/src/main/java/ast/FieldNode.java b/src/main/java/ast/FieldNode.java index 948701f..0ac7cd4 100644 --- a/src/main/java/ast/FieldNode.java +++ b/src/main/java/ast/FieldNode.java @@ -1,10 +1,12 @@ package ast; public class FieldNode extends MemberNode { + public AccessTypeNode accessTypeNode; public TypeNode type; public String name; - public FieldNode(TypeNode type, String name){ + public FieldNode(AccessTypeNode accessTypeNode, TypeNode type, String name){ + this.accessTypeNode = accessTypeNode; this.type = type; this.name = name; } diff --git a/src/main/java/parser/ASTBuilder.java b/src/main/java/parser/ASTBuilder.java index 48c26a5..931fc76 100644 --- a/src/main/java/parser/ASTBuilder.java +++ b/src/main/java/parser/ASTBuilder.java @@ -19,20 +19,20 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { @Override public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) { - ClassNode classNode = new ClassNode(); - classNode.name = ctx.IDENTIFIER().getText(); + ClassNode classNode = new ClassNode((AccessTypeNode) visit(ctx.accessType()),ctx.IDENTIFIER().getText()); for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) { classNode.addMember((MemberNode) visit(member)); } - classNode.ensureConstructor(); // Check and add default constructor if needed + classNode.ensureConstructor(); return classNode; } @Override public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) { + AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType()); TypeNode type = (TypeNode) visit(ctx.type()); String identifier = ctx.IDENTIFIER().getText(); - return new FieldNode(type, identifier); + return new FieldNode(accessType, type, identifier); } @Override @@ -51,9 +51,25 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { return method; } + @Override + public ASTNode visitParameterList(SimpleJavaParser.ParameterListContext ctx) { + List parameters = new ArrayList<>(); + for (SimpleJavaParser.ParameterContext paramCtx : ctx.parameter()) { + parameters.add((ParameterNode) visitParameter(paramCtx)); + } + return new ParameterListNode(parameters); + } + + @Override + public ASTNode visitParameter(SimpleJavaParser.ParameterContext ctx) { + TypeNode type = (TypeNode) visit(ctx.type()); + String identifier = ctx.IDENTIFIER().getText(); + return new ParameterNode(type, identifier); + } + @Override public ASTNode visitType(SimpleJavaParser.TypeContext ctx) { - String typeStr = ctx.getText(); // Get the text of the type from the context + String typeStr = ctx.getText(); switch (typeStr) { case "int": return new TypeNode(EnumTypeNode.INT); @@ -90,21 +106,4 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { return null; } - @Override - public ASTNode visitParameterList(SimpleJavaParser.ParameterListContext ctx) { - List parameters = new ArrayList<>(); - for (SimpleJavaParser.ParameterContext paramCtx : ctx.parameter()) { - parameters.add((ParameterNode) visitParameter(paramCtx)); - } - return new ParameterListNode(parameters); - } - - @Override - public ASTNode visitParameter(SimpleJavaParser.ParameterContext ctx) { - TypeNode type = (TypeNode) visit(ctx.type()); // Assuming visitType returns a TypeNode - String identifier = ctx.IDENTIFIER().getText(); - return new ParameterNode(type, identifier); - } - - } From 3cbef38c5ec201129c115f98e6d0e58f98295ad7 Mon Sep 17 00:00:00 2001 From: Purplumbi Date: Wed, 8 May 2024 15:17:35 +0200 Subject: [PATCH 4/6] Visitor and generated updated --- src/main/java/parser/ASTBuilder.java | 2 +- src/main/java/parser/generated/SimpleJavaBaseVisitor.java | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/parser/ASTBuilder.java b/src/main/java/parser/ASTBuilder.java index 931fc76..e5e80a9 100644 --- a/src/main/java/parser/ASTBuilder.java +++ b/src/main/java/parser/ASTBuilder.java @@ -83,7 +83,7 @@ public class ASTBuilder extends SimpleJavaBaseVisitor { } @Override - public ASTNode visitAccessType(SimpleJavaParser.TypeContext ctx) { + public ASTNode visitAccessType(SimpleJavaParser.AccessTypeContext ctx) { String typeStr = ctx.getText(); switch (typeStr) { case "public": diff --git a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java index b7ea4bf..d220df2 100644 --- a/src/main/java/parser/generated/SimpleJavaBaseVisitor.java +++ b/src/main/java/parser/generated/SimpleJavaBaseVisitor.java @@ -1,6 +1,5 @@ // Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1 package parser.generated; -import ast.ASTNode; import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; /** @@ -12,7 +11,7 @@ import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; * operations with no return type. */ @SuppressWarnings("CheckReturnValue") -public abstract class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implements SimpleJavaVisitor { +public class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor implements SimpleJavaVisitor { /** * {@inheritDoc} * @@ -76,9 +75,6 @@ public abstract class SimpleJavaBaseVisitor extends AbstractParseTreeVisitor< * {@link #visitChildren} on {@code ctx}.

*/ @Override public T visitAccessType(SimpleJavaParser.AccessTypeContext ctx) { return visitChildren(ctx); } - - public abstract ASTNode visitAccessType(SimpleJavaParser.TypeContext ctx); - /** * {@inheritDoc} * From 44452d204b7cdcff5a2de508ffbd30973ccd1fc4 Mon Sep 17 00:00:00 2001 From: i22007 Date: Wed, 8 May 2024 15:22:39 +0200 Subject: [PATCH 5/6] Add accesTypeToOpcode mapper --- src/main/java/Example.java | 4 ++-- src/main/java/Main.java | 2 +- src/main/java/bytecode/ClassCodeGen.java | 17 ++++++++++++----- src/main/java/bytecode/FieldCodeGen.java | 7 +++++-- src/main/java/bytecode/MethodCodeGen.java | 3 ++- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/main/java/Example.java b/src/main/java/Example.java index 6f34d6e..75d8cd9 100644 --- a/src/main/java/Example.java +++ b/src/main/java/Example.java @@ -1,3 +1,3 @@ -public class Example { -} +public class Example() { +} \ No newline at end of file diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 65c9921..1315931 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -14,7 +14,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.java")); + 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/bytecode/ClassCodeGen.java b/src/main/java/bytecode/ClassCodeGen.java index 619068a..af003bc 100644 --- a/src/main/java/bytecode/ClassCodeGen.java +++ b/src/main/java/bytecode/ClassCodeGen.java @@ -1,6 +1,9 @@ package bytecode; import ast.ClassNode; +import ast.FieldNode; +import ast.MemberNode; +import ast.MethodNode; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; @@ -13,11 +16,15 @@ public class ClassCodeGen { classWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, classNode.name, null, "java/lang/Object", null); - FieldCodeGen fieldCodeGen = new FieldCodeGen(); - fieldCodeGen.generateFieldCode(classWriter); - - MethodCodeGen methodCodeGen = new MethodCodeGen(); - methodCodeGen.generateMethodCode(classWriter); + for (MemberNode memberNode : classNode.members) { + if (memberNode instanceof FieldNode) { + FieldCodeGen fieldCodeGen = new FieldCodeGen(); + fieldCodeGen.generateFieldCode(classWriter, (FieldNode) memberNode); + } else if (memberNode instanceof MethodNode) { + MethodCodeGen methodCodeGen = new MethodCodeGen(); + methodCodeGen.generateMethodCode(classWriter, (MethodNode) memberNode); + } + } classWriter.visitEnd(); printIntoClassFile(classWriter.toByteArray(), classNode.name); diff --git a/src/main/java/bytecode/FieldCodeGen.java b/src/main/java/bytecode/FieldCodeGen.java index 4cca429..abe7ebb 100644 --- a/src/main/java/bytecode/FieldCodeGen.java +++ b/src/main/java/bytecode/FieldCodeGen.java @@ -1,10 +1,13 @@ package bytecode; +import ast.FieldNode; import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Opcodes; public class FieldCodeGen { - public void generateFieldCode(ClassWriter classWriter) { - + public void generateFieldCode(ClassWriter classWriter, FieldNode fieldNode) { + FieldVisitor fieldVisitor = classWriter.visitField(Opcodes.ACC_PUBLIC, fieldNode.name, "", null, null); } } diff --git a/src/main/java/bytecode/MethodCodeGen.java b/src/main/java/bytecode/MethodCodeGen.java index a54fda8..c7c1bd3 100644 --- a/src/main/java/bytecode/MethodCodeGen.java +++ b/src/main/java/bytecode/MethodCodeGen.java @@ -1,11 +1,12 @@ package bytecode; +import ast.MethodNode; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; public class MethodCodeGen { - public void generateMethodCode(ClassWriter classWriter) { + public void generateMethodCode(ClassWriter classWriter, MethodNode methodNode) { MethodVisitor constructor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "", From 26653ac7194b90592a4f4aff3c9a1f9e87c8c3a1 Mon Sep 17 00:00:00 2001 From: i22007 Date: Wed, 8 May 2024 15:23:04 +0200 Subject: [PATCH 6/6] Add AccesTypeToOpcode mapper --- src/main/java/bytecode/ClassCodeGen.java | 3 ++- src/main/java/bytecode/FieldCodeGen.java | 3 ++- src/main/java/bytecode/Mapper.java | 17 +++++++++++++++++ src/main/java/bytecode/MethodCodeGen.java | 3 ++- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 src/main/java/bytecode/Mapper.java diff --git a/src/main/java/bytecode/ClassCodeGen.java b/src/main/java/bytecode/ClassCodeGen.java index af003bc..a59a632 100644 --- a/src/main/java/bytecode/ClassCodeGen.java +++ b/src/main/java/bytecode/ClassCodeGen.java @@ -13,7 +13,8 @@ import java.io.IOException; public class ClassCodeGen { public void generateClassCode(ClassNode classNode) { ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - classWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, classNode.name, null, + Mapper mapper = new Mapper(); + classWriter.visit(Opcodes.V1_8, mapper.mapAccesTypeToOpcode(classNode.accessType), classNode.name, null, "java/lang/Object", null); for (MemberNode memberNode : classNode.members) { diff --git a/src/main/java/bytecode/FieldCodeGen.java b/src/main/java/bytecode/FieldCodeGen.java index abe7ebb..8dd6a99 100644 --- a/src/main/java/bytecode/FieldCodeGen.java +++ b/src/main/java/bytecode/FieldCodeGen.java @@ -8,6 +8,7 @@ import org.objectweb.asm.Opcodes; public class FieldCodeGen { public void generateFieldCode(ClassWriter classWriter, FieldNode fieldNode) { - FieldVisitor fieldVisitor = classWriter.visitField(Opcodes.ACC_PUBLIC, fieldNode.name, "", null, null); + Mapper mapper = new Mapper(); + FieldVisitor fieldVisitor = classWriter.visitField(mapper.mapAccesTypeToOpcode(fieldNode.accessTypeNode), fieldNode.name, "", null, null); } } diff --git a/src/main/java/bytecode/Mapper.java b/src/main/java/bytecode/Mapper.java new file mode 100644 index 0000000..872f8e1 --- /dev/null +++ b/src/main/java/bytecode/Mapper.java @@ -0,0 +1,17 @@ +package bytecode; + +import ast.AccessTypeNode; +import ast.EnumAccessTypeNode; +import org.objectweb.asm.Opcodes; + +public class Mapper { + public int mapAccesTypeToOpcode(AccessTypeNode type) { + switch (type.enumAccessTypeNode) { + case EnumAccessTypeNode.PUBLIC: + return Opcodes.ACC_PUBLIC; + case EnumAccessTypeNode.PRIVATE: + return Opcodes.ACC_PRIVATE; + } + return 0; + } +} diff --git a/src/main/java/bytecode/MethodCodeGen.java b/src/main/java/bytecode/MethodCodeGen.java index c7c1bd3..6f217ac 100644 --- a/src/main/java/bytecode/MethodCodeGen.java +++ b/src/main/java/bytecode/MethodCodeGen.java @@ -7,8 +7,9 @@ import org.objectweb.asm.Opcodes; public class MethodCodeGen { public void generateMethodCode(ClassWriter classWriter, MethodNode methodNode) { + Mapper mapper = new Mapper(); MethodVisitor constructor = - classWriter.visitMethod(Opcodes.ACC_PUBLIC, + classWriter.visitMethod(mapper.mapAccesTypeToOpcode(methodNode.visibility), "", "()V", null,