Small change

This commit is contained in:
Linus K 2022-10-24 10:28:26 +02:00
parent b4172066e7
commit 0aead27bbd

View File

@ -9,10 +9,15 @@ import java.util.ArrayList;
public class SwitchTest {
public static void main(String[] args) {
printSyntax(new ClassOrInterface(Modifier.PUBLIC, new JavaClassName("Test"), new ArrayList<>(), java.util.Optional.empty(), new ArrayList<>(), new ArrayList<>(), new GenericDeclarationList(new ArrayList<>(), new NullToken()),
String plh= "Test";
RefTypeOrTPHOrWildcardOrGeneric type = null;
printSyntax(new ClassOrInterface(Modifier.PUBLIC, new JavaClassName(plh), new ArrayList<>(), java.util.Optional.empty(), new ArrayList<>(), new ArrayList<>(), new GenericDeclarationList(new ArrayList<>(), new NullToken()),
new RefType(new JavaClassName("Object"), new NullToken()), false, new ArrayList<>(), new NullToken()));
printSyntax(new FormalParameter(plh = "Test", type, new NullToken()));
}
static void printSyntax(SyntaxTreeNode s){
switch (s){
@ -26,7 +31,7 @@ public class SwitchTest {
}
}
case FormalParameter formalParameter -> {
System.out.println("formalParameter");
System.out.println(formalParameter.name());
}
case GenericDeclarationList genericDeclarationList -> {
System.out.println("genericDeclarationList");
@ -38,7 +43,7 @@ public class SwitchTest {
System.out.println("parameterList");
}
case SourceFile sourceFile -> {
System.out.println("sourceFile");
System.out.println(sourceFile.pkgName() + ".java");
}
case FieldDeclaration fieldDeclaration -> {
System.out.println("fieldDeclaration");
@ -47,7 +52,7 @@ public class SwitchTest {
System.out.println("field");
}
case Method method -> {
System.out.println("method");
System.out.println(method.modifier() + method.returnType().toString() + method.name() + "(" + method.parameterList() +")");
}
case Constructor constructor -> {
System.out.println("constructor");
@ -80,7 +85,7 @@ public class SwitchTest {
System.out.println("wildcardType");
}
case CastExpr castExpr -> {
System.out.println("castExpr");
System.out.println("(" + castExpr.castType().toString() + ")" + castExpr.expr().toString());
}
case FieldVar fieldVar -> {
System.out.println("fieldVar");
@ -92,40 +97,41 @@ public class SwitchTest {
System.out.println("literal");
}
case NewArray newArray -> {
System.out.println("newArray");
System.out.println("param array[];");
}
case Super aSuper -> {
System.out.println("Super");
System.out.println("super");
}
case This aThis -> {
System.out.println("This");
System.out.println("this");
}
case BinaryExpr binaryExpr -> {
System.out.println("binaryExpr");
System.out.println(binaryExpr.lexpr().toString() + binaryExpr.operation().toString() + binaryExpr.rexpr().toString());
}
case InstanceOf instanceOf -> {
System.out.println("instanceOf");
System.out.println("instanceof");
}
case ExpressionReceiver expressionReceiver -> {
System.out.println("expressionReceiver");
}
case StaticClassName staticClassName -> {
System.out.println("staticClassName");
System.out.println(staticClassName.className());
}
case Assign assign -> {
System.out.println("assign");
}
case Block block -> {
System.out.println("block");
System.out.println("{ }");
}
case EmptyStmt emptyStmt -> {
System.out.println("emptyStmt");
}
case ForStmt forStmt -> {
System.out.println("forStmt");
System.out.println("for(){}");
}
case IfStmt ifStmt -> {
System.out.println("ifStmt");
System.out.println("if(){}");
}
case LocalVar localVar -> {
System.out.println("localVar");
@ -149,16 +155,16 @@ public class SwitchTest {
System.out.println("thisCall");
}
case Return aReturn -> {
System.out.println("Return");
System.out.println("return");
}
case ReturnVoid returnVoid -> {
System.out.println("returnVoid");
System.out.println("return void;");
}
case DoStmt doStmt -> {
System.out.println("doStmt");
System.out.println("do{}while())");
}
case WhileStmt whileStmt -> {
System.out.println("whileStmt");
System.out.println("while(){}");
}
}
}