move type enum out of struct

This commit is contained in:
r4
2021-12-28 13:55:01 +01:00
parent 0d5313a063
commit befce544e7
6 changed files with 61 additions and 69 deletions

28
tok.h
View File

@@ -5,21 +5,17 @@
#include "util.h"
typedef struct Type {
enum {
TypeVoid = 0,
TypeFloat,
TypeInt,
TypeBool,
TypeChar,
TypePtr,
TypeArr,
TypeEnumSize,
} kind;
/*union {
};*/
} Type;
enum Type {
TypeVoid = 0,
TypeFloat,
TypeInt,
TypeBool,
TypeChar,
TypePtr,
TypeArr,
TypeEnumSize,
};
typedef enum Type Type;
extern size_t type_size[TypeEnumSize];
extern const char *type_str[TypeEnumSize];
@@ -38,8 +34,8 @@ typedef struct Value {
struct Value *val;
} Ptr;
struct {
bool is_string : 1;
Type type;
bool is_string : 1;
void *vals;
size_t len, cap;
} Arr;