Skip to content
Permalink
Browse files

Small modifications for better visitors

  • Loading branch information
octylFractal committed Oct 13, 2019
1 parent 7d52374 commit 9f1e7cdaafd83ef7465ee581e48fe13f83f3373c
Showing with 22 additions and 23 deletions.
  1. +22 −23 worldedit-core/src/main/antlr/com/sk89q/worldedit/antlr/Expression.g4
@@ -79,17 +79,17 @@ allStatements : statements EOF ;
statements : statement+ ;

statement
: block
| ifStatement
| whileStatement
| doStatement
| forStatement
| breakStatement
| continueStatement
| returnStatement
| switchStatement
| expressionStatement
| SEMI_COLON
: block # BlockStmt
| ifStatement # IfStmt
| whileStatement # WhileStmt
| doStatement # DoStmt
| forStatement # ForStmt
| breakStatement # BreakStmt
| continueStatement # ContinueStmt
| returnStatement # ReturnStmt
| switchStatement # SwitchStmt
| expressionStatement # ExpressionStmt
| SEMI_COLON # EmptyStmt
;

block : '{' statements '}' ;
@@ -118,29 +118,28 @@ returnStatement : RETURN expression? ;
switchStatement : SWITCH '(' expression ')' '{' (switchLabel ':' statements )+ '}' ;

switchLabel
: CASE constantExpression
| DEFAULT
: CASE constantExpression # Case
| DEFAULT # Default
;

expressionStatement : expression SEMI_COLON ;

expression
: constantExpression
| functionCall
| identifierExpression
| '(' expression ')'
| unaryOp expression
| identifierExpression binaryAssignOp expression
| expression binaryOp expression
| expression postUnaryOp
: unaryOp expression # UnaryExpr
| expression binaryOp expression # BinaryExpr
| expression postUnaryOp # PostUnaryExpr
| ID binaryAssignOp expression # AssignExpr
| expression '?' expression ':' expression # TernaryExpr
| functionCall # FunctionCallExpr
| constantExpression # ConstantExpr
| ID # IdExpr
| '(' expression ')' # WrappedExpr
;

constantExpression : NUMBER ;

functionCall : ID '(' (expression ( ',' expression )*)? ')' ;

identifierExpression : ID ;

unaryOp
: MINUS
| EXCLAMATION_MARK

0 comments on commit 9f1e7cd

Please sign in to comment.
You can’t perform that action at this time.