mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 15:54:45 -08:00
Compare commits
2 Commits
9b059dca47
...
ceea184d5a
Author | SHA1 | Date | |
---|---|---|---|
ceea184d5a | |||
92e0d3ab8b |
@ -105,6 +105,10 @@ int gen_main()
|
|||||||
PreprocessorDefines.append(txt("GEN_API_C_BEGIN"));
|
PreprocessorDefines.append(txt("GEN_API_C_BEGIN"));
|
||||||
PreprocessorDefines.append(txt("GEN_API_C_END"));
|
PreprocessorDefines.append(txt("GEN_API_C_END"));
|
||||||
PreprocessorDefines.append(txt("HashTable("));
|
PreprocessorDefines.append(txt("HashTable("));
|
||||||
|
PreprocessorDefines.append(txt("GEN_NS_PARSER"));
|
||||||
|
PreprocessorDefines.append(txt("GEN_NS_PARSER_BEGIN"));
|
||||||
|
PreprocessorDefines.append(txt("GEN_NS_PARSER_END"));
|
||||||
|
//PreprocessorDefines.append(txt("GEN_EXECUTION_EXPRESSION_SUPPORT"));
|
||||||
|
|
||||||
Code push_ignores = scan_file( project_dir "helpers/push_ignores.inline.hpp" );
|
Code push_ignores = scan_file( project_dir "helpers/push_ignores.inline.hpp" );
|
||||||
Code pop_ignores = scan_file( project_dir "helpers/pop_ignores.inline.hpp" );
|
Code pop_ignores = scan_file( project_dir "helpers/pop_ignores.inline.hpp" );
|
||||||
@ -121,8 +125,45 @@ int gen_main()
|
|||||||
header.print( c_library_header_start );
|
header.print( c_library_header_start );
|
||||||
|
|
||||||
#pragma region Scan, Parse, and Generate Components
|
#pragma region Scan, Parse, and Generate Components
|
||||||
Code types = scan_file( project_dir "components/types.hpp" );
|
CodeBody parsed_types = parse_file( project_dir "components/types.hpp" );
|
||||||
Code ast = scan_file( project_dir "components/ast.hpp" );
|
CodeBody types = def_body(CT_Global_Body);
|
||||||
|
for ( Code entry = parsed_types.begin(); entry != parsed_types.end(); ++ entry )
|
||||||
|
{
|
||||||
|
switch(entry->Type)
|
||||||
|
{
|
||||||
|
case CT_Using:
|
||||||
|
{
|
||||||
|
CodeUsing using_ver = cast(CodeUsing, entry);
|
||||||
|
|
||||||
|
if (using_ver->UnderlyingType->ReturnType)
|
||||||
|
{
|
||||||
|
CodeTypename type = using_ver->UnderlyingType;
|
||||||
|
CodeTypedef typedef_ver = parse_typedef(token_fmt(
|
||||||
|
"ReturnType", to_string(type->ReturnType).to_strc()
|
||||||
|
, "Name" , using_ver->Name
|
||||||
|
, "Parameters", to_string(type->Params).to_strc()
|
||||||
|
, stringize(
|
||||||
|
typedef <ReturnType>( * <Name>)(<Parameters>);
|
||||||
|
)));
|
||||||
|
types.append(typedef_ver);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CodeTypedef typedef_ver = def_typedef(using_ver->Name, using_ver->UnderlyingType);
|
||||||
|
types.append(typedef_ver);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CT_Enum:
|
||||||
|
{
|
||||||
|
CodeEnum enum_def = cast(CodeEnum, entry);
|
||||||
|
CodeTypedef typedef_enum = parse_typedef(token_fmt("name", enum_def->Name, stringize( typedef enum <name> <name>; )));
|
||||||
|
types.append(enum_def);
|
||||||
|
types.append(typedef_enum);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Code ast_types = scan_file( project_dir "components/ast_types.hpp" );
|
Code ast_types = scan_file( project_dir "components/ast_types.hpp" );
|
||||||
Code code_types = scan_file( project_dir "components/code_types.hpp" );
|
Code code_types = scan_file( project_dir "components/code_types.hpp" );
|
||||||
Code interface = scan_file( project_dir "components/interface.hpp" );
|
Code interface = scan_file( project_dir "components/interface.hpp" );
|
||||||
@ -133,6 +174,86 @@ int gen_main()
|
|||||||
CodeBody eoperator = gen_eoperator ( project_dir "enums/EOperator.csv" );
|
CodeBody eoperator = gen_eoperator ( project_dir "enums/EOperator.csv" );
|
||||||
CodeBody especifier = gen_especifier( project_dir "enums/ESpecifier.csv" );
|
CodeBody especifier = gen_especifier( project_dir "enums/ESpecifier.csv" );
|
||||||
CodeBody ast_inlines = gen_ast_inlines();
|
CodeBody ast_inlines = gen_ast_inlines();
|
||||||
|
|
||||||
|
CodeBody parsed_ast = parse_file( project_dir "components/ast.hpp" );
|
||||||
|
CodeBody ast = def_body(CT_Global_Body);
|
||||||
|
for ( Code entry = parsed_ast.begin(); entry != parsed_ast.end(); ++ entry )
|
||||||
|
switch (entry->Type)
|
||||||
|
{
|
||||||
|
case CT_Preprocess_If:
|
||||||
|
{
|
||||||
|
CodePreprocessCond cond = cast(CodePreprocessCond, entry);
|
||||||
|
if (cond->Content.contains(txt("GEN_COMPILER_C")))
|
||||||
|
{
|
||||||
|
//++ entry; //
|
||||||
|
//ast.append(entry) // typedef
|
||||||
|
//for ( ; entry != parsed_ast.end() && entry->Type != CT_Preprocess_EndIf; ++ entry) {}
|
||||||
|
//++ entry; // Consume endif
|
||||||
|
}
|
||||||
|
|
||||||
|
b32 found = ignore_preprocess_cond_block(txt("GEN_SUPPORT_CPP_MEMBER_FEATURES"), entry, parsed_ast, ast );
|
||||||
|
if (found) break;
|
||||||
|
|
||||||
|
found = ignore_preprocess_cond_block(txt("GEN_SUPPORT_CPP_REFERENCES"), entry, parsed_ast, ast);
|
||||||
|
if (found) break;
|
||||||
|
|
||||||
|
found = ignore_preprocess_cond_block(txt("GEN_COMPILER_CPP"), entry, parsed_ast, ast);
|
||||||
|
if (found) break;
|
||||||
|
|
||||||
|
ast.append(entry);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CT_Struct_Fwd:
|
||||||
|
{
|
||||||
|
CodeStruct fwd = cast(CodeStruct, entry);
|
||||||
|
if (fwd->Name.starts_with(txt("AST"))) {
|
||||||
|
ast.append(fwd);
|
||||||
|
CodeTypedef td = parse_typedef(token_fmt("name", fwd->Name, stringize( typedef struct <name> <name>; )));
|
||||||
|
ast.append(td);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CT_Variable:
|
||||||
|
{
|
||||||
|
CodeVar var = cast(CodeVar, entry);
|
||||||
|
|
||||||
|
s32 constexpr_found = var->Specs.remove( Spec_Constexpr );
|
||||||
|
if (constexpr_found > -1) {
|
||||||
|
log_fmt("Found constexpr: %S\n", entry.to_string());
|
||||||
|
if (var->Name.contains(txt("AST_ArrSpecs_Cap")))
|
||||||
|
{
|
||||||
|
Code def = untyped_str(txt(
|
||||||
|
R"(#define AST_ArrSpecs_Cap \
|
||||||
|
( \
|
||||||
|
AST_POD_Size \
|
||||||
|
- sizeof(AST*) * 3 \
|
||||||
|
- sizeof(Token*) \
|
||||||
|
- sizeof(AST*) \
|
||||||
|
- sizeof(StringCached) \
|
||||||
|
- sizeof(CodeType) \
|
||||||
|
- sizeof(ModuleFlag) \
|
||||||
|
- sizeof(int) \
|
||||||
|
) \
|
||||||
|
/ sizeof(int) - 1
|
||||||
|
)"
|
||||||
|
));
|
||||||
|
ast.append(def);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
CodeDefine def = def_define(var->Name, var->Value.to_string());
|
||||||
|
ast.append(def);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ast.append(var);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ast.append(entry);
|
||||||
|
break;
|
||||||
|
}
|
||||||
#pragma endregion Scan, Parse, and Generate Components
|
#pragma endregion Scan, Parse, and Generate Components
|
||||||
|
|
||||||
#pragma region Scan, Parse, and Generate Dependencies
|
#pragma region Scan, Parse, and Generate Dependencies
|
||||||
@ -464,19 +585,30 @@ int gen_main()
|
|||||||
header.print_fmt( roll_own_dependencies_guard_end );
|
header.print_fmt( roll_own_dependencies_guard_end );
|
||||||
#pragma endregion Print Dependencies
|
#pragma endregion Print Dependencies
|
||||||
|
|
||||||
|
header.print(fmt_newline);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
#pragma region region Print Components
|
||||||
|
header.print_fmt( "GEN_NS_BEGIN\n" );
|
||||||
|
header.print_fmt( "GEN_API_C_BEGIN\n\n" );
|
||||||
|
|
||||||
#if 0
|
|
||||||
#region region Print Components
|
|
||||||
header.print_fmt("#pragma region Types\n");
|
header.print_fmt("#pragma region Types\n");
|
||||||
header.print( types );
|
header.print( dump_to_scratch_and_retireve(types) );
|
||||||
header.print( fmt_newline );
|
header.print( fmt_newline );
|
||||||
header.print( dump_to_scratch_and_retireve( ecode ));
|
header.print( dump_to_scratch_and_retireve( ecode ));
|
||||||
header.print( fmt_newline );
|
header.print( fmt_newline );
|
||||||
header.print( dump_to_scratch_and_retireve( eoperator ));
|
header.print( dump_to_scratch_and_retireve( eoperator ));
|
||||||
header.print( fmt_newline );
|
header.print( fmt_newline );
|
||||||
header.print( dump_to_scratch_and_retireve( especifier ));
|
header.print( dump_to_scratch_and_retireve( especifier ));
|
||||||
header.print( fmt_newline );
|
|
||||||
header.print_fmt("#pragma endregion Types\n\n");
|
header.print_fmt("#pragma endregion Types\n\n");
|
||||||
|
|
||||||
|
header.print_fmt("#pragma region AST\n");
|
||||||
|
header.print( dump_to_scratch_and_retireve(ast) );
|
||||||
|
header.print_fmt("\n#pragma endregion AST\n");
|
||||||
|
|
||||||
|
header.print_fmt( "\nGEN_API_C_END\n" );
|
||||||
|
|
||||||
|
header.print_fmt( "GEN_NS_END\n\n" );
|
||||||
#pragma endregion Print Compoennts
|
#pragma endregion Print Compoennts
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ CodeFn rename_function_to_unique_symbol(CodeFn fn, StrC optional_prefix = txt(""
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_name.append_fmt("%SC_", to_str(spec));
|
new_name.append_fmt("%SC_", spec_to_str(spec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ CodeFn rename_function_to_unique_symbol(CodeFn fn, StrC optional_prefix = txt(""
|
|||||||
spec != end(fn->Specs);
|
spec != end(fn->Specs);
|
||||||
++spec)
|
++spec)
|
||||||
{
|
{
|
||||||
new_name.append_fmt("%SC_", to_str(*spec));
|
new_name.append_fmt("%SC_", spec_to_str(*spec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ void Builder::pad_lines( s32 num )
|
|||||||
|
|
||||||
void Builder::print( Code code )
|
void Builder::print( Code code )
|
||||||
{
|
{
|
||||||
String str = to_string(code);
|
String str = code_to_string(code);
|
||||||
// const ssize len = str.length();
|
// const ssize len = str.length();
|
||||||
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
|
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
|
||||||
string_append_string( & Buffer, str );
|
string_append_string( & Buffer, str );
|
||||||
|
@ -7,19 +7,19 @@ global Code Code_Global;
|
|||||||
global Code Code_Invalid;
|
global Code Code_Invalid;
|
||||||
|
|
||||||
// This serializes all the data-members in a "debug" format, where each member is printed with its associated value.
|
// This serializes all the data-members in a "debug" format, where each member is printed with its associated value.
|
||||||
char const* debug_str(Code self)
|
char const* code_debug_str(Code self)
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self != nullptr);
|
GEN_ASSERT(self != nullptr);
|
||||||
String result_stack = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
String result_stack = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||||
String* result = & result_stack;
|
String* result = & result_stack;
|
||||||
|
|
||||||
if ( self->Parent )
|
if ( self->Parent )
|
||||||
string_append_fmt( result, "\n\tParent : %S %S", type_str(self->Parent), self->Name ? self->Name : "" );
|
string_append_fmt( result, "\n\tParent : %S %S", code_type_str(self->Parent), self->Name ? self->Name : "" );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, "\n\tParent : %S", "Null" );
|
string_append_fmt( result, "\n\tParent : %S", "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tName : %S", self->Name ? self->Name : "Null" );
|
string_append_fmt( result, "\n\tName : %S", self->Name ? self->Name : "Null" );
|
||||||
string_append_fmt( result, "\n\tType : %S", type_str(self) );
|
string_append_fmt( result, "\n\tType : %S", code_type_str(self) );
|
||||||
string_append_fmt( result, "\n\tModule Flags : %S", to_str( self->ModuleFlags ) );
|
string_append_fmt( result, "\n\tModule Flags : %S", to_str( self->ModuleFlags ) );
|
||||||
|
|
||||||
switch ( self->Type )
|
switch ( self->Type )
|
||||||
@ -30,9 +30,9 @@ char const* debug_str(Code self)
|
|||||||
case CT_Access_Protected:
|
case CT_Access_Protected:
|
||||||
case CT_Access_Public:
|
case CT_Access_Public:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Untyped:
|
case CT_Untyped:
|
||||||
@ -48,9 +48,9 @@ char const* debug_str(Code self)
|
|||||||
case CT_Preprocess_IfDef:
|
case CT_Preprocess_IfDef:
|
||||||
case CT_Preprocess_IfNotDef:
|
case CT_Preprocess_IfNotDef:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tContent: %S", self->Content );
|
string_append_fmt( result, "\n\tContent: %S", self->Content );
|
||||||
break;
|
break;
|
||||||
@ -58,64 +58,64 @@ char const* debug_str(Code self)
|
|||||||
case CT_Class:
|
case CT_Class:
|
||||||
case CT_Struct:
|
case CT_Struct:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
|
string_append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
|
||||||
string_append_fmt( result, "\n\tParentType : %s", self->ParentType ? type_str(self->ParentType) : "Null" );
|
string_append_fmt( result, "\n\tParentType : %s", self->ParentType ? code_type_str(self->ParentType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Class_Fwd:
|
case CT_Class_Fwd:
|
||||||
case CT_Struct_Fwd:
|
case CT_Struct_Fwd:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
|
string_append_fmt( result, "\n\tParentAccess: %s", self->ParentType ? to_str( self->ParentAccess ) : "No Parent" );
|
||||||
string_append_fmt( result, "\n\tParentType : %s", self->ParentType ? type_str(self->ParentType) : "Null" );
|
string_append_fmt( result, "\n\tParentType : %s", self->ParentType ? code_type_str(self->ParentType) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Constructor:
|
case CT_Constructor:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? to_string(self->InitializerList) : "Null" );
|
string_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? code_to_string(self->InitializerList) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Constructor_Fwd:
|
case CT_Constructor_Fwd:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? to_string(self->InitializerList) : "Null" );
|
string_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? code_to_string(self->InitializerList) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Destructor:
|
case CT_Destructor:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Destructor_Fwd:
|
case CT_Destructor_Fwd:
|
||||||
@ -124,142 +124,142 @@ char const* debug_str(Code self)
|
|||||||
case CT_Enum:
|
case CT_Enum:
|
||||||
case CT_Enum_Class:
|
case CT_Enum_Class:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
|
string_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? code_to_string(self->UnderlyingType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Enum_Fwd:
|
case CT_Enum_Fwd:
|
||||||
case CT_Enum_Class_Fwd:
|
case CT_Enum_Class_Fwd:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
|
string_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? code_to_string(self->UnderlyingType) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Extern_Linkage:
|
case CT_Extern_Linkage:
|
||||||
case CT_Namespace:
|
case CT_Namespace:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tBody: %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody: %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Friend:
|
case CT_Friend:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? to_string(self->Declaration) : "Null" );
|
string_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? code_to_string(self->Declaration) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Function:
|
case CT_Function:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
|
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? code_to_string(self->ReturnType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Function_Fwd:
|
case CT_Function_Fwd:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
|
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? code_to_string(self->ReturnType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Module:
|
case CT_Module:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Operator:
|
case CT_Operator:
|
||||||
case CT_Operator_Member:
|
case CT_Operator_Member:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
|
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? code_to_string(self->ReturnType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
string_append_fmt( result, "\n\tOp : %S", to_str( self->Op ) );
|
string_append_fmt( result, "\n\tOp : %S", operator_to_str( self->Op ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Operator_Fwd:
|
case CT_Operator_Fwd:
|
||||||
case CT_Operator_Member_Fwd:
|
case CT_Operator_Member_Fwd:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
|
string_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? code_to_string(self->ReturnType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
string_append_fmt( result, "\n\tOp : %S", to_str( self->Op ) );
|
string_append_fmt( result, "\n\tOp : %S", operator_to_str( self->Op ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Operator_Cast:
|
case CT_Operator_Cast:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
|
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? code_to_string(self->ValueType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Operator_Cast_Fwd:
|
case CT_Operator_Cast_Fwd:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
|
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? code_to_string(self->ValueType) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Parameters:
|
case CT_Parameters:
|
||||||
string_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
|
string_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries );
|
||||||
string_append_fmt( result, "\n\tLast : %S", self->Last->Name );
|
string_append_fmt( result, "\n\tLast : %S", self->Last->Name );
|
||||||
string_append_fmt( result, "\n\tNext : %S", self->Next->Name );
|
string_append_fmt( result, "\n\tNext : %S", self->Next->Name );
|
||||||
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
|
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? code_to_string(self->ValueType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
|
string_append_fmt( result, "\n\tValue : %S", self->Value ? code_to_string(self->Value) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Specifiers:
|
case CT_Specifiers:
|
||||||
@ -271,61 +271,61 @@ char const* debug_str(Code self)
|
|||||||
s32 left = self->NumEntries;
|
s32 left = self->NumEntries;
|
||||||
while ( left-- )
|
while ( left-- )
|
||||||
{
|
{
|
||||||
StrC spec = to_str( self->ArrSpecs[idx] );
|
StrC spec = spec_to_str( self->ArrSpecs[idx] );
|
||||||
string_append_fmt( result, "%.*s, ", spec.Len, spec.Ptr );
|
string_append_fmt( result, "%.*s, ", spec.Len, spec.Ptr );
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
string_append_fmt( result, "\n\tNextSpecs: %S", self->NextSpecs ? debug_str(self->NextSpecs) : "Null" );
|
string_append_fmt( result, "\n\tNextSpecs: %S", self->NextSpecs ? code_debug_str(self->NextSpecs) : "Null" );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Template:
|
case CT_Template:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
string_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? to_string(self->Declaration) : "Null" );
|
string_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? code_to_string(self->Declaration) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Typedef:
|
case CT_Typedef:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
|
string_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? code_to_string(self->UnderlyingType) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Typename:
|
case CT_Typename:
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tReturnType : %S", self->ReturnType ? to_string(self->ReturnType) : "Null" );
|
string_append_fmt( result, "\n\tReturnType : %S", self->ReturnType ? code_to_string(self->ReturnType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tParams : %S", self->Params ? to_string(self->Params) : "Null" );
|
string_append_fmt( result, "\n\tParams : %S", self->Params ? code_to_string(self->Params) : "Null" );
|
||||||
string_append_fmt( result, "\n\tArrExpr : %S", self->ArrExpr ? to_string(self->ArrExpr) : "Null" );
|
string_append_fmt( result, "\n\tArrExpr : %S", self->ArrExpr ? code_to_string(self->ArrExpr) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Union:
|
case CT_Union:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBody : %S", self->Body ? debug_str(self->Body) : "Null" );
|
string_append_fmt( result, "\n\tBody : %S", self->Body ? code_debug_str(self->Body) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Using:
|
case CT_Using:
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? to_string(self->UnderlyingType) : "Null" );
|
string_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? code_to_string(self->UnderlyingType) : "Null" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_Variable:
|
case CT_Variable:
|
||||||
@ -333,32 +333,32 @@ char const* debug_str(Code self)
|
|||||||
if ( self->Parent && self->Parent->Type == CT_Variable )
|
if ( self->Parent && self->Parent->Type == CT_Variable )
|
||||||
{
|
{
|
||||||
// Its a NextVar
|
// Its a NextVar
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
|
string_append_fmt( result, "\n\tValue : %S", self->Value ? code_to_string(self->Value) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? to_string(self->BitfieldSize) : "Null" );
|
string_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? code_to_string(self->BitfieldSize) : "Null" );
|
||||||
string_append_fmt( result, "\n\tNextVar : %S", self->NextVar ? debug_str(self->NextVar) : "Null" );
|
string_append_fmt( result, "\n\tNextVar : %S", self->NextVar ? code_debug_str(self->NextVar) : "Null" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self->Prev )
|
if ( self->Prev )
|
||||||
string_append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tPrev: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
if ( self->Next )
|
if ( self->Next )
|
||||||
string_append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
string_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
|
||||||
|
|
||||||
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
string_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt ? self->InlineCmt->Content : "Null" );
|
||||||
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? to_string(self->Attributes) : "Null" );
|
string_append_fmt( result, "\n\tAttributes : %S", self->Attributes ? code_to_string(self->Attributes) : "Null" );
|
||||||
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? to_string(self->Specs) : "Null" );
|
string_append_fmt( result, "\n\tSpecs : %S", self->Specs ? code_to_string(self->Specs) : "Null" );
|
||||||
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? to_string(self->ValueType) : "Null" );
|
string_append_fmt( result, "\n\tValueType : %S", self->ValueType ? code_to_string(self->ValueType) : "Null" );
|
||||||
string_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? to_string(self->BitfieldSize) : "Null" );
|
string_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? code_to_string(self->BitfieldSize) : "Null" );
|
||||||
string_append_fmt( result, "\n\tValue : %S", self->Value ? to_string(self->Value) : "Null" );
|
string_append_fmt( result, "\n\tValue : %S", self->Value ? code_to_string(self->Value) : "Null" );
|
||||||
string_append_fmt( result, "\n\tNextVar : %S", self->NextVar ? debug_str(self->NextVar) : "Null" );
|
string_append_fmt( result, "\n\tNextVar : %S", self->NextVar ? code_debug_str(self->NextVar) : "Null" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return * result;
|
return * result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Code duplicate(Code self)
|
Code code_duplicate(Code self)
|
||||||
{
|
{
|
||||||
Code result = make_code();
|
Code result = make_code();
|
||||||
|
|
||||||
@ -368,14 +368,14 @@ Code duplicate(Code self)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
String to_string(Code self)
|
String code_to_string(Code self)
|
||||||
{
|
{
|
||||||
String result = string_make_strc( GlobalAllocator, txt("") );
|
String result = string_make_strc( GlobalAllocator, txt("") );
|
||||||
GEN_NS to_string( self, & result );
|
code_to_string_ptr( self, & result );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_string( Code self, String* result )
|
void code_to_string_ptr( Code self, String* result )
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self != nullptr);
|
GEN_ASSERT(self != nullptr);
|
||||||
local_persist thread_local
|
local_persist thread_local
|
||||||
@ -385,7 +385,7 @@ void to_string( Code self, String* result )
|
|||||||
{
|
{
|
||||||
case CT_Invalid:
|
case CT_Invalid:
|
||||||
#ifdef GEN_DONT_ALLOW_INVALID_CODE
|
#ifdef GEN_DONT_ALLOW_INVALID_CODE
|
||||||
log_failure("Attempted to serialize invalid code! - %S", Parent ? Parent->debug_str() : Name );
|
log_failure("Attempted to serialize invalid code! - %S", Parent ? Parent->code_debug_str() : Name );
|
||||||
#else
|
#else
|
||||||
string_append_fmt( result, "Invalid Code!" );
|
string_append_fmt( result, "Invalid Code!" );
|
||||||
#endif
|
#endif
|
||||||
@ -591,7 +591,7 @@ void to_string( Code self, String* result )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_equal( Code self, Code other )
|
bool code_is_equal( Code self, Code other )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
AST values are either some u32 value, a cached string, or a pointer to another AST.
|
AST values are either some u32 value, a cached string, or a pointer to another AST.
|
||||||
@ -602,15 +602,15 @@ bool is_equal( Code self, Code other )
|
|||||||
*/
|
*/
|
||||||
if ( other == nullptr )
|
if ( other == nullptr )
|
||||||
{
|
{
|
||||||
log_fmt( "AST::is_equal: other is null\nAST: %S", debug_str(self) );
|
log_fmt( "AST::is_equal: other is null\nAST: %S", code_debug_str(self) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self->Type != other->Type )
|
if ( self->Type != other->Type )
|
||||||
{
|
{
|
||||||
log_fmt("AST::is_equal: Type check failure with other\nAST: %S\nOther: %S"
|
log_fmt("AST::is_equal: Type check failure with other\nAST: %S\nOther: %S"
|
||||||
, debug_str(self)
|
, code_debug_str(self)
|
||||||
,debug_str(other)
|
,code_debug_str(other)
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -624,8 +624,8 @@ bool is_equal( Code self, Code other )
|
|||||||
log_fmt("\nAST::is_equal: Member - " #val " failed\n" \
|
log_fmt("\nAST::is_equal: Member - " #val " failed\n" \
|
||||||
"AST : %S\n" \
|
"AST : %S\n" \
|
||||||
"Other: %S\n" \
|
"Other: %S\n" \
|
||||||
, debug_str(self) \
|
, code_debug_str(self) \
|
||||||
,debug_str(other) \
|
,code_debug_str(other) \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
return false; \
|
return false; \
|
||||||
@ -637,8 +637,8 @@ bool is_equal( Code self, Code other )
|
|||||||
log_fmt("\nAST::is_equal: Member string - "#str " failed\n" \
|
log_fmt("\nAST::is_equal: Member string - "#str " failed\n" \
|
||||||
"AST : %S\n" \
|
"AST : %S\n" \
|
||||||
"Other: %S\n" \
|
"Other: %S\n" \
|
||||||
, debug_str(self) \
|
, code_debug_str(self) \
|
||||||
,debug_str(other) \
|
,code_debug_str(other) \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
return false; \
|
return false; \
|
||||||
@ -650,8 +650,8 @@ bool is_equal( Code self, Code other )
|
|||||||
log_fmt("\nAST::is_equal: Member content - "#content " failed\n" \
|
log_fmt("\nAST::is_equal: Member content - "#content " failed\n" \
|
||||||
"AST : %S\n" \
|
"AST : %S\n" \
|
||||||
"Other: %S\n" \
|
"Other: %S\n" \
|
||||||
, debug_str(self) \
|
, code_debug_str(self) \
|
||||||
, debug_str(other) \
|
, code_debug_str(other) \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
log_fmt("Content cannot be trusted to be unique with this check " \
|
log_fmt("Content cannot be trusted to be unique with this check " \
|
||||||
@ -672,25 +672,25 @@ bool is_equal( Code self, Code other )
|
|||||||
"AST : %s\n" \
|
"AST : %s\n" \
|
||||||
"Other: %s\n" \
|
"Other: %s\n" \
|
||||||
"For ast member: %s\n" \
|
"For ast member: %s\n" \
|
||||||
, debug_str(self) \
|
, code_debug_str(self) \
|
||||||
, debug_str(other) \
|
, code_debug_str(other) \
|
||||||
, debug_str(self->ast) \
|
, code_debug_str(self->ast) \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
return false; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if ( ! is_equal(self->ast, other->ast ) ) \
|
if ( ! code_is_equal(self->ast, other->ast ) ) \
|
||||||
{ \
|
{ \
|
||||||
log_fmt( "\nAST::is_equal: Failed for " #ast"\n" \
|
log_fmt( "\nAST::is_equal: Failed for " #ast"\n" \
|
||||||
"AST : %S\n" \
|
"AST : %S\n" \
|
||||||
"Other: %S\n" \
|
"Other: %S\n" \
|
||||||
"For ast member: %S\n" \
|
"For ast member: %S\n" \
|
||||||
"other's ast member: %S\n" \
|
"other's ast member: %S\n" \
|
||||||
, debug_str(self) \
|
, code_debug_str(self) \
|
||||||
, debug_str(other) \
|
, code_debug_str(other) \
|
||||||
, debug_str(self->ast) \
|
, code_debug_str(self->ast) \
|
||||||
, debug_str(other->ast) \
|
, code_debug_str(other->ast) \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
return false; \
|
return false; \
|
||||||
@ -919,7 +919,7 @@ bool is_equal( Code self, Code other )
|
|||||||
"AST : %S\n"
|
"AST : %S\n"
|
||||||
"Other: %S\n"
|
"Other: %S\n"
|
||||||
"For ast member: %S\n"
|
"For ast member: %S\n"
|
||||||
, debug_str(curr)
|
, code_debug_str(curr)
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -932,40 +932,40 @@ bool is_equal( Code self, Code other )
|
|||||||
"Other: %S\n"
|
"Other: %S\n"
|
||||||
"For ast member: %S\n"
|
"For ast member: %S\n"
|
||||||
"other's ast member: %S\n"
|
"other's ast member: %S\n"
|
||||||
, debug_str(self)
|
, code_debug_str(self)
|
||||||
, debug_str(other)
|
, code_debug_str(other)
|
||||||
, debug_str(curr)
|
, code_debug_str(curr)
|
||||||
, debug_str(curr_other)
|
, code_debug_str(curr_other)
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( curr->ValueType && ! is_equal(curr->ValueType, curr_other->ValueType) )
|
if ( curr->ValueType && ! code_is_equal(curr->ValueType, curr_other->ValueType) )
|
||||||
{
|
{
|
||||||
log_fmt( "\nAST::is_equal: Failed for parameter value type check\n"
|
log_fmt( "\nAST::is_equal: Failed for parameter value type check\n"
|
||||||
"AST : %S\n"
|
"AST : %S\n"
|
||||||
"Other: %S\n"
|
"Other: %S\n"
|
||||||
"For ast member: %S\n"
|
"For ast member: %S\n"
|
||||||
"other's ast member: %S\n"
|
"other's ast member: %S\n"
|
||||||
, debug_str(self)
|
, code_debug_str(self)
|
||||||
, debug_str(other)
|
, code_debug_str(other)
|
||||||
, debug_str(curr)
|
, code_debug_str(curr)
|
||||||
, debug_str(curr_other)
|
, code_debug_str(curr_other)
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( curr->Value && ! is_equal(curr->Value, curr_other->Value) )
|
if ( curr->Value && ! code_is_equal(curr->Value, curr_other->Value) )
|
||||||
{
|
{
|
||||||
log_fmt( "\nAST::is_equal: Failed for parameter value check\n"
|
log_fmt( "\nAST::is_equal: Failed for parameter value check\n"
|
||||||
"AST : %S\n"
|
"AST : %S\n"
|
||||||
"Other: %S\n"
|
"Other: %S\n"
|
||||||
"For ast member: %S\n"
|
"For ast member: %S\n"
|
||||||
"other's ast member: %S\n"
|
"other's ast member: %S\n"
|
||||||
, debug_str(self)
|
, code_debug_str(self)
|
||||||
, debug_str(other)
|
, code_debug_str(other)
|
||||||
, debug_str(curr)
|
, code_debug_str(curr)
|
||||||
, debug_str(curr_other)
|
, code_debug_str(curr_other)
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1118,23 +1118,23 @@ bool is_equal( Code self, Code other )
|
|||||||
"AST : %S\n"
|
"AST : %S\n"
|
||||||
"Other: %S\n"
|
"Other: %S\n"
|
||||||
"For ast member: %S\n"
|
"For ast member: %S\n"
|
||||||
, debug_str(curr)
|
, code_debug_str(curr)
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! is_equal( curr, curr_other ) )
|
if ( ! code_is_equal( curr, curr_other ) )
|
||||||
{
|
{
|
||||||
log_fmt( "\nAST::is_equal: Failed for body\n"
|
log_fmt( "\nAST::is_equal: Failed for body\n"
|
||||||
"AST : %S\n"
|
"AST : %S\n"
|
||||||
"Other: %S\n"
|
"Other: %S\n"
|
||||||
"For ast member: %S\n"
|
"For ast member: %S\n"
|
||||||
"other's ast member: %S\n"
|
"other's ast member: %S\n"
|
||||||
, debug_str(self)
|
, code_debug_str(self)
|
||||||
, debug_str(other)
|
, code_debug_str(other)
|
||||||
, debug_str(curr)
|
, code_debug_str(curr)
|
||||||
, debug_str(curr_other)
|
, code_debug_str(curr_other)
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1157,17 +1157,18 @@ bool is_equal( Code self, Code other )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validate_body(Code self)
|
bool code_validate_body(Code self)
|
||||||
{
|
{
|
||||||
#define CheckEntries( Unallowed_Types ) \
|
#define CheckEntries( Unallowed_Types ) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
for ( Code entry : cast(CodeBody, self) ) \
|
CodeBody body = cast(CodeBody, self); \
|
||||||
|
for ( Code code_entry = begin(body); code_entry != end(body); next(body, code_entry) ) \
|
||||||
{ \
|
{ \
|
||||||
switch ( entry->Type ) \
|
switch ( code_entry->Type ) \
|
||||||
{ \
|
{ \
|
||||||
Unallowed_Types \
|
Unallowed_Types \
|
||||||
log_failure( "AST::validate_body: Invalid entry in body %s", GEN_NS debug_str(entry) ); \
|
log_failure( "AST::validate_body: Invalid entry in body %s", code_debug_str(code_entry) ); \
|
||||||
return false; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
@ -1177,29 +1178,42 @@ bool validate_body(Code self)
|
|||||||
switch ( self->Type )
|
switch ( self->Type )
|
||||||
{
|
{
|
||||||
case CT_Class_Body:
|
case CT_Class_Body:
|
||||||
|
{
|
||||||
CheckEntries( GEN_AST_BODY_CLASS_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_CLASS_UNALLOWED_TYPES );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Enum_Body:
|
case CT_Enum_Body:
|
||||||
for ( Code entry : cast(CodeBody, self) )
|
{
|
||||||
|
CodeBody body = cast(CodeBody, self);
|
||||||
|
for ( Code entry = begin(body); entry != end(body); next(body, entry) )
|
||||||
{
|
{
|
||||||
if ( entry->Type != CT_Untyped )
|
if ( entry->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure( "AST::validate_body: Invalid entry in enum body (needs to be untyped or comment) %s", GEN_NS debug_str(entry) );
|
log_failure( "AST::validate_body: Invalid entry in enum body (needs to be untyped or comment) %s", GEN_NS code_debug_str(entry) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Export_Body:
|
case CT_Export_Body:
|
||||||
|
{
|
||||||
CheckEntries( GEN_AST_BODY_CLASS_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_CLASS_UNALLOWED_TYPES );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Extern_Linkage:
|
case CT_Extern_Linkage:
|
||||||
|
{
|
||||||
CheckEntries( GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Function_Body:
|
case CT_Function_Body:
|
||||||
|
{
|
||||||
CheckEntries( GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Global_Body:
|
case CT_Global_Body:
|
||||||
for (Code entry : cast(CodeBody, self))
|
{
|
||||||
|
CodeBody body = cast(CodeBody, self);
|
||||||
|
for ( Code entry = begin(body); entry != end(body); next(body, entry) )
|
||||||
{
|
{
|
||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
@ -1220,30 +1234,38 @@ bool validate_body(Code self)
|
|||||||
case CT_Specifiers:
|
case CT_Specifiers:
|
||||||
case CT_Struct_Body:
|
case CT_Struct_Body:
|
||||||
case CT_Typename:
|
case CT_Typename:
|
||||||
log_failure("AST::validate_body: Invalid entry in body %s", GEN_NS debug_str(entry));
|
log_failure("AST::validate_body: Invalid entry in body %s", GEN_NS code_debug_str(entry));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Namespace_Body:
|
case CT_Namespace_Body:
|
||||||
|
{
|
||||||
CheckEntries( GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Struct_Body:
|
case CT_Struct_Body:
|
||||||
|
{
|
||||||
CheckEntries( GEN_AST_BODY_STRUCT_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_STRUCT_UNALLOWED_TYPES );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CT_Union_Body:
|
case CT_Union_Body:
|
||||||
for ( Code entry : cast(CodeBody, {self->Body}) )
|
{
|
||||||
|
CodeBody body = cast(CodeBody, self);
|
||||||
|
for ( Code entry = begin(body); entry != end(body); next(body, entry) )
|
||||||
{
|
{
|
||||||
if ( entry->Type != CT_Untyped )
|
if ( entry->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure( "AST::validate_body: Invalid entry in union body (needs to be untyped or comment) %s", GEN_NS debug_str(entry) );
|
log_failure( "AST::validate_body: Invalid entry in union body (needs to be untyped or comment) %s", GEN_NS code_debug_str(entry) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "AST::validate_body: Invalid this AST does not have a body %s", debug_str(self) );
|
log_failure( "AST::validate_body: Invalid this AST does not have a body %s", code_debug_str(self) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "gen/especifier.hpp"
|
#include "gen/especifier.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GEN_API_C_BEGIN
|
||||||
|
|
||||||
struct AST;
|
struct AST;
|
||||||
struct AST_Body;
|
struct AST_Body;
|
||||||
struct AST_Attributes;
|
struct AST_Attributes;
|
||||||
@ -80,7 +82,7 @@ struct AST_Var;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GEN_COMPILER_C
|
#if GEN_COMPILER_C
|
||||||
typedef AST* code;
|
typedef AST* Code;
|
||||||
#else
|
#else
|
||||||
struct Code;
|
struct Code;
|
||||||
#endif
|
#endif
|
||||||
@ -155,29 +157,35 @@ Define_Code(Var);
|
|||||||
GEN_NS_PARSER_BEGIN
|
GEN_NS_PARSER_BEGIN
|
||||||
struct Token;
|
struct Token;
|
||||||
GEN_NS_PARSER_END
|
GEN_NS_PARSER_END
|
||||||
typedef struct GEN_NS_PARSER Token Token;
|
|
||||||
|
|
||||||
#if ! GEN_COMPILER_C
|
#define Token_Typedef struct Token Token
|
||||||
|
typedef Token_Typedef;
|
||||||
|
#undef Token_Typedef
|
||||||
|
|
||||||
|
#if GEN_COMPILER_CPP
|
||||||
|
GEN_API_C_END
|
||||||
template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast( Type*, & self ); }
|
template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast( Type*, & self ); }
|
||||||
|
GEN_API_C_BEGIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma region Code Interface
|
#pragma region Code Interface
|
||||||
void append (Code code, Code other );
|
void code_append (Code code, Code other );
|
||||||
char const* debug_str (Code code);
|
char const* code_debug_str (Code code);
|
||||||
Code duplicate (Code code);
|
Code code_duplicate (Code code);
|
||||||
Code* entry (Code code, u32 idx );
|
Code* code_entry (Code code, u32 idx );
|
||||||
bool has_entries (Code code);
|
bool code_has_entries (Code code);
|
||||||
bool is_body (Code code);
|
bool code_is_body (Code code);
|
||||||
bool is_equal (Code code, Code other);
|
bool code_is_equal (Code code, Code other);
|
||||||
bool is_valid (Code code);
|
bool code_is_valid (Code code);
|
||||||
void set_global (Code code);
|
void code_set_global (Code code);
|
||||||
String to_string (Code self );
|
String code_to_string (Code self );
|
||||||
void to_string (Code self, String* result );
|
void code_to_string_ptr(Code self, String* result );
|
||||||
char const* type_str (Code self );
|
char const* code_type_str (Code self );
|
||||||
bool validate_body(Code self );
|
bool code_validate_body(Code self );
|
||||||
#pragma endregion Code Interface
|
#pragma endregion Code Interface
|
||||||
|
|
||||||
#if ! GEN_COMPILER_C
|
#if GEN_COMPILER_CPP
|
||||||
|
GEN_API_C_END
|
||||||
/*
|
/*
|
||||||
AST* wrapper
|
AST* wrapper
|
||||||
- Not constantly have to append the '*' as this is written often..
|
- Not constantly have to append the '*' as this is written often..
|
||||||
@ -187,13 +195,13 @@ struct Code
|
|||||||
{
|
{
|
||||||
AST* ast;
|
AST* ast;
|
||||||
|
|
||||||
# define Using_Code( Typename ) \
|
# define Using_Code( Typename ) \
|
||||||
char const* debug_str() { return GEN_NS debug_str(* this); } \
|
char const* debug_str() { return code_debug_str(* this); } \
|
||||||
Code duplicate() { return GEN_NS duplicate(* this); } \
|
Code duplicate() { return code_duplicate(* this); } \
|
||||||
bool is_equal( Code other ) { return GEN_NS is_equal(* this, other); } \
|
bool is_equal( Code other ) { return code_is_equal(* this, other); } \
|
||||||
bool is_body() { return GEN_NS is_body(* this); } \
|
bool is_body() { return code_is_body(* this); } \
|
||||||
bool is_valid() { return GEN_NS is_valid(* this); } \
|
bool is_valid() { return code_is_valid(* this); } \
|
||||||
void set_global() { return GEN_NS set_global(* this); }
|
void set_global() { return code_set_global(* this); }
|
||||||
|
|
||||||
# define Using_CodeOps( Typename ) \
|
# define Using_CodeOps( Typename ) \
|
||||||
Typename& operator = ( Code other ); \
|
Typename& operator = ( Code other ); \
|
||||||
@ -203,13 +211,13 @@ struct Code
|
|||||||
|
|
||||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||||
Using_Code( Code );
|
Using_Code( Code );
|
||||||
void append(Code other) { return GEN_NS append(* this, other); }
|
void append(Code other) { return code_append(* this, other); }
|
||||||
Code* entry(u32 idx) { return GEN_NS entry(* this, idx); }
|
Code* entry(u32 idx) { return code_entry(* this, idx); }
|
||||||
bool has_entries() { return GEN_NS has_entries(* this); }
|
bool has_entries() { return code_has_entries(* this); }
|
||||||
String to_string() { return GEN_NS to_string(* this); }
|
String to_string() { return code_to_string(* this); }
|
||||||
void to_string(String& result) { return GEN_NS to_string(* this, & result); }
|
void to_string(String& result) { return code_to_string_ptr(* this, & result); }
|
||||||
char const* type_str() { return GEN_NS type_str(* this); }
|
char const* type_str() { return code_type_str(* this); }
|
||||||
bool validate_body() { return GEN_NS validate_body(*this); }
|
bool validate_body() { return code_validate_body(*this); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Using_CodeOps( Code );
|
Using_CodeOps( Code );
|
||||||
@ -268,6 +276,7 @@ struct Code
|
|||||||
operator CodeVar() const;
|
operator CodeVar() const;
|
||||||
#undef operator
|
#undef operator
|
||||||
};
|
};
|
||||||
|
GEN_API_C_BEGIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma region Statics
|
#pragma region Statics
|
||||||
@ -278,6 +287,7 @@ extern Code Code_Global;
|
|||||||
extern Code Code_Invalid;
|
extern Code Code_Invalid;
|
||||||
#pragma endregion Statics
|
#pragma endregion Statics
|
||||||
|
|
||||||
|
typedef struct Code_POD Code_POD;
|
||||||
struct Code_POD
|
struct Code_POD
|
||||||
{
|
{
|
||||||
AST* ast;
|
AST* ast;
|
||||||
@ -352,7 +362,7 @@ struct AST
|
|||||||
Code Next;
|
Code Next;
|
||||||
Code Back;
|
Code Back;
|
||||||
};
|
};
|
||||||
parser::Token* Token; // Reference to starting token, only avaialble if it was derived from parsing.
|
Token* Token; // Reference to starting token, only avaialble if it was derived from parsing.
|
||||||
Code Parent;
|
Code Parent;
|
||||||
StringCached Name;
|
StringCached Name;
|
||||||
CodeType Type;
|
CodeType Type;
|
||||||
@ -369,7 +379,7 @@ struct AST
|
|||||||
};
|
};
|
||||||
static_assert( sizeof(AST) == AST_POD_Size, "ERROR: AST POD is not size of AST_POD_Size" );
|
static_assert( sizeof(AST) == AST_POD_Size, "ERROR: AST POD is not size of AST_POD_Size" );
|
||||||
|
|
||||||
#if ! GEN_COMPILER_C
|
#if GEN_COMPILER_CPP
|
||||||
// Uses an implicitly overloaded cast from the AST to the desired code type.
|
// Uses an implicitly overloaded cast from the AST to the desired code type.
|
||||||
// Necessary if the user wants GEN_ENFORCE_STRONG_CODE_TYPES
|
// Necessary if the user wants GEN_ENFORCE_STRONG_CODE_TYPES
|
||||||
struct InvalidCode_ImplictCaster;
|
struct InvalidCode_ImplictCaster;
|
||||||
@ -380,3 +390,5 @@ struct InvalidCode_ImplictCaster;
|
|||||||
|
|
||||||
// Used when the its desired when omission is allowed in a definition.
|
// Used when the its desired when omission is allowed in a definition.
|
||||||
#define NullCode { nullptr }
|
#define NullCode { nullptr }
|
||||||
|
|
||||||
|
GEN_API_C_END
|
||||||
|
@ -44,7 +44,7 @@ void to_string( CodeBody body, String* result )
|
|||||||
s32 left = body.ast->NumEntries;
|
s32 left = body.ast->NumEntries;
|
||||||
while ( left -- )
|
while ( left -- )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "%S", GEN_NS to_string(curr) );
|
string_append_fmt( result, "%S", code_to_string(curr) );
|
||||||
++curr;
|
++curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ void to_string_export( CodeBody body, String* result )
|
|||||||
s32 left = body.ast->NumEntries;
|
s32 left = body.ast->NumEntries;
|
||||||
while ( left-- )
|
while ( left-- )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "%S", to_string(curr) );
|
string_append_fmt( result, "%S", code_to_string(curr) );
|
||||||
++curr;
|
++curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +102,12 @@ void to_string_def(CodeConstructor self, String* result )
|
|||||||
string_append_strc( result, txt("()") );
|
string_append_strc( result, txt("()") );
|
||||||
|
|
||||||
if ( self->InitializerList )
|
if ( self->InitializerList )
|
||||||
string_append_fmt( result, " : %S", to_string(self->InitializerList) );
|
string_append_fmt( result, " : %S", code_to_string(self->InitializerList) );
|
||||||
|
|
||||||
if ( self->InlineCmt )
|
if ( self->InlineCmt )
|
||||||
string_append_fmt( result, " // %SC", self->InlineCmt->Content );
|
string_append_fmt( result, " // %SC", self->InlineCmt->Content );
|
||||||
|
|
||||||
string_append_fmt( result, "\n{\n%S\n}\n", to_string(self->Body) );
|
string_append_fmt( result, "\n{\n%S\n}\n", code_to_string(self->Body) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_string_fwd(CodeConstructor self, String* result )
|
void to_string_fwd(CodeConstructor self, String* result )
|
||||||
@ -126,7 +126,7 @@ void to_string_fwd(CodeConstructor self, String* result )
|
|||||||
string_append_fmt( result, "()");
|
string_append_fmt( result, "()");
|
||||||
|
|
||||||
if (self->Body)
|
if (self->Body)
|
||||||
string_append_fmt( result, " = %S", to_string(self->Body) );
|
string_append_fmt( result, " = %S", code_to_string(self->Body) );
|
||||||
|
|
||||||
if ( self->InlineCmt )
|
if ( self->InlineCmt )
|
||||||
string_append_fmt( result, "; // %SC\n", self->InlineCmt->Content );
|
string_append_fmt( result, "; // %SC\n", self->InlineCmt->Content );
|
||||||
@ -260,7 +260,7 @@ void to_string_def(CodeDestructor self, String* result )
|
|||||||
else
|
else
|
||||||
string_append_fmt( result, "~%SC()", self->Parent->Name );
|
string_append_fmt( result, "~%SC()", self->Parent->Name );
|
||||||
|
|
||||||
string_append_fmt( result, "\n{\n%S\n}\n", to_string(self->Body) );
|
string_append_fmt( result, "\n{\n%S\n}\n", code_to_string(self->Body) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_string_fwd(CodeDestructor self, String* result )
|
void to_string_fwd(CodeDestructor self, String* result )
|
||||||
@ -275,7 +275,7 @@ void to_string_fwd(CodeDestructor self, String* result )
|
|||||||
if ( has(self->Specs, Spec_Pure ) )
|
if ( has(self->Specs, Spec_Pure ) )
|
||||||
string_append_strc( result, txt(" = 0;") );
|
string_append_strc( result, txt(" = 0;") );
|
||||||
else if (self->Body)
|
else if (self->Body)
|
||||||
string_append_fmt( result, " = %S;", to_string(self->Body) );
|
string_append_fmt( result, " = %S;", code_to_string(self->Body) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
string_append_fmt( result, "~%SC();", self->Parent->Name );
|
string_append_fmt( result, "~%SC();", self->Parent->Name );
|
||||||
@ -312,7 +312,7 @@ void to_string_def(CodeEnum self, String* result )
|
|||||||
if ( bitfield_is_equal( u32, self->ModuleFlags, ModuleFlag_Export ))
|
if ( bitfield_is_equal( u32, self->ModuleFlags, ModuleFlag_Export ))
|
||||||
string_append_strc( result, txt("export ") );
|
string_append_strc( result, txt("export ") );
|
||||||
|
|
||||||
if ( self->Attributes || self->UnderlyingType )
|
if ( self->Attributes || self->UnderlyingType || self->UnderlyingTypeMacro )
|
||||||
{
|
{
|
||||||
string_append_strc( result, txt("enum ") );
|
string_append_strc( result, txt("enum ") );
|
||||||
|
|
||||||
@ -326,9 +326,9 @@ void to_string_def(CodeEnum self, String* result )
|
|||||||
, to_string(self->Body)
|
, to_string(self->Body)
|
||||||
);
|
);
|
||||||
else if ( self->UnderlyingTypeMacro )
|
else if ( self->UnderlyingTypeMacro )
|
||||||
string_append_fmt( result, "%SC : %S\n{\n%S\n}"
|
string_append_fmt( result, "%SC %S\n\n{\n%S\n}"
|
||||||
, self->Name
|
, self->Name
|
||||||
, to_string(self->UnderlyingTypeMacro)
|
, code_to_string(self->UnderlyingTypeMacro)
|
||||||
, to_string(self->Body)
|
, to_string(self->Body)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ void to_string_fwd(CodeEnum self, String* result )
|
|||||||
if ( self->UnderlyingType )
|
if ( self->UnderlyingType )
|
||||||
string_append_fmt( result, "enum %SC : %S", self->Name, to_string(self->UnderlyingType) );
|
string_append_fmt( result, "enum %SC : %S", self->Name, to_string(self->UnderlyingType) );
|
||||||
else if (self->UnderlyingTypeMacro)
|
else if (self->UnderlyingTypeMacro)
|
||||||
string_append_fmt( result, "enum %SC : %S", self->Name, to_string(self->UnderlyingTypeMacro) );
|
string_append_fmt( result, "enum %SC %S", self->Name, to_string(self->UnderlyingType) );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, "enum %SC", self->Name );
|
string_append_fmt( result, "enum %SC", self->Name );
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ String to_string(CodeFriend self)
|
|||||||
|
|
||||||
void to_string(CodeFriend self, String* result )
|
void to_string(CodeFriend self, String* result )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "friend %S", to_string(self->Declaration) );
|
string_append_fmt( result, "friend %S", code_to_string(self->Declaration) );
|
||||||
|
|
||||||
if ( self->Declaration->Type != CT_Function && self->Declaration->Type != CT_Operator && (* result)[ string_length(* result) - 1 ] != ';' )
|
if ( self->Declaration->Type != CT_Function && self->Declaration->Type != CT_Operator && (* result)[ string_length(* result) - 1 ] != ';' )
|
||||||
{
|
{
|
||||||
@ -490,9 +490,9 @@ void to_string_def(CodeFn self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( ! is_trailing( spec ) )
|
if ( ! spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
|
|
||||||
prefix_specs = true;
|
prefix_specs = true;
|
||||||
@ -519,9 +519,9 @@ void to_string_def(CodeFn self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( is_trailing( spec ) )
|
if ( spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,9 +543,9 @@ void to_string_fwd(CodeFn self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( ! is_trailing( spec ) || ! (spec != Spec_Pure) )
|
if ( ! spec_is_trailing( spec ) || ! (spec != Spec_Pure) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
|
|
||||||
prefix_specs = true;
|
prefix_specs = true;
|
||||||
@ -574,9 +574,9 @@ void to_string_fwd(CodeFn self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( is_trailing( spec ) )
|
if ( spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -658,9 +658,9 @@ void to_string_def(CodeOperator self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( ! is_trailing( spec ) )
|
if ( ! spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -684,9 +684,9 @@ void to_string_def(CodeOperator self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( is_trailing( spec ) )
|
if ( spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -709,9 +709,9 @@ void to_string_fwd(CodeOperator self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( ! is_trailing( spec ) )
|
if ( ! spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -734,9 +734,9 @@ void to_string_fwd(CodeOperator self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( is_trailing( spec ) )
|
if ( spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -769,9 +769,9 @@ void to_string_def(CodeOpCast self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( ! is_trailing( spec ) )
|
if ( ! spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, "%*s ", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, "%*s ", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -783,9 +783,9 @@ void to_string_def(CodeOpCast self, String* result )
|
|||||||
|
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( is_trailing( spec ) )
|
if ( spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -806,9 +806,9 @@ void to_string_fwd(CodeOpCast self, String* result )
|
|||||||
{
|
{
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( ! is_trailing( spec ) )
|
if ( ! spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, "%*s ", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, "%*s ", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -817,9 +817,9 @@ void to_string_fwd(CodeOpCast self, String* result )
|
|||||||
|
|
||||||
for ( Specifier spec : self->Specs )
|
for ( Specifier spec : self->Specs )
|
||||||
{
|
{
|
||||||
if ( is_trailing( spec ) )
|
if ( spec_is_trailing( spec ) )
|
||||||
{
|
{
|
||||||
StrC spec_str = to_str( spec );
|
StrC spec_str = spec_to_str( spec );
|
||||||
string_append_fmt( result, " %*s", spec_str.Len, spec_str.Ptr );
|
string_append_fmt( result, " %*s", spec_str.Len, spec_str.Ptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -867,11 +867,11 @@ void to_string( CodeParam self, String* result )
|
|||||||
|
|
||||||
if ( ast->PostNameMacro )
|
if ( ast->PostNameMacro )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, " %S", to_string(ast->PostNameMacro) );
|
string_append_fmt( result, " %S", code_to_string(ast->PostNameMacro) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ast->Value )
|
if ( ast->Value )
|
||||||
string_append_fmt( result, " = %S", to_string(ast->Value) );
|
string_append_fmt( result, " = %S", code_to_string(ast->Value) );
|
||||||
|
|
||||||
if ( ast->NumEntries - 1 > 0 )
|
if ( ast->NumEntries - 1 > 0 )
|
||||||
{
|
{
|
||||||
@ -911,7 +911,7 @@ String to_string(CodePreprocessCond self)
|
|||||||
|
|
||||||
void to_string_if(CodePreprocessCond cond, String* result )
|
void to_string_if(CodePreprocessCond cond, String* result )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "#if %SC\n", cond->Content );
|
string_append_fmt( result, "#if %SC", cond->Content );
|
||||||
}
|
}
|
||||||
|
|
||||||
void to_string_ifdef(CodePreprocessCond cond, String* result )
|
void to_string_ifdef(CodePreprocessCond cond, String* result )
|
||||||
@ -948,7 +948,7 @@ String to_string(CodePragma self)
|
|||||||
|
|
||||||
void to_string(CodePragma self, String* result )
|
void to_string(CodePragma self, String* result )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "#pragma %SC\n", self->Content );
|
string_append_fmt( result, "#pragma %SC", self->Content );
|
||||||
}
|
}
|
||||||
|
|
||||||
String to_string(CodeSpecifiers self)
|
String to_string(CodeSpecifiers self)
|
||||||
@ -966,7 +966,7 @@ void to_string( CodeSpecifiers self, String* result )
|
|||||||
s32 left = self->NumEntries;
|
s32 left = self->NumEntries;
|
||||||
while ( left-- )
|
while ( left-- )
|
||||||
{
|
{
|
||||||
StrC spec = to_str( self->ArrSpecs[idx] );
|
StrC spec = spec_to_str( self->ArrSpecs[idx] );
|
||||||
string_append_fmt( result, "%.*s ", spec.Len, spec.Ptr );
|
string_append_fmt( result, "%.*s ", spec.Len, spec.Ptr );
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
@ -1070,9 +1070,9 @@ void to_string(CodeTemplate self, String* result )
|
|||||||
string_append_strc( result, txt("export ") );
|
string_append_strc( result, txt("export ") );
|
||||||
|
|
||||||
if ( self->Params )
|
if ( self->Params )
|
||||||
string_append_fmt( result, "template< %S >\n%S", to_string(self->Params), to_string(self->Declaration) );
|
string_append_fmt( result, "template< %S >\n%S", to_string(self->Params), code_to_string(self->Declaration) );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, "template<>\n%S", to_string(self->Declaration) );
|
string_append_fmt( result, "template<>\n%S", code_to_string(self->Declaration) );
|
||||||
}
|
}
|
||||||
|
|
||||||
String to_string(CodeTypedef self)
|
String to_string(CodeTypedef self)
|
||||||
@ -1091,18 +1091,18 @@ void to_string(CodeTypedef self, String* result )
|
|||||||
|
|
||||||
// Determines if the typedef is a function typename
|
// Determines if the typedef is a function typename
|
||||||
if ( self->UnderlyingType->ReturnType )
|
if ( self->UnderlyingType->ReturnType )
|
||||||
string_append_string( result, to_string(self->UnderlyingType) );
|
string_append_string( result, code_to_string(self->UnderlyingType) );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, "%S %SC", to_string(self->UnderlyingType), self->Name );
|
string_append_fmt( result, "%S %SC", code_to_string(self->UnderlyingType), self->Name );
|
||||||
|
|
||||||
if ( self->UnderlyingType->Type == CT_Typename && self->UnderlyingType->ArrExpr )
|
if ( self->UnderlyingType->Type == CT_Typename && self->UnderlyingType->ArrExpr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ];", to_string(self->UnderlyingType->ArrExpr) );
|
string_append_fmt( result, "[ %S ];", code_to_string(self->UnderlyingType->ArrExpr) );
|
||||||
|
|
||||||
Code next_arr_expr = self->UnderlyingType->ArrExpr->Next;
|
Code next_arr_expr = self->UnderlyingType->ArrExpr->Next;
|
||||||
while ( next_arr_expr )
|
while ( next_arr_expr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ];", to_string(next_arr_expr) );
|
string_append_fmt( result, "[ %S ];", code_to_string(next_arr_expr) );
|
||||||
next_arr_expr = next_arr_expr->Next;
|
next_arr_expr = next_arr_expr->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1262,12 +1262,12 @@ void to_string(CodeUsing self, String* result )
|
|||||||
|
|
||||||
if ( self->UnderlyingType->ArrExpr )
|
if ( self->UnderlyingType->ArrExpr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(self->UnderlyingType->ArrExpr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(self->UnderlyingType->ArrExpr) );
|
||||||
|
|
||||||
Code next_arr_expr = self->UnderlyingType->ArrExpr->Next;
|
Code next_arr_expr = self->UnderlyingType->ArrExpr->Next;
|
||||||
while ( next_arr_expr )
|
while ( next_arr_expr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(next_arr_expr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(next_arr_expr) );
|
||||||
next_arr_expr = next_arr_expr->Next;
|
next_arr_expr = next_arr_expr->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1311,12 +1311,12 @@ void to_string(CodeVar self, String* result )
|
|||||||
|
|
||||||
if ( self->ValueType->ArrExpr )
|
if ( self->ValueType->ArrExpr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(self->ValueType->ArrExpr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(self->ValueType->ArrExpr) );
|
||||||
|
|
||||||
Code next_arr_expr = self->ValueType->ArrExpr->Next;
|
Code next_arr_expr = self->ValueType->ArrExpr->Next;
|
||||||
while ( next_arr_expr )
|
while ( next_arr_expr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(next_arr_expr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(next_arr_expr) );
|
||||||
next_arr_expr = next_arr_expr->Next;
|
next_arr_expr = next_arr_expr->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1324,9 +1324,9 @@ void to_string(CodeVar self, String* result )
|
|||||||
if ( self->Value )
|
if ( self->Value )
|
||||||
{
|
{
|
||||||
if ( self->VarConstructorInit )
|
if ( self->VarConstructorInit )
|
||||||
string_append_fmt( result, "( %S ", to_string(self->Value) );
|
string_append_fmt( result, "( %S ", code_to_string(self->Value) );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, " = %S", to_string(self->Value) );
|
string_append_fmt( result, " = %S", code_to_string(self->Value) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep the chain going...
|
// Keep the chain going...
|
||||||
@ -1354,25 +1354,25 @@ void to_string(CodeVar self, String* result )
|
|||||||
|
|
||||||
if ( self->ValueType->ArrExpr )
|
if ( self->ValueType->ArrExpr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(self->ValueType->ArrExpr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(self->ValueType->ArrExpr) );
|
||||||
|
|
||||||
Code next_arr_expr = self->ValueType->ArrExpr->Next;
|
Code next_arr_expr = self->ValueType->ArrExpr->Next;
|
||||||
while ( next_arr_expr )
|
while ( next_arr_expr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(next_arr_expr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(next_arr_expr) );
|
||||||
next_arr_expr = next_arr_expr->Next;
|
next_arr_expr = next_arr_expr->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self->BitfieldSize )
|
if ( self->BitfieldSize )
|
||||||
string_append_fmt( result, " : %S", to_string(self->BitfieldSize) );
|
string_append_fmt( result, " : %S", code_to_string(self->BitfieldSize) );
|
||||||
|
|
||||||
if ( self->Value )
|
if ( self->Value )
|
||||||
{
|
{
|
||||||
if ( self->VarConstructorInit )
|
if ( self->VarConstructorInit )
|
||||||
string_append_fmt( result, "( %S ", to_string(self->Value) );
|
string_append_fmt( result, "( %S ", code_to_string(self->Value) );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, " = %S", to_string(self->Value) );
|
string_append_fmt( result, " = %S", code_to_string(self->Value) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self->NextVar )
|
if ( self->NextVar )
|
||||||
@ -1390,16 +1390,16 @@ void to_string(CodeVar self, String* result )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( self->BitfieldSize )
|
if ( self->BitfieldSize )
|
||||||
string_append_fmt( result, "%S %SC : %S", to_string(self->ValueType), self->Name, to_string(self->BitfieldSize) );
|
string_append_fmt( result, "%S %SC : %S", to_string(self->ValueType), self->Name, code_to_string(self->BitfieldSize) );
|
||||||
|
|
||||||
else if ( self->ValueType->ArrExpr )
|
else if ( self->ValueType->ArrExpr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "%S %SC[ %S ]", to_string(self->ValueType), self->Name, to_string(self->ValueType->ArrExpr) );
|
string_append_fmt( result, "%S %SC[ %S ]", to_string(self->ValueType), self->Name, code_to_string(self->ValueType->ArrExpr) );
|
||||||
|
|
||||||
Code next_arr_expr = self->ValueType->ArrExpr->Next;
|
Code next_arr_expr = self->ValueType->ArrExpr->Next;
|
||||||
while ( next_arr_expr )
|
while ( next_arr_expr )
|
||||||
{
|
{
|
||||||
string_append_fmt( result, "[ %S ]", to_string(next_arr_expr) );
|
string_append_fmt( result, "[ %S ]", code_to_string(next_arr_expr) );
|
||||||
next_arr_expr = next_arr_expr->Next;
|
next_arr_expr = next_arr_expr->Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1410,9 +1410,9 @@ void to_string(CodeVar self, String* result )
|
|||||||
if ( self->Value )
|
if ( self->Value )
|
||||||
{
|
{
|
||||||
if ( self->VarConstructorInit )
|
if ( self->VarConstructorInit )
|
||||||
string_append_fmt( result, "( %S ", to_string(self->Value) );
|
string_append_fmt( result, "( %S ", code_to_string(self->Value) );
|
||||||
else
|
else
|
||||||
string_append_fmt( result, " = %S", to_string(self->Value) );
|
string_append_fmt( result, " = %S", code_to_string(self->Value) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self->NextVar )
|
if ( self->NextVar )
|
||||||
|
@ -12,6 +12,7 @@ void to_string_export ( CodeBody body, String* result );
|
|||||||
|
|
||||||
Code begin( CodeBody body);
|
Code begin( CodeBody body);
|
||||||
Code end ( CodeBody body );
|
Code end ( CodeBody body );
|
||||||
|
Code next ( CodeBody body );
|
||||||
|
|
||||||
void add_interface( CodeClass self, CodeType interface );
|
void add_interface( CodeClass self, CodeType interface );
|
||||||
String to_string ( CodeClass self );
|
String to_string ( CodeClass self );
|
||||||
@ -135,7 +136,7 @@ struct CodeBody
|
|||||||
|
|
||||||
void append( Code other ) { return GEN_NS append( *this, other ); }
|
void append( Code other ) { return GEN_NS append( *this, other ); }
|
||||||
void append( CodeBody body ) { return GEN_NS append(*this, body); }
|
void append( CodeBody body ) { return GEN_NS append(*this, body); }
|
||||||
bool has_entries() { return GEN_NS has_entries(* this); }
|
bool has_entries() { return GEN_NS code_has_entries(* this); }
|
||||||
|
|
||||||
String to_string() { return GEN_NS to_string(* this); }
|
String to_string() { return GEN_NS to_string(* this); }
|
||||||
void to_string( String& result ) { return GEN_NS to_string(* this, & result ); }
|
void to_string( String& result ) { return GEN_NS to_string(* this, & result ); }
|
||||||
@ -696,7 +697,7 @@ struct CodeOpCast
|
|||||||
|
|
||||||
struct CodePragma
|
struct CodePragma
|
||||||
{
|
{
|
||||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||||
Using_Code( CodePragma );
|
Using_Code( CodePragma );
|
||||||
|
|
||||||
String to_string() { return GEN_NS to_string(* this); }
|
String to_string() { return GEN_NS to_string(* this); }
|
||||||
@ -963,8 +964,9 @@ struct CodeUnion
|
|||||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||||
Using_Code( CodeUnion );
|
Using_Code( CodeUnion );
|
||||||
|
|
||||||
String to_string() { return GEN_NS to_string(* this); }
|
String to_string() { return GEN_NS to_string(* this); }
|
||||||
void to_string( String& result ) { return GEN_NS to_string(* this, & result); }
|
void to_string_def( String& result ) { return GEN_NS to_string_def(* this, & result); }
|
||||||
|
void to_string_fwd( String& result ) { return GEN_NS to_string_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Using_CodeOps(CodeUnion);
|
Using_CodeOps(CodeUnion);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once #include "components/types.hpp"
|
||||||
#include "components/types.hpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||||
@ -11,7 +10,7 @@ inline Code& Code::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -27,7 +26,7 @@ inline CodeBody& CodeBody::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -43,7 +42,7 @@ inline CodeAttributes& CodeAttributes::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -74,7 +73,7 @@ inline CodeComment& CodeComment::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -105,7 +104,7 @@ inline CodeConstructor& CodeConstructor::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -136,7 +135,7 @@ inline CodeClass& CodeClass::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -152,7 +151,7 @@ inline CodeDefine& CodeDefine::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -183,7 +182,7 @@ inline CodeDestructor& CodeDestructor::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -214,7 +213,7 @@ inline CodeEnum& CodeEnum::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -245,7 +244,7 @@ inline CodeExec& CodeExec::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -276,7 +275,7 @@ inline CodeExtern& CodeExtern::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -307,7 +306,7 @@ inline CodeFriend& CodeFriend::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -338,7 +337,7 @@ inline CodeFn& CodeFn::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -369,7 +368,7 @@ inline CodeInclude& CodeInclude::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -400,7 +399,7 @@ inline CodeModule& CodeModule::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -431,7 +430,7 @@ inline CodeNS& CodeNS::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -462,7 +461,7 @@ inline CodeOperator& CodeOperator::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -493,7 +492,7 @@ inline CodeOpCast& CodeOpCast::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -524,7 +523,7 @@ inline CodeParam& CodeParam::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -540,7 +539,7 @@ inline CodePragma& CodePragma::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -571,7 +570,7 @@ inline CodePreprocessCond& CodePreprocessCond::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -602,7 +601,7 @@ inline CodeSpecifiers& CodeSpecifiers::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -618,7 +617,7 @@ inline CodeStruct& CodeStruct::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -634,7 +633,7 @@ inline CodeTemplate& CodeTemplate::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -665,7 +664,7 @@ inline CodeTypename& CodeTypename::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -696,7 +695,7 @@ inline CodeTypedef& CodeTypedef::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -727,7 +726,7 @@ inline CodeUnion& CodeUnion::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -758,7 +757,7 @@ inline CodeUsing& CodeUsing::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -789,7 +788,7 @@ inline CodeVar& CodeVar::operator=( Code other )
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other ).ast );
|
ast = rcast( decltype( ast ), code_duplicate( other ).ast );
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
ast = rcast( decltype( ast ), other.ast );
|
ast = rcast( decltype( ast ), other.ast );
|
||||||
@ -817,7 +816,6 @@ inline AST_Var* CodeVar::operator->()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma endregion generated code inline implementation
|
#pragma endregion generated code inline implementation
|
||||||
|
|
||||||
#pragma region generated AST/Code cast implementation
|
#pragma region generated AST/Code cast implementation
|
||||||
|
|
||||||
inline Code::operator CodeBody() const
|
inline Code::operator CodeBody() const
|
||||||
|
@ -1,80 +1,78 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once #include "components/types.hpp"
|
||||||
#include "components/types.hpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||||
|
|
||||||
enum CodeType_Def : u32
|
enum CodeType_Def enum_underlying( u32 )
|
||||||
{
|
|
||||||
CT_Invalid,
|
{ CT_Invalid,
|
||||||
CT_Untyped,
|
CT_Untyped,
|
||||||
CT_NewLine,
|
CT_NewLine,
|
||||||
CT_Comment,
|
CT_Comment,
|
||||||
CT_Access_Private,
|
CT_Access_Private,
|
||||||
CT_Access_Protected,
|
CT_Access_Protected,
|
||||||
CT_Access_Public,
|
CT_Access_Public,
|
||||||
CT_PlatformAttributes,
|
CT_PlatformAttributes,
|
||||||
CT_Class,
|
CT_Class,
|
||||||
CT_Class_Fwd,
|
CT_Class_Fwd,
|
||||||
CT_Class_Body,
|
CT_Class_Body,
|
||||||
CT_Constructor,
|
CT_Constructor,
|
||||||
CT_Constructor_Fwd,
|
CT_Constructor_Fwd,
|
||||||
CT_Destructor,
|
CT_Destructor,
|
||||||
CT_Destructor_Fwd,
|
CT_Destructor_Fwd,
|
||||||
CT_Enum,
|
CT_Enum,
|
||||||
CT_Enum_Fwd,
|
CT_Enum_Fwd,
|
||||||
CT_Enum_Body,
|
CT_Enum_Body,
|
||||||
CT_Enum_Class,
|
CT_Enum_Class,
|
||||||
CT_Enum_Class_Fwd,
|
CT_Enum_Class_Fwd,
|
||||||
CT_Execution,
|
CT_Execution,
|
||||||
CT_Export_Body,
|
CT_Export_Body,
|
||||||
CT_Extern_Linkage,
|
CT_Extern_Linkage,
|
||||||
CT_Extern_Linkage_Body,
|
CT_Extern_Linkage_Body,
|
||||||
CT_Friend,
|
CT_Friend,
|
||||||
CT_Function,
|
CT_Function,
|
||||||
CT_Function_Fwd,
|
CT_Function_Fwd,
|
||||||
CT_Function_Body,
|
CT_Function_Body,
|
||||||
CT_Global_Body,
|
CT_Global_Body,
|
||||||
CT_Module,
|
CT_Module,
|
||||||
CT_Namespace,
|
CT_Namespace,
|
||||||
CT_Namespace_Body,
|
CT_Namespace_Body,
|
||||||
CT_Operator,
|
CT_Operator,
|
||||||
CT_Operator_Fwd,
|
CT_Operator_Fwd,
|
||||||
CT_Operator_Member,
|
CT_Operator_Member,
|
||||||
CT_Operator_Member_Fwd,
|
CT_Operator_Member_Fwd,
|
||||||
CT_Operator_Cast,
|
CT_Operator_Cast,
|
||||||
CT_Operator_Cast_Fwd,
|
CT_Operator_Cast_Fwd,
|
||||||
CT_Parameters,
|
CT_Parameters,
|
||||||
CT_Preprocess_Define,
|
CT_Preprocess_Define,
|
||||||
CT_Preprocess_Include,
|
CT_Preprocess_Include,
|
||||||
CT_Preprocess_If,
|
CT_Preprocess_If,
|
||||||
CT_Preprocess_IfDef,
|
CT_Preprocess_IfDef,
|
||||||
CT_Preprocess_IfNotDef,
|
CT_Preprocess_IfNotDef,
|
||||||
CT_Preprocess_ElIf,
|
CT_Preprocess_ElIf,
|
||||||
CT_Preprocess_Else,
|
CT_Preprocess_Else,
|
||||||
CT_Preprocess_EndIf,
|
CT_Preprocess_EndIf,
|
||||||
CT_Preprocess_Pragma,
|
CT_Preprocess_Pragma,
|
||||||
CT_Specifiers,
|
CT_Specifiers,
|
||||||
CT_Struct,
|
CT_Struct,
|
||||||
CT_Struct_Fwd,
|
CT_Struct_Fwd,
|
||||||
CT_Struct_Body,
|
CT_Struct_Body,
|
||||||
CT_Template,
|
CT_Template,
|
||||||
CT_Typedef,
|
CT_Typedef,
|
||||||
CT_Typename,
|
CT_Typename,
|
||||||
CT_Union,
|
CT_Union,
|
||||||
CT_Union_Fwd,
|
CT_Union_Fwd,
|
||||||
CT_Union_Body,
|
CT_Union_Body,
|
||||||
CT_Using,
|
CT_Using,
|
||||||
CT_Using_Namespace,
|
CT_Using_Namespace,
|
||||||
CT_Variable,
|
CT_Variable,
|
||||||
CT_NumTypes
|
CT_NumTypes };
|
||||||
};
|
|
||||||
typedef enum CodeType_Def CodeType;
|
typedef enum CodeType_Def CodeType;
|
||||||
|
|
||||||
inline StrC to_str( CodeType type )
|
inline StrC codetype_to_str( CodeType type )
|
||||||
{
|
{
|
||||||
local_persist StrC lookup[] {
|
local_persist StrC lookup[61] = {
|
||||||
{ sizeof( "Invalid" ), "Invalid" },
|
{ sizeof( "Invalid" ), "Invalid" },
|
||||||
{ sizeof( "Untyped" ), "Untyped" },
|
{ sizeof( "Untyped" ), "Untyped" },
|
||||||
{ sizeof( "NewLine" ), "NewLine" },
|
{ sizeof( "NewLine" ), "NewLine" },
|
||||||
|
@ -1,66 +1,64 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once #include "components/types.hpp"
|
||||||
#include "components/types.hpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||||
|
|
||||||
enum Operator_Def : u32
|
enum Operator_Def enum_underlying( u32 )
|
||||||
{
|
|
||||||
Op_Invalid,
|
{ Op_Invalid,
|
||||||
Op_Assign,
|
Op_Assign,
|
||||||
Op_Assign_Add,
|
Op_Assign_Add,
|
||||||
Op_Assign_Subtract,
|
Op_Assign_Subtract,
|
||||||
Op_Assign_Multiply,
|
Op_Assign_Multiply,
|
||||||
Op_Assign_Divide,
|
Op_Assign_Divide,
|
||||||
Op_Assign_Modulo,
|
Op_Assign_Modulo,
|
||||||
Op_Assign_BAnd,
|
Op_Assign_BAnd,
|
||||||
Op_Assign_BOr,
|
Op_Assign_BOr,
|
||||||
Op_Assign_BXOr,
|
Op_Assign_BXOr,
|
||||||
Op_Assign_LShift,
|
Op_Assign_LShift,
|
||||||
Op_Assign_RShift,
|
Op_Assign_RShift,
|
||||||
Op_Increment,
|
Op_Increment,
|
||||||
Op_Decrement,
|
Op_Decrement,
|
||||||
Op_Unary_Plus,
|
Op_Unary_Plus,
|
||||||
Op_Unary_Minus,
|
Op_Unary_Minus,
|
||||||
Op_UnaryNot,
|
Op_UnaryNot,
|
||||||
Op_Add,
|
Op_Add,
|
||||||
Op_Subtract,
|
Op_Subtract,
|
||||||
Op_Multiply,
|
Op_Multiply,
|
||||||
Op_Divide,
|
Op_Divide,
|
||||||
Op_Modulo,
|
Op_Modulo,
|
||||||
Op_BNot,
|
Op_BNot,
|
||||||
Op_BAnd,
|
Op_BAnd,
|
||||||
Op_BOr,
|
Op_BOr,
|
||||||
Op_BXOr,
|
Op_BXOr,
|
||||||
Op_LShift,
|
Op_LShift,
|
||||||
Op_RShift,
|
Op_RShift,
|
||||||
Op_LAnd,
|
Op_LAnd,
|
||||||
Op_LOr,
|
Op_LOr,
|
||||||
Op_LEqual,
|
Op_LEqual,
|
||||||
Op_LNot,
|
Op_LNot,
|
||||||
Op_Lesser,
|
Op_Lesser,
|
||||||
Op_Greater,
|
Op_Greater,
|
||||||
Op_LesserEqual,
|
Op_LesserEqual,
|
||||||
Op_GreaterEqual,
|
Op_GreaterEqual,
|
||||||
Op_Subscript,
|
Op_Subscript,
|
||||||
Op_Indirection,
|
Op_Indirection,
|
||||||
Op_AddressOf,
|
Op_AddressOf,
|
||||||
Op_MemberOfPointer,
|
Op_MemberOfPointer,
|
||||||
Op_PtrToMemOfPtr,
|
Op_PtrToMemOfPtr,
|
||||||
Op_FunctionCall,
|
Op_FunctionCall,
|
||||||
Op_Comma,
|
Op_Comma,
|
||||||
Op_New,
|
Op_New,
|
||||||
Op_NewArray,
|
Op_NewArray,
|
||||||
Op_Delete,
|
Op_Delete,
|
||||||
Op_DeleteArray,
|
Op_DeleteArray,
|
||||||
NumOps
|
NumOps };
|
||||||
};
|
|
||||||
typedef enum Operator_Def Operator;
|
typedef enum Operator_Def Operator;
|
||||||
|
|
||||||
inline StrC to_str( Operator op )
|
inline StrC operator_to_str( Operator op )
|
||||||
{
|
{
|
||||||
local_persist StrC lookup[] {
|
local_persist StrC lookup[47] = {
|
||||||
{ sizeof( "INVALID" ), "INVALID" },
|
{ sizeof( "INVALID" ), "INVALID" },
|
||||||
{ sizeof( "=" ), "=" },
|
{ sizeof( "=" ), "=" },
|
||||||
{ sizeof( "+=" ), "+=" },
|
{ sizeof( "+=" ), "+=" },
|
||||||
|
@ -1,50 +1,25 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once #include "components/types.hpp"
|
||||||
#include "components/types.hpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||||
|
|
||||||
enum Specifier_Def : u32
|
enum Specifier_Def enum_underlying( u32 )
|
||||||
{
|
|
||||||
Spec_Invalid,
|
{ Spec_Invalid, Spec_Consteval, Spec_Constexpr, Spec_Constinit, Spec_Explicit, Spec_External_Linkage, Spec_ForceInline,
|
||||||
Spec_Consteval,
|
Spec_Global, Spec_Inline, Spec_Internal_Linkage, Spec_Local_Persist, Spec_Mutable, Spec_NeverInline, Spec_Ptr,
|
||||||
Spec_Constexpr,
|
Spec_Ref, Spec_Register, Spec_RValue, Spec_Static, Spec_Thread_Local, Spec_Virtual, Spec_Const,
|
||||||
Spec_Constinit,
|
Spec_Final, Spec_NoExceptions, Spec_Override, Spec_Pure, Spec_Volatile, Spec_NumSpecifiers };
|
||||||
Spec_Explicit,
|
|
||||||
Spec_External_Linkage,
|
|
||||||
Spec_ForceInline,
|
|
||||||
Spec_Global,
|
|
||||||
Spec_Inline,
|
|
||||||
Spec_Internal_Linkage,
|
|
||||||
Spec_Local_Persist,
|
|
||||||
Spec_Mutable,
|
|
||||||
Spec_NeverInline,
|
|
||||||
Spec_Ptr,
|
|
||||||
Spec_Ref,
|
|
||||||
Spec_Register,
|
|
||||||
Spec_RValue,
|
|
||||||
Spec_Static,
|
|
||||||
Spec_Thread_Local,
|
|
||||||
Spec_Virtual,
|
|
||||||
Spec_Const,
|
|
||||||
Spec_Final,
|
|
||||||
Spec_NoExceptions,
|
|
||||||
Spec_Override,
|
|
||||||
Spec_Pure,
|
|
||||||
Spec_Volatile,
|
|
||||||
Spec_NumSpecifiers
|
|
||||||
};
|
|
||||||
typedef enum Specifier_Def Specifier;
|
typedef enum Specifier_Def Specifier;
|
||||||
|
|
||||||
inline bool is_trailing( Specifier specifier )
|
inline bool spec_is_trailing( Specifier specifier )
|
||||||
{
|
{
|
||||||
return specifier > Spec_Virtual;
|
return specifier > Spec_Virtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StrC to_str( Specifier type )
|
inline StrC spec_to_str( Specifier type )
|
||||||
{
|
{
|
||||||
local_persist StrC lookup[] {
|
local_persist StrC lookup[26] = {
|
||||||
{ sizeof( "INVALID" ), "INVALID" },
|
{ sizeof( "INVALID" ), "INVALID" },
|
||||||
{ sizeof( "consteval" ), "consteval" },
|
{ sizeof( "consteval" ), "consteval" },
|
||||||
{ sizeof( "constexpr" ), "constexpr" },
|
{ sizeof( "constexpr" ), "constexpr" },
|
||||||
@ -75,12 +50,12 @@ inline StrC to_str( Specifier type )
|
|||||||
return lookup[type];
|
return lookup[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Specifier to_specifier( StrC str )
|
inline Specifier strc_to_specifier( StrC str )
|
||||||
{
|
{
|
||||||
local_persist u32 keymap[Spec_NumSpecifiers];
|
local_persist u32 keymap[Spec_NumSpecifiers];
|
||||||
do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||||
{
|
{
|
||||||
StrC enum_str = to_str( (Specifier)index );
|
StrC enum_str = spec_to_str( (Specifier)index );
|
||||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
||||||
}
|
}
|
||||||
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
||||||
#pragma once
|
#pragma once #include "components/types.hpp"
|
||||||
#include "components/types.hpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
#pragma region Code
|
#pragma region Code
|
||||||
inline
|
inline
|
||||||
void append( Code self, Code other )
|
void code_append( Code self, Code other )
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self.ast != nullptr);
|
GEN_ASSERT(self.ast != nullptr);
|
||||||
GEN_ASSERT(other.ast != nullptr);
|
GEN_ASSERT(other.ast != nullptr);
|
||||||
|
|
||||||
if ( other->Parent )
|
if ( other->Parent )
|
||||||
other = duplicate(other);
|
other = code_duplicate(other);
|
||||||
|
|
||||||
other->Parent = self;
|
other->Parent = self;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ void append( Code self, Code other )
|
|||||||
self->NumEntries++;
|
self->NumEntries++;
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
bool is_body(Code self)
|
bool code_is_body(Code self)
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self != nullptr);
|
GEN_ASSERT(self != nullptr);
|
||||||
switch (self->Type)
|
switch (self->Type)
|
||||||
@ -51,7 +51,7 @@ bool is_body(Code self)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
Code* entry( Code self, u32 idx )
|
Code* code_entry( Code self, u32 idx )
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self.ast != nullptr);
|
GEN_ASSERT(self.ast != nullptr);
|
||||||
Code* current = & self->Front;
|
Code* current = & self->Front;
|
||||||
@ -67,18 +67,18 @@ Code* entry( Code self, u32 idx )
|
|||||||
return rcast( Code*, current);
|
return rcast( Code*, current);
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
bool is_valid(Code self)
|
bool code_is_valid(Code self)
|
||||||
{
|
{
|
||||||
return self.ast != nullptr && self.ast->Type != CT_Invalid;
|
return self.ast != nullptr && self.ast->Type != CT_Invalid;
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
bool has_entries(AST* self)
|
bool code_has_entries(AST* self)
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self != nullptr);
|
GEN_ASSERT(self != nullptr);
|
||||||
return self->NumEntries > 0;
|
return self->NumEntries > 0;
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
void set_global(Code self)
|
void code_set_global(Code self)
|
||||||
{
|
{
|
||||||
if ( self.ast == nullptr )
|
if ( self.ast == nullptr )
|
||||||
{
|
{
|
||||||
@ -97,10 +97,10 @@ Code& Code::operator ++()
|
|||||||
return * this;
|
return * this;
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
char const* type_str(Code self)
|
char const* code_type_str(Code self)
|
||||||
{
|
{
|
||||||
GEN_ASSERT(self != nullptr);
|
GEN_ASSERT(self != nullptr);
|
||||||
return to_str( self->Type );
|
return codetype_to_str( self->Type );
|
||||||
}
|
}
|
||||||
#pragma endregion Code
|
#pragma endregion Code
|
||||||
|
|
||||||
@ -110,12 +110,12 @@ void append( CodeBody self, Code other )
|
|||||||
{
|
{
|
||||||
GEN_ASSERT(other.ast != nullptr);
|
GEN_ASSERT(other.ast != nullptr);
|
||||||
|
|
||||||
if (is_body(other)) {
|
if (code_is_body(other)) {
|
||||||
append( self, cast(CodeBody, other) );
|
append( self, cast(CodeBody, other) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
append( cast(Code, self), other );
|
code_append( cast(Code, self), other );
|
||||||
}
|
}
|
||||||
inline
|
inline
|
||||||
void append( CodeBody self, CodeBody body )
|
void append( CodeBody self, CodeBody body )
|
||||||
@ -136,6 +136,10 @@ inline
|
|||||||
Code end(CodeBody body ){
|
Code end(CodeBody body ){
|
||||||
return { rcast(AST*, body.ast)->Back->Next };
|
return { rcast(AST*, body.ast)->Back->Next };
|
||||||
}
|
}
|
||||||
|
inline
|
||||||
|
Code next(CodeBody body, Code entry) {
|
||||||
|
return entry->Next;
|
||||||
|
}
|
||||||
#pragma endregion CodeBody
|
#pragma endregion CodeBody
|
||||||
|
|
||||||
#pragma region CodeClass
|
#pragma region CodeClass
|
||||||
@ -170,7 +174,7 @@ void append( CodeParam appendee, CodeParam other )
|
|||||||
Code entry = cast(Code, other);
|
Code entry = cast(Code, other);
|
||||||
|
|
||||||
if ( entry->Parent )
|
if ( entry->Parent )
|
||||||
entry = GEN_NS duplicate( entry );
|
entry = code_duplicate( entry );
|
||||||
|
|
||||||
entry->Parent = self;
|
entry->Parent = self;
|
||||||
|
|
||||||
@ -355,7 +359,7 @@ CodeBody def_body( CodeType type )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "def_body: Invalid type %s", (char const*)to_str(type) );
|
log_failure( "def_body: Invalid type %s", (char const*)codetype_to_str(type) );
|
||||||
return (CodeBody)Code_Invalid;
|
return (CodeBody)Code_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,73 +79,73 @@ void define_constants()
|
|||||||
Code_Global->Content = Code_Global->Name;
|
Code_Global->Content = Code_Global->Name;
|
||||||
|
|
||||||
Code_Invalid = make_code();
|
Code_Invalid = make_code();
|
||||||
set_global(Code_Invalid);
|
code_set_global(Code_Invalid);
|
||||||
|
|
||||||
t_empty = (CodeTypename) make_code();
|
t_empty = (CodeTypename) make_code();
|
||||||
t_empty->Type = CT_Typename;
|
t_empty->Type = CT_Typename;
|
||||||
t_empty->Name = get_cached_string( txt("") );
|
t_empty->Name = get_cached_string( txt("") );
|
||||||
set_global(t_empty);
|
code_set_global(t_empty);
|
||||||
|
|
||||||
access_private = make_code();
|
access_private = make_code();
|
||||||
access_private->Type = CT_Access_Private;
|
access_private->Type = CT_Access_Private;
|
||||||
access_private->Name = get_cached_string( txt("private:\n") );
|
access_private->Name = get_cached_string( txt("private:\n") );
|
||||||
set_global(access_private);
|
code_set_global(access_private);
|
||||||
|
|
||||||
access_protected = make_code();
|
access_protected = make_code();
|
||||||
access_protected->Type = CT_Access_Protected;
|
access_protected->Type = CT_Access_Protected;
|
||||||
access_protected->Name = get_cached_string( txt("protected:\n") );
|
access_protected->Name = get_cached_string( txt("protected:\n") );
|
||||||
set_global(access_protected);
|
code_set_global(access_protected);
|
||||||
|
|
||||||
access_public = make_code();
|
access_public = make_code();
|
||||||
access_public->Type = CT_Access_Public;
|
access_public->Type = CT_Access_Public;
|
||||||
access_public->Name = get_cached_string( txt("public:\n") );
|
access_public->Name = get_cached_string( txt("public:\n") );
|
||||||
set_global(access_public);
|
code_set_global(access_public);
|
||||||
|
|
||||||
attrib_api_export = def_attributes( code(GEN_API_Export_Code));
|
attrib_api_export = def_attributes( code(GEN_API_Export_Code));
|
||||||
set_global(attrib_api_export);
|
code_set_global(attrib_api_export);
|
||||||
|
|
||||||
attrib_api_import = def_attributes( code(GEN_API_Import_Code));
|
attrib_api_import = def_attributes( code(GEN_API_Import_Code));
|
||||||
set_global(attrib_api_import);
|
code_set_global(attrib_api_import);
|
||||||
|
|
||||||
module_global_fragment = make_code();
|
module_global_fragment = make_code();
|
||||||
module_global_fragment->Type = CT_Untyped;
|
module_global_fragment->Type = CT_Untyped;
|
||||||
module_global_fragment->Name = get_cached_string( txt("module;") );
|
module_global_fragment->Name = get_cached_string( txt("module;") );
|
||||||
module_global_fragment->Content = module_global_fragment->Name;
|
module_global_fragment->Content = module_global_fragment->Name;
|
||||||
set_global(module_global_fragment);
|
code_set_global(module_global_fragment);
|
||||||
|
|
||||||
module_private_fragment = make_code();
|
module_private_fragment = make_code();
|
||||||
module_private_fragment->Type = CT_Untyped;
|
module_private_fragment->Type = CT_Untyped;
|
||||||
module_private_fragment->Name = get_cached_string( txt("module : private;") );
|
module_private_fragment->Name = get_cached_string( txt("module : private;") );
|
||||||
module_private_fragment->Content = module_private_fragment->Name;
|
module_private_fragment->Content = module_private_fragment->Name;
|
||||||
set_global(module_private_fragment);
|
code_set_global(module_private_fragment);
|
||||||
|
|
||||||
fmt_newline = make_code();
|
fmt_newline = make_code();
|
||||||
fmt_newline->Type = CT_NewLine;
|
fmt_newline->Type = CT_NewLine;
|
||||||
set_global(fmt_newline);
|
code_set_global(fmt_newline);
|
||||||
|
|
||||||
pragma_once = (CodePragma) make_code();
|
pragma_once = (CodePragma) make_code();
|
||||||
pragma_once->Type = CT_Preprocess_Pragma;
|
pragma_once->Type = CT_Preprocess_Pragma;
|
||||||
pragma_once->Name = get_cached_string( txt("once") );
|
pragma_once->Name = get_cached_string( txt("once") );
|
||||||
pragma_once->Content = pragma_once->Name;
|
pragma_once->Content = pragma_once->Name;
|
||||||
set_global(pragma_once);
|
code_set_global(pragma_once);
|
||||||
|
|
||||||
param_varadic = (CodeTypename) make_code();
|
param_varadic = (CodeTypename) make_code();
|
||||||
param_varadic->Type = CT_Parameters;
|
param_varadic->Type = CT_Parameters;
|
||||||
param_varadic->Name = get_cached_string( txt("...") );
|
param_varadic->Name = get_cached_string( txt("...") );
|
||||||
param_varadic->ValueType = t_empty;
|
param_varadic->ValueType = t_empty;
|
||||||
set_global(param_varadic);
|
code_set_global(param_varadic);
|
||||||
|
|
||||||
preprocess_else = (CodePreprocessCond) make_code();
|
preprocess_else = (CodePreprocessCond) make_code();
|
||||||
preprocess_else->Type = CT_Preprocess_Else;
|
preprocess_else->Type = CT_Preprocess_Else;
|
||||||
set_global(preprocess_else);
|
code_set_global(preprocess_else);
|
||||||
|
|
||||||
preprocess_endif = (CodePreprocessCond) make_code();
|
preprocess_endif = (CodePreprocessCond) make_code();
|
||||||
preprocess_endif->Type = CT_Preprocess_EndIf;
|
preprocess_endif->Type = CT_Preprocess_EndIf;
|
||||||
set_global(preprocess_endif);
|
code_set_global(preprocess_endif);
|
||||||
|
|
||||||
# define def_constant_code_type( Type_ ) \
|
# define def_constant_code_type( Type_ ) \
|
||||||
t_##Type_ = def_type( name(Type_) ); \
|
t_##Type_ = def_type( name(Type_) ); \
|
||||||
set_global(t_##Type_);
|
code_set_global(t_##Type_);
|
||||||
|
|
||||||
def_constant_code_type( auto );
|
def_constant_code_type( auto );
|
||||||
def_constant_code_type( void );
|
def_constant_code_type( void );
|
||||||
@ -180,7 +180,7 @@ void define_constants()
|
|||||||
|
|
||||||
# define def_constant_spec( Type_, ... ) \
|
# define def_constant_spec( Type_, ... ) \
|
||||||
spec_##Type_ = def_specifiers( num_args(__VA_ARGS__), __VA_ARGS__); \
|
spec_##Type_ = def_specifiers( num_args(__VA_ARGS__), __VA_ARGS__); \
|
||||||
set_global(spec_##Type_);
|
code_set_global(spec_##Type_);
|
||||||
|
|
||||||
# pragma push_macro("forceinline")
|
# pragma push_macro("forceinline")
|
||||||
# pragma push_macro("global")
|
# pragma push_macro("global")
|
||||||
@ -218,7 +218,7 @@ void define_constants()
|
|||||||
def_constant_spec( volatile, Spec_Volatile)
|
def_constant_spec( volatile, Spec_Volatile)
|
||||||
|
|
||||||
spec_local_persist = def_specifiers( 1, Spec_Local_Persist );
|
spec_local_persist = def_specifiers( 1, Spec_Local_Persist );
|
||||||
set_global(spec_local_persist);
|
code_set_global(spec_local_persist);
|
||||||
|
|
||||||
# pragma pop_macro("forceinline")
|
# pragma pop_macro("forceinline")
|
||||||
# pragma pop_macro("global")
|
# pragma pop_macro("global")
|
||||||
|
@ -41,7 +41,7 @@ CodeConstructor parse_constructor( StrC def )
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
b32 ignore_spec = false;
|
b32 ignore_spec = false;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ CodeConstructor parse_constructor( StrC def )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
log_failure( "Invalid specifier %s for variable\n%s", to_str( spec ), to_string(Context) );
|
log_failure( "Invalid specifier %s for variable\n%s", spec_to_str( spec ), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
@ -24,24 +24,24 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
# define check_params() \
|
# define check_params() \
|
||||||
if ( ! params_code ) \
|
if ( ! params_code ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen::def_operator: params is null and operator%s requires it", to_str(op)); \
|
log_failure("gen::def_operator: params is null and operator%s requires it", operator_to_str(op)); \
|
||||||
return OpValResult_Fail; \
|
return OpValResult_Fail; \
|
||||||
} \
|
} \
|
||||||
if ( params_code->Type != CT_Parameters ) \
|
if ( params_code->Type != CT_Parameters ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen::def_operator: params is not of Parameters type - %s", debug_str(params_code)); \
|
log_failure("gen::def_operator: params is not of Parameters type - %s", code_debug_str(params_code)); \
|
||||||
return OpValResult_Fail; \
|
return OpValResult_Fail; \
|
||||||
}
|
}
|
||||||
|
|
||||||
# define check_param_eq_ret() \
|
# define check_param_eq_ret() \
|
||||||
if ( ! is_member_symbol && ! is_equal(params_code->ValueType, ret_type) ) \
|
if ( ! is_member_symbol && ! code_is_equal(params_code->ValueType, ret_type) ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen::def_operator: operator%s requires first parameter to equal return type\n" \
|
log_failure("gen::def_operator: operator%s requires first parameter to equal return type\n" \
|
||||||
"param types: %s\n" \
|
"param types: %s\n" \
|
||||||
"return type: %s", \
|
"return type: %s", \
|
||||||
to_str(op).Ptr, \
|
operator_to_str(op).Ptr, \
|
||||||
debug_str(params_code), \
|
code_debug_str(params_code), \
|
||||||
debug_str(ret_type) \
|
code_debug_str(ret_type) \
|
||||||
); \
|
); \
|
||||||
return OpValResult_Fail; \
|
return OpValResult_Fail; \
|
||||||
}
|
}
|
||||||
@ -49,12 +49,12 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
|
|
||||||
if ( ! ret_type )
|
if ( ! ret_type )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: ret_type is null but is required by operator%s", to_str(op));
|
log_failure("gen::def_operator: ret_type is null but is required by operator%s", operator_to_str(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ret_type->Type != CT_Typename )
|
if ( ret_type->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: ret_type is not of typename type - %s", debug_str(ret_type));
|
log_failure("gen::def_operator: ret_type is not of typename type - %s", code_debug_str(ret_type));
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +70,8 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s does not support non-member definition (more than one parameter provided) - %s",
|
"operator%s does not support non-member definition (more than one parameter provided) - %s",
|
||||||
to_str(op),
|
operator_to_str(op),
|
||||||
debug_str(params_code)
|
code_debug_str(params_code)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -100,9 +100,9 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
if (params_code->NumEntries > 2 )
|
if (params_code->NumEntries > 2 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s may not be defined with more than two parametes - param count; %d\n%s"
|
log_failure("gen::def_operator: operator%s may not be defined with more than two parametes - param count; %d\n%s"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
, debug_str(params_code)
|
, code_debug_str(params_code)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -116,8 +116,8 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
if ( params_code->Type != CT_Parameters )
|
if ( params_code->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s params code provided is not of Parameters type - %s"
|
log_failure("gen::def_operator: operator%s params code provided is not of Parameters type - %s"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, debug_str(params_code)
|
, code_debug_str(params_code)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
switch ( params_code->NumEntries )
|
switch ( params_code->NumEntries )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if ( is_equal(params_code->ValueType, t_int ) )
|
if ( code_is_equal(params_code->ValueType, t_int ) )
|
||||||
is_member_symbol = true;
|
is_member_symbol = true;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -135,11 +135,11 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
case 2:
|
case 2:
|
||||||
check_param_eq_ret();
|
check_param_eq_ret();
|
||||||
|
|
||||||
if ( ! is_equal(get(params_code, 1), t_int ) )
|
if ( ! code_is_equal(get(params_code, 1), t_int ) )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s requires second parameter of non-member definition to be int for post-decrement",
|
"operator%s requires second parameter of non-member definition to be int for post-decrement",
|
||||||
to_str(op)
|
operator_to_str(op)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of parameters recived %d instead of 0-2"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of parameters recived %d instead of 0-2"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
@ -164,18 +164,18 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
{
|
{
|
||||||
if ( params_code->Type != CT_Parameters )
|
if ( params_code->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: params is not of Parameters type - %s", debug_str(params_code));
|
log_failure("gen::def_operator: params is not of Parameters type - %s", code_debug_str(params_code));
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_equal(params_code->ValueType, ret_type ) )
|
if ( code_is_equal(params_code->ValueType, ret_type ) )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
||||||
"param type: %s\n"
|
"param type: %s\n"
|
||||||
"return type: %s\n"
|
"return type: %s\n"
|
||||||
, debug_str(params_code)
|
, code_debug_str(params_code)
|
||||||
, debug_str(ret_type)
|
, code_debug_str(ret_type)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
if ( params_code->NumEntries > 1 )
|
if ( params_code->NumEntries > 1 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s may not have more than one parameter - param count: %d"
|
log_failure("gen::def_operator: operator%s may not have more than one parameter - param count: %d"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
@ -197,7 +197,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
#if 0
|
#if 0
|
||||||
if ( ! ret_type.is_equal( t_bool) )
|
if ( ! ret_type.is_equal( t_bool) )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_operator: return type is not a boolean - %s", debug_str(params_code) );
|
log_failure( "gen::def_operator: return type is not a boolean - %s", code_debug_str(params_code) );
|
||||||
return OpValidateResult::Fail;
|
return OpValidateResult::Fail;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -209,7 +209,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
{
|
{
|
||||||
if ( params_code->Type != CT_Parameters )
|
if ( params_code->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_operator: params is not of Parameters type - %s", debug_str(params_code) );
|
log_failure( "gen::def_operator: params is not of Parameters type - %s", code_debug_str(params_code) );
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
{
|
{
|
||||||
log_failure(
|
log_failure(
|
||||||
"gen::def_operator: operator%s may not have more than one parameter - param count: %d",
|
"gen::def_operator: operator%s may not have more than one parameter - param count: %d",
|
||||||
to_str( op ),
|
operator_to_str( op ),
|
||||||
params_code->NumEntries
|
params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
@ -245,14 +245,14 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if ( ! is_equal(params_code->ValueType, ret_type ) )
|
if ( ! code_is_equal(params_code->ValueType, ret_type ) )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: "
|
log_failure("gen::def_operator: "
|
||||||
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
"operator%s is non-member symbol yet first paramter does not equal return type\n"
|
||||||
"param type: %s\n"
|
"param type: %s\n"
|
||||||
"return type: %s\n"
|
"return type: %s\n"
|
||||||
, debug_str(params_code)
|
, code_debug_str(params_code)
|
||||||
, debug_str(ret_type)
|
, code_debug_str(ret_type)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-2"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-2"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
@ -275,25 +275,25 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
{
|
{
|
||||||
if ( params_code->Type != CT_Parameters )
|
if ( params_code->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: params is not of Parameters type - %s", debug_str(params_code));
|
log_failure("gen::def_operator: params is not of Parameters type - %s", code_debug_str(params_code));
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( params_code->NumEntries != 1 )
|
if ( params_code->NumEntries != 1 )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! is_equal(ret_type, t_bool ))
|
if ( ! code_is_equal(ret_type, t_bool ))
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s return type must be of type bool - %s"
|
log_failure("gen::def_operator: operator%s return type must be of type bool - %s"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, debug_str(ret_type)
|
, code_debug_str(ret_type)
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 1-2"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 1-2"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
@ -333,7 +333,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
if ( params_code && params_code->NumEntries > 1)
|
if ( params_code && params_code->NumEntries > 1)
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
|
||||||
, to_str(op)
|
, operator_to_str(op)
|
||||||
, params_code->NumEntries
|
, params_code->NumEntries
|
||||||
);
|
);
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
@ -347,7 +347,7 @@ OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeTyp
|
|||||||
case Op_PtrToMemOfPtr:
|
case Op_PtrToMemOfPtr:
|
||||||
if ( params_code )
|
if ( params_code )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: operator%s expects no paramters - %s", to_str(op), debug_str(params_code));
|
log_failure("gen::def_operator: operator%s expects no paramters - %s", operator_to_str(op), code_debug_str(params_code));
|
||||||
return OpValResult_Fail;
|
return OpValResult_Fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -501,7 +501,7 @@ CodeConstructor def_constructor( Opts_def_constructor p )
|
|||||||
|
|
||||||
if ( params && params->Type != CT_Parameters )
|
if ( params && params->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_constructor: params must be of Parameters type - %s", debug_str(params));
|
log_failure("gen::def_constructor: params must be of Parameters type - %s", code_debug_str(params));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ CodeConstructor def_constructor( Opts_def_constructor p )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_constructor: body must be either of Function_Body or Untyped type - %s", debug_str(body));
|
log_failure("gen::def_constructor: body must be either of Function_Body or Untyped type - %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,13 +556,13 @@ CodeClass def_class( StrC name, Opts_def_struct p )
|
|||||||
|
|
||||||
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_class: attributes was not a 'PlatformAttributes' type: %s", debug_str(attributes) );
|
log_failure( "gen::def_class: attributes was not a 'PlatformAttributes' type: %s", code_debug_str(attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parent && ( parent->Type != CT_Class && parent->Type != CT_Struct && parent->Type != CT_Typename && parent->Type != CT_Untyped ) )
|
if ( parent && ( parent->Type != CT_Class && parent->Type != CT_Struct && parent->Type != CT_Typename && parent->Type != CT_Untyped ) )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_class: parent provided is not type 'Class', 'Struct', 'Typeanme', or 'Untyped': %s", debug_str(parent) );
|
log_failure( "gen::def_class: parent provided is not type 'Class', 'Struct', 'Typeanme', or 'Untyped': %s", code_debug_str(parent) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ CodeClass def_class( StrC name, Opts_def_struct p )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_class: body must be either of Class_Body or Untyped type - %s", debug_str(body));
|
log_failure("gen::def_class: body must be either of Class_Body or Untyped type - %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ CodeDestructor def_destructor( Opts_def_destructor p )
|
|||||||
|
|
||||||
if ( specifiers && specifiers->Type != CT_Specifiers )
|
if ( specifiers && specifiers->Type != CT_Specifiers )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_destructor: specifiers was not a 'Specifiers' type: %s", debug_str(specifiers) );
|
log_failure( "gen::def_destructor: specifiers was not a 'Specifiers' type: %s", code_debug_str(specifiers) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,7 +665,7 @@ CodeDestructor def_destructor( Opts_def_destructor p )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_destructor: body must be either of Function_Body or Untyped type - %s", debug_str(body));
|
log_failure("gen::def_destructor: body must be either of Function_Body or Untyped type - %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,13 +692,13 @@ CodeEnum def_enum( StrC name, Opts_def_enum p )
|
|||||||
|
|
||||||
if ( type && type->Type != CT_Typename )
|
if ( type && type->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_enum: enum underlying type provided was not of type Typename: %s", debug_str(type) );
|
log_failure( "gen::def_enum: enum underlying type provided was not of type Typename: %s", code_debug_str(type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_enum: attributes was not a 'PlatformAttributes' type: %s", debug_str(attributes) );
|
log_failure( "gen::def_enum: attributes was not a 'PlatformAttributes' type: %s", code_debug_str(attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ CodeEnum def_enum( StrC name, Opts_def_enum p )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "gen::def_enum: body must be of Enum_Body or Untyped type %s", debug_str(body));
|
log_failure( "gen::def_enum: body must be of Enum_Body or Untyped type %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,7 +771,7 @@ CodeExtern def_extern_link( StrC name, Code body )
|
|||||||
|
|
||||||
if ( body->Type != CT_Extern_Linkage_Body && body->Type != CT_Untyped )
|
if ( body->Type != CT_Extern_Linkage_Body && body->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_extern_linkage: body is not of extern_linkage or untyped type %s", debug_str(body));
|
log_failure("gen::def_extern_linkage: body is not of extern_linkage or untyped type %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,7 +801,7 @@ CodeFriend def_friend( Code declaration )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure("gen::def_friend: requires declartion to have class, function, operator, or struct - %s", debug_str(declaration));
|
log_failure("gen::def_friend: requires declartion to have class, function, operator, or struct - %s", code_debug_str(declaration));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,25 +827,25 @@ CodeFn def_function( StrC name, Opts_def_function p )
|
|||||||
|
|
||||||
if ( params && params->Type != CT_Parameters )
|
if ( params && params->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_function: params was not a `Parameters` type: %s", debug_str(params) );
|
log_failure( "gen::def_function: params was not a `Parameters` type: %s", code_debug_str(params) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ret_type && ret_type->Type != CT_Typename )
|
if ( ret_type && ret_type->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_function: ret_type was not a Typename: %s", debug_str(ret_type) );
|
log_failure( "gen::def_function: ret_type was not a Typename: %s", code_debug_str(ret_type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( specifiers && specifiers->Type != CT_Specifiers )
|
if ( specifiers && specifiers->Type != CT_Specifiers )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_function: specifiers was not a `Specifiers` type: %s", debug_str(specifiers) );
|
log_failure( "gen::def_function: specifiers was not a `Specifiers` type: %s", code_debug_str(specifiers) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_function: attributes was not a `PlatformAttributes` type: %s", debug_str(attributes) );
|
log_failure( "gen::def_function: attributes was not a `PlatformAttributes` type: %s", code_debug_str(attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,7 +865,7 @@ CodeFn def_function( StrC name, Opts_def_function p )
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
log_failure("gen::def_function: body must be either of Function_Body, Execution, or Untyped type. %s", debug_str(body));
|
log_failure("gen::def_function: body must be either of Function_Body, Execution, or Untyped type. %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -941,7 +941,7 @@ CodeNS def_namespace( StrC name, Code body, Opts_def_namespace p )
|
|||||||
|
|
||||||
if ( body && body->Type != CT_Namespace_Body && body->Type != CT_Untyped )
|
if ( body && body->Type != CT_Namespace_Body && body->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_namespace: body is not of namespace or untyped type %s", debug_str(body));
|
log_failure("gen::def_namespace: body is not of namespace or untyped type %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -965,13 +965,13 @@ CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator p )
|
|||||||
|
|
||||||
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_operator: PlatformAttributes was provided but its not of attributes type: %s", debug_str(attributes) );
|
log_failure( "gen::def_operator: PlatformAttributes was provided but its not of attributes type: %s", code_debug_str(attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( specifiers && specifiers->Type != CT_Specifiers )
|
if ( specifiers && specifiers->Type != CT_Specifiers )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_operator: Specifiers was provided but its not of specifiers type: %s", debug_str(specifiers) );
|
log_failure( "gen::def_operator: Specifiers was provided but its not of specifiers type: %s", code_debug_str(specifiers) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -984,7 +984,7 @@ CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator p )
|
|||||||
|
|
||||||
char const* name = nullptr;
|
char const* name = nullptr;
|
||||||
|
|
||||||
StrC op_str = to_str( op );
|
StrC op_str = operator_to_str( op );
|
||||||
if ( nspace.Len > 0 )
|
if ( nspace.Len > 0 )
|
||||||
name = str_fmt_buf( "%.*soperator %.*s", nspace.Len, nspace.Ptr, op_str.Len, op_str.Ptr );
|
name = str_fmt_buf( "%.*soperator %.*s", nspace.Len, nspace.Ptr, op_str.Len, op_str.Ptr );
|
||||||
else
|
else
|
||||||
@ -1006,7 +1006,7 @@ CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator p )
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
log_failure("gen::def_operator: body must be either of Function_Body, Execution, or Untyped type. %s", debug_str(body));
|
log_failure("gen::def_operator: body must be either of Function_Body, Execution, or Untyped type. %s", code_debug_str(body));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1045,7 +1045,7 @@ CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast p )
|
|||||||
|
|
||||||
if ( type->Type != CT_Typename )
|
if ( type->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_operator_cast: type is not a typename - %s", debug_str(type) );
|
log_failure( "gen::def_operator_cast: type is not a typename - %s", code_debug_str(type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,7 +1057,7 @@ CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast p )
|
|||||||
|
|
||||||
if ( body->Type != CT_Function_Body && body->Type != CT_Execution )
|
if ( body->Type != CT_Function_Body && body->Type != CT_Execution )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_operator_cast: body is not of function body or execution type - %s", debug_str(body) );
|
log_failure( "gen::def_operator_cast: body is not of function body or execution type - %s", code_debug_str(body) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1084,13 +1084,13 @@ CodeParam def_param( CodeTypename type, StrC name, Opts_def_param p )
|
|||||||
|
|
||||||
if ( type->Type != CT_Typename )
|
if ( type->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_param: type is not a typename - %s", debug_str(type) );
|
log_failure( "gen::def_param: type is not a typename - %s", code_debug_str(type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p.value && p.value->Type != CT_Untyped )
|
if ( p.value && p.value->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_param: value is not untyped - %s", debug_str(p.value) );
|
log_failure( "gen::def_param: value is not untyped - %s", code_debug_str(p.value) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,19 +1178,19 @@ CodeStruct def_struct( StrC name, Opts_def_struct p )
|
|||||||
|
|
||||||
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_struct: attributes was not a `PlatformAttributes` type - %s", debug_str(attributes) );
|
log_failure( "gen::def_struct: attributes was not a `PlatformAttributes` type - %s", code_debug_str(attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( parent && parent->Type != CT_Typename )
|
if ( parent && parent->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_struct: parent was not a `Struct` type - %s", debug_str(parent) );
|
log_failure( "gen::def_struct: parent was not a `Struct` type - %s", code_debug_str(parent) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( body && body->Type != CT_Struct_Body )
|
if ( body && body->Type != CT_Struct_Body )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_struct: body was not a Struct_Body type - %s", debug_str(body) );
|
log_failure( "gen::def_struct: body was not a Struct_Body type - %s", code_debug_str(body) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1237,7 +1237,7 @@ CodeTemplate def_template( CodeParam params, Code declaration, Opts_def_template
|
|||||||
|
|
||||||
if ( params && params->Type != CT_Parameters )
|
if ( params && params->Type != CT_Parameters )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_template: params is not of parameters type - %s", debug_str(params) );
|
log_failure( "gen::def_template: params is not of parameters type - %s", code_debug_str(params) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1251,7 +1251,7 @@ CodeTemplate def_template( CodeParam params, Code declaration, Opts_def_template
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "gen::def_template: declaration is not of class, function, struct, variable, or using type - %s", debug_str(declaration) );
|
log_failure( "gen::def_template: declaration is not of class, function, struct, variable, or using type - %s", code_debug_str(declaration) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeTemplate
|
CodeTemplate
|
||||||
@ -1273,19 +1273,19 @@ CodeTypename def_type( StrC name, Opts_def_type p )
|
|||||||
|
|
||||||
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
if ( attributes && attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_type: attributes is not of attributes type - %s", debug_str(attributes) );
|
log_failure( "gen::def_type: attributes is not of attributes type - %s", code_debug_str(attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( specifiers && specifiers->Type != CT_Specifiers )
|
if ( specifiers && specifiers->Type != CT_Specifiers )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_type: specifiers is not of specifiers type - %s", debug_str(specifiers) );
|
log_failure( "gen::def_type: specifiers is not of specifiers type - %s", code_debug_str(specifiers) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( arrayexpr && arrayexpr->Type != CT_Untyped )
|
if ( arrayexpr && arrayexpr->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", debug_str(arrayexpr) );
|
log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", code_debug_str(arrayexpr) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1325,13 +1325,13 @@ CodeTypedef def_typedef( StrC name, Code type, Opts_def_typedef p )
|
|||||||
case CT_Typename:
|
case CT_Typename:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log_failure( "gen::def_typedef: type was not a Class, Enum, Function Forward, Struct, Typename, or Union - %s", debug_str(type) );
|
log_failure( "gen::def_typedef: type was not a Class, Enum, Function Forward, Struct, Typename, or Union - %s", code_debug_str(type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_typedef: attributes was not a PlatformAttributes - %s", debug_str(p.attributes) );
|
log_failure( "gen::def_typedef: attributes was not a PlatformAttributes - %s", code_debug_str(p.attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,7 +1355,7 @@ CodeTypedef def_typedef( StrC name, Code type, Opts_def_typedef p )
|
|||||||
{
|
{
|
||||||
if (type->Type != CT_Untyped)
|
if (type->Type != CT_Untyped)
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_typedef: name was empty and type was not untyped (indicating its a function typedef) - %s", debug_str(type) );
|
log_failure( "gen::def_typedef: name was empty and type was not untyped (indicating its a function typedef) - %s", code_debug_str(type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1377,13 +1377,13 @@ CodeUnion def_union( StrC name, Code body, Opts_def_union p )
|
|||||||
|
|
||||||
if ( body->Type != CT_Union_Body )
|
if ( body->Type != CT_Union_Body )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_union: body was not a Union_Body type - %s", debug_str(body) );
|
log_failure( "gen::def_union: body was not a Union_Body type - %s", code_debug_str(body) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_union: attributes was not a PlatformAttributes type - %s", debug_str(p.attributes) );
|
log_failure( "gen::def_union: attributes was not a PlatformAttributes type - %s", code_debug_str(p.attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1418,7 +1418,7 @@ CodeUsing def_using( StrC name, Code type, Opts_def_using p )
|
|||||||
|
|
||||||
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_using: attributes was not a PlatformAttributes type - %s", debug_str(p.attributes) );
|
log_failure( "gen::def_using: attributes was not a PlatformAttributes type - %s", code_debug_str(p.attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1456,25 +1456,25 @@ CodeVar def_variable( CodeTypename type, StrC name, Code value, Opts_def_variabl
|
|||||||
|
|
||||||
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_variable: attributes was not a `PlatformAttributes` type - %s", debug_str(p.attributes) );
|
log_failure( "gen::def_variable: attributes was not a `PlatformAttributes` type - %s", code_debug_str(p.attributes) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p.specifiers && p.specifiers->Type != CT_Specifiers )
|
if ( p.specifiers && p.specifiers->Type != CT_Specifiers )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_variable: specifiers was not a `Specifiers` type - %s", debug_str(p.specifiers) );
|
log_failure( "gen::def_variable: specifiers was not a `Specifiers` type - %s", code_debug_str(p.specifiers) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type->Type != CT_Typename )
|
if ( type->Type != CT_Typename )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_variable: type was not a Typename - %s", debug_str(type) );
|
log_failure( "gen::def_variable: type was not a Typename - %s", code_debug_str(type) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value && value->Type != CT_Untyped )
|
if ( value && value->Type != CT_Untyped )
|
||||||
{
|
{
|
||||||
log_failure( "gen::def_variable: value was not a `Untyped` type - %s", debug_str(value) );
|
log_failure( "gen::def_variable: value was not a `Untyped` type - %s", code_debug_str(value) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,7 +1546,7 @@ CodeBody def_class_body( s32 num, ... )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_CLASS_UNALLOWED_TYPES
|
GEN_AST_BODY_CLASS_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1583,7 +1583,7 @@ CodeBody def_class_body( s32 num, Code* codes )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_CLASS_UNALLOWED_TYPES
|
GEN_AST_BODY_CLASS_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1620,7 +1620,7 @@ CodeBody def_enum_body( s32 num, ... )
|
|||||||
|
|
||||||
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_enum_body: Entry type is not allowed - %s. Must be of untyped or comment type.", debug_str(entry) );
|
log_failure("gen::def_enum_body: Entry type is not allowed - %s. Must be of untyped or comment type.", code_debug_str(entry) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1652,7 +1652,7 @@ CodeBody def_enum_body( s32 num, Code* codes )
|
|||||||
|
|
||||||
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_enum_body: Entry type is not allowed: %s", debug_str(entry) );
|
log_failure("gen::def_enum_body: Entry type is not allowed: %s", code_debug_str(entry) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1687,7 +1687,7 @@ CodeBody def_export_body( s32 num, ... )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
|
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1724,7 +1724,7 @@ CodeBody def_export_body( s32 num, Code* codes )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
|
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1750,8 +1750,8 @@ CodeBody def_extern_link_body( s32 num, ... )
|
|||||||
va_start(va, num);
|
va_start(va, num);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Code_POD pod = va_arg(va, Code_POD);
|
Code_POD pod = va_arg(va, Code_POD);
|
||||||
Code entry = pcast(Code, pod);
|
Code entry = pcast(Code, pod);
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
{
|
{
|
||||||
@ -1762,7 +1762,7 @@ CodeBody def_extern_link_body( s32 num, ... )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
|
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1799,7 +1799,7 @@ CodeBody def_extern_link_body( s32 num, Code* codes )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
|
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1839,7 +1839,7 @@ CodeBody def_function_body( s32 num, ... )
|
|||||||
{
|
{
|
||||||
|
|
||||||
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
|
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
|
||||||
log_failure("gen::" stringize(def_function_body) ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" stringize(def_function_body) ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1876,7 +1876,7 @@ CodeBody def_function_body( s32 num, Code* codes )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
|
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_function_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_function_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1918,7 +1918,7 @@ CodeBody def_global_body( s32 num, ... )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1959,7 +1959,7 @@ CodeBody def_global_body( s32 num, Code* codes )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1997,7 +1997,7 @@ CodeBody def_namespace_body( s32 num, ... )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
|
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2034,7 +2034,7 @@ CodeBody def_namespace_body( s32 num, Code* codes )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
|
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", debug_str(entry) );
|
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", code_debug_str(entry) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
@ -2065,7 +2065,7 @@ CodeParam def_params( s32 num, ... )
|
|||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeParam result = (CodeParam) duplicate(param);
|
CodeParam result = (CodeParam) code_duplicate(param);
|
||||||
|
|
||||||
while ( -- num )
|
while ( -- num )
|
||||||
{
|
{
|
||||||
@ -2098,11 +2098,11 @@ CodeParam def_params( s32 num, CodeParam* codes )
|
|||||||
\
|
\
|
||||||
if (current->Type != CT_Parameters ) \
|
if (current->Type != CT_Parameters ) \
|
||||||
{ \
|
{ \
|
||||||
log_failure("gen::def_params: Code in coes array is not of paramter type - %s", debug_str(current) ); \
|
log_failure("gen::def_params: Code in coes array is not of paramter type - %s", code_debug_str(current) ); \
|
||||||
return InvalidCode; \
|
return InvalidCode; \
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeParam current = (CodeParam)duplicate(* codes);
|
CodeParam current = (CodeParam)code_duplicate(* codes);
|
||||||
check_current();
|
check_current();
|
||||||
|
|
||||||
CodeParam
|
CodeParam
|
||||||
@ -2206,7 +2206,7 @@ CodeBody def_struct_body( s32 num, ... )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES
|
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", debug_str(entry));
|
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", code_debug_str(entry));
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2243,7 +2243,7 @@ CodeBody def_struct_body( s32 num, Code* codes )
|
|||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES
|
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", debug_str(entry) );
|
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", code_debug_str(entry) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2280,7 +2280,7 @@ CodeBody def_union_body( s32 num, ... )
|
|||||||
|
|
||||||
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_union_body: Entry type is not allowed - %s. Must be of untyped or comment type.", debug_str(entry) );
|
log_failure("gen::def_union_body: Entry type is not allowed - %s. Must be of untyped or comment type.", code_debug_str(entry) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2312,7 +2312,7 @@ CodeBody def_union_body( s32 num, CodeUnion* codes )
|
|||||||
|
|
||||||
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
if ( entry->Type != CT_Untyped && entry->Type != CT_Comment )
|
||||||
{
|
{
|
||||||
log_failure("gen::def_union_body: Entry type is not allowed: %s", debug_str(entry) );
|
log_failure("gen::def_union_body: Entry type is not allowed: %s", code_debug_str(entry) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,7 +995,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
b32 ignore_spec = false;
|
b32 ignore_spec = false;
|
||||||
|
|
||||||
@ -1022,7 +1022,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "Invalid specifier %s for variable\n%s", to_str(spec), to_string(Context) );
|
log_failure( "Invalid specifier %s for variable\n%s", spec_to_str(spec), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1183,13 +1183,13 @@ Code parse_complicated_definition( TokType which )
|
|||||||
}
|
}
|
||||||
|
|
||||||
Token tok = tokens.Arr[ idx - 1 ];
|
Token tok = tokens.Arr[ idx - 1 ];
|
||||||
if ( is_specifier(tok) && is_trailing( to_specifier( to_str(tok))) )
|
if ( is_specifier(tok) && spec_is_trailing( strc_to_specifier( to_str(tok))) )
|
||||||
{
|
{
|
||||||
// <which> <type_identifier>(...) <specifier> ...;
|
// <which> <type_identifier>(...) <specifier> ...;
|
||||||
|
|
||||||
s32 spec_idx = idx - 1;
|
s32 spec_idx = idx - 1;
|
||||||
Token spec = tokens.Arr[spec_idx];
|
Token spec = tokens.Arr[spec_idx];
|
||||||
while ( is_specifier(spec) && is_trailing( to_specifier( to_str(spec))) )
|
while ( is_specifier(spec) && spec_is_trailing( strc_to_specifier( to_str(spec))) )
|
||||||
{
|
{
|
||||||
-- spec_idx;
|
-- spec_idx;
|
||||||
spec = tokens.Arr[spec_idx];
|
spec = tokens.Arr[spec_idx];
|
||||||
@ -1443,12 +1443,12 @@ CodeFn parse_function_after_name(
|
|||||||
{
|
{
|
||||||
if ( specifiers.ast == nullptr )
|
if ( specifiers.ast == nullptr )
|
||||||
{
|
{
|
||||||
specifiers = def_specifier( to_specifier( to_str(currtok)) );
|
specifiers = def_specifier( strc_to_specifier( to_str(currtok)) );
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
append(specifiers, to_specifier( to_str(currtok)) );
|
append(specifiers, strc_to_specifier( to_str(currtok)) );
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
// <Attributes> <Specifiers> <ReturnType> <Name> ( <Paraemters> ) <Specifiers>
|
// <Attributes> <Specifiers> <ReturnType> <Name> ( <Paraemters> ) <Specifiers>
|
||||||
@ -1509,7 +1509,7 @@ CodeFn parse_function_after_name(
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", debug_str(body), to_string(Context));
|
log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", code_debug_str(body), to_string(Context));
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1779,7 +1779,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
bool ignore_spec = false;
|
bool ignore_spec = false;
|
||||||
|
|
||||||
@ -1807,7 +1807,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
StrC spec_str = to_str(spec);
|
StrC spec_str = spec_to_str(spec);
|
||||||
|
|
||||||
log_failure( "Invalid specifier %.*s for variable\n%s", spec_str.Len, spec_str, to_string(Context) );
|
log_failure( "Invalid specifier %.*s for variable\n%s", spec_str.Len, spec_str, to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
@ -2366,8 +2366,8 @@ CodeOperator parse_operator_after_ret_type(
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
StrC str_new = to_str(Op_New);
|
StrC str_new = operator_to_str(Op_New);
|
||||||
StrC str_delete = to_str(Op_Delete);
|
StrC str_delete = operator_to_str(Op_Delete);
|
||||||
if ( str_compare_len( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0)
|
if ( str_compare_len( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0)
|
||||||
{
|
{
|
||||||
op = Op_New;
|
op = Op_New;
|
||||||
@ -2450,12 +2450,12 @@ CodeOperator parse_operator_after_ret_type(
|
|||||||
{
|
{
|
||||||
if ( specifiers.ast == nullptr )
|
if ( specifiers.ast == nullptr )
|
||||||
{
|
{
|
||||||
specifiers = def_specifier( to_specifier( to_str(currtok)) );
|
specifiers = def_specifier( strc_to_specifier( to_str(currtok)) );
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
append(specifiers, to_specifier( to_str(currtok)) );
|
append(specifiers, strc_to_specifier( to_str(currtok)) );
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
// <ExportFlag> <Attributes> <Specifiers> <ReturnType> <Qualifier::...> operator <Op> ( <Parameters> ) <Specifiers>
|
// <ExportFlag> <Attributes> <Specifiers> <ReturnType> <Qualifier::...> operator <Op> ( <Parameters> ) <Specifiers>
|
||||||
@ -2618,7 +2618,6 @@ CodePragma parse_pragma()
|
|||||||
internal inline
|
internal inline
|
||||||
CodeParam parse_params( bool use_template_capture )
|
CodeParam parse_params( bool use_template_capture )
|
||||||
{
|
{
|
||||||
|
|
||||||
push_scope();
|
push_scope();
|
||||||
|
|
||||||
if ( ! use_template_capture )
|
if ( ! use_template_capture )
|
||||||
@ -2989,6 +2988,7 @@ Code parse_simple_preprocess( TokType which, bool dont_consume_braces )
|
|||||||
if (strc_contains(Context.Scope->Prev->ProcName, txt("parse_enum")))
|
if (strc_contains(Context.Scope->Prev->ProcName, txt("parse_enum")))
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
goto Leave_Scope_Early;
|
||||||
}
|
}
|
||||||
else if (strc_contains(Context.Scope->Prev->ProcName, txt("parse_typedef")))
|
else if (strc_contains(Context.Scope->Prev->ProcName, txt("parse_typedef")))
|
||||||
{
|
{
|
||||||
@ -3002,11 +3002,14 @@ Code parse_simple_preprocess( TokType which, bool dont_consume_braces )
|
|||||||
eat( Tok_Comment );
|
eat( Tok_Comment );
|
||||||
// <Macro>; <InlineCmt>
|
// <Macro>; <InlineCmt>
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tok.Length = ( (sptr)currtok_noskip.Text + currtok_noskip.Length ) - (sptr)tok.Text;
|
tok.Length = ( (sptr)currtok_noskip.Text + currtok_noskip.Length ) - (sptr)tok.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Leave_Scope_Early:
|
||||||
|
|
||||||
char const* content = str_fmt_buf( "%.*s ", tok.Length, tok.Text );
|
char const* content = str_fmt_buf( "%.*s ", tok.Length, tok.Text );
|
||||||
|
|
||||||
Code result = untyped_str( to_strc_from_c_str(content) );
|
Code result = untyped_str( to_strc_from_c_str(content) );
|
||||||
@ -3291,7 +3294,7 @@ CodeVar parse_variable_declaration_list()
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
switch ( spec )
|
switch ( spec )
|
||||||
{
|
{
|
||||||
@ -3880,7 +3883,7 @@ CodeFriend parse_friend()
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
switch ( spec )
|
switch ( spec )
|
||||||
{
|
{
|
||||||
@ -3890,7 +3893,7 @@ CodeFriend parse_friend()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
log_failure( "Invalid specifier %s for friend definition\n%s", to_str( spec ), to_string(Context) );
|
log_failure( "Invalid specifier %s for friend definition\n%s", spec_to_str( spec ), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4004,7 +4007,7 @@ CodeFn parse_function()
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
switch ( spec )
|
switch ( spec )
|
||||||
{
|
{
|
||||||
@ -4019,7 +4022,7 @@ CodeFn parse_function()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "Invalid specifier %s for functon\n%s", to_str(spec), to_string(Context) );
|
log_failure( "Invalid specifier %s for functon\n%s", spec_to_str(spec), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4117,7 +4120,7 @@ CodeOperator parse_operator()
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
switch ( spec )
|
switch ( spec )
|
||||||
{
|
{
|
||||||
@ -4130,7 +4133,7 @@ CodeOperator parse_operator()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "Invalid specifier " "%s" " for operator\n%s", to_str(spec), to_string(Context) );
|
log_failure( "Invalid specifier " "%s" " for operator\n%s", spec_to_str(spec), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4358,7 +4361,7 @@ CodeTemplate parse_template()
|
|||||||
{
|
{
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
switch ( spec )
|
switch ( spec )
|
||||||
{
|
{
|
||||||
@ -4381,7 +4384,7 @@ CodeTemplate parse_template()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
log_failure( "Invalid specifier %s for variable or function\n%s", to_str( spec ), to_string(Context) );
|
log_failure( "Invalid specifier %s for variable or function\n%s", spec_to_str( spec ), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4500,7 +4503,7 @@ CodeTypename parse_type( bool from_template, bool* typedef_is_function )
|
|||||||
// Prefix specifiers
|
// Prefix specifiers
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
if ( spec != Spec_Const )
|
if ( spec != Spec_Const )
|
||||||
{
|
{
|
||||||
@ -4626,7 +4629,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
// Suffix specifiers for typename.
|
// Suffix specifiers for typename.
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
if ( spec != Spec_Const && spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
if ( spec != Spec_Const && spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
||||||
{
|
{
|
||||||
@ -4826,7 +4829,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
// Look for suffix specifiers for the function
|
// Look for suffix specifiers for the function
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
|
|
||||||
if ( spec != Spec_Const
|
if ( spec != Spec_Const
|
||||||
// TODO : Add support for NoExcept, l-value, volatile, l-value, etc
|
// TODO : Add support for NoExcept, l-value, volatile, l-value, etc
|
||||||
@ -4863,7 +4866,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodeTypename result = ( CodeTypename )make_code();
|
CodeTypename result = ( CodeTypename )make_code();
|
||||||
result->Type = CT_Typename;
|
result->Type = CT_Typename;
|
||||||
// result->Token = Context.Scope->Start;
|
// result->Token = Context.Scope->Start;
|
||||||
|
|
||||||
// Need to wait until were using the new parsing method to do this.
|
// Need to wait until were using the new parsing method to do this.
|
||||||
@ -5396,7 +5399,7 @@ CodeVar parse_variable()
|
|||||||
|
|
||||||
while ( left && is_specifier(currtok) )
|
while ( left && is_specifier(currtok) )
|
||||||
{
|
{
|
||||||
Specifier spec = to_specifier( to_str(currtok) );
|
Specifier spec = strc_to_specifier( to_str(currtok) );
|
||||||
switch ( spec )
|
switch ( spec )
|
||||||
{
|
{
|
||||||
case Spec_Const:
|
case Spec_Const:
|
||||||
@ -5413,7 +5416,7 @@ CodeVar parse_variable()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "Invalid specifier %s for variable\n%s", to_str( spec ), to_string(Context) );
|
log_failure( "Invalid specifier %s for variable\n%s", spec_to_str( spec ), to_string(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
@ -32,17 +32,21 @@ CodeBody gen_ecode( char const* path )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CodeEnum enum_code = parse_enum(gen::token_fmt_impl((3 + 1) / 2, "entries", string_to_strc(enum_entries),
|
CodeEnum enum_code = parse_enum(gen::token_fmt_impl((3 + 1) / 2, "entries", string_to_strc(enum_entries),
|
||||||
"enum CodeType_Def : u32 { <entries> CT_NumTypes };"
|
"enum CodeType_Def enum_underlying(u32) { <entries> CT_NumTypes };"
|
||||||
));
|
));
|
||||||
|
|
||||||
#pragma push_macro("local_persist")
|
#pragma push_macro("local_persist")
|
||||||
#undef local_persist
|
#undef local_persist
|
||||||
CodeFn to_str = parse_function( token_fmt( "entries", string_to_strc(to_str_entries), stringize(
|
StrC lookup_size = string_to_strc(string_fmt_buf(GlobalAllocator, "%d", array_num(enum_strs) ));
|
||||||
|
CodeFn to_str = parse_function( token_fmt(
|
||||||
|
"entries", string_to_strc(to_str_entries)
|
||||||
|
, "num", lookup_size
|
||||||
|
, stringize(
|
||||||
inline
|
inline
|
||||||
StrC to_str( CodeType type )
|
StrC codetype_to_str( CodeType type )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
StrC lookup[] {
|
StrC lookup[<num>] = {
|
||||||
<entries>
|
<entries>
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,22 +87,29 @@ CodeBody gen_eoperator( char const* path )
|
|||||||
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma push_macro("enum_underlying")
|
||||||
|
#undef enum_underlying
|
||||||
CodeEnum enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
CodeEnum enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
||||||
enum Operator_Def : u32
|
enum Operator_Def enum_underlying(u32)
|
||||||
{
|
{
|
||||||
<entries>
|
<entries>
|
||||||
NumOps
|
NumOps
|
||||||
};
|
};
|
||||||
)));
|
)));
|
||||||
|
#pragma pop_macro("enum_underlying")
|
||||||
|
|
||||||
#pragma push_macro("local_persist")
|
#pragma push_macro("local_persist")
|
||||||
#undef local_persist
|
#undef local_persist
|
||||||
CodeFn to_str = parse_function(token_fmt("entries", string_to_strc(to_str_entries), stringize(
|
StrC lookup_size = string_to_strc(string_fmt_buf(GlobalAllocator, "%d", array_num(enum_strs) ));
|
||||||
|
CodeFn to_str = parse_function(token_fmt(
|
||||||
|
"entries", string_to_strc(to_str_entries)
|
||||||
|
, "num", lookup_size
|
||||||
|
, stringize(
|
||||||
inline
|
inline
|
||||||
StrC to_str( Operator op )
|
StrC operator_to_str( Operator op )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
StrC lookup[] {
|
StrC lookup[<num>] = {
|
||||||
<entries>
|
<entries>
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,17 +150,20 @@ CodeBody gen_especifier( char const* path )
|
|||||||
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma push_macro("enum_underlying")
|
||||||
|
#undef enum_underlying
|
||||||
CodeEnum enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
CodeEnum enum_code = parse_enum(token_fmt("entries", string_to_strc(enum_entries), stringize(
|
||||||
enum Specifier_Def : u32
|
enum Specifier_Def enum_underlying(u32)
|
||||||
{
|
{
|
||||||
<entries>
|
<entries>
|
||||||
Spec_NumSpecifiers
|
Spec_NumSpecifiers
|
||||||
};
|
};
|
||||||
)));
|
)));
|
||||||
|
#pragma pop_macro("enum_underlying")
|
||||||
|
|
||||||
CodeFn is_trailing = parse_function(token_fmt("specifier", string_to_strc(to_str_entries), stringize(
|
CodeFn is_trailing = parse_function(token_fmt("specifier", string_to_strc(to_str_entries), stringize(
|
||||||
inline
|
inline
|
||||||
bool is_trailing( Specifier specifier )
|
bool spec_is_trailing( Specifier specifier )
|
||||||
{
|
{
|
||||||
return specifier > Spec_Virtual;
|
return specifier > Spec_Virtual;
|
||||||
}
|
}
|
||||||
@ -165,12 +179,17 @@ CodeBody gen_especifier( char const* path )
|
|||||||
#undef do_once_end
|
#undef do_once_end
|
||||||
#undef forceinline
|
#undef forceinline
|
||||||
#undef neverinline
|
#undef neverinline
|
||||||
CodeFn to_str = parse_function(token_fmt("entries", string_to_strc(to_str_entries), stringize(
|
|
||||||
|
StrC lookup_size = string_to_strc(string_fmt_buf(GlobalAllocator, "%d", array_num(enum_strs) ));
|
||||||
|
CodeFn to_str = parse_function(token_fmt(
|
||||||
|
"entries", string_to_strc(to_str_entries)
|
||||||
|
, "num", lookup_size
|
||||||
|
, stringize(
|
||||||
inline
|
inline
|
||||||
StrC to_str( Specifier type )
|
StrC spec_to_str( Specifier type )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
StrC lookup[] {
|
StrC lookup[<num>] = {
|
||||||
<entries>
|
<entries>
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -180,14 +199,14 @@ CodeBody gen_especifier( char const* path )
|
|||||||
|
|
||||||
CodeFn to_type = parse_function( token_fmt( "entries", string_to_strc(to_str_entries), stringize(
|
CodeFn to_type = parse_function( token_fmt( "entries", string_to_strc(to_str_entries), stringize(
|
||||||
inline
|
inline
|
||||||
Specifier to_specifier( StrC str )
|
Specifier strc_to_specifier( StrC str )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
u32 keymap[ Spec_NumSpecifiers ];
|
u32 keymap[ Spec_NumSpecifiers ];
|
||||||
do_once_start
|
do_once_start
|
||||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||||
{
|
{
|
||||||
StrC enum_str = to_str( (Specifier)index );
|
StrC enum_str = spec_to_str( (Specifier)index );
|
||||||
|
|
||||||
// We subtract 1 to remove the null terminator
|
// We subtract 1 to remove the null terminator
|
||||||
// This is because the tokens lexed are not null terminated.
|
// This is because the tokens lexed are not null terminated.
|
||||||
@ -367,7 +386,7 @@ CodeBody gen_ast_inlines()
|
|||||||
{
|
{
|
||||||
if ( other.ast && other->Parent )
|
if ( other.ast && other->Parent )
|
||||||
{
|
{
|
||||||
ast = rcast( decltype(ast), GEN_NS duplicate(other).ast);
|
ast = rcast( decltype(ast), code_duplicate(other).ast);
|
||||||
ast->Parent = { nullptr };
|
ast->Parent = { nullptr };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user