diff options
Diffstat (limited to 'include/type.h')
-rw-r--r-- | include/type.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/include/type.h b/include/type.h index 78a3d18..c8a6b76 100644 --- a/include/type.h +++ b/include/type.h @@ -2,6 +2,12 @@ #define CERC_TYPE_H #include <stdbool.h> #include <stdint.h> +#include "expr.h" +#include "lex.h" +#include "util.h" + +// Only 64-bit targets are supported +#define PLATBITS 64 struct cer_int { bool sign; @@ -14,11 +20,7 @@ struct cer_float { struct cer_array { struct type *member_type; - int length; -}; - -struct cer_slice { - struct type *member_type; + struct disjunction_e *length; }; struct field { @@ -28,6 +30,7 @@ struct field { struct cer_struct { struct field *fields; + int fieldsz, fieldlen; }; struct variant { @@ -36,12 +39,15 @@ struct variant { }; struct cer_enum { - struct cer_int tag_type; - struct variant variants[]; + struct type *tag_type; + struct variant *variants; + int variantsz, variantlen; }; struct cer_union { + struct type *tag_type; struct type *alts; + int altsz, altlen; }; enum type_kind { @@ -52,6 +58,7 @@ enum type_kind { TYP_FLOAT, TYP_INT, TYP_OPTIONAL, + TYP_PATH, TYP_POINTER, TYP_SLICE, TYP_STRUCT, @@ -62,10 +69,11 @@ union type_desc { struct cer_int i; struct cer_float f; struct cer_array array; - struct cer_slice slice; struct cer_struct s; struct cer_enum en; struct cer_union un; + struct type *inner; + struct path path; }; struct type { |