From 16b8a3a164c6b6d83a4ec700a8cf2c627b5e69ad Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 2 Dec 2024 04:12:09 -0500 Subject: [PATCH] began to remove usage of code specific types member procs --- project/components/ast.cpp | 8 +- project/components/code_serialization.cpp | 121 ++++++++++++---------- project/components/code_types.hpp | 48 ++++----- project/components/inlines.hpp | 28 ++++- project/components/interface.upfront.cpp | 42 ++++---- project/components/parser.cpp | 12 +-- project/helpers/helper.hpp | 46 ++++---- 7 files changed, 168 insertions(+), 137 deletions(-) diff --git a/project/components/ast.cpp b/project/components/ast.cpp index 128c788..4950e37 100644 --- a/project/components/ast.cpp +++ b/project/components/ast.cpp @@ -415,11 +415,11 @@ void to_string( AST* self, String* result ) break; case Class: - cast(CodeClass, {self}).to_string_def( * result ); + to_string_def(cast(CodeClass, {self}), result ); break; case Class_Fwd: - cast(CodeClass, {self}).to_string_fwd( * result ); + to_string_fwd(cast(CodeClass, {self}), result ); break; case Constructor: @@ -455,7 +455,7 @@ void to_string( AST* self, String* result ) break; case Export_Body: - cast(CodeBody, {self}).to_string_export( * result ); + to_string_export(cast(CodeBody, {self}), result ); break; case Extern_Linkage: @@ -588,7 +588,7 @@ void to_string( AST* self, String* result ) case Namespace_Body: case Struct_Body: case Union_Body: - cast(CodeBody, {self}).to_string( * result ); + to_string( cast(CodeBody, {self}), result ); break; } } diff --git a/project/components/code_serialization.cpp b/project/components/code_serialization.cpp index 08323d9..3ccc61f 100644 --- a/project/components/code_serialization.cpp +++ b/project/components/code_serialization.cpp @@ -18,15 +18,16 @@ String CodeAttributes::to_string() return GEN_NS duplicate( ast->Content, GlobalAllocator ); } -String CodeBody::to_string() +String to_string(CodeBody body) { + GEN_ASSERT(body.ast != nullptr); String result = string_make( GlobalAllocator, "" ); - switch ( ast->Type ) + switch ( body.ast->Type ) { using namespace ECode; case Untyped: case Execution: - GEN_NS append( & result, raw()->Content ); + append( & result, rcast(AST*, body.ast)->Content ); break; case Enum_Body: @@ -37,40 +38,44 @@ String CodeBody::to_string() case Namespace_Body: case Struct_Body: case Union_Body: - to_string( result ); + to_string( body, & result ); break; case Export_Body: - to_string_export( result ); + to_string_export( body, & result ); break; } return result; } -void CodeBody::to_string( String& result ) +void to_string( CodeBody body, String* result ) { - Code curr = ast->Front; - s32 left = ast->NumEntries; + GEN_ASSERT(body.ast != nullptr); + GEN_ASSERT(result != nullptr); + Code curr = body.ast->Front; + s32 left = body.ast->NumEntries; while ( left -- ) { - append_fmt( & result, "%S", GEN_NS to_string(curr) ); + append_fmt( result, "%S", GEN_NS to_string(curr) ); ++curr; } } -void CodeBody::to_string_export( String& result ) +void to_string_export( CodeBody body, String* result ) { - append_fmt( & result, "export\n{\n" ); + GEN_ASSERT(body.ast != nullptr); + GEN_ASSERT(result != nullptr); + append_fmt( result, "export\n{\n" ); - Code curr = *this; - s32 left = ast->NumEntries; + Code curr = body; + s32 left = body.ast->NumEntries; while ( left-- ) { - append_fmt( & result, "%S", GEN_NS to_string(curr) ); + append_fmt( result, "%S", to_string(curr) ); ++curr; } - append_fmt( & result, "};\n" ); + append_fmt( result, "};\n" ); } String CodeComment::to_string() @@ -142,83 +147,89 @@ void CodeConstructor::to_string_fwd( String& result ) append( & result, ";\n" ); } -String CodeClass::to_string() +String to_string( CodeClass self ) { String result = string_make( GlobalAllocator, "" ); - switch ( ast->Type ) + switch ( self->Type ) { using namespace ECode; case Class: - to_string_def( result ); + to_string_def(self, & result ); break; case Class_Fwd: - to_string_fwd( result ); + to_string_fwd(self, & result ); break; } return result; } -void CodeClass::to_string_def( String& result ) +void to_string_def( CodeClass self, String* result ) { - if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export )) - append( & result, "export " ); + GEN_ASSERT(self.ast != nullptr); + AST_Class* ast = self.ast; - append( & result, "class " ); + if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export )) + append( result, "export " ); + + append( result, "class " ); if ( ast->Attributes ) { - append_fmt( & result, "%S ", ast->Attributes.to_string() ); + append_fmt( result, "%S ", ast->Attributes.to_string() ); } if ( ast->ParentType ) { char const* access_level = to_str( ast->ParentAccess ); - append_fmt( & result, "%S : %s %S", ast->Name, access_level, ast->ParentType.to_string() ); + append_fmt( result, "%S : %s %S", ast->Name, access_level, ast->ParentType.to_string() ); CodeType interface = cast(CodeType, ast->ParentType->Next); if ( interface ) - append( & result, "\n" ); + append( result, "\n" ); while ( interface ) { - append_fmt( & result, ", %S", interface.to_string() ); + append_fmt( result, ", %S", interface.to_string() ); interface = interface->Next ? cast(CodeType, interface->Next) : CodeType { nullptr }; } } else if ( ast->Name ) { - append( & result, ast->Name ); + append( result, ast->Name ); } if ( ast->InlineCmt ) { - append_fmt( & result, " // %S", ast->InlineCmt->Content ); + append_fmt( result, " // %S", ast->InlineCmt->Content ); } - append_fmt( & result, "\n{\n%S\n}", ast->Body.to_string() ); + append_fmt( result, "\n{\n%S\n}", GEN_NS to_string(ast->Body) ); if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) ) - append( & result, ";\n"); + append( result, ";\n"); } -void CodeClass::to_string_fwd( String& result ) +void to_string_fwd( CodeClass self, String* result ) { + GEN_ASSERT(self.ast != nullptr); + AST_Class* ast = self.ast; + if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export )) - append( & result, "export " ); + append( result, "export " ); if ( ast->Attributes ) - append_fmt( & result, "class %S %S", ast->Attributes.to_string(), ast->Name ); + append_fmt( result, "class %S %S", ast->Attributes.to_string(), ast->Name ); - else append_fmt( & result, "class %S", ast->Name ); + else append_fmt( result, "class %S", ast->Name ); // Check if it can have an end-statement if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) ) { if ( ast->InlineCmt ) - append_fmt( & result, "; // %S\n", ast->InlineCmt->Content ); + append_fmt( result, "; // %S\n", ast->InlineCmt->Content ); else - append( & result,";\n"); + append( result,";\n"); } } @@ -328,18 +339,18 @@ void CodeEnum::to_string_def( String& result ) append_fmt( & result, "%S : %S\n{\n%S\n}" , ast->Name , ast->UnderlyingType.to_string() - , ast->Body.to_string() + , GEN_NS to_string(ast->Body) ); else if ( ast->UnderlyingTypeMacro ) append_fmt( & result, "%S : %S\n{\n%S\n}" , ast->Name , GEN_NS to_string(ast->UnderlyingTypeMacro) - , ast->Body.to_string() + , GEN_NS to_string(ast->Body) ); - else append_fmt( & result, "%S\n{\n%S\n}", ast->Name, ast->Body.to_string() ); + else append_fmt( & result, "%S\n{\n%S\n}", ast->Name, GEN_NS to_string(ast->Body) ); } - else append_fmt( & result, "enum %S\n{\n%S\n}", ast->Name, ast->Body.to_string() ); + else append_fmt( & result, "enum %S\n{\n%S\n}", ast->Name, GEN_NS to_string(ast->Body) ); if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) ) append( & result, ";\n"); @@ -383,16 +394,16 @@ void CodeEnum::to_string_class_def( String& result ) if ( ast->UnderlyingType ) { - append_fmt( & result, "%S : %S\n{\n%S\n}", ast->Name, ast->UnderlyingType.to_string(), ast->Body.to_string() ); + append_fmt( & result, "%S : %S\n{\n%S\n}", ast->Name, ast->UnderlyingType.to_string(), GEN_NS to_string(ast->Body) ); } else { - append_fmt( & result, "%S\n{\n%S\n}", ast->Name, ast->Body.to_string() ); + append_fmt( & result, "%S\n{\n%S\n}", ast->Name, GEN_NS to_string(ast->Body) ); } } else { - append_fmt( & result, "enum class %S\n{\n%S\n}", ast->Body.to_string() ); + append_fmt( & result, "enum class %S\n{\n%S\n}", GEN_NS to_string(ast->Body) ); } if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) ) @@ -428,7 +439,7 @@ String CodeExec::to_string() void CodeExtern::to_string( String& result ) { if ( ast->Body ) - append_fmt( & result, "extern \"%S\"\n{\n%S\n}\n", ast->Name, ast->Body.to_string() ); + append_fmt( & result, "extern \"%S\"\n{\n%S\n}\n", ast->Name, GEN_NS to_string(ast->Body) ); else append_fmt( & result, "extern \"%S\"\n{}\n", ast->Name ); } @@ -531,7 +542,7 @@ void CodeFn::to_string_def( String& result ) } } - append_fmt( & result, "\n{\n%S\n}\n", ast->Body.to_string() ); + append_fmt( & result, "\n{\n%S\n}\n", GEN_NS to_string(ast->Body) ); } void CodeFn::to_string_fwd( String& result ) @@ -589,7 +600,7 @@ void CodeFn::to_string_fwd( String& result ) if ( ast->Specs && ast->Specs.has( ESpecifier::Pure ) >= 0 ) append( & result, " = 0;" ); else if (ast->Body) - append_fmt( & result, " = %S;", ast->Body.to_string() ); + append_fmt( & result, " = %S;", GEN_NS to_string(ast->Body) ); if ( ast->InlineCmt ) append_fmt( & result, "; %S", ast->InlineCmt->Content ); @@ -627,7 +638,7 @@ void CodeNS::to_string( String& result ) if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export )) append( & result, "export " ); - append_fmt( & result, "namespace %S\n{\n%S\n}\n", ast->Name , ast->Body.to_string() ); + append_fmt( & result, "namespace %S\n{\n%S\n}\n", ast->Name , GEN_NS to_string(ast->Body) ); } String CodeOperator::to_string() @@ -698,7 +709,7 @@ void CodeOperator::to_string_def( String& result ) } append_fmt( & result, "\n{\n%S\n}\n" - , ast->Body.to_string() + , GEN_NS to_string(ast->Body) ); } @@ -796,14 +807,14 @@ void CodeOpCast::to_string_def( String& result ) } } - append_fmt( & result, "\n{\n%S\n}\n", ast->Body.to_string() ); + append_fmt( & result, "\n{\n%S\n}\n", GEN_NS to_string(ast->Body) ); return; } if ( ast->Name && length(ast->Name) ) - append_fmt( & result, "%Soperator %S()\n{\n%S\n}\n", ast->Name, ast->ValueType.to_string(), ast->Body.to_string() ); + append_fmt( & result, "%Soperator %S()\n{\n%S\n}\n", ast->Name, ast->ValueType.to_string(), GEN_NS to_string(ast->Body) ); else - append_fmt( & result, "operator %S()\n{\n%S\n}\n", ast->ValueType.to_string(), ast->Body.to_string() ); + append_fmt( & result, "operator %S()\n{\n%S\n}\n", ast->ValueType.to_string(), GEN_NS to_string(ast->Body) ); } void CodeOpCast::to_string_fwd( String& result ) @@ -1030,7 +1041,7 @@ void CodeStruct::to_string_def( String& result ) append_fmt( & result, " // %S", ast->InlineCmt->Content ); } - append_fmt( & result, "\n{\n%S\n}", ast->Body.to_string() ); + append_fmt( & result, "\n{\n%S\n}", GEN_NS to_string(ast->Body) ); if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) ) append( & result, ";\n"); @@ -1189,14 +1200,14 @@ void CodeUnion::to_string( String& result ) { append_fmt( & result, "%S\n{\n%S\n}" , ast->Name - , ast->Body.to_string() + , GEN_NS to_string(ast->Body) ); } else { // Anonymous union append_fmt( & result, "\n{\n%S\n}" - , ast->Body.to_string() + , GEN_NS to_string(ast->Body) ); } diff --git a/project/components/code_types.hpp b/project/components/code_types.hpp index a582b62..ff915c5 100644 --- a/project/components/code_types.hpp +++ b/project/components/code_types.hpp @@ -3,6 +3,17 @@ #include "ast.hpp" #endif +void append ( CodeBody body, Code other ); +void append ( CodeBody body, CodeBody other ); +String to_string ( CodeBody body ); +void to_string ( CodeBody body, String* result ); +void to_string_export ( CodeBody body, String* result ); + +void add_interface( CodeClass self, CodeType interface ); +String to_string ( CodeClass self ); +void to_string_def( CodeClass self, String* result ); +void to_string_fwd( CodeClass self, String* result ); + #pragma region Code Types // These structs are not used at all by the C vairant. #if ! GEN_COMPILER_C @@ -10,31 +21,16 @@ struct CodeBody { -#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1 +#if GEN_SUPPORT_CPP_MEMBER_FEATURES Using_Code( CodeBody ); - void append( Code other ) - { - GEN_ASSERT(other.ast != nullptr); + void append( Code other ) { return GEN_NS append( *this, other ); } + void append( CodeBody body ) { return GEN_NS append(*this, body); } + bool has_entries() { return GEN_NS has_entries(rcast( AST*, ast )); } - if (GEN_NS is_body(other)) { - append( cast(CodeBody, other) ); - } - - GEN_NS append( raw(), other.ast ); - } - void append( CodeBody body ) - { - for ( Code entry : body ) { - append( entry ); - } - } - bool has_entries() { return GEN_NS has_entries(rcast( AST*, ast )); } - AST* raw() { return rcast( AST*, ast ); } - - String to_string(); - void to_string( String& result ); - void to_string_export( String& result ); + String to_string() { return GEN_NS to_string(* this); } + void to_string( String& result ) { return GEN_NS to_string(* this, & result ); } + void to_string_export( String& result ) { return GEN_NS to_string_export(* this, & result); } #endif Using_CodeOps( CodeBody ); @@ -59,7 +55,7 @@ struct CodeBody struct CodeClass { -#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1 +#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 0 Using_Code( CodeClass ); void add_interface( CodeType interface ); @@ -67,8 +63,6 @@ struct CodeClass String to_string(); void to_string_def( String& result ); void to_string_fwd( String& result ); - - AST* raw() { return rcast( AST*, ast ); } #endif Using_CodeOps( CodeClass ); @@ -1054,5 +1048,9 @@ struct CodeVar #undef Using_Code #undef Using_CodeOps +#if GEN_SUPPORT_CPP_REFERENCES +void to_string_export( CodeBody body, String& result ) { return to_string_export(body, & result); }; +#endif + #endif //if ! GEN_COMPILER_C #pragma endregion Code Types diff --git a/project/components/inlines.hpp b/project/components/inlines.hpp index ce99931..1258f2f 100644 --- a/project/components/inlines.hpp +++ b/project/components/inlines.hpp @@ -163,13 +163,35 @@ Code& Code::operator ++() #pragma endregion Code inline -void CodeClass::add_interface( CodeType type ) +void append( CodeBody self, Code other ) { - CodeType possible_slot = ast->ParentType; + GEN_ASSERT(other.ast != nullptr); + + if (is_body(other)) { + append( self, cast(CodeBody, other) ); + return; + } + + append( rcast(AST*, self.ast), other.ast ); +} + +inline +void append( CodeBody self, CodeBody body ) +{ + for ( Code entry : body ) { + append( self, entry ); + } +} + +inline +void add_interface( CodeClass self, CodeType type ) +{ + GEN_ASSERT(self.ast !=nullptr); + CodeType possible_slot = self->ParentType; if ( possible_slot.ast ) { // Were adding an interface to parent type, so we need to make sure the parent type is public. - ast->ParentAccess = AccessSpec_Public; + self->ParentAccess = AccessSpec_Public; // If your planning on adding a proper parent, // then you'll need to move this over to ParentType->next and update ParentAccess accordingly. } diff --git a/project/components/interface.upfront.cpp b/project/components/interface.upfront.cpp index 5f9ce5e..cc5b7a0 100644 --- a/project/components/interface.upfront.cpp +++ b/project/components/interface.upfront.cpp @@ -605,7 +605,7 @@ CodeClass def_class( StrC name { for (s32 idx = 0; idx < num_interfaces; idx++ ) { - result.add_interface( interfaces[idx] ); + add_interface(result, interfaces[idx] ); } } @@ -1565,7 +1565,7 @@ CodeBody def_class_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -1602,7 +1602,7 @@ CodeBody def_class_body( s32 num, Code* codes ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -1636,7 +1636,7 @@ CodeBody def_enum_body( s32 num, ... ) return InvalidCode; } - result.append( entry ); + append(result, entry ); } while ( num--, num > 0 ); va_end(va); @@ -1668,7 +1668,7 @@ CodeBody def_enum_body( s32 num, Code* codes ) return InvalidCode; } - result.append( entry ); + append(result, entry ); } while ( codes++, num--, num > 0 ); @@ -1706,7 +1706,7 @@ CodeBody def_export_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -1743,7 +1743,7 @@ CodeBody def_export_body( s32 num, Code* codes ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -1781,7 +1781,7 @@ CodeBody def_extern_link_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -1818,7 +1818,7 @@ CodeBody def_extern_link_body( s32 num, Code* codes ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -1858,7 +1858,7 @@ CodeBody def_function_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -1894,7 +1894,7 @@ CodeBody def_function_body( s32 num, Code* codes ) default: break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -1926,7 +1926,7 @@ CodeBody def_global_body( s32 num, ... ) { case Global_Body: // result.append( entry.code_cast() ) ; - result.append( cast(CodeBody, entry) ) ; + append( result, cast(CodeBody, entry) ); continue; GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES @@ -1937,7 +1937,7 @@ CodeBody def_global_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -1967,7 +1967,7 @@ CodeBody def_global_body( s32 num, Code* codes ) switch (entry->Type) { case Global_Body: - result.append( cast(CodeBody, entry) ); + append(result, cast(CodeBody, entry) ); continue; GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES @@ -1978,7 +1978,7 @@ CodeBody def_global_body( s32 num, Code* codes ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -2016,7 +2016,7 @@ CodeBody def_namespace_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -2052,7 +2052,7 @@ CodeBody def_namespace_body( s32 num, Code* codes ) default: break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -2225,7 +2225,7 @@ CodeBody def_struct_body( s32 num, ... ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); va_end(va); @@ -2262,7 +2262,7 @@ CodeBody def_struct_body( s32 num, Code* codes ) break; } - result.append(entry); + append(result, entry); } while (num--, num > 0); @@ -2296,7 +2296,7 @@ CodeBody def_union_body( s32 num, ... ) return InvalidCode; } - result.append( entry ); + append(result, entry ); } while ( num--, num > 0 ); va_end(va); @@ -2328,7 +2328,7 @@ CodeBody def_union_body( s32 num, CodeUnion* codes ) return InvalidCode; } - result.append( entry ); + append(result, entry ); } while ( codes++, num--, num > 0 ); diff --git a/project/components/parser.cpp b/project/components/parser.cpp index c024bc2..2a98575 100644 --- a/project/components/parser.cpp +++ b/project/components/parser.cpp @@ -1115,7 +1115,7 @@ CodeBody parse_class_struct_body( TokType which, Token name ) return InvalidCode; } - result.append( member ); + append(result, member ); } eat( TokType::BraceCurly_Close ); @@ -1503,7 +1503,7 @@ CodeFn parse_function_after_name( default: { - log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", body.debug_str(), Context.to_string()); + log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", debug_str(body), Context.to_string()); Context.pop(); return InvalidCode; } @@ -1568,7 +1568,7 @@ Code parse_function_body() if ( len > 0 ) { - result.append( def_execution( { len, start.Text } ) ); + append( result, def_execution( { len, start.Text } ) ); } eat( TokType::BraceCurly_Close ); @@ -1878,7 +1878,7 @@ CodeBody parse_global_nspace( CodeT which ) } // log_fmt("Global Body Member: %s", member->debug_str()); - result.append( member ); + append(result, member ); } if ( which != Global_Body ) @@ -3743,7 +3743,7 @@ CodeEnum parse_enum( bool inplace_def ) return InvalidCode; } - body.append( member ); + append(body, member ); } eat( TokType::BraceCurly_Close ); @@ -5187,7 +5187,7 @@ CodeUnion parse_union( bool inplace_def ) } if ( member ) - body.append( member ); + append(body, member ); } // union { diff --git a/project/helpers/helper.hpp b/project/helpers/helper.hpp index 5baa9e8..9e61baa 100644 --- a/project/helpers/helper.hpp +++ b/project/helpers/helper.hpp @@ -428,29 +428,29 @@ CodeBody gen_ast_inlines() CodeBody impl_code_using = parse_global_body( token_fmt( "typename", StrC name(CodeUsing), code_impl_tmpl )); CodeBody impl_code_var = parse_global_body( token_fmt( "typename", StrC name(CodeVar), code_impl_tmpl )); - impl_code_attr. append( parse_global_body( token_fmt( "typename", StrC name(Attributes), codetype_impl_tmpl ))); - impl_code_cmt. append( parse_global_body( token_fmt( "typename", StrC name(Comment), codetype_impl_tmpl ))); - impl_code_constr. append( parse_global_body( token_fmt( "typename", StrC name(Constructor), codetype_impl_tmpl ))); - impl_code_define. append( parse_global_body( token_fmt( "typename", StrC name(Define), codetype_impl_tmpl ))); - impl_code_destruct.append( parse_global_body( token_fmt( "typename", StrC name(Destructor), codetype_impl_tmpl ))); - impl_code_enum. append( parse_global_body( token_fmt( "typename", StrC name(Enum), codetype_impl_tmpl ))); - impl_code_exec. append( parse_global_body( token_fmt( "typename", StrC name(Exec), codetype_impl_tmpl ))); - impl_code_extern. append( parse_global_body( token_fmt( "typename", StrC name(Extern), codetype_impl_tmpl ))); - impl_code_include. append( parse_global_body( token_fmt( "typename", StrC name(Include), codetype_impl_tmpl ))); - impl_code_friend. append( parse_global_body( token_fmt( "typename", StrC name(Friend), codetype_impl_tmpl ))); - impl_code_fn. append( parse_global_body( token_fmt( "typename", StrC name(Fn), codetype_impl_tmpl ))); - impl_code_module. append( parse_global_body( token_fmt( "typename", StrC name(Module), codetype_impl_tmpl ))); - impl_code_ns. append( parse_global_body( token_fmt( "typename", StrC name(NS), codetype_impl_tmpl ))); - impl_code_op. append( parse_global_body( token_fmt( "typename", StrC name(Operator), codetype_impl_tmpl ))); - impl_code_opcast. append( parse_global_body( token_fmt( "typename", StrC name(OpCast), codetype_impl_tmpl ))); - impl_code_pragma . append( parse_global_body( token_fmt( "typename", StrC name(Pragma), codetype_impl_tmpl ))); - impl_code_precond. append( parse_global_body( token_fmt( "typename", StrC name(PreprocessCond), codetype_impl_tmpl ))); - impl_code_tmpl. append( parse_global_body( token_fmt( "typename", StrC name(Template), codetype_impl_tmpl ))); - impl_code_type. append( parse_global_body( token_fmt( "typename", StrC name(Type), codetype_impl_tmpl ))); - impl_code_typedef. append( parse_global_body( token_fmt( "typename", StrC name(Typedef), codetype_impl_tmpl ))); - impl_code_union. append( parse_global_body( token_fmt( "typename", StrC name(Union), codetype_impl_tmpl ))); - impl_code_using. append( parse_global_body( token_fmt( "typename", StrC name(Using), codetype_impl_tmpl ))); - impl_code_var. append( parse_global_body( token_fmt( "typename", StrC name(Var), codetype_impl_tmpl ))); + append(impl_code_attr, parse_global_body( token_fmt( "typename", StrC name(Attributes), codetype_impl_tmpl ))); + append(impl_code_cmt, parse_global_body( token_fmt( "typename", StrC name(Comment), codetype_impl_tmpl ))); + append(impl_code_constr, parse_global_body( token_fmt( "typename", StrC name(Constructor), codetype_impl_tmpl ))); + append(impl_code_define, parse_global_body( token_fmt( "typename", StrC name(Define), codetype_impl_tmpl ))); + append(impl_code_destruct, parse_global_body( token_fmt( "typename", StrC name(Destructor), codetype_impl_tmpl ))); + append(impl_code_enum, parse_global_body( token_fmt( "typename", StrC name(Enum), codetype_impl_tmpl ))); + append(impl_code_exec, parse_global_body( token_fmt( "typename", StrC name(Exec), codetype_impl_tmpl ))); + append(impl_code_extern, parse_global_body( token_fmt( "typename", StrC name(Extern), codetype_impl_tmpl ))); + append(impl_code_include, parse_global_body( token_fmt( "typename", StrC name(Include), codetype_impl_tmpl ))); + append(impl_code_friend, parse_global_body( token_fmt( "typename", StrC name(Friend), codetype_impl_tmpl ))); + append(impl_code_fn, parse_global_body( token_fmt( "typename", StrC name(Fn), codetype_impl_tmpl ))); + append(impl_code_module, parse_global_body( token_fmt( "typename", StrC name(Module), codetype_impl_tmpl ))); + append(impl_code_ns, parse_global_body( token_fmt( "typename", StrC name(NS), codetype_impl_tmpl ))); + append(impl_code_op, parse_global_body( token_fmt( "typename", StrC name(Operator), codetype_impl_tmpl ))); + append(impl_code_opcast, parse_global_body( token_fmt( "typename", StrC name(OpCast), codetype_impl_tmpl ))); + append(impl_code_pragma, parse_global_body( token_fmt( "typename", StrC name(Pragma), codetype_impl_tmpl ))); + append(impl_code_precond, parse_global_body( token_fmt( "typename", StrC name(PreprocessCond), codetype_impl_tmpl ))); + append(impl_code_tmpl, parse_global_body( token_fmt( "typename", StrC name(Template), codetype_impl_tmpl ))); + append(impl_code_type, parse_global_body( token_fmt( "typename", StrC name(Type), codetype_impl_tmpl ))); + append(impl_code_typedef, parse_global_body( token_fmt( "typename", StrC name(Typedef), codetype_impl_tmpl ))); + append(impl_code_union, parse_global_body( token_fmt( "typename", StrC name(Union), codetype_impl_tmpl ))); + append(impl_code_using, parse_global_body( token_fmt( "typename", StrC name(Using), codetype_impl_tmpl ))); + append(impl_code_var, parse_global_body( token_fmt( "typename", StrC name(Var), codetype_impl_tmpl ))); char const* cast_tmpl = stringize( inline AST::operator Code()