112 lines
4.2 KiB
C++
112 lines
4.2 KiB
C++
global B32 emit_line_directives = true;
|
|
global B32 emit_type_info = true;
|
|
global String symbol_prefix = ""_s;
|
|
global B32 single_header_library_mode = false;
|
|
global String single_header_library_name = ""_s;
|
|
global bool color_codes_enabled;
|
|
|
|
thread_local Core_Ctx *pctx;
|
|
|
|
|
|
Arena *bigint_allocator;
|
|
global S64 bigint_allocation_count;
|
|
|
|
global Token token_null = {SAME_SCOPE};
|
|
global Token null_token; // @todo: memes, why the above is called null?
|
|
|
|
/*#import meta
|
|
for i in meta.keywords: print(f'Intern_String keyword_{i.lower()};')
|
|
for i in meta.interns: print(f'Intern_String intern_{i.lower()};')
|
|
|
|
*/
|
|
Intern_String keyword_struct;
|
|
Intern_String keyword_union;
|
|
Intern_String keyword_true;
|
|
Intern_String keyword_default;
|
|
Intern_String keyword_break;
|
|
Intern_String keyword_false;
|
|
Intern_String keyword_return;
|
|
Intern_String keyword_switch;
|
|
Intern_String keyword_assert;
|
|
Intern_String keyword_if;
|
|
Intern_String keyword_elif;
|
|
Intern_String keyword_pass;
|
|
Intern_String keyword_else;
|
|
Intern_String keyword_for;
|
|
Intern_String keyword_enum;
|
|
Intern_String intern_typeof;
|
|
Intern_String intern_sizeof;
|
|
Intern_String intern_len;
|
|
Intern_String intern_alignof;
|
|
Intern_String intern_foreign;
|
|
Intern_String intern_strict;
|
|
Intern_String intern_void;
|
|
Intern_String intern_flag;
|
|
Intern_String intern_it;
|
|
Intern_String intern_load;
|
|
Intern_String intern_import;
|
|
Intern_String intern_link;
|
|
/*END*/
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Type globals
|
|
//-----------------------------------------------------------------------------
|
|
const uintptr_t pointer_size = sizeof(uintptr_t);
|
|
const uintptr_t pointer_align = __alignof(uintptr_t);
|
|
global Ast_Type type__void = {TYPE_VOID};
|
|
global Ast_Type type__string = {TYPE_STRING, sizeof(String), __alignof(String)};
|
|
global Ast_Type type__bool = {TYPE_BOOL, sizeof(bool), __alignof(bool)};
|
|
global Ast_Type type__type = {TYPE_TYPE, sizeof(S64), __alignof(S64)};
|
|
|
|
global Ast_Type type__f32 = {TYPE_F32, sizeof(F32), __alignof(F32)};
|
|
global Ast_Type type__f64 = {TYPE_F64, sizeof(F64), __alignof(F64)};
|
|
|
|
global Ast_Type type__s8 = {TYPE_S8, sizeof(S8), __alignof(S8)};
|
|
global Ast_Type type__s16 = {TYPE_S16, sizeof(S16), __alignof(S16)};
|
|
global Ast_Type type__s32 = {TYPE_S32, sizeof(S32), __alignof(S32)};
|
|
global Ast_Type type__s64 = {TYPE_S64, sizeof(S64), __alignof(S64)};
|
|
|
|
global Ast_Type type__u8 = {TYPE_U8, sizeof(U8), __alignof(U8), true};
|
|
global Ast_Type type__u16 = {TYPE_U16, sizeof(U16), __alignof(U16), true};
|
|
global Ast_Type type__u32 = {TYPE_U32, sizeof(U32), __alignof(U32), true};
|
|
global Ast_Type type__u64 = {TYPE_U64, sizeof(U64), __alignof(U64), true};
|
|
|
|
global Ast_Type type__untyped_bool = {TYPE_UNTYPED_BOOL, sizeof(bool), __alignof(bool)};
|
|
global Ast_Type type__untyped_int = {TYPE_UNTYPED_INT, sizeof(S64), __alignof(S64)};
|
|
global Ast_Type type__untyped_string = {TYPE_UNTYPED_STRING, sizeof(String), __alignof(String)};
|
|
global Ast_Type type__untyped_float = {TYPE_UNTYPED_FLOAT, sizeof(double), __alignof(double)};
|
|
|
|
global Ast_Type type__char = {TYPE_CHAR, sizeof(char), __alignof(char)};
|
|
global Ast_Type type__int = {TYPE_INT, sizeof(int), __alignof(int)};
|
|
global Ast_Type *type_char = &type__char;
|
|
global Ast_Type *type_int = &type__int;
|
|
global Ast_Type *type_void = &type__void;
|
|
|
|
global Ast_Type *type_pointer_to_char; // Needs to be inited at runtime
|
|
global Ast_Type *type_pointer_to_void; // Needs to be inited at runtime
|
|
global Ast_Type *type_any; // Needs to be inited at runtime
|
|
|
|
global Ast_Type *type_type = &type__type;
|
|
global Ast_Type *type_string = &type__string;
|
|
global Ast_Type *type_bool = &type__bool;
|
|
|
|
global Ast_Type *type_f32 = &type__f32;
|
|
global Ast_Type *type_f64 = &type__f64;
|
|
|
|
global Ast_Type *type_s8 = &type__s8 ;
|
|
global Ast_Type *type_s16 = &type__s16;
|
|
global Ast_Type *type_s32 = &type__s32;
|
|
global Ast_Type *type_s64 = &type__s64;
|
|
|
|
global Ast_Type *type_u8 = &type__u8 ;
|
|
global Ast_Type *type_u16 = &type__u16;
|
|
global Ast_Type *type_u32 = &type__u32;
|
|
global Ast_Type *type_u64 = &type__u64;
|
|
|
|
global Ast_Type *untyped_string = &type__untyped_string;
|
|
global Ast_Type *untyped_bool = &type__untyped_bool;
|
|
global Ast_Type *untyped_int = &type__untyped_int;
|
|
global Ast_Type *untyped_float = &type__untyped_float;
|
|
|
|
|