parser: implement for loops, port for/while loop test
Implement in parser.c: - forPrefix: parse for input expressions and capture variables - parseForExpr: for_simple and for AST nodes with optional else - Handle for and while in parsePrimaryTypeExpr for top-level usage Remove stale cppcheck knownConditionTrueFalse suppression. Port test "top-level for/while loop". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -624,6 +624,17 @@ test "zig fmt: respect line breaks before functions" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: top-level for/while loop" {
|
||||
try testCanonical(
|
||||
\\for (foo) |_| foo
|
||||
\\
|
||||
);
|
||||
try testCanonical(
|
||||
\\while (foo) |_| foo
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: simple top level comptime block" {
|
||||
try testCanonical(
|
||||
\\// line comment
|
||||
|
||||
Reference in New Issue
Block a user