aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-01 11:53:01 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-01 11:53:01 +0100
commitd782b3d21d55a78fb538aa8b6421ae177235f037 (patch)
treeef05682761381d49b2220f92fdf84df07f54d7c6 /src/parser.cpp
parented089b44b9634c431785b5fa40c086f59900d740 (diff)
Fix `do` on `for` loops
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index ae54b1dd6..45e733353 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -3971,7 +3971,8 @@ AstNode *parse_for_stmt(AstFile *f) {
AstNode *body = NULL;
bool is_range = false;
- if (f->curr_token.kind != Token_OpenBrace) {
+ if (f->curr_token.kind != Token_OpenBrace &&
+ f->curr_token.kind != Token_do) {
isize prev_level = f->expr_level;
f->expr_level = -1;
if (f->curr_token.kind != Token_Semicolon) {
@@ -3981,8 +3982,7 @@ AstNode *parse_for_stmt(AstFile *f) {
}
}
- if (!is_range && (f->curr_token.kind == Token_Semicolon ||
- f->curr_token.kind == Token_do)) {
+ if (!is_range && f->curr_token.kind == Token_Semicolon) {
next_token(f);
init = cond;
cond = NULL;