Clang format

This commit is contained in:
Krzosa Karol
2023-03-28 21:16:10 +02:00
parent f53d5dd1f2
commit 5495f96b3b
25 changed files with 9886 additions and 9989 deletions

View File

@@ -1,195 +1,195 @@
struct Lex_Stream{
String stream;
S64 iter;
struct Lex_Stream {
String stream;
S64 iter;
U8 *line_begin;
Intern_String file;
S32 line;
S32 inside_brace_paren;
Array<Token *> indent_stack; // @scratch_allocated
U8 *line_begin;
Intern_String file;
S32 line;
S32 inside_brace_paren;
Array<Token *> indent_stack; // @scratch_allocated
};
struct Core_Ctx{
Allocator *heap;
struct Core_Ctx {
Allocator *heap;
Arena perm_push_only;
Arena *perm; // Stores: AST, tokens, interns
Arena perm_push_only;
Arena *perm; // Stores: AST, tokens, interns
Arena *scratch;
Arena scratch_;
Arena stage_arena_;
Arena *stage_arena;
String_Builder helper_builder;
Arena *scratch;
Arena scratch_;
Arena stage_arena_;
Arena *stage_arena;
String_Builder helper_builder;
int errors_occured;
int warnings_occured;
Core_Message *first_message;
Core_Message *last_message;
int errors_occured;
int warnings_occured;
Core_Message *first_message;
Core_Message *last_message;
// Lexer stuff
Lex_Stream stream;
Array<Token> tokens;
Intern_Table interns;
S64 token_iter;
U32 token_debug_ids;
// Lexer stuff
Lex_Stream stream;
Array<Token> tokens;
Intern_Table interns;
S64 token_iter;
U32 token_debug_ids;
// Types
List<Ast_Type *> all_types;
S32 type_ids;
int lambda_ids;
U64 unique_ids; // @Debug
Map type_map;
// Types
List<Ast_Type *> all_types;
S32 type_ids;
int lambda_ids;
U64 unique_ids; // @Debug
Map type_map;
Ast_Module *custom_module;
Ast_Module *language_base_module;
Ast_Module *custom_module;
Ast_Module *language_base_module;
List<Ast_File *> files;
List<Ast_Module *> modules;
List<Ast_Decl *> ordered_decls;
S32 base_language_ordered_decl_len;
List<Ast_File *> files;
List<Ast_Module *> modules;
List<Ast_Decl *> ordered_decls;
S32 base_language_ordered_decl_len;
Ast_Scope *currently_parsed_scope;
Ast_File *currently_parsed_file;
U32 scope_ids;
U32 scope_visit_id;
Ast_Scope *currently_parsed_scope;
Ast_File *currently_parsed_file;
U32 scope_ids;
U32 scope_visit_id;
List<String> module_folders;
String module_folder;
String exe_folder;
String working_folder;
List<Token *> files_to_link;
List<String> module_folders;
String module_folder;
String exe_folder;
String working_folder;
List<Token *> files_to_link;
struct {
F64 typechecking;
F64 code_generation;
F64 total;
F64 init_context;
F64 parsing;
struct {
F64 typechecking;
F64 code_generation;
F64 total;
F64 init_context;
F64 parsing;
F64 start;
} time;
F64 start;
} time;
bool color_codes_enabled;
bool debugger_break_on_compiler_error;
bool color_codes_enabled;
bool debugger_break_on_compiler_error;
// Codegen stage mostly
S64 indent;
String_Builder gen;
// Codegen stage mostly
S64 indent;
String_Builder gen;
// Codegen stage configurables
bool emit_line_directives;
bool emit_type_info;
String symbol_prefix;
bool single_header_library_mode;
String single_header_library_name;
// Codegen stage configurables
bool emit_line_directives;
bool emit_type_info;
String symbol_prefix;
bool single_header_library_mode;
String single_header_library_name;
Token same_scope_token;
Token null_token;
Token same_scope_token;
Token null_token;
/*#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*/
/*#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*/
/*#import meta
size = 0
for i in meta.token_simple_expr:
if i[1] != "SPECIAL":
size += 1
print(f"Ast_Operator_Info op_info_table[{size}];")
*/
Ast_Operator_Info op_info_table[20];
/*END*/
/*#import meta
size = 0
for i in meta.token_simple_expr:
if i[1] != "SPECIAL":
size += 1
print(f"Ast_Operator_Info op_info_table[{size}];")
*/
Ast_Operator_Info op_info_table[20];
/*END*/
Ast_Type type__void;
Ast_Type type__string;
Ast_Type type__bool;
Ast_Type type__type;
Ast_Type type__void;
Ast_Type type__string;
Ast_Type type__bool;
Ast_Type type__type;
Ast_Type type__f32;
Ast_Type type__f64;
Ast_Type type__f32;
Ast_Type type__f64;
Ast_Type type__s8 ;
Ast_Type type__s16;
Ast_Type type__s32;
Ast_Type type__s64;
Ast_Type type__s8;
Ast_Type type__s16;
Ast_Type type__s32;
Ast_Type type__s64;
Ast_Type type__u8 ;
Ast_Type type__u16;
Ast_Type type__u32;
Ast_Type type__u64;
Ast_Type type__u8;
Ast_Type type__u16;
Ast_Type type__u32;
Ast_Type type__u64;
Ast_Type type__untyped_bool;
Ast_Type type__untyped_int;
Ast_Type type__untyped_string;
Ast_Type type__untyped_float;
Ast_Type type__untyped_bool;
Ast_Type type__untyped_int;
Ast_Type type__untyped_string;
Ast_Type type__untyped_float;
Ast_Type type__char;
Ast_Type type__int;
Ast_Type type__char;
Ast_Type type__int;
Ast_Type *type_char = &type__char;
Ast_Type *type_int = &type__int;
Ast_Type *type_void = &type__void;
Ast_Type *type_char = &type__char;
Ast_Type *type_int = &type__int;
Ast_Type *type_void = &type__void;
Ast_Type *type_pointer_to_char;
Ast_Type *type_pointer_to_void;
Ast_Type *type_any; // Needs to be inited at runtime
Ast_Type *type_pointer_to_char;
Ast_Type *type_pointer_to_void;
Ast_Type *type_any; // Needs to be inited at runtime
Ast_Type *type_type = &type__type;
Ast_Type *type_string = &type__string;
Ast_Type *type_bool = &type__bool;
Ast_Type *type_type = &type__type;
Ast_Type *type_string = &type__string;
Ast_Type *type_bool = &type__bool;
Ast_Type *type_f32 = &type__f32;
Ast_Type *type_f64 = &type__f64;
Ast_Type *type_f32 = &type__f32;
Ast_Type *type_f64 = &type__f64;
Ast_Type *type_s8 = &type__s8 ;
Ast_Type *type_s16 = &type__s16;
Ast_Type *type_s32 = &type__s32;
Ast_Type *type_s64 = &type__s64;
Ast_Type *type_s8 = &type__s8;
Ast_Type *type_s16 = &type__s16;
Ast_Type *type_s32 = &type__s32;
Ast_Type *type_s64 = &type__s64;
Ast_Type *type_u8 = &type__u8 ;
Ast_Type *type_u16 = &type__u16;
Ast_Type *type_u32 = &type__u32;
Ast_Type *type_u64 = &type__u64;
Ast_Type *type_u8 = &type__u8;
Ast_Type *type_u16 = &type__u16;
Ast_Type *type_u32 = &type__u32;
Ast_Type *type_u64 = &type__u64;
Ast_Type *untyped_string = &type__untyped_string;
Ast_Type *untyped_bool = &type__untyped_bool;
Ast_Type *untyped_int = &type__untyped_int;
Ast_Type *untyped_float = &type__untyped_float;
Ast_Type *untyped_string = &type__untyped_string;
Ast_Type *untyped_bool = &type__untyped_bool;
Ast_Type *untyped_int = &type__untyped_int;
Ast_Type *untyped_float = &type__untyped_float;
Intern_String intern(String string){
assert(string.len > 0);
return intern_string(&interns, string);
}
Intern_String intern(String string) {
assert(string.len > 0);
return intern_string(&interns, string);
}
};
CORE_Static String compile_to_c_code();