mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 17:08:03 +00:00
changed For to explicitly have an assignement in first and last place
This commit is contained in:
parent
1f0d690043
commit
706e6ee872
@ -19,14 +19,14 @@ param : type id;
|
||||
block : '{' (localVar | stmt)* '}';
|
||||
|
||||
stmt : 'if' '(' expr ')' block ('else' block)? #If
|
||||
| 'for' '(' expr ';' expr ';' expr ')' block #For
|
||||
| 'for' '(' assignement ';' expr ';' assignement ')' block #For
|
||||
| 'while' '(' expr ')' block #While
|
||||
| 'do' block 'while' '(' expr ')' #DoWhile
|
||||
| 'return' expr ';' #Return
|
||||
| 'return' ';' #ReturnVoid
|
||||
| 'break' ';' #Break
|
||||
| 'continue' ';' #Continue
|
||||
| id assignSign expr ';' #Assignment
|
||||
| assignement ';' #Assignment
|
||||
| stmtexpr ';' #StatementExpressionstmt
|
||||
;
|
||||
|
||||
@ -48,6 +48,7 @@ unaryOp : SUB | NOT;
|
||||
|
||||
fieldId : (THIS '.')? (recipient '.')* id;
|
||||
|
||||
assignement : id assignSign expr ;
|
||||
methCall : (THIS '.')? (recipient '.')* methName;
|
||||
recipient : methName | id;
|
||||
methName : id '(' args? ')';
|
||||
|
@ -1,5 +1,5 @@
|
||||
package de.maishai.ast.records;
|
||||
|
||||
|
||||
public record For(Expression assign, Expression cond, Expression inc, Block block) implements Statement {
|
||||
public record For(Assignment assign, Expression cond, Assignment inc, Block block) implements Statement {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user