diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:34:23 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-06 16:34:23 -0400 |
| commit | 52e50e58c6674560056a4dcb787099d739284b02 (patch) | |
| tree | e814b9d779e523c042f938161aadd7dd589327cf /src/parse.c | |
| parent | 6fda59fd5e57e9267d2ec0480d53b5f9b0546855 (diff) | |
Change Set syntax from {x} to |x|
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 0f76243d..b0f9206d 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); } |
