aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-13 13:39:44 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-13 13:39:44 -0400
commit63e6ba596ae8e35727289a69b11d5640bfc5e49e (patch)
tree2a6e3022103f42898da7c02640e2dab817b36b88 /parse.c
parentcc0763713495a2b5b154d318772fc7f745e96635 (diff)
Change table syntax to {key:value} instead of {key=>value}
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/parse.c b/parse.c
index 4d283918..fd071a0e 100644
--- a/parse.c
+++ b/parse.c
@@ -466,7 +466,7 @@ type_ast_t *parse_table_type(parse_ctx_t *ctx, const char *pos) {
if (!key_type) return NULL;
pos = key_type->end;
whitespace(&pos);
- if (!match(&pos, "=>")) return NULL;
+ if (!match(&pos, ":")) return NULL;
type_ast_t *value_type = expect(ctx, start, &pos, parse_type, "I couldn't parse the rest of this table type");
whitespace(&pos);
expect_closing(ctx, &pos, "}", "I wasn't able to parse the rest of this table type");
@@ -658,8 +658,8 @@ PARSER(parse_table) {
whitespace(&pos);
key_type = expect(ctx, pos-1, &pos, parse_type, "I couldn't parse a key type for this table");
whitespace(&pos);
- if (!match(&pos, "=>"))
- parser_err(ctx, pos, pos, "I expected an '=>' for this table type");
+ if (!match(&pos, ":"))
+ parser_err(ctx, pos, pos, "I expected an ':' for this table type");
value_type = expect(ctx, pos-1, &pos, parse_type, "I couldn't parse a value type for this table");
whitespace(&pos);
}
@@ -669,7 +669,7 @@ PARSER(parse_table) {
ast_t *key = optional(ctx, &pos, parse_extended_expr);
if (!key) break;
whitespace(&pos);
- if (!match(&pos, "=>")) return NULL;
+ if (!match(&pos, ":")) return NULL;
ast_t *value = expect(ctx, pos-1, &pos, parse_expr, "I couldn't parse the value for this table entry");
ast_t *entry = NewAST(ctx->file, entry_start, pos, TableEntry, .key=key, .value=value);
ast_t *suffixed = parse_comprehension_suffix(ctx, entry);