parser/ast: Some renaming and namespacing of enumerations
This commit is contained in:
@@ -11,18 +11,18 @@
|
|||||||
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},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user