parser/ast: Some renaming and namespacing of enumerations

This commit is contained in:
2026-01-24 02:21:12 +00:00
parent 10613f4a75
commit f09e720c7f
2 changed files with 13 additions and 13 deletions

View File

@@ -11,8 +11,8 @@
obj_t obj_string(u64 byte, sv_t string) obj_t obj_string(u64 byte, sv_t string)
{ {
return (obj_t){ return (obj_t){
.byte = byte, .byte_location = byte,
.type = TYPE_STRING, .type = OBJ_TYPE_STRING,
.value = {string}, .value = {string},
}; };
} }
@@ -20,8 +20,8 @@ obj_t obj_string(u64 byte, sv_t string)
obj_t obj_symbol(u64 byte, sv_t symbol) obj_t obj_symbol(u64 byte, sv_t symbol)
{ {
return (obj_t){ return (obj_t){
.byte = byte, .byte_location = byte,
.type = TYPE_SYMBOL, .type = OBJ_TYPE_SYMBOL,
.value = {symbol}, .value = {symbol},
}; };
} }
@@ -35,10 +35,10 @@ void obj_print(FILE *fp, obj_t *obj)
} }
switch (obj->type) switch (obj->type)
{ {
case TYPE_SYMBOL: case OBJ_TYPE_SYMBOL:
fprintf(fp, "SYMBOL(" PR_SV ")", SV_FMT(obj->value.as_symbol)); fprintf(fp, "SYMBOL(" PR_SV ")", SV_FMT(obj->value.as_symbol));
break; break;
case TYPE_STRING: case OBJ_TYPE_STRING:
fprintf(fp, "STRING(" PR_SV ")", SV_FMT(obj->value.as_string)); fprintf(fp, "STRING(" PR_SV ")", SV_FMT(obj->value.as_string));
break; break;
} }

View File

@@ -15,15 +15,15 @@
/// Types the AST can encode /// Types the AST can encode
typedef enum typedef enum
{ {
TYPE_SYMBOL, OBJ_TYPE_SYMBOL,
TYPE_STRING, OBJ_TYPE_STRING,
} type_t; } obj_type_t;
/// Node of the AST as a tagged union /// Node of the AST as a tagged union
typedef struct typedef struct
{ {
u64 byte; u64 byte_location;
type_t type; obj_type_t type;
union union
{ {
sv_t as_string; sv_t as_string;