From 9901f09ca4e52ed389710429c8eb8509d90cced7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 14 Feb 2024 13:43:23 -0500 Subject: Syntax tweaks and cleanup --- parse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 00394135..d87675ed 100644 --- a/parse.c +++ b/parse.c @@ -1405,7 +1405,7 @@ PARSER(parse_struct_def) { if (!name) parser_err(ctx, start, pos, "I expected a name for this struct"); spaces(&pos); - if (!match(&pos, "(")) + if (!match(&pos, "{")) parser_err(ctx, pos, pos, "I expected a '(' and a list of fields here"); arg_ast_t *fields = parse_args(ctx, &pos, false); @@ -1425,7 +1425,7 @@ PARSER(parse_struct_def) { } } - expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this struct"); + expect_closing(ctx, &pos, "}", "I wasn't able to parse the rest of this struct"); const char *ns_pos = pos; whitespace(&ns_pos); @@ -1441,7 +1441,7 @@ PARSER(parse_struct_def) { } ast_t *parse_enum_def(parse_ctx_t *ctx, const char *pos) { - // tagged union: enum Foo(a|b(x:Int,y:Int)=5|...) \n namespace + // tagged union: enum Foo[a, b(x:Int,y:Int)=5, ...] \n namespace const char *start = pos; if (!match_word(&pos, "enum")) return NULL; int64_t starting_indent = get_indent(ctx->file, pos); @@ -1450,7 +1450,7 @@ ast_t *parse_enum_def(parse_ctx_t *ctx, const char *pos) { if (!name) parser_err(ctx, start, pos, "I expected a name for this enum"); spaces(&pos); - if (!match(&pos, "(")) return NULL; + if (!match(&pos, "[")) return NULL; tag_ast_t *tags = NULL; int64_t next_value = 0; @@ -1498,7 +1498,7 @@ ast_t *parse_enum_def(parse_ctx_t *ctx, const char *pos) { } whitespace(&pos); - expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this enum definition"); + expect_closing(ctx, &pos, "]", "I wasn't able to parse the rest of this enum definition"); REVERSE_LIST(tags); -- cgit v1.2.3