diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:36:40 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:36:40 -0400 |
| commit | 6d12f1dce744146dfa9072d574c540e1d49bb31b (patch) | |
| tree | 4ffc721508ba25a6f125147873446365820dd0ff /src/parse.c | |
| parent | 2640c138b305b558bccf1d36f3f0d54fab96e84c (diff) | |
| parent | 52e50e58c6674560056a4dcb787099d739284b02 (diff) | |
Merge branch 'main' into no-colons
Diffstat (limited to 'src/parse.c')
| -rw-r--r-- | src/parse.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/parse.c b/src/parse.c index ca6a6af2..d9f06371 100644 --- a/src/parse.c +++ b/src/parse.c @@ -520,14 +520,13 @@ type_ast_t *parse_table_type(parse_ctx_t *ctx, const char *pos) { type_ast_t *parse_set_type(parse_ctx_t *ctx, const char *pos) { const char *start = pos; - if (!match(&pos, "{")) return NULL; + if (!match(&pos, "|")) return NULL; whitespace(&pos); type_ast_t *item_type = parse_type(ctx, pos); if (!item_type) return NULL; pos = item_type->end; whitespace(&pos); - if (match(&pos, ",")) return NULL; - expect_closing(ctx, &pos, "}", "I wasn't able to parse the rest of this set type"); + expect_closing(ctx, &pos, "|", "I wasn't able to parse the rest of this set type"); return NewTypeAST(ctx->file, start, pos, SetTypeAST, .item=item_type); } @@ -706,7 +705,6 @@ PARSER(parse_array) { PARSER(parse_table) { const char *start = pos; - if (match(&pos, "{/}")) return NULL; if (!match(&pos, "{")) return NULL; whitespace(&pos); @@ -768,10 +766,10 @@ PARSER(parse_table) { PARSER(parse_set) { const char *start = pos; - if (match(&pos, "{/}")) + if (match(&pos, "||")) return NewAST(ctx->file, start, pos, Set); - if (!match(&pos, "{")) return NULL; + if (!match(&pos, "|")) return NULL; whitespace(&pos); @@ -780,7 +778,6 @@ PARSER(parse_set) { ast_t *item = optional(ctx, &pos, parse_extended_expr); if (!item) break; whitespace(&pos); - if (match(&pos, "=")) return NULL; ast_t *suffixed = parse_comprehension_suffix(ctx, item); while (suffixed) { item = suffixed; @@ -795,7 +792,7 @@ PARSER(parse_set) { REVERSE_LIST(items); whitespace(&pos); - expect_closing(ctx, &pos, "}", "I wasn't able to parse the rest of this set"); + expect_closing(ctx, &pos, "|", "I wasn't able to parse the rest of this set"); return NewAST(ctx->file, start, pos, Set, .items=items); } |
