diff --git a/src/compiler.bbb b/src/compiler.bbb index b2825a9..c6f0187 100644 --- a/src/compiler.bbb +++ b/src/compiler.bbb @@ -7170,12 +7170,55 @@ parse = fn (module: &Module) void if (is_generic) { + while (1) + { + skip_space(module); + + if (consume_character_if_match(module, right_bracket)) + { + break; + } + + >argument_name = arena_duplicate_string(module.arena, parse_identifier(module)); + + skip_space(module); + + >has_value = consume_character_if_match(module, ':'); + + >constant_argument_index = constant_argument_count; + + if (has_value) + { + #trap(); + } + else + { + >ty = new_type(module, { + .id = .unresolved, + .name = argument_name, + .scope = ¯o_declaration.scope, + zero, + }); + + constant_argument_buffer[constant_argument_index] = { + .name = argument_name, + .content = { + .type = ty, + }, + .id = .type, + }; + } + + constant_argument_count += 1; + } + + skip_space(module); + // END OF SCOPE if (constant_argument_count == 0) { report_error(); } - #trap(); } else { @@ -16929,6 +16972,7 @@ names: [_][]u8 = "slice_array_literal", "slice_only_start", "basic_macro", + "generic_macro", ]; [export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32