aboutsummaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-29 13:52:50 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-29 13:52:50 -0400
commit59f0311087099d567fa0e75b3b03f6b2a5f2eca7 (patch)
tree9487366143a26af08ea8dd5d80b01a95d5d67357 /src/parse
parent5ab9adf6e57c516220a594f9e8b39e5214f1af2d (diff)
Remove special case for `while when`
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/controlflow.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/parse/controlflow.c b/src/parse/controlflow.c
index 2f07d925..1087e20e 100644
--- a/src/parse/controlflow.c
+++ b/src/parse/controlflow.c
@@ -131,18 +131,8 @@ ast_t *parse_while(parse_ctx_t *ctx, const char *pos) {
// while condition ["do"] [<indent>] body
const char *start = pos;
if (!match_word(&pos, "while")) return NULL;
-
- const char *tmp = pos;
- // Shorthand form: `while when ...`
- if (match_word(&tmp, "when")) {
- ast_t *when = expect(ctx, start, &pos, parse_when, "I expected a 'when' block after this");
- if (!when->__data.When.else_body) when->__data.When.else_body = NewAST(ctx->file, pos, pos, Stop);
- return NewAST(ctx->file, start, pos, Repeat, .body = when);
- }
-
- (void)match_word(&pos, "do"); // Optional 'do'
-
ast_t *condition = expect(ctx, start, &pos, parse_expr, "I don't see a viable condition for this 'while'");
+ (void)match_word(&pos, "do"); // Optional 'do'
ast_t *body = expect(ctx, start, &pos, parse_block, "I expected a body for this 'while'");
return NewAST(ctx->file, start, pos, While, .condition = condition, .body = body);
}