diff options
| author | gingerBill <bill@gingerbill.org> | 2018-02-24 18:19:11 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-02-24 18:19:11 +0000 |
| commit | b2461f7192684f979301be9f174237e740ec28c6 (patch) | |
| tree | aee9cf0a4abcd65d3aa5d5db2df0e6d62c5b1d87 /src/parser.cpp | |
| parent | 921f2613774b69b6b6f74bf61fe410675a585eff (diff) | |
Fix issue #195
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index d54c63cd9..f05f9a0e1 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1358,6 +1358,7 @@ void expect_semicolon(AstFile *f, AstNode *s) { switch (f->curr_token.kind) { case Token_CloseBrace: case Token_CloseParen: + case Token_else: return; } } @@ -3175,7 +3176,7 @@ AstNode *parse_when_stmt(AstFile *f) { break; case Token_do: { Token arrow = expect_token(f, Token_do); - body = convert_stmt_to_body(f, parse_stmt(f)); + else_stmt = convert_stmt_to_body(f, parse_stmt(f)); } break; default: syntax_error(f->curr_token, "Expected when statement block statement"); @@ -3184,11 +3185,6 @@ AstNode *parse_when_stmt(AstFile *f) { } } - // if (f->curr_proc == nullptr && f->when_level > 1) { - // syntax_error(token, "Nested when statements are not currently supported at the file scope"); - // return ast_bad_stmt(f, token, f->curr_token); - // } - return ast_when_stmt(f, token, cond, body, else_stmt); } |