Skip to content

Commit 892fbcb

Browse files
committed
Change if-else statement definition
1 parent 753370e commit 892fbcb

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

MyParser.g4

+15-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ program
1414

1515
codeBlock
1616
: OPEN_BRACKET_CURLY (codeBlock)* CLOSE_BRACKET_CURLY
17-
| ifElse
17+
| ifThenElse
1818
| forLoop
1919
| whileLoop
2020
| assignment
@@ -24,10 +24,20 @@ codeBlock
2424
| continue
2525
;
2626

27-
ifElse
28-
: IF OPEN_BRACKET_ROUND comparison CLOSE_BRACKET_ROUND codeBlock (
29-
ELSE codeBlock
30-
)?
27+
ifThenElse
28+
: if then else?
29+
;
30+
31+
if
32+
: IF OPEN_BRACKET_ROUND comparison CLOSE_BRACKET_ROUND
33+
;
34+
35+
then
36+
: codeBlock
37+
;
38+
39+
else
40+
: ELSE codeBlock
3141
;
3242

3343
forLoop

0 commit comments

Comments
 (0)