spl

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 24d39cdff122eb375989894089d1fd21816b315c
parent 1707b415c7ebbc747fb162b782ced1dacb1791b6
Author: Brian Swetland <swetland@frotz.net>
Date:   Tue, 17 Oct 2023 13:27:22 -0700

compiler0: support named enums

Diffstat:
Mbootstrap/compiler0.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/bootstrap/compiler0.c b/bootstrap/compiler0.c @@ -1494,6 +1494,12 @@ void parse_function(void) { } void parse_enum_def(void) { + if (ctx.tok == tIDN) { + String *name = parse_name("enum name"); + type_make(name, TYPE_ENUM, nil, nil, 0); + emit_type("typedef t$u32 t$%s; // enum\n", name->text); + } + require(tOBRACE); u32 val = 0; while (ctx.tok != tCBRACE) {