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