Support optional else-branch for if-then-elif-end (#2598)

This commit is contained in:
Mattias Wadman authored and GitHub committed 2023-07-04 07:51:29 +09:00
1 parent 4dc2a2fb9d
commit 12ce4e3b54
4 files changed
+388 -391

No files matched your search

+377 -387
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -367,9 +367,6 @@ Term "as" Patterns '|' Exp {
"if" Exp "then" Exp ElseBody {
$$ = gen_cond($2, $4, $5);
} |
"if" Exp "then" Exp "end" {
$$ = gen_cond($2, $4, gen_noop());
} |
"if" Exp "then" error {
FAIL(@$, "Possibly unterminated 'if' statement");
$$ = $2;
@@ -625,6 +622,9 @@ ElseBody:
} |
"else" Exp "end" {
$$ = $2;
} |
"end" {
$$ = gen_noop();
}
ExpD: