New types, Value rework, Sym cleanup
This commit is contained in:
26
new_ast.cpp
26
new_ast.cpp
@@ -18,7 +18,7 @@ Intern_String keyword_enum;
|
||||
Intern_String intern_void;
|
||||
Intern_String intern_int;
|
||||
Intern_String intern_str;
|
||||
Intern_String intern_unsigned;
|
||||
Intern_String intern_uint;
|
||||
|
||||
struct Ast_Package;
|
||||
struct Sym;
|
||||
@@ -67,10 +67,10 @@ struct Parse_Ctx:Lexer{
|
||||
interns.first_keyword = keyword_struct.str;
|
||||
interns.last_keyword = keyword_enum.str;
|
||||
|
||||
intern_void = intern_string(&interns, "void"_s);
|
||||
intern_int = intern_string(&interns, "int"_s);
|
||||
intern_void = intern_string(&interns, "Void"_s);
|
||||
intern_int = intern_string(&interns, "Int"_s);
|
||||
intern_str = intern_string(&interns, "String"_s);
|
||||
intern_unsigned = intern_string(&interns, "unsigned"_s);
|
||||
intern_uint = intern_string(&interns, "UInt"_s);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -133,11 +133,21 @@ struct Ast{
|
||||
struct Ast_Resolved_Type;
|
||||
struct Ast_Expr:Ast{};
|
||||
|
||||
#define VALUE_FIELDS \
|
||||
Ast_Resolved_Type *type; \
|
||||
union{ \
|
||||
bool bool_val; \
|
||||
F64 f64_val; \
|
||||
F32 f32_val; \
|
||||
S64 int_val; \
|
||||
Intern_String intern_val; \
|
||||
Ast_Resolved_Type *type_val; \
|
||||
};
|
||||
#define INLINE_VALUE_FIELDS union{Value value; struct{VALUE_FIELDS};}
|
||||
struct Value{VALUE_FIELDS};
|
||||
|
||||
struct Ast_Atom: Ast_Expr{
|
||||
union{
|
||||
Intern_String intern_val;
|
||||
U64 int_val;
|
||||
};
|
||||
INLINE_VALUE_FIELDS;
|
||||
};
|
||||
|
||||
struct Ast_Call_Item: Ast_Expr{
|
||||
|
||||
Reference in New Issue
Block a user