pregress on fixing regressions with unreal parsing

https://github.com/Ed94/gencpp/issues/64 is required. Resolving it next
This commit is contained in:
2024-12-14 11:24:21 -05:00
parent 683f13deab
commit 3c249d2fae
16 changed files with 439 additions and 161 deletions

View File

@ -1165,7 +1165,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for (Code code_entry = begin_CodeBody(body); code_entry != end_CodeBody(body); next_CodeBody(body, code_entry)) switch (code_entry->Type)
{
GEN_AST_BODY_CLASS_UNALLOWED_TYPES:
GEN_AST_BODY_CLASS_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(code_entry));
return false;
@ -1192,7 +1192,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for (Code code_entry = begin_CodeBody(body); code_entry != end_CodeBody(body); next_CodeBody(body, code_entry)) switch (code_entry->Type)
{
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES:
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(code_entry));
return false;
@ -1206,7 +1206,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for (Code code_entry = begin_CodeBody(body); code_entry != end_CodeBody(body); next_CodeBody(body, code_entry)) switch (code_entry->Type)
{
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES:
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(code_entry));
return false;
@ -1220,7 +1220,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for (Code code_entry = begin_CodeBody(body); code_entry != end_CodeBody(body); next_CodeBody(body, code_entry)) switch (code_entry->Type)
{
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES:
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(code_entry));
return false;
@ -1234,7 +1234,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for ( Code entry = begin_CodeBody(body); entry != end_CodeBody(body); next_CodeBody(body, entry) )switch (entry->Type)
{
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES:
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(entry));
return false;
}
@ -1245,7 +1245,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for ( Code entry = begin_CodeBody(body); entry != end_CodeBody(body); next_CodeBody(body, entry) ) switch (entry->Type)
{
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES:
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(entry));
return false;
}
@ -1256,7 +1256,7 @@ bool code_validate_body(Code self)
CodeBody body = cast(CodeBody, self);
for ( Code entry = begin_CodeBody(body); entry != end_CodeBody(body); next_CodeBody(body, entry) ) switch (entry->Type)
{
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES:
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES_CASES:
log_failure("AST::validate_body: Invalid entry in body %S", code_debug_str(entry));
return false;
}

View File

@ -1,6 +1,6 @@
// These macros are used in the swtich cases are used within ast.cpp, inteface.upfront.cpp, parser.cpp
// These macros are used in the swtich cases within ast.cpp, inteface.upfront.cpp, parser.cpp
# define GEN_AST_BODY_CLASS_UNALLOWED_TYPES \
# define GEN_AST_BODY_CLASS_UNALLOWED_TYPES_CASES \
case CT_PlatformAttributes: \
case CT_Class_Body: \
case CT_Enum_Body: \
@ -16,9 +16,9 @@
case CT_Specifiers: \
case CT_Struct_Body: \
case CT_Typename
# define GEN_AST_BODY_STRUCT_UNALLOWED_TYPES GEN_AST_BODY_CLASS_UNALLOWED_TYPES
# define GEN_AST_BODY_STRUCT_UNALLOWED_TYPES_CASES GEN_AST_BODY_CLASS_UNALLOWED_TYPES_CASES
# define GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES \
# define GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES_CASES \
case CT_Access_Public: \
case CT_Access_Protected: \
case CT_Access_Private: \
@ -41,7 +41,7 @@
case CT_Struct_Body: \
case CT_Typename
# define GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES \
# define GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES \
case CT_Access_Public: \
case CT_Access_Protected: \
case CT_Access_Private: \
@ -58,10 +58,10 @@
case CT_Specifiers: \
case CT_Struct_Body: \
case CT_Typename
# define GEN_AST_BODY_EXPORT_UNALLOWED_TYPES GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
# define GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
# define GEN_AST_BODY_EXPORT_UNALLOWED_TYPES_CASES GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES
# define GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES_CASES GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES
# define GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES \
# define GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES_CASES \
case CT_Access_Public: \
case CT_Access_Protected: \
case CT_Access_Private: \

View File

@ -1364,7 +1364,7 @@ CodeBody def_class_body( s32 num, ... )
}
switch (entry->Type)
{
GEN_AST_BODY_CLASS_UNALLOWED_TYPES:
GEN_AST_BODY_CLASS_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1396,7 +1396,7 @@ CodeBody def_class_body( s32 num, Code* codes )
}
switch (entry->Type)
{
GEN_AST_BODY_CLASS_UNALLOWED_TYPES:
GEN_AST_BODY_CLASS_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1486,7 +1486,7 @@ CodeBody def_export_body( s32 num, ... )
}
switch (entry->Type)
{
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES:
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1518,7 +1518,7 @@ CodeBody def_export_body( s32 num, Code* codes )
}
switch (entry->Type)
{
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES:
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1552,7 +1552,7 @@ CodeBody def_extern_link_body( s32 num, ... )
}
switch (entry->Type)
{
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES:
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1585,7 +1585,7 @@ CodeBody def_extern_link_body( s32 num, Code* codes )
}
switch (entry->Type)
{
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES:
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1619,7 +1619,7 @@ CodeBody def_function_body( s32 num, ... )
}
switch (entry->Type)
{
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES:
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES_CASES:
log_failure("gen::" stringize(def_function_body) ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1651,7 +1651,7 @@ CodeBody def_function_body( s32 num, Code* codes )
}
switch (entry->Type)
{
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES:
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_function_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1690,7 +1690,7 @@ CodeBody def_global_body( s32 num, ... )
body_append_body( result, cast(CodeBody, entry) );
continue;
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES:
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1726,7 +1726,7 @@ CodeBody def_global_body( s32 num, Code* codes )
body_append_body(result, cast(CodeBody, entry) );
continue;
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES:
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1761,7 +1761,7 @@ CodeBody def_namespace_body( s32 num, ... )
}
switch (entry->Type)
{
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES:
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1793,7 +1793,7 @@ CodeBody def_namespace_body( s32 num, Code* codes )
}
switch (entry->Type)
{
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES:
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", code_debug_str(entry) );
return InvalidCode;
@ -1938,7 +1938,7 @@ CodeBody def_struct_body( s32 num, ... )
}
switch (entry->Type)
{
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES:
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", code_debug_str(entry));
return InvalidCode;
@ -1970,7 +1970,7 @@ CodeBody def_struct_body( s32 num, Code* codes )
}
switch (entry->Type)
{
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES:
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES_CASES:
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", code_debug_str(entry) );
return InvalidCode;

View File

@ -1,6 +1,7 @@
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
#include "gen/etoktype.cpp"
#include "parser_case_macros.cpp"
#include "interface.upfront.cpp"
#include "lexer.cpp"
#endif
@ -979,17 +980,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
// <Attributes>
}
//! Fallthrough intended
case Tok_Spec_Consteval:
case Tok_Spec_Constexpr:
case Tok_Spec_Constinit:
case Tok_Spec_Explicit:
case Tok_Spec_ForceInline:
case Tok_Spec_Inline:
case Tok_Spec_Mutable:
case Tok_Spec_NeverInline:
case Tok_Spec_Static:
case Tok_Spec_Volatile:
case Tok_Spec_Virtual:
GEN_PARSER_CLASS_STRUCT_BODY_ALLOWED_MEMBER_TOK_SPECIFIERS_CASES:
{
Specifier specs_found[16] = { Spec_NumSpecifiers };
s32 NumSpecifiers = 0;
@ -1002,16 +993,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
switch ( spec )
{
case Spec_Constexpr:
case Spec_Constinit:
case Spec_Explicit:
case Spec_Inline:
case Spec_ForceInline:
case Spec_Mutable:
case Spec_NeverInline:
case Spec_Static:
case Spec_Volatile:
case Spec_Virtual:
GEN_PARSER_CLASS_STRUCT_BODY_ALLOWED_MEMBER_SPECIFIERS_CASES:
break;
case Spec_Consteval:
@ -1023,7 +1005,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
break;
default:
log_failure( "Invalid specifier %S for variable\n%S", spec_to_str(spec), strbuilder_to_str( parser_to_strbuilder(_ctx->parser)) );
log_failure( "Invalid specifier %S for class/struct member\n%S", spec_to_str(spec), strbuilder_to_str( parser_to_strbuilder(_ctx->parser)) );
parser_pop(& _ctx->parser);
return InvalidCode;
}
@ -1792,16 +1774,7 @@ CodeBody parse_global_nspace( CodeType which )
// <Attributes>
}
//! Fallthrough intentional
case Tok_Spec_Consteval:
case Tok_Spec_Constexpr:
case Tok_Spec_Constinit:
case Tok_Spec_Extern:
case Tok_Spec_ForceInline:
case Tok_Spec_Global:
case Tok_Spec_Inline:
case Tok_Spec_Internal_Linkage:
case Tok_Spec_NeverInline:
case Tok_Spec_Static:
GEN_PARSER_CLASS_GLOBAL_NSPACE_ALLOWED_MEMBER_TOK_SPECIFIERS_CASES:
{
Specifier specs_found[16] = { Spec_NumSpecifiers };
s32 NumSpecifiers = 0;
@ -1814,17 +1787,7 @@ CodeBody parse_global_nspace( CodeType which )
switch ( spec )
{
case Spec_Constexpr:
case Spec_Constinit:
case Spec_ForceInline:
case Spec_Global:
case Spec_External_Linkage:
case Spec_Internal_Linkage:
case Spec_Inline:
case Spec_Mutable:
case Spec_NeverInline:
case Spec_Static:
case Spec_Volatile:
GEN_PARSER_CLASS_GLOBAL_NSPACE_ALLOWED_MEMBER_SPECIFIERS_CASES:
break;
case Spec_Consteval:
@ -2560,7 +2523,7 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
#ifndef GEN_PARSER_DISABLE_MACRO_FUNCTION_SIGNATURES
b32 lone_macro = false;
if ( currtok.Type == Tok_Preprocess_Macro && nexttok.Type == Tok_Statement_End )
if ( currtok.Type == Tok_Preprocess_Macro && ( nexttok.Type == Tok_Statement_End || nexttok.Type == Tok_Comment ) )
{
// Were dealing with a lone macro after attributes/specifiers, there was a end statement ';' after.
result = parse_simple_preprocess( Tok_Preprocess_Macro, parser_consume_braces );
@ -3971,10 +3934,8 @@ CodeFriend parser_parse_friend()
switch ( spec )
{
case Spec_Const :
case Spec_Inline :
case Spec_ForceInline :
break;
GEN_PARSER_FRIEND_ALLOWED_SPECIFIERS_CASES:
break;
default :
log_failure( "Invalid specifier %S for friend definition\n%S", spec_to_str( spec ), strbuilder_to_str( parser_to_strbuilder(_ctx->parser)) );
@ -4095,14 +4056,7 @@ CodeFn parser_parse_function()
switch ( spec )
{
case Spec_Const:
case Spec_Consteval:
case Spec_Constexpr:
case Spec_External_Linkage:
case Spec_ForceInline:
case Spec_Inline:
case Spec_NeverInline:
case Spec_Static:
GEN_PARSER_FUNCTION_ALLOWED_SPECIFIERS_CASES:
break;
default:
@ -4208,12 +4162,7 @@ CodeOperator parser_parse_operator()
switch ( spec )
{
case Spec_Const:
case Spec_Constexpr:
case Spec_ForceInline:
case Spec_Inline:
case Spec_NeverInline:
case Spec_Static:
GEN_PARSER_OPERATOR_ALLOWED_SPECIFIERS_CASES:
break;
default:
@ -4451,19 +4400,8 @@ CodeTemplate parser_parse_template()
switch ( spec )
{
case Spec_Const :
case Spec_Constexpr :
case Spec_Constinit :
case Spec_External_Linkage :
case Spec_Global :
case Spec_Inline :
case Spec_ForceInline :
case Spec_Local_Persist :
case Spec_Mutable :
case Spec_Static :
case Spec_Thread_Local :
case Spec_Volatile :
break;
GEN_PARSER_TEMPLATE_ALLOWED_SPECIFIERS_CASES:
break;
case Spec_Consteval :
expects_function = true;
@ -5509,17 +5447,7 @@ CodeVar parser_parse_variable()
Specifier spec = str_to_specifier( tok_to_str(currtok) );
switch ( spec )
{
case Spec_Const:
case Spec_Constexpr:
case Spec_Constinit:
case Spec_External_Linkage:
case Spec_Global:
case Spec_Inline:
case Spec_Local_Persist:
case Spec_Mutable:
case Spec_Static:
case Spec_Thread_Local:
case Spec_Volatile:
GEN_PARSER_VARIABLE_ALLOWED_SPECIFIER_CASES:
break;
default:

View File

@ -0,0 +1,105 @@
// These macros are used in the swtich cases within parser.cpp
#define GEN_PARSER_CLASS_STRUCT_BODY_ALLOWED_MEMBER_TOK_SPECIFIERS_CASES \
case Tok_Spec_Consteval: \
case Tok_Spec_Constexpr: \
case Tok_Spec_Constinit: \
case Tok_Spec_Explicit: \
case Tok_Spec_ForceInline: \
case Tok_Spec_Inline: \
case Tok_Spec_Mutable: \
case Tok_Spec_NeverInline: \
case Tok_Spec_Static: \
case Tok_Spec_Volatile: \
case Tok_Spec_Virtual
#define GEN_PARSER_CLASS_STRUCT_BODY_ALLOWED_MEMBER_SPECIFIERS_CASES \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_Explicit: \
case Spec_Inline: \
case Spec_ForceInline: \
case Spec_Mutable: \
case Spec_NeverInline: \
case Spec_Static: \
case Spec_Volatile: \
case Spec_Virtual
#define GEN_PARSER_CLASS_GLOBAL_NSPACE_ALLOWED_MEMBER_TOK_SPECIFIERS_CASES \
case Tok_Spec_Consteval: \
case Tok_Spec_Constexpr: \
case Tok_Spec_Constinit: \
case Tok_Spec_Extern: \
case Tok_Spec_ForceInline: \
case Tok_Spec_Global: \
case Tok_Spec_Inline: \
case Tok_Spec_Internal_Linkage: \
case Tok_Spec_NeverInline: \
case Tok_Spec_Static
#define GEN_PARSER_CLASS_GLOBAL_NSPACE_ALLOWED_MEMBER_SPECIFIERS_CASES \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_ForceInline: \
case Spec_Global: \
case Spec_External_Linkage: \
case Spec_Internal_Linkage: \
case Spec_Inline: \
case Spec_Mutable: \
case Spec_NeverInline: \
case Spec_Static: \
case Spec_Volatile
#define GEN_PARSER_FRIEND_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Inline: \
case Spec_ForceInline
#define GEN_PARSER_FUNCTION_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Consteval: \
case Spec_Constexpr: \
case Spec_External_Linkage: \
case Spec_Internal_Linkage: \
case Spec_ForceInline: \
case Spec_Inline: \
case Spec_NeverInline: \
case Spec_Static
#define GEN_PARSER_OPERATOR_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Constexpr: \
case Spec_ForceInline: \
case Spec_Inline: \
case Spec_NeverInline: \
case Spec_Static
#define GEN_PARSER_TEMPLATE_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_External_Linkage: \
case Spec_Global: \
case Spec_Inline: \
case Spec_ForceInline: \
case Spec_Local_Persist: \
case Spec_Mutable: \
case Spec_Static: \
case Spec_Thread_Local: \
case Spec_Volatile
#define GEN_PARSER_VARIABLE_ALLOWED_SPECIFIER_CASES \
case Spec_Const: \
case Spec_Constexpr: \
case Spec_Constinit: \
case Spec_External_Linkage: \
case Spec_Global: \
case Spec_Inline: \
case Spec_Local_Persist: \
case Spec_Mutable: \
case Spec_Static: \
case Spec_Thread_Local: \
case Spec_Volatile

View File

@ -6,6 +6,24 @@
#include "gen/especifier.hpp"
#endif
enum MacroFlags : u32
{
// Can only be one of these at a time (required)
MF_Block_Start = bit(0), // Start of a "block" scope
MF_Block_End = bit(1), // End of a "block" scope
MF_Case_Statement = bit(2), // Used as a case statement (not utilized by the parser yet)
MF_Expression = bit(3), // Used as an expresssion (not utilized by the parser yet)
MF_Statement = bit(4), // Used a statement (will expect to be a lone macro)
MF_Expects_Body = bit(5), // Expects to consume a braced scope
MF_Typename = bit(6), // Behaves as a typename
// Optional
MF_Functional = bit(7),
MF_Null = 0,
MF_UnderlyingType = GEN_U32_MAX,
};
enum TokFlags : u32
{
TF_Operator = bit(0),

View File

@ -32,6 +32,7 @@ GEN_NS_BEGIN
#include "components/interface.cpp"
#include "components/interface.upfront.cpp"
#include "components/lexer.cpp"
#include "components/parser_case_macros.cpp"
#include "components/parser.cpp"
#include "components/interface.parsing.cpp"
#include "components/interface.untyped.cpp"

View File

@ -9,10 +9,7 @@ using namespace gen;
CodeBody gen_ecode( char const* path, bool use_c_definition = false )
{
FixedArena_32KB scratch; fixed_arena_init(& scratch);
AllocatorInfo scratch_info = fixed_arena_allocator_info(& scratch);
CSV_Columns2 csv_enum = parse_csv_two_columns( scratch_info, path );
CSV_Columns2 csv_enum = parse_csv_two_columns( _ctx->Allocator_Temp, path );
StrBuilder enum_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(1) );
StrBuilder to_c_str_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(1) );
StrBuilder to_keyword_c_str_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(1) );
@ -93,10 +90,7 @@ CodeBody gen_ecode( char const* path, bool use_c_definition = false )
CodeBody gen_eoperator( char const* path, bool use_c_definition = false )
{
FixedArena_16KB scratch; fixed_arena_init(& scratch);
AllocatorInfo scratch_info = fixed_arena_allocator_info(& scratch);
CSV_Columns2 csv_enum = parse_csv_two_columns( scratch_info, path );
CSV_Columns2 csv_enum = parse_csv_two_columns( _ctx->Allocator_Temp, path );
StrBuilder enum_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, 32 );
StrBuilder to_c_str_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, 32 );
@ -178,12 +172,9 @@ CodeBody gen_eoperator( char const* path, bool use_c_definition = false )
CodeBody gen_especifier( char const* path, bool use_c_definition = false )
{
FixedArena_16KB scratch; fixed_arena_init(& scratch);
AllocatorInfo scratch_info = fixed_arena_allocator_info(& scratch);
CSV_Columns2 csv_enum = parse_csv_two_columns( scratch_info, path );
StrBuilder enum_entries = strbuilder_make_reserve( scratch_info, kilobytes(1) );
StrBuilder to_c_str_entries = strbuilder_make_reserve( scratch_info, kilobytes(1) );
CSV_Columns2 csv_enum = parse_csv_two_columns( _ctx->Allocator_Temp, path );
StrBuilder enum_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(1) );
StrBuilder to_c_str_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(1) );
for (usize idx = 0; idx < array_num(csv_enum.Col_1); idx++)
{
@ -317,29 +308,24 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false )
CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_definition = false )
{
FixedArena_64KB scratch; fixed_arena_init(& scratch);
AllocatorInfo scratch_info = fixed_arena_allocator_info(& scratch);
FileContents enum_content = file_read_contents( scratch_info, file_zero_terminate, etok_path );
FileContents enum_content = file_read_contents( _ctx->Allocator_Temp, file_zero_terminate, etok_path );
CSV_Object csv_enum_nodes;
csv_parse( &csv_enum_nodes, rcast(char*, enum_content.data), scratch_info, false );
FileContents attrib_content = file_read_contents( scratch_info, file_zero_terminate, attr_path );
csv_parse( &csv_enum_nodes, rcast(char*, enum_content.data), _ctx->Allocator_Temp, false );
FileContents attrib_content = file_read_contents( _ctx->Allocator_Temp, file_zero_terminate, attr_path );
CSV_Object csv_attr_nodes;
csv_parse( &csv_attr_nodes, rcast(char*, attrib_content.data), scratch_info, false );
csv_parse( &csv_attr_nodes, rcast(char*, attrib_content.data), _ctx->Allocator_Temp, false );
Array<ADT_Node> enum_strs = csv_enum_nodes.nodes[0].nodes;
Array<ADT_Node> enum_c_str_strs = csv_enum_nodes.nodes[1].nodes;
Array<ADT_Node> attribute_strs = csv_attr_nodes.nodes[0].nodes;
Array<ADT_Node> attribute_c_str_strs = csv_attr_nodes.nodes[1].nodes;
StrBuilder enum_entries = strbuilder_make_reserve( scratch_info, kilobytes(2) );
StrBuilder to_c_str_entries = strbuilder_make_reserve( scratch_info, kilobytes(4) );
StrBuilder attribute_entries = strbuilder_make_reserve( scratch_info, kilobytes(2) );
StrBuilder to_c_str_attributes = strbuilder_make_reserve( scratch_info, kilobytes(4) );
StrBuilder attribute_define_entries = strbuilder_make_reserve( scratch_info, kilobytes(4) );
StrBuilder enum_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(2) );
StrBuilder to_c_str_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(4) );
StrBuilder attribute_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(2) );
StrBuilder to_c_str_attributes = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(4) );
StrBuilder attribute_define_entries = strbuilder_make_reserve( _ctx->Allocator_Temp, kilobytes(4) );
for (usize idx = 0; idx < array_num(enum_strs); idx++)
{

View File

@ -173,12 +173,12 @@
#undef GEN_DEFINE_ATTRIBUTE_TOKENS
#undef GEN_AST_BODY_CLASS_UNALLOWED_TYPES
#undef GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
#undef GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
#undef GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
#undef GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
#undef GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
#undef GEN_AST_BODY_CLASS_UNALLOWED_TYPES_CASES
#undef GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES_CASES
#undef GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES_CASES
#undef GEN_AST_BODY_EXPORT_UNALLOWED_TYPES_CASES
#undef GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES_CASES
#undef GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES_CASES
#undef GEN_GLOBAL_BUCKET_SIZE
#undef GEN_CODEPOOL_NUM_BLOCKS