aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-21 19:34:25 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-21 19:34:25 -0400
commit864515595e8798273f55979fcb28040c4c7f50e5 (patch)
tree5aeb25a4bc20723492975a6dc3c2e65c2b52fe81 /src
parente2449c99d2831799f86bf530d1add0ea5537e96f (diff)
Allow comprehensions inside parentheses
Diffstat (limited to 'src')
-rw-r--r--src/parse.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/parse.c b/src/parse.c
index b5ca090a..59caabaa 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -478,6 +478,14 @@ PARSER(parse_parens) {
whitespace(&pos);
ast_t *expr = optional(ctx, &pos, parse_extended_expr);
if (!expr) return NULL;
+
+ ast_t *comprehension = parse_comprehension_suffix(ctx, expr);
+ while (comprehension) {
+ expr = comprehension;
+ pos = comprehension->end;
+ comprehension = parse_comprehension_suffix(ctx, expr);
+ }
+
whitespace(&pos);
expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this expression");