diff --git a/src/main/antlr4/astRefactor/astRefactor.g4 b/src/main/antlr4/astRefactor/astRefactor.g4 index ef2fe3b4..838ddac9 100644 --- a/src/main/antlr4/astRefactor/astRefactor.g4 +++ b/src/main/antlr4/astRefactor/astRefactor.g4 @@ -7,10 +7,10 @@ grammar astRefactor; class : ACCESSMODIFIER WHITESPACE CLASS WHITESPACE NAME '(' ( MODIFIER| TYPEPLACEHOLDER ) WHITESPACE NAME ')''{'NEWLINE classbody'}'; classbody : ( method NEWLINE | variable NEWLINE )+; -variable : ACCESSMODIFIER WHITESPACE ( MODIFIER WHITESPACE )? NAME WHITESPACE '=' WHITESPACE ( WORD | NUMBER) ';' - | ACCESSMODIFIER WHITESPACE ( MODIFIER WHITESPACE )? NAME ';'; +variable : ACCESSMODIFIER WHITESPACE ( MODIFIER | TYPEPLACEHOLDER )WHITESPACE NAME WHITESPACE '=' WHITESPACE ( WORD | NUMBER) ';' + | ACCESSMODIFIER WHITESPACE ( MODIFIER | TYPEPLACEHOLDER ) WHITESPACE NAME ';'; -method : ACCESSMODIFIER WHITESPACE ( MODIFIER WHITESPACE )? NAME '(' MODIFIER WHITESPACE WORD ')'; +method : ACCESSMODIFIER WHITESPACE ( MODIFIER | TYPEPLACEHOLDER ) WHITESPACE NAME '(' ( MODIFIER | TYPEPLACEHOLDER ) WHITESPACE WORD ')'; syntaxtreenode: typablestatement | reftypeortphorwildcardorgeneric | methodinterface | fieldinterface | formalparameter | parameterlist | generictypevar | sourcefile | genericdecllist | argumentlist | classorinterface; diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/SwitchTest.java b/src/main/java/de/dhbwstuttgart/syntaxtree/SwitchTest.java index 43f6f117..14e0b841 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/SwitchTest.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/SwitchTest.java @@ -20,9 +20,10 @@ public class SwitchTest { System.out.println("argumentList"); } case ClassOrInterface classOrInterface -> { - System.out.println("ClassOrInterface: \n" + - "Modifier = " + classOrInterface.getModifiers() + "\n" + - "Classname = " + classOrInterface.getClassName()); + int mod = classOrInterface.getModifiers(); + if (mod == 1) { + System.out.println("ClassOrInterface: \n" + "public PLACEHOLDER " + classOrInterface.getClassName() + "{}"); + } } case FormalParameter formalParameter -> { System.out.println("formalParameter");