Small change

This commit is contained in:
Linus K 2022-10-24 03:22:40 +02:00
parent dd33b17f5c
commit 1d0bb99b7e

View File

@ -5,13 +5,13 @@ grammar astRefactor;
*/
syntaxtreenode: typablestatement | reftypeortphorwildcardorgeneric | methodinterface | fieldinterface | formalparameter | parameterlist | generictypevar | sourcefile | genericdecllist | argumentlist | classorinterface;
class : ACCESSMODIFIER WHITESPACE CLASS WHITESPACE CLASSNAME '(' (( formalparameter| typeplaceholder ) WHITESPACE NAME)* ')''{'(NEWLINE)* classbody'}';
classbody : ( method NEWLINE | variable NEWLINE | NEWLINE | whilestmt | dostmt)*;
class : ACCESSMODIFIER WHITESPACE CLASS WHITESPACE CLASSNAME ('(' (( syntaxtreenode ) WHITESPACE NAME)* ')''{'(NEWLINE)* classbody'}'| '{'(NEWLINE)* classbody'}');
classbody : ( method NEWLINE | variable NEWLINE | NEWLINE | syntaxtreenode)*;
variable : ACCESSMODIFIER WHITESPACE ( formalparameter | typeplaceholder )WHITESPACE NAME WHITESPACE '=' WHITESPACE ( WORD | NUMBER) ';'
| ACCESSMODIFIER WHITESPACE ( formalparameter | typeplaceholder ) WHITESPACE NAME ';';
variable : ACCESSMODIFIER WHITESPACE ( formalparameter | typeplaceholder ) WHITESPACE NAME WHITESPACE '=' WHITESPACE ( WORD | NUMBER) ';'
| ACCESSMODIFIER WHITESPACE ( syntaxtreenode ) WHITESPACE NAME ';';
method : ACCESSMODIFIER WHITESPACE ( formalparameter | typeplaceholder ) WHITESPACE NAME '(' ( formalparameter | typeplaceholder ) WHITESPACE WORD ')';
method : ACCESSMODIFIER WHITESPACE ( syntaxtreenode ) WHITESPACE NAME '(' ( formalparameter | typeplaceholder ) WHITESPACE WORD ')';
classorinterface: class;
@ -26,7 +26,7 @@ generictypevar: GENERICTYPEVAR;
parameterlist: (variable)+;
formalparameter: variable;
formalparameter: FORMALPARAMETER;
fieldinterface: fielddeclaration | field;
@ -48,7 +48,7 @@ reftype: REFTYPE;
wildcardtypeinterface: superwildcardtype | wildcardtype | extendswildcardType;
extendswildcardType: EXTENDSWILDARDARDARDTYPE;
extendswildcardType: EXTENDSWILDARDTYPE;
wildcardtype: WILDCARDTYPE;
@ -74,19 +74,25 @@ expressionreceiver: EXPRESSIONRECEIVER;
staticclassname: STATICCLASSNAME;
statement: whileinterface | methodcallinterface | returninterface | javainternalexpressioninterface | FORSMT | BLOCK | EMPTYSTMT | LOCALVARDECL | ASSIGN | IFSTMT | LOCALVAR;
statement: whileinterface | methodcallinterface | returninterface | javainternalexpressioninterface | forstmt | BLOCK | EMPTYSTMT | LOCALVARDECL | ASSIGN | ifstmt | LOCALVAR;
ifstmt: IFSTMT')''{'( NEWLINE )*'}';
forstmt: FORSMT')''{'( NEWLINE )*'}';
javainternalexpressioninterface: UNARYEXPR;
returninterface: RETURN | RETURNVOID;
returninterface: RETURN | returnvoid;
returnvoid: RETURN VOID;
methodcallinterface: METHODCALL | THISCALL | SUPERCALL | NEWCLASS;
whileinterface: whilestmt | dostmt;
dostmt: DOSTMT '{'( NEWLINE )*'}' (NEWLINE)* whilestmt ;
dostmt: DOSTMT ( NEWLINE )*'}' (NEWLINE)* whilestmt ;
whilestmt: WHILESTMT'('')''{'( NEWLINE)*'}';
whilestmt: WHILESTMT')''{'( NEWLINE)*'}';
assignleft: assigntofield | ASSIGNLEFTSIDE;
@ -108,15 +114,15 @@ GENERICDECLLIST : 'List<T>';
SOURCEFILE : WORD '.java';
ASSIGNTOFIELD : 'assigntofield';
ASSIGNLEFTSIDE : 'assignleftside';
WHILESTMT : 'while';
DOSTMT : 'do';
WHILESTMT : 'while(';
DOSTMT : 'do{';
GENERICTYPEVAR : 'generictypevar';
FORMALPARAMETER : ('int' | 'String' | 'double' | 'float' | 'boolean');
FIELDDECLARATION : 'fielddeclaration';
CONSTRUCTOR : 'constructor';
VOID : 'void';
REFTYPE : 'reftype';
EXTENDSWILDARDARDARDTYPE : 'extendwildcardType';
EXTENDSWILDARDTYPE : 'extendwildcardType';
WILDCARDTYPE : 'wildcardtype';
SUPERWILDCARDTYPE : 'superwildcardtype';
TYPEPLACEHOLDER : 'typeplaceholder';
@ -128,22 +134,21 @@ NEWARRAY : 'new ArrayList';
LITERAL : 'literal';
CASTEXPR : 'castexpr';
LAMBDAEXPRESSION : 'lambdaexpression';
INSTANCEOF : 'instanceOf';
INSTANCEOF : 'instanceof';
BINARYEXPR : 'binaryexpr';
EXPRESSIONRECEIVER : 'expressionreceiver';
STATICCLASSNAME : 'staticclassname';
FORSMT : 'for';
FORSMT : 'for(';
BLOCK : 'block';
EMPTYSTMT : 'emptystmt';
LOCALVARDECL : 'localvardecl';
ASSIGN : 'assign';
IFSTMT : 'if';
IFSTMT : 'if(';
LOCALVAR : 'localvar';
RETURN : 'return';
RETURNVOID : 'return void';
METHODCALL : 'methodcall';
THISCALL : 'this()';
SUPERCALL : 'super()';
THISCALL : 'this(';
SUPERCALL : 'super(';
NEWCLASS : 'newclass';
UNARYEXPR : ('+' | '-' | '++' | '--' | '!');
CLASSNAME : UPPERCASE ( LOWERCASE | UPPERCASE)*;