Skip to content

Commit f92a34c

Browse files
committed
Add diagnostics for semicolon at the end of for loop
This change introduce diagnostics when there is a semicolon at the end of the for..do loop body: ```cpp for v* | all next log() do :(e) = { foo(); bar*; }; ``` generates: ``` error: for..do loop body shall not end with a semicolon (at ';') ```
1 parent e016dc1 commit f92a34c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source/parse.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,6 +4157,11 @@ class parser
41574157
n->for_with_in = true;
41584158
}
41594159

4160+
if (!done() && curr().type() == lexeme::Semicolon) {
4161+
error("for..do loop body shall not end with a semicolon");
4162+
return {};
4163+
}
4164+
41604165
return n;
41614166
}
41624167

0 commit comments

Comments
 (0)