diff --git a/project/bootstrap.cpp b/project/bootstrap.cpp index 804a674..e36d202 100644 --- a/project/bootstrap.cpp +++ b/project/bootstrap.cpp @@ -145,6 +145,34 @@ int gen_main() header.print_fmt( "GEN_NS_END\n\n" ); header.print( pop_ignores ); header.write(); + + Builder + header_ecode = Builder::open( "components/gen/ecode.hpp" ); + header_ecode.print_fmt( generation_notice ); + header_ecode.print( pragma_once ); + header_ecode.print( ecode ); + header_ecode.write(); + + Builder + header_eoperator = Builder::open( "components/gen/eoperator.hpp" ); + header_eoperator.print_fmt( generation_notice ); + header_eoperator.print( pragma_once ); + header_eoperator.print( eoperator ); + header_eoperator.write(); + + Builder + header_especifier = Builder::open( "components/gen/especifier.hpp" ); + header_especifier.print_fmt( generation_notice ); + header_especifier.print( pragma_once ); + header_especifier.print( especifier ); + header_especifier.write(); + + Builder + header_ast_inlines = Builder::open( "components/gen/ast_inlines.hpp" ); + header_ast_inlines.print_fmt( generation_notice ); + header_ast_inlines.print( pragma_once ); + header_ast_inlines.print( ast_inlines ); + header_ast_inlines.write(); } // gen.cpp @@ -158,8 +186,8 @@ int gen_main() Code parsing = scan_file( "components/interface.parsing.cpp" ); Code untyped = scan_file( "components/interface.untyped.cpp" ); - CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" ); - CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) ); + CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" ); + CodeNS nspaced_etoktype = def_namespace( name(Parser), def_namespace_body( args(etoktype)) ); Builder src = Builder::open( "gen/gen.cpp" ); @@ -179,7 +207,7 @@ int gen_main() src.print( interface ); src.print( upfront ); src.print_fmt( "#pragma region Parsing\n\n" ); - src.print( parser_nspace ); + src.print( nspaced_etoktype ); src.print( parsing ); src.print( untyped ); src.print_fmt( "#pragma endregion Parsing\n\n" ); @@ -188,11 +216,18 @@ int gen_main() src.print_fmt( "GEN_NS_END\n\n"); src.print( pop_ignores ); src.write(); + + Builder + src_etoktype = Builder::open( "components/gen/etoktype.cpp" ); + src_etoktype.print_fmt( generation_notice ); + src_etoktype.print( pragma_once ); + src_etoktype.print( nspaced_etoktype ); + src_etoktype.write(); } // gen_builder.hpp { - Code builder = scan_file( "auxillary/builder.hpp", DontSkipInitialDirectives ); + Code builder = scan_file( "auxillary/builder.hpp" ); Builder header = Builder::open( "gen/gen.builder.hpp" ); @@ -207,7 +242,7 @@ int gen_main() // gen_builder.cpp { - Code builder = scan_file( "auxillary/builder.cpp", DontSkipInitialDirectives ); + Code builder = scan_file( "auxillary/builder.cpp" ); Builder src = Builder::open( "gen/gen.builder.cpp" ); @@ -222,7 +257,7 @@ int gen_main() // gen_scanner.hpp { Code parsing = scan_file( "dependencies/parsing.hpp" ); - Code scanner = scan_file( "auxillary/scanner.hpp", DontSkipInitialDirectives ); + Code scanner = scan_file( "auxillary/scanner.hpp" ); Builder header = Builder::open( "gen/gen.scanner.hpp" ); @@ -239,7 +274,7 @@ int gen_main() // gen_scanner.cpp { Code parsing = scan_file( "dependencies/parsing.cpp" ); - Code scanner = scan_file( "auxillary/scanner.cpp", DontSkipInitialDirectives ); + Code scanner = scan_file( "auxillary/scanner.cpp" ); Builder src = Builder::open( "gen/gen.scanner.cpp" ); diff --git a/project/components/ast.hpp b/project/components/ast.hpp index 580f4d7..7292e25 100644 --- a/project/components/ast.hpp +++ b/project/components/ast.hpp @@ -1,8 +1,8 @@ #pragma once #include "types.hpp" -#include "temp/ecode.hpp" -#include "temp/eoperator.hpp" -#include "temp/especifier.hpp" +#include "gen/ecode.hpp" +#include "gen/eoperator.hpp" +#include "gen/especifier.hpp" struct AST; struct AST_Body; diff --git a/project/components/gen/ast_inlines.hpp b/project/components/gen/ast_inlines.hpp new file mode 100644 index 0000000..1cb8a45 --- /dev/null +++ b/project/components/gen/ast_inlines.hpp @@ -0,0 +1,3012 @@ +// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp) + +#pragma once +#pragma region generated code inline implementation + +char const* Code::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code Code::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool Code::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool Code::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void Code::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String Code::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +Code& Code::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool Code::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool Code::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +Code::operator bool() +{ + return ast != nullptr; +} + +char const* CodeBody::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeBody::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeBody::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeBody::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeBody::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeBody::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeBody& CodeBody::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeBody::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeBody::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeBody::operator bool() +{ + return ast != nullptr; +} + +char const* CodeAttributes::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeAttributes::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeAttributes::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeAttributes::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeAttributes::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeAttributes::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeAttributes& CodeAttributes::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeAttributes::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeAttributes::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeAttributes::operator bool() +{ + return ast != nullptr; +} + +AST* CodeAttributes::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeAttributes::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Attributes* CodeAttributes::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeComment::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeComment::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeComment::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeComment::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeComment::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeComment::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeComment& CodeComment::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeComment::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeComment::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeComment::operator bool() +{ + return ast != nullptr; +} + +AST* CodeComment::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeComment::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Comment* CodeComment::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeConstructor::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeConstructor::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeConstructor::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeConstructor::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeConstructor::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeConstructor::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeConstructor& CodeConstructor::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeConstructor::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeConstructor::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeConstructor::operator bool() +{ + return ast != nullptr; +} + +AST* CodeConstructor::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeConstructor::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Constructor* CodeConstructor::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeClass::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeClass::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeClass::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeClass::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeClass::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeClass::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeClass& CodeClass::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeClass::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeClass::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeClass::operator bool() +{ + return ast != nullptr; +} + +char const* CodeDefine::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeDefine::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeDefine::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeDefine::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeDefine::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeDefine::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeDefine& CodeDefine::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeDefine::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeDefine::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeDefine::operator bool() +{ + return ast != nullptr; +} + +AST* CodeDefine::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeDefine::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Define* CodeDefine::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeDestructor::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeDestructor::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeDestructor::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeDestructor::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeDestructor::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeDestructor::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeDestructor& CodeDestructor::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeDestructor::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeDestructor::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeDestructor::operator bool() +{ + return ast != nullptr; +} + +AST* CodeDestructor::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeDestructor::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Destructor* CodeDestructor::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeEnum::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeEnum::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeEnum::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeEnum::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeEnum::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeEnum::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeEnum& CodeEnum::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeEnum::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeEnum::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeEnum::operator bool() +{ + return ast != nullptr; +} + +AST* CodeEnum::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeEnum::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Enum* CodeEnum::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeExec::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeExec::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeExec::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeExec::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeExec::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeExec::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeExec& CodeExec::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeExec::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeExec::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeExec::operator bool() +{ + return ast != nullptr; +} + +AST* CodeExec::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeExec::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Exec* CodeExec::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeExtern::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeExtern::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeExtern::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeExtern::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeExtern::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeExtern::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeExtern& CodeExtern::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeExtern::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeExtern::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeExtern::operator bool() +{ + return ast != nullptr; +} + +AST* CodeExtern::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeExtern::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Extern* CodeExtern::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeFriend::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeFriend::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeFriend::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeFriend::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeFriend::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeFriend::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeFriend& CodeFriend::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeFriend::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeFriend::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeFriend::operator bool() +{ + return ast != nullptr; +} + +AST* CodeFriend::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeFriend::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Friend* CodeFriend::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeFn::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeFn::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeFn::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeFn::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeFn::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeFn::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeFn& CodeFn::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeFn::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeFn::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeFn::operator bool() +{ + return ast != nullptr; +} + +AST* CodeFn::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeFn::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Fn* CodeFn::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeInclude::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeInclude::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeInclude::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeInclude::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeInclude::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeInclude::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeInclude& CodeInclude::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeInclude::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeInclude::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeInclude::operator bool() +{ + return ast != nullptr; +} + +AST* CodeInclude::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeInclude::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Include* CodeInclude::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeModule::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeModule::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeModule::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeModule::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeModule::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeModule::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeModule& CodeModule::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeModule::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeModule::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeModule::operator bool() +{ + return ast != nullptr; +} + +AST* CodeModule::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeModule::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Module* CodeModule::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeNS::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeNS::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeNS::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeNS::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeNS::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeNS::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeNS& CodeNS::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeNS::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeNS::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeNS::operator bool() +{ + return ast != nullptr; +} + +AST* CodeNS::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeNS::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_NS* CodeNS::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeOperator::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeOperator::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeOperator::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeOperator::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeOperator::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeOperator::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeOperator& CodeOperator::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeOperator::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeOperator::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeOperator::operator bool() +{ + return ast != nullptr; +} + +AST* CodeOperator::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeOperator::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Operator* CodeOperator::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeOpCast::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeOpCast::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeOpCast::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeOpCast::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeOpCast::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeOpCast::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeOpCast& CodeOpCast::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeOpCast::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeOpCast::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeOpCast::operator bool() +{ + return ast != nullptr; +} + +AST* CodeOpCast::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeOpCast::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_OpCast* CodeOpCast::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeParam::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeParam::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeParam::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeParam::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeParam::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeParam::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeParam& CodeParam::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeParam::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeParam::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeParam::operator bool() +{ + return ast != nullptr; +} + +char const* CodePragma::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodePragma::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodePragma::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodePragma::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodePragma::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodePragma::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodePragma& CodePragma::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodePragma::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodePragma::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodePragma::operator bool() +{ + return ast != nullptr; +} + +AST* CodePragma::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodePragma::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Pragma* CodePragma::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodePreprocessCond::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodePreprocessCond::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodePreprocessCond::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodePreprocessCond::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodePreprocessCond::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodePreprocessCond::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodePreprocessCond& CodePreprocessCond::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodePreprocessCond::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodePreprocessCond::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodePreprocessCond::operator bool() +{ + return ast != nullptr; +} + +AST* CodePreprocessCond::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodePreprocessCond::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_PreprocessCond* CodePreprocessCond::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeSpecifiers::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeSpecifiers::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeSpecifiers::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeSpecifiers::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeSpecifiers::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeSpecifiers::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeSpecifiers& CodeSpecifiers::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeSpecifiers::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeSpecifiers::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeSpecifiers::operator bool() +{ + return ast != nullptr; +} + +char const* CodeStruct::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeStruct::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeStruct::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeStruct::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeStruct::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeStruct::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeStruct& CodeStruct::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeStruct::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeStruct::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeStruct::operator bool() +{ + return ast != nullptr; +} + +char const* CodeTemplate::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeTemplate::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeTemplate::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeTemplate::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeTemplate::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeTemplate::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeTemplate& CodeTemplate::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeTemplate::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeTemplate::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeTemplate::operator bool() +{ + return ast != nullptr; +} + +AST* CodeTemplate::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeTemplate::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Template* CodeTemplate::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeType::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeType::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeType::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeType::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeType::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeType::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeType& CodeType::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeType::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeType::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeType::operator bool() +{ + return ast != nullptr; +} + +AST* CodeType::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeType::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Type* CodeType::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeTypedef::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeTypedef::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeTypedef::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeTypedef::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeTypedef::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeTypedef::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeTypedef& CodeTypedef::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeTypedef::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeTypedef::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeTypedef::operator bool() +{ + return ast != nullptr; +} + +AST* CodeTypedef::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeTypedef::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Typedef* CodeTypedef::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeUnion::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeUnion::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeUnion::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeUnion::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeUnion::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeUnion::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeUnion& CodeUnion::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeUnion::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeUnion::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeUnion::operator bool() +{ + return ast != nullptr; +} + +AST* CodeUnion::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeUnion::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Union* CodeUnion::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeUsing::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeUsing::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeUsing::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeUsing::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeUsing::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeUsing::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeUsing& CodeUsing::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeUsing::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeUsing::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeUsing::operator bool() +{ + return ast != nullptr; +} + +AST* CodeUsing::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeUsing::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Using* CodeUsing::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +char const* CodeVar::debug_str( void ) +{ + if ( ast == nullptr ) + return "Code::debug_str: AST is null!"; + return rcast( AST*, ast )->debug_str(); +} + +Code CodeVar::duplicate( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::duplicate: Cannot duplicate code, AST is null!" ); + return Code::Invalid; + } + return { rcast( AST*, ast )->duplicate() }; +} + +bool CodeVar::is_equal( Code other ) +{ + if ( ast == nullptr || other.ast == nullptr ) + { + log_failure( "Code::is_equal: Cannot compare code, AST is null!" ); + return false; + } + return rcast( AST*, ast )->is_equal( other.ast ); +} + +bool CodeVar::is_valid( void ) +{ + return ( AST* )ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid; +} + +void CodeVar::set_global( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::set_global: Cannot set code as global, AST is null!" ); + return; + } + rcast( AST*, ast )->Parent = Code::Global.ast; +} + +String CodeVar::to_string( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); + return { nullptr }; + } + return rcast( AST*, ast )->to_string(); +} + +CodeVar& CodeVar::operator=( Code other ) +{ + if ( other.ast && other->Parent ) + { + ast = rcast( decltype( ast ), other.ast->duplicate() ); + rcast( AST*, ast )->Parent = nullptr; + } + ast = rcast( decltype( ast ), other.ast ); + return *this; +} + +bool CodeVar::operator==( Code other ) +{ + return ( AST* )ast == other.ast; +} + +bool CodeVar::operator!=( Code other ) +{ + return ( AST* )ast != other.ast; +} + +CodeVar::operator bool() +{ + return ast != nullptr; +} + +AST* CodeVar::raw( void ) +{ + return rcast( AST*, ast ); +} + +CodeVar::operator Code() +{ + return *rcast( Code*, this ); +} + +AST_Var* CodeVar::operator->( void ) +{ + if ( ast == nullptr ) + { + log_failure( "Attempt to dereference a nullptr!" ); + return nullptr; + } + return ast; +} + +#pragma endregion generated code inline implementation + +#pragma region generated AST/Code cast implementation + +AST::operator CodeBody() +{ + return { rcast( AST_Body*, this ) }; +} + +Code::operator CodeBody() const +{ + return { ( AST_Body* )ast }; +} + +AST::operator CodeAttributes() +{ + return { rcast( AST_Attributes*, this ) }; +} + +Code::operator CodeAttributes() const +{ + return { ( AST_Attributes* )ast }; +} + +AST::operator CodeComment() +{ + return { rcast( AST_Comment*, this ) }; +} + +Code::operator CodeComment() const +{ + return { ( AST_Comment* )ast }; +} + +AST::operator CodeConstructor() +{ + return { rcast( AST_Constructor*, this ) }; +} + +Code::operator CodeConstructor() const +{ + return { ( AST_Constructor* )ast }; +} + +AST::operator CodeClass() +{ + return { rcast( AST_Class*, this ) }; +} + +Code::operator CodeClass() const +{ + return { ( AST_Class* )ast }; +} + +AST::operator CodeDefine() +{ + return { rcast( AST_Define*, this ) }; +} + +Code::operator CodeDefine() const +{ + return { ( AST_Define* )ast }; +} + +AST::operator CodeDestructor() +{ + return { rcast( AST_Destructor*, this ) }; +} + +Code::operator CodeDestructor() const +{ + return { ( AST_Destructor* )ast }; +} + +AST::operator CodeEnum() +{ + return { rcast( AST_Enum*, this ) }; +} + +Code::operator CodeEnum() const +{ + return { ( AST_Enum* )ast }; +} + +AST::operator CodeExec() +{ + return { rcast( AST_Exec*, this ) }; +} + +Code::operator CodeExec() const +{ + return { ( AST_Exec* )ast }; +} + +AST::operator CodeExtern() +{ + return { rcast( AST_Extern*, this ) }; +} + +Code::operator CodeExtern() const +{ + return { ( AST_Extern* )ast }; +} + +AST::operator CodeFriend() +{ + return { rcast( AST_Friend*, this ) }; +} + +Code::operator CodeFriend() const +{ + return { ( AST_Friend* )ast }; +} + +AST::operator CodeFn() +{ + return { rcast( AST_Fn*, this ) }; +} + +Code::operator CodeFn() const +{ + return { ( AST_Fn* )ast }; +} + +AST::operator CodeInclude() +{ + return { rcast( AST_Include*, this ) }; +} + +Code::operator CodeInclude() const +{ + return { ( AST_Include* )ast }; +} + +AST::operator CodeModule() +{ + return { rcast( AST_Module*, this ) }; +} + +Code::operator CodeModule() const +{ + return { ( AST_Module* )ast }; +} + +AST::operator CodeNS() +{ + return { rcast( AST_NS*, this ) }; +} + +Code::operator CodeNS() const +{ + return { ( AST_NS* )ast }; +} + +AST::operator CodeOperator() +{ + return { rcast( AST_Operator*, this ) }; +} + +Code::operator CodeOperator() const +{ + return { ( AST_Operator* )ast }; +} + +AST::operator CodeOpCast() +{ + return { rcast( AST_OpCast*, this ) }; +} + +Code::operator CodeOpCast() const +{ + return { ( AST_OpCast* )ast }; +} + +AST::operator CodeParam() +{ + return { rcast( AST_Param*, this ) }; +} + +Code::operator CodeParam() const +{ + return { ( AST_Param* )ast }; +} + +AST::operator CodePragma() +{ + return { rcast( AST_Pragma*, this ) }; +} + +Code::operator CodePragma() const +{ + return { ( AST_Pragma* )ast }; +} + +AST::operator CodePreprocessCond() +{ + return { rcast( AST_PreprocessCond*, this ) }; +} + +Code::operator CodePreprocessCond() const +{ + return { ( AST_PreprocessCond* )ast }; +} + +AST::operator CodeSpecifiers() +{ + return { rcast( AST_Specifiers*, this ) }; +} + +Code::operator CodeSpecifiers() const +{ + return { ( AST_Specifiers* )ast }; +} + +AST::operator CodeStruct() +{ + return { rcast( AST_Struct*, this ) }; +} + +Code::operator CodeStruct() const +{ + return { ( AST_Struct* )ast }; +} + +AST::operator CodeTemplate() +{ + return { rcast( AST_Template*, this ) }; +} + +Code::operator CodeTemplate() const +{ + return { ( AST_Template* )ast }; +} + +AST::operator CodeType() +{ + return { rcast( AST_Type*, this ) }; +} + +Code::operator CodeType() const +{ + return { ( AST_Type* )ast }; +} + +AST::operator CodeTypedef() +{ + return { rcast( AST_Typedef*, this ) }; +} + +Code::operator CodeTypedef() const +{ + return { ( AST_Typedef* )ast }; +} + +AST::operator CodeUnion() +{ + return { rcast( AST_Union*, this ) }; +} + +Code::operator CodeUnion() const +{ + return { ( AST_Union* )ast }; +} + +AST::operator CodeUsing() +{ + return { rcast( AST_Using*, this ) }; +} + +Code::operator CodeUsing() const +{ + return { ( AST_Using* )ast }; +} + +AST::operator CodeVar() +{ + return { rcast( AST_Var*, this ) }; +} + +Code::operator CodeVar() const +{ + return { ( AST_Var* )ast }; +} + +#pragma endregion generated AST / Code cast implementation diff --git a/project/components/gen/ecode.hpp b/project/components/gen/ecode.hpp new file mode 100644 index 0000000..80f749a --- /dev/null +++ b/project/components/gen/ecode.hpp @@ -0,0 +1,141 @@ +// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp) + +#pragma once + +namespace ECode +{ + enum Type : u32 + { + Invalid, + Untyped, + NewLine, + Comment, + Access_Private, + Access_Protected, + Access_Public, + PlatformAttributes, + Class, + Class_Fwd, + Class_Body, + Constructor, + Constructor_Fwd, + Destructor, + Destructor_Fwd, + Enum, + Enum_Fwd, + Enum_Body, + Enum_Class, + Enum_Class_Fwd, + Execution, + Export_Body, + Extern_Linkage, + Extern_Linkage_Body, + Friend, + Function, + Function_Fwd, + Function_Body, + Global_Body, + Module, + Namespace, + Namespace_Body, + Operator, + Operator_Fwd, + Operator_Member, + Operator_Member_Fwd, + Operator_Cast, + Operator_Cast_Fwd, + Parameters, + Preprocess_Define, + Preprocess_Include, + Preprocess_If, + Preprocess_IfDef, + Preprocess_IfNotDef, + Preprocess_ElIf, + Preprocess_Else, + Preprocess_EndIf, + Preprocess_Pragma, + Specifiers, + Struct, + Struct_Fwd, + Struct_Body, + Template, + Typedef, + Typename, + Union, + Union_Body, + Using, + Using_Namespace, + Variable, + NumTypes + }; + + StrC to_str( Type type ) + { + local_persist StrC lookup[] { + {sizeof( "Invalid" ), "Invalid" }, + { sizeof( "Untyped" ), "Untyped" }, + { sizeof( "NewLine" ), "NewLine" }, + { sizeof( "Comment" ), "Comment" }, + { sizeof( "Access_Private" ), "Access_Private" }, + { sizeof( "Access_Protected" ), "Access_Protected" }, + { sizeof( "Access_Public" ), "Access_Public" }, + { sizeof( "PlatformAttributes" ), "PlatformAttributes" }, + { sizeof( "Class" ), "Class" }, + { sizeof( "Class_Fwd" ), "Class_Fwd" }, + { sizeof( "Class_Body" ), "Class_Body" }, + { sizeof( "Constructor" ), "Constructor" }, + { sizeof( "Constructor_Fwd" ), "Constructor_Fwd" }, + { sizeof( "Destructor" ), "Destructor" }, + { sizeof( "Destructor_Fwd" ), "Destructor_Fwd" }, + { sizeof( "Enum" ), "Enum" }, + { sizeof( "Enum_Fwd" ), "Enum_Fwd" }, + { sizeof( "Enum_Body" ), "Enum_Body" }, + { sizeof( "Enum_Class" ), "Enum_Class" }, + { sizeof( "Enum_Class_Fwd" ), "Enum_Class_Fwd" }, + { sizeof( "Execution" ), "Execution" }, + { sizeof( "Export_Body" ), "Export_Body" }, + { sizeof( "Extern_Linkage" ), "Extern_Linkage" }, + { sizeof( "Extern_Linkage_Body" ), "Extern_Linkage_Body"}, + { sizeof( "Friend" ), "Friend" }, + { sizeof( "Function" ), "Function" }, + { sizeof( "Function_Fwd" ), "Function_Fwd" }, + { sizeof( "Function_Body" ), "Function_Body" }, + { sizeof( "Global_Body" ), "Global_Body" }, + { sizeof( "Module" ), "Module" }, + { sizeof( "Namespace" ), "Namespace" }, + { sizeof( "Namespace_Body" ), "Namespace_Body" }, + { sizeof( "Operator" ), "Operator" }, + { sizeof( "Operator_Fwd" ), "Operator_Fwd" }, + { sizeof( "Operator_Member" ), "Operator_Member" }, + { sizeof( "Operator_Member_Fwd" ), "Operator_Member_Fwd"}, + { sizeof( "Operator_Cast" ), "Operator_Cast" }, + { sizeof( "Operator_Cast_Fwd" ), "Operator_Cast_Fwd" }, + { sizeof( "Parameters" ), "Parameters" }, + { sizeof( "Preprocess_Define" ), "Preprocess_Define" }, + { sizeof( "Preprocess_Include" ), "Preprocess_Include" }, + { sizeof( "Preprocess_If" ), "Preprocess_If" }, + { sizeof( "Preprocess_IfDef" ), "Preprocess_IfDef" }, + { sizeof( "Preprocess_IfNotDef" ), "Preprocess_IfNotDef"}, + { sizeof( "Preprocess_ElIf" ), "Preprocess_ElIf" }, + { sizeof( "Preprocess_Else" ), "Preprocess_Else" }, + { sizeof( "Preprocess_EndIf" ), "Preprocess_EndIf" }, + { sizeof( "Preprocess_Pragma" ), "Preprocess_Pragma" }, + { sizeof( "Specifiers" ), "Specifiers" }, + { sizeof( "Struct" ), "Struct" }, + { sizeof( "Struct_Fwd" ), "Struct_Fwd" }, + { sizeof( "Struct_Body" ), "Struct_Body" }, + { sizeof( "Template" ), "Template" }, + { sizeof( "Typedef" ), "Typedef" }, + { sizeof( "Typename" ), "Typename" }, + { sizeof( "Union" ), "Union" }, + { sizeof( "Union_Body" ), "Union_Body" }, + { sizeof( "Using" ), "Using" }, + { sizeof( "Using_Namespace" ), "Using_Namespace" }, + { sizeof( "Variable" ), "Variable" }, + }; + return lookup[ type ]; + } + +} // namespace ECode + +using CodeT = ECode::Type; diff --git a/project/components/gen/eoperator.hpp b/project/components/gen/eoperator.hpp new file mode 100644 index 0000000..b49b89e --- /dev/null +++ b/project/components/gen/eoperator.hpp @@ -0,0 +1,107 @@ +// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp) + +#pragma once + +namespace EOperator +{ + enum Type : u32 + { + Invalid, + Assign, + Assign_Add, + Assign_Subtract, + Assign_Multiply, + Assign_Divide, + Assign_Modulo, + Assign_BAnd, + Assign_BOr, + Assign_BXOr, + Assign_LShift, + Assign_RShift, + Increment, + Decrement, + Unary_Plus, + Unary_Minus, + UnaryNot, + Add, + Subtract, + Multiply, + Divide, + Modulo, + BNot, + BAnd, + BOr, + BXOr, + LShift, + RShift, + LAnd, + LOr, + LEqual, + LNot, + Lesser, + Greater, + LesserEqual, + GreaterEqual, + Subscript, + Indirection, + AddressOf, + MemberOfPointer, + PtrToMemOfPtr, + FunctionCall, + Comma, + NumOps + }; + + StrC to_str( Type op ) + { + local_persist StrC lookup[] { + {sizeof( "INVALID" ), "INVALID"}, + { sizeof( "=" ), "=" }, + { sizeof( "+=" ), "+=" }, + { sizeof( "-=" ), "-=" }, + { sizeof( "*=" ), "*=" }, + { sizeof( "/=" ), "/=" }, + { sizeof( "%=" ), "%=" }, + { sizeof( "&=" ), "&=" }, + { sizeof( "|=" ), "|=" }, + { sizeof( "^=" ), "^=" }, + { sizeof( "<<=" ), "<<=" }, + { sizeof( ">>=" ), ">>=" }, + { sizeof( "++" ), "++" }, + { sizeof( "--" ), "--" }, + { sizeof( "+" ), "+" }, + { sizeof( "-" ), "-" }, + { sizeof( "!" ), "!" }, + { sizeof( "+" ), "+" }, + { sizeof( "-" ), "-" }, + { sizeof( "*" ), "*" }, + { sizeof( "/" ), "/" }, + { sizeof( "%" ), "%" }, + { sizeof( "~" ), "~" }, + { sizeof( "&" ), "&" }, + { sizeof( "|" ), "|" }, + { sizeof( "^" ), "^" }, + { sizeof( "<<" ), "<<" }, + { sizeof( ">>" ), ">>" }, + { sizeof( "&&" ), "&&" }, + { sizeof( "||" ), "||" }, + { sizeof( "==" ), "==" }, + { sizeof( "!=" ), "!=" }, + { sizeof( "<" ), "<" }, + { sizeof( ">" ), ">" }, + { sizeof( "<=" ), "<=" }, + { sizeof( ">=" ), ">=" }, + { sizeof( "[]" ), "[]" }, + { sizeof( "*" ), "*" }, + { sizeof( "&" ), "&" }, + { sizeof( "->" ), "->" }, + { sizeof( "->*" ), "->*" }, + { sizeof( "()" ), "()" }, + { sizeof( "," ), "," }, + }; + return lookup[ op ]; + } + +} // namespace EOperator + +using OperatorT = EOperator::Type; diff --git a/project/components/gen/especifier.hpp b/project/components/gen/especifier.hpp new file mode 100644 index 0000000..fccecae --- /dev/null +++ b/project/components/gen/especifier.hpp @@ -0,0 +1,93 @@ +// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp) + +#pragma once + +namespace ESpecifier +{ + enum Type : u32 + { + Invalid, + Consteval, + Constexpr, + Constinit, + Explicit, + External_Linkage, + ForceInline, + Global, + Inline, + Internal_Linkage, + Local_Persist, + Mutable, + NeverInline, + Ptr, + Ref, + Register, + RValue, + Static, + Thread_Local, + Volatile, + Virtual, + Const, + Final, + Override, + Pure, + NumSpecifiers + }; + + bool is_trailing( Type specifier ) + { + return specifier > Virtual; + } + + StrC to_str( Type type ) + { + local_persist StrC lookup[] { + {sizeof( "INVALID" ), "INVALID" }, + { sizeof( "consteval" ), "consteval" }, + { sizeof( "constexpr" ), "constexpr" }, + { sizeof( "constinit" ), "constinit" }, + { sizeof( "explicit" ), "explicit" }, + { sizeof( "extern" ), "extern" }, + { sizeof( "forceinline" ), "forceinline" }, + { sizeof( "global" ), "global" }, + { sizeof( "inline" ), "inline" }, + { sizeof( "internal" ), "internal" }, + { sizeof( "local_persist" ), "local_persist"}, + { sizeof( "mutable" ), "mutable" }, + { sizeof( "neverinline" ), "neverinline" }, + { sizeof( "*" ), "*" }, + { sizeof( "&" ), "&" }, + { sizeof( "register" ), "register" }, + { sizeof( "&&" ), "&&" }, + { sizeof( "static" ), "static" }, + { sizeof( "thread_local" ), "thread_local" }, + { sizeof( "volatile" ), "volatile" }, + { sizeof( "virtual" ), "virtual" }, + { sizeof( "const" ), "const" }, + { sizeof( "final" ), "final" }, + { sizeof( "override" ), "override" }, + { sizeof( "= 0" ), "= 0" }, + }; + return lookup[ type ]; + } + + Type to_type( StrC str ) + { + local_persist u32 keymap[ NumSpecifiers ]; + do_once_start for ( u32 index = 0; index < NumSpecifiers; index++ ) + { + StrC enum_str = to_str( ( Type )index ); + keymap[ index ] = crc32( enum_str.Ptr, enum_str.Len - 1 ); + } + do_once_end u32 hash = crc32( str.Ptr, str.Len ); + for ( u32 index = 0; index < NumSpecifiers; index++ ) + { + if ( keymap[ index ] == hash ) + return ( Type )index; + } + return Invalid; + } + +} // namespace ESpecifier + +using SpecifierT = ESpecifier::Type; diff --git a/project/components/gen/etoktype.cpp b/project/components/gen/etoktype.cpp new file mode 100644 index 0000000..0ef4f7a --- /dev/null +++ b/project/components/gen/etoktype.cpp @@ -0,0 +1,234 @@ +// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp) + +#pragma once + +namespace Parser +{ + namespace ETokType + { +#define GEN_DEFINE_ATTRIBUTE_TOKENS Entry( API_Export, GEN_API_Export_Code ) Entry( API_Import, GEN_API_Import_Code ) + + enum Type : u32 + { + Invalid, + Access_Private, + Access_Protected, + Access_Public, + Access_MemberSymbol, + Access_StaticSymbol, + Ampersand, + Ampersand_DBL, + Assign_Classifer, + Attribute_Open, + Attribute_Close, + BraceCurly_Open, + BraceCurly_Close, + BraceSquare_Open, + BraceSquare_Close, + Capture_Start, + Capture_End, + Comment, + Comment_End, + Comment_Start, + Char, + Comma, + Decl_Class, + Decl_GNU_Attribute, + Decl_MSVC_Attribute, + Decl_Enum, + Decl_Extern_Linkage, + Decl_Friend, + Decl_Module, + Decl_Namespace, + Decl_Operator, + Decl_Struct, + Decl_Template, + Decl_Typedef, + Decl_Using, + Decl_Union, + Identifier, + Module_Import, + Module_Export, + NewLine, + Number, + Operator, + Preprocess_Hash, + Preprocess_Define, + Preprocess_If, + Preprocess_IfDef, + Preprocess_IfNotDef, + Preprocess_ElIf, + Preprocess_Else, + Preprocess_EndIf, + Preprocess_Include, + Preprocess_Pragma, + Preprocess_Content, + Preprocess_Macro, + Preprocess_Unsupported, + Spec_Alignas, + Spec_Const, + Spec_Consteval, + Spec_Constexpr, + Spec_Constinit, + Spec_Explicit, + Spec_Extern, + Spec_Final, + Spec_ForceInline, + Spec_Global, + Spec_Inline, + Spec_Internal_Linkage, + Spec_LocalPersist, + Spec_Mutable, + Spec_NeverInline, + Spec_Override, + Spec_Static, + Spec_ThreadLocal, + Spec_Volatile, + Spec_Virtual, + Star, + Statement_End, + StaticAssert, + String, + Type_Unsigned, + Type_Signed, + Type_Short, + Type_Long, + Type_char, + Type_int, + Type_double, + Type_MS_int8, + Type_MS_int16, + Type_MS_int32, + Type_MS_int64, + Type_MS_W64, + Varadic_Argument, + __Attributes_Start, + API_Export, + API_Import, + NumTokens + }; + + StrC to_str( Type type ) + { + local_persist StrC lookup[] { + {sizeof( "__invalid__" ), "__invalid__" }, + { sizeof( "private" ), "private" }, + { sizeof( "protected" ), "protected" }, + { sizeof( "public" ), "public" }, + { sizeof( "." ), "." }, + { sizeof( "::" ), "::" }, + { sizeof( "&" ), "&" }, + { sizeof( "&&" ), "&&" }, + { sizeof( ":" ), ":" }, + { sizeof( "[[" ), "[[" }, + { sizeof( "]]" ), "]]" }, + { sizeof( "{" ), "{" }, + { sizeof( "}" ), "}" }, + { sizeof( "[" ), "[" }, + { sizeof( "]" ), "]" }, + { sizeof( "(" ), "(" }, + { sizeof( ")" ), ")" }, + { sizeof( "__comemnt__" ), "__comemnt__" }, + { sizeof( "__comment_end__" ), "__comment_end__" }, + { sizeof( "__comment_start__" ), "__comment_start__" }, + { sizeof( "__character__" ), "__character__" }, + { sizeof( "," ), "," }, + { sizeof( "class" ), "class" }, + { sizeof( "__attribute__" ), "__attribute__" }, + { sizeof( "__declspec" ), "__declspec" }, + { sizeof( "enum" ), "enum" }, + { sizeof( "extern" ), "extern" }, + { sizeof( "friend" ), "friend" }, + { sizeof( "module" ), "module" }, + { sizeof( "namespace" ), "namespace" }, + { sizeof( "operator" ), "operator" }, + { sizeof( "struct" ), "struct" }, + { sizeof( "template" ), "template" }, + { sizeof( "typedef" ), "typedef" }, + { sizeof( "using" ), "using" }, + { sizeof( "union" ), "union" }, + { sizeof( "__identifier__" ), "__identifier__" }, + { sizeof( "import" ), "import" }, + { sizeof( "export" ), "export" }, + { sizeof( "__new_line__" ), "__new_line__" }, + { sizeof( "__number__" ), "__number__" }, + { sizeof( "__operator__" ), "__operator__" }, + { sizeof( "#" ), "#" }, + { sizeof( "define" ), "define" }, + { sizeof( "if" ), "if" }, + { sizeof( "ifdef" ), "ifdef" }, + { sizeof( "ifndef" ), "ifndef" }, + { sizeof( "elif" ), "elif" }, + { sizeof( "else" ), "else" }, + { sizeof( "endif" ), "endif" }, + { sizeof( "include" ), "include" }, + { sizeof( "pragma" ), "pragma" }, + { sizeof( "__macro_content__" ), "__macro_content__" }, + { sizeof( "__macro__" ), "__macro__" }, + { sizeof( "__unsupported__" ), "__unsupported__" }, + { sizeof( "alignas" ), "alignas" }, + { sizeof( "const" ), "const" }, + { sizeof( "consteval" ), "consteval" }, + { sizeof( "constexpr" ), "constexpr" }, + { sizeof( "constinit" ), "constinit" }, + { sizeof( "explicit" ), "explicit" }, + { sizeof( "extern" ), "extern" }, + { sizeof( "final" ), "final" }, + { sizeof( "forceinline" ), "forceinline" }, + { sizeof( "global" ), "global" }, + { sizeof( "inline" ), "inline" }, + { sizeof( "internal" ), "internal" }, + { sizeof( "local_persist" ), "local_persist" }, + { sizeof( "mutable" ), "mutable" }, + { sizeof( "neverinline" ), "neverinline" }, + { sizeof( "override" ), "override" }, + { sizeof( "static" ), "static" }, + { sizeof( "thread_local" ), "thread_local" }, + { sizeof( "volatile" ), "volatile" }, + { sizeof( "virtual" ), "virtual" }, + { sizeof( "*" ), "*" }, + { sizeof( ";" ), ";" }, + { sizeof( "static_assert" ), "static_assert" }, + { sizeof( "__string__" ), "__string__" }, + { sizeof( "unsigned" ), "unsigned" }, + { sizeof( "signed" ), "signed" }, + { sizeof( "short" ), "short" }, + { sizeof( "long" ), "long" }, + { sizeof( "char" ), "char" }, + { sizeof( "int" ), "int" }, + { sizeof( "double" ), "double" }, + { sizeof( "__int8" ), "__int8" }, + { sizeof( "__int16" ), "__int16" }, + { sizeof( "__int32" ), "__int32" }, + { sizeof( "__int64" ), "__int64" }, + { sizeof( "_W64" ), "_W64" }, + { sizeof( "..." ), "..." }, + { sizeof( "__attrib_start__" ), "__attrib_start__" }, + { sizeof( "GEN_API_Export_Code" ), "GEN_API_Export_Code"}, + { sizeof( "GEN_API_Import_Code" ), "GEN_API_Import_Code"}, + }; + return lookup[ type ]; + } + + Type to_type( StrC str ) + { + local_persist u32 keymap[ NumTokens ]; + do_once_start for ( u32 index = 0; index < NumTokens; index++ ) + { + StrC enum_str = to_str( ( Type )index ); + keymap[ index ] = crc32( enum_str.Ptr, enum_str.Len - 1 ); + } + do_once_end u32 hash = crc32( str.Ptr, str.Len ); + for ( u32 index = 0; index < NumTokens; index++ ) + { + if ( keymap[ index ] == hash ) + return ( Type )index; + } + return Invalid; + } + + } // namespace ETokType + + using TokType = ETokType::Type; + +} // namespace Parser diff --git a/project/components/header_end.hpp b/project/components/header_end.hpp index b51ce09..e505f0a 100644 --- a/project/components/header_end.hpp +++ b/project/components/header_end.hpp @@ -1,6 +1,6 @@ #pragma once #include "inlines.hpp" -#include "temp/ast_inlines.hpp" +#include "gen/ast_inlines.hpp" #pragma region Constants diff --git a/project/components/interface.parsing.cpp b/project/components/interface.parsing.cpp index 1760041..c72a575 100644 --- a/project/components/interface.parsing.cpp +++ b/project/components/interface.parsing.cpp @@ -1,5 +1,5 @@ #pragma once -#include "temp/etoktype.cpp" +#include "gen/etoktype.cpp" #include "interface.upfront.cpp" namespace Parser diff --git a/project/components/temp/Readme.md b/project/components/temp/Readme.md deleted file mode 100644 index eae1c40..0000000 --- a/project/components/temp/Readme.md +++ /dev/null @@ -1,8 +0,0 @@ -# Temporary Code - -These are heavy macro code used throughout the library thats intended to be replaced with codegen done with the library itself. - -The reason for this is to minimize macro generation to only trivial cases. -This makes the library more verbose but makes it easier to debug which is of higher priority. - -Any sort of verbosity cost will be mitigated with better docs and heavy usage of pragma regions. diff --git a/project/components/temp/ast_inlines.hpp b/project/components/temp/ast_inlines.hpp deleted file mode 100644 index 5563b82..0000000 --- a/project/components/temp/ast_inlines.hpp +++ /dev/null @@ -1,232 +0,0 @@ -#pragma once - -// This is the non-bootstraped version of the Common AST Implementation. This will be obsolete once bootstrap is stress tested. - -#pragma region AST Common - -#define Define_CodeImpl( Typename ) \ -char const* Typename::debug_str() \ -{ \ - if ( ast == nullptr ) \ - return "Code::debug_str: AST is null!"; \ - \ - return rcast(AST*, ast)->debug_str(); \ -} \ -Code Typename::duplicate() \ -{ \ - if ( ast == nullptr ) \ - { \ - log_failure("Code::duplicate: Cannot duplicate code, AST is null!"); \ - return Code::Invalid; \ - } \ - \ - return { rcast(AST*, ast)->duplicate() }; \ -} \ -bool Typename::is_equal( Code other ) \ -{ \ - if ( ast == nullptr || other.ast == nullptr ) \ - { \ - log_failure("Code::is_equal: Cannot compare code, AST is null!"); \ - return false; \ - } \ - \ - return rcast(AST*, ast)->is_equal( other.ast ); \ -} \ -bool Typename::is_valid() \ -{ \ - return (AST*) ast != nullptr && rcast( AST*, ast)->Type != CodeT::Invalid; \ -} \ -void Typename::set_global() \ -{ \ - if ( ast == nullptr ) \ - { \ - log_failure("Code::set_global: Cannot set code as global, AST is null!"); \ - return; \ - } \ - \ - rcast(AST*, ast)->Parent = Code::Global.ast; \ -} \ -String Typename::to_string() \ -{ \ - if ( ast == nullptr ) \ - { \ - log_failure("Code::to_string: Cannot convert code to string, AST is null!"); \ - return { nullptr }; \ - } \ - \ - return rcast(AST*, ast)->to_string(); \ -} \ -Typename& Typename::operator =( Code other ) \ -{ \ - if ( other.ast && other->Parent ) \ - { \ - ast = rcast( decltype(ast), other.ast->duplicate() ); \ - rcast( AST*, ast)->Parent = nullptr; \ - } \ - \ - ast = rcast( decltype(ast), other.ast ); \ - return *this; \ -} \ -bool Typename::operator ==( Code other ) \ -{ \ - return (AST*) ast == other.ast; \ -} \ -bool Typename::operator !=( Code other ) \ -{ \ - return (AST*) ast != other.ast; \ -} \ -Typename::operator bool() \ -{ \ - return ast != nullptr; \ -} - -#define Define_CodeType_Impl( Typename ) \ -AST* Code##Typename::raw() \ -{ \ - return rcast( AST*, ast ); \ -} \ -Code##Typename::operator Code() \ -{ \ - return *rcast( Code*, this ); \ -} \ -AST_##Typename* Code##Typename::operator->() \ -{ \ - if ( ast == nullptr ) \ - { \ - log_failure( "Attempt to dereference a nullptr!" ); \ - return nullptr; \ - } \ - return ast; \ -} \ - -Define_CodeImpl( Code ); -Define_CodeImpl( CodeBody ); -Define_CodeImpl( CodeAttributes ); -Define_CodeImpl( CodeComment ); -Define_CodeImpl( CodeClass ); -Define_CodeImpl( CodeConstructor ); -Define_CodeImpl( CodeDefine ); -Define_CodeImpl( CodeDestructor ); -Define_CodeImpl( CodeEnum ); -Define_CodeImpl( CodeExec ); -Define_CodeImpl( CodeExtern ); -Define_CodeImpl( CodeInclude ); -Define_CodeImpl( CodeFriend ); -Define_CodeImpl( CodeFn ); -Define_CodeImpl( CodeModule ); -Define_CodeImpl( CodeNS ); -Define_CodeImpl( CodeOperator ); -Define_CodeImpl( CodeOpCast ); -Define_CodeImpl( CodeParam ); -Define_CodeImpl( CodePragma ); -Define_CodeImpl( CodePreprocessCond ); -Define_CodeImpl( CodeSpecifiers ); -Define_CodeImpl( CodeStruct ); -Define_CodeImpl( CodeTemplate ); -Define_CodeImpl( CodeType ); -Define_CodeImpl( CodeTypedef ); -Define_CodeImpl( CodeUnion ); -Define_CodeImpl( CodeUsing ); -Define_CodeImpl( CodeVar ); - -Define_CodeType_Impl( Attributes ); -Define_CodeType_Impl( Comment ); -Define_CodeType_Impl( Constructor ); -Define_CodeType_Impl( Define ); -Define_CodeType_Impl( Destructor ); -Define_CodeType_Impl( Enum ); -Define_CodeType_Impl( Exec ); -Define_CodeType_Impl( Extern ); -Define_CodeType_Impl( Include ); -Define_CodeType_Impl( Friend ); -Define_CodeType_Impl( Fn ); -Define_CodeType_Impl( Module ); -Define_CodeType_Impl( NS ); -Define_CodeType_Impl( Operator ); -Define_CodeType_Impl( OpCast ); -Define_CodeType_Impl( Pragma ); -Define_CodeType_Impl( PreprocessCond ); -Define_CodeType_Impl( Template ); -Define_CodeType_Impl( Type ); -Define_CodeType_Impl( Typedef ); -Define_CodeType_Impl( Union ); -Define_CodeType_Impl( Using ); -Define_CodeType_Impl( Var ); - -#undef Define_CodeImpl -#undef Define_CodeType_Impl - -#define Define_AST_Cast( typename ) \ -AST::operator Code ## typename() \ -{ \ - return { rcast( AST_ ## typename*, this ) }; \ -} - -Define_AST_Cast( Body ); -Define_AST_Cast( Attributes ); -Define_AST_Cast( Comment ); -Define_AST_Cast( Constructor ); -Define_AST_Cast( Class ); -Define_AST_Cast( Define ); -Define_AST_Cast( Destructor ); -Define_AST_Cast( Enum ); -Define_AST_Cast( Exec ); -Define_AST_Cast( Extern ); -Define_AST_Cast( Include ); -Define_AST_Cast( Friend ); -Define_AST_Cast( Fn ); -Define_AST_Cast( Module ); -Define_AST_Cast( NS ); -Define_AST_Cast( Operator ); -Define_AST_Cast( OpCast ); -Define_AST_Cast( Param ); -Define_AST_Cast( Pragma ); -Define_AST_Cast( PreprocessCond ); -Define_AST_Cast( Struct ); -Define_AST_Cast( Specifiers ); -Define_AST_Cast( Template ); -Define_AST_Cast( Type ); -Define_AST_Cast( Typedef ); -Define_AST_Cast( Union ); -Define_AST_Cast( Using ); -Define_AST_Cast( Var ); -#undef Define_AST_Cast - -#define Define_CodeCast( type ) \ -Code::operator Code ## type() const \ -{ \ - return { (AST_ ## type*) ast }; \ -} - -Define_CodeCast( Attributes ); -Define_CodeCast( Comment ); -Define_CodeCast( Constructor ); -Define_CodeCast( Class ); -Define_CodeCast( Define ); -Define_CodeCast( Destructor ); -Define_CodeCast( Exec ); -Define_CodeCast( Enum ); -Define_CodeCast( Extern ); -Define_CodeCast( Include ); -Define_CodeCast( Friend ); -Define_CodeCast( Fn ); -Define_CodeCast( Module ); -Define_CodeCast( NS ); -Define_CodeCast( Operator ); -Define_CodeCast( OpCast ); -Define_CodeCast( Param ); -Define_CodeCast( Pragma ); -Define_CodeCast( PreprocessCond ); -Define_CodeCast( Specifiers ); -Define_CodeCast( Struct ); -Define_CodeCast( Template ); -Define_CodeCast( Type ); -Define_CodeCast( Typedef ); -Define_CodeCast( Union ); -Define_CodeCast( Using ); -Define_CodeCast( Var ); -Define_CodeCast( Body); -#undef Define_CodeCast - -#pragma endregion AST Common - diff --git a/project/components/temp/ecode.hpp b/project/components/temp/ecode.hpp deleted file mode 100644 index fc076fe..0000000 --- a/project/components/temp/ecode.hpp +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -// This is the non-bootstraped version of the ECode. This will be obsolete once bootstrap is stress tested. - -namespace ECode -{ -# define Define_Types \ - Entry( Invalid ) \ - Entry( Untyped ) \ - Entry( NewLine ) \ - Entry( Comment ) \ - Entry( Access_Private ) \ - Entry( Access_Protected ) \ - Entry( Access_Public ) \ - Entry( PlatformAttributes ) \ - Entry( Class ) \ - Entry( Class_Fwd ) \ - Entry( Class_Body ) \ - Entry( Constructor ) \ - Entry( Constructor_Fwd ) \ - Entry( Destructor ) \ - Entry( Destructor_Fwd ) \ - Entry( Enum ) \ - Entry( Enum_Fwd ) \ - Entry( Enum_Body ) \ - Entry( Enum_Class ) \ - Entry( Enum_Class_Fwd ) \ - Entry( Execution ) \ - Entry( Export_Body ) \ - Entry( Extern_Linkage ) \ - Entry( Extern_Linkage_Body ) \ - Entry( Friend ) \ - Entry( Function ) \ - Entry( Function_Fwd ) \ - Entry( Function_Body ) \ - Entry( Global_Body ) \ - Entry( Module ) \ - Entry( Namespace ) \ - Entry( Namespace_Body ) \ - Entry( Operator ) \ - Entry( Operator_Fwd ) \ - Entry( Operator_Member ) \ - Entry( Operator_Member_Fwd ) \ - Entry( Operator_Cast ) \ - Entry( Operator_Cast_Fwd ) \ - Entry( Parameters ) \ - Entry( Preprocess_Define ) \ - Entry( Preprocess_If ) \ - Entry( Preprocess_IfDef ) \ - Entry( Preprocess_IfNotDef ) \ - Entry( Preprocess_ElIf ) \ - Entry( Preprocess_Else ) \ - Entry( Preprocess_EndIf ) \ - Entry( Preprocess_Include ) \ - Entry( Preprocess_Pragma ) \ - Entry( Specifiers ) \ - Entry( Struct ) \ - Entry( Struct_Fwd ) \ - Entry( Struct_Body ) \ - Entry( Template ) \ - Entry( Typedef ) \ - Entry( Typename ) \ - Entry( Union ) \ - Entry( Union_Body) \ - Entry( Using ) \ - Entry( Using_Namespace ) \ - Entry( Variable ) - - enum Type : u32 - { - # define Entry( Type ) Type, - Define_Types - # undef Entry - - Num_Types - }; - - inline - StrC to_str( Type type ) - { - static - StrC lookup[Num_Types] = { - # define Entry( Type ) { sizeof(stringize(Type)), stringize(Type) }, - Define_Types - # undef Entry - }; - - return lookup[ type ]; - } - -# undef Define_Types -} -using CodeT = ECode::Type; -using ECode::to_str; - diff --git a/project/components/temp/eoperator.hpp b/project/components/temp/eoperator.hpp deleted file mode 100644 index eea9de8..0000000 --- a/project/components/temp/eoperator.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -// This is the non-bootstraped version of the EOperator. This will be obsolete once bootstrap is stress tested. - -namespace EOperator -{ -# define Define_Operators \ - Entry( Invalid, INVALID ) \ - Entry( Assign, = ) \ - Entry( Assign_Add, += ) \ - Entry( Assign_Subtract, -= ) \ - Entry( Assign_Multiply, *= ) \ - Entry( Assign_Divide, /= ) \ - Entry( Assign_Modulo, %= ) \ - Entry( Assign_BAnd, &= ) \ - Entry( Assign_BOr, |= ) \ - Entry( Assign_BXOr, ^= ) \ - Entry( Assign_LShift, <<= ) \ - Entry( Assign_RShift, >>= ) \ - Entry( Increment, ++ ) \ - Entry( Decrement, -- ) \ - Entry( Unary_Plus, + ) \ - Entry( Unary_Minus, - ) \ - Entry( UnaryNot, ! ) \ - Entry( Add, + ) \ - Entry( Subtract, - ) \ - Entry( Multiply, * ) \ - Entry( Divide, / ) \ - Entry( Modulo, % ) \ - Entry( BNot, ~ ) \ - Entry( BAnd, & ) \ - Entry( BOr, | ) \ - Entry( BXOr, ^ ) \ - Entry( LShift, << ) \ - Entry( RShift, >> ) \ - Entry( LAnd, && ) \ - Entry( LOr, || ) \ - Entry( LEqual, == ) \ - Entry( LNot, != ) \ - Entry( Lesser, < ) \ - Entry( Greater, > ) \ - Entry( LesserEqual, <= ) \ - Entry( GreaterEqual, >= ) \ - Entry( Subscript, [] ) \ - Entry( Indirection, * ) \ - Entry( AddressOf, & ) \ - Entry( MemberOfPointer, -> ) \ - Entry( PtrToMemOfPtr, ->* ) \ - Entry( FunctionCall, () ) - - enum Type : u32 - { - # define Entry( Type_, Token_ ) Type_, - Define_Operators - # undef Entry - Comma, - - Num_Ops, - }; - - inline - StrC to_str( Type op ) - { - local_persist - StrC lookup[ Num_Ops ] = { - # define Entry( Type_, Token_ ) { sizeof(stringize(Token_)), stringize(Token_) }, - Define_Operators - # undef Entry - txt(",") - }; - - return lookup[ op ]; - } - -# undef Define_Operators -} -using OperatorT = EOperator::Type; -using EOperator::to_str; - diff --git a/project/components/temp/especifier.hpp b/project/components/temp/especifier.hpp deleted file mode 100644 index d246768..0000000 --- a/project/components/temp/especifier.hpp +++ /dev/null @@ -1,114 +0,0 @@ -#pragma once - -// This is the non-bootstraped version of the ESpecifier. This will be obsolete once bootstrap is stress tested. - -namespace ESpecifier -{ -/* - Note: The following are handled separately: - attributes - alignas -*/ - -# define Define_Specifiers \ - Entry( Invalid, INVALID ) \ - Entry( Consteval, consteval ) \ - Entry( Constexpr, constexpr ) \ - Entry( Constinit, constinit ) \ - Entry( Explicit, explicit ) \ - Entry( External_Linkage, extern ) \ - Entry( ForceInline, forceinline ) \ - Entry( Global, global ) \ - Entry( Inline, inline ) \ - Entry( Internal_Linkage, internal ) \ - Entry( Local_Persist, local_persist ) \ - Entry( Mutable, mutable ) \ - Entry( NeverInline, neverinline ) \ - Entry( Ptr, * ) \ - Entry( Ref, & ) \ - Entry( Register, register ) \ - Entry( RValue, && ) \ - Entry( Static, static ) \ - Entry( Thread_Local, thread_local ) \ - Entry( Volatile, volatile ) \ - Entry( Virtual, virtual ) \ - Entry( Const, const ) \ - Entry( Final, final ) \ - Entry( Override, override ) \ - Entry( Pure, = 0 ) - - enum Type : u32 - { - # define Entry( Specifier, Code ) Specifier, - Define_Specifiers - # undef Entry - - NumSpecifiers, - }; - - inline - bool is_trailing( Type specifier ) - { - return specifier > Virtual; - } - - // Specifier to string - inline - StrC to_str( Type specifier ) - { - local_persist - StrC lookup[ NumSpecifiers ] = { - # pragma push_macro( "global" ) - # pragma push_macro( "internal" ) - # pragma push_macro( "local_persist" ) - # pragma push_macro( "neverinline" ) - # undef global - # undef internal - # undef local_persist - # undef neverinline - - # define Entry( Spec_, Code_ ) { sizeof(stringize(Code_)), stringize(Code_) }, - Define_Specifiers - # undef Entry - - # pragma pop_macro( "global" ) - # pragma pop_macro( "internal" ) - # pragma pop_macro( "local_persist" ) - # pragma pop_macro( "neverinline" ) - }; - - return lookup[ specifier ]; - } - - inline - Type to_type( StrC str ) - { - local_persist - u32 keymap[ NumSpecifiers ]; - do_once_start - for ( u32 index = 0; index < NumSpecifiers; index++ ) - { - StrC enum_str = to_str( (Type)index ); - - // We subtract 1 to remove the null terminator - // This is because the tokens lexed are not null terminated. - keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1); - } - do_once_end - - u32 hash = crc32( str.Ptr, str.Len ); - - for ( u32 index = 0; index < NumSpecifiers; index++ ) - { - if ( keymap[index] == hash ) - return (Type)index; - } - - return Invalid; - } - -# undef Define_Specifiers -} -using SpecifierT = ESpecifier::Type; -using ESpecifier::to_str; - diff --git a/project/components/temp/etoktype.cpp b/project/components/temp/etoktype.cpp deleted file mode 100644 index cc888e0..0000000 --- a/project/components/temp/etoktype.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#pragma once - -namespace Parser -{ -/* - This is a simple lexer that focuses on tokenizing only tokens relevant to the library. - It will not be capable of lexing C++ code with unsupported features. - - For the sake of scanning files, it can scan preprocessor directives - - __Attributes_Start is only used to indicate the start of the user_defined attribute list. -*/ - -#ifndef GEN_DEFINE_ATTRIBUTE_TOKENS -# define GEN_DEFINE_ATTRIBUTE_TOKENS \ - Entry( API_Export, "GEN_API_Export_Code" ) \ - Entry( API_Import, "GEN_API_Import_Code" ) -#endif - -# define Define_TokType \ - Entry( Invalid, "INVALID" ) \ - Entry( Access_Private, "private" ) \ - Entry( Access_Protected, "protected" ) \ - Entry( Access_Public, "public" ) \ - Entry( Access_MemberSymbol, "." ) \ - Entry( Access_StaticSymbol, "::") \ - Entry( Ampersand, "&" ) \ - Entry( Ampersand_DBL, "&&" ) \ - Entry( Assign_Classifer, ":" ) \ - Entry( Attribute_Open, "[[" ) \ - Entry( Attribute_Close, "]]" ) \ - Entry( BraceCurly_Open, "{" ) \ - Entry( BraceCurly_Close, "}" ) \ - Entry( BraceSquare_Open, "[" ) \ - Entry( BraceSquare_Close, "]" ) \ - Entry( Capture_Start, "(" ) \ - Entry( Capture_End, ")" ) \ - Entry( Comment, "__comment__" ) \ - Entry( Comment_End, "__comment_end__" ) \ - Entry( Comment_Start, "__comment start__" ) \ - Entry( Char, "__character__" ) \ - Entry( Comma, "," ) \ - Entry( Decl_Class, "class" ) \ - Entry( Decl_GNU_Attribute, "__attribute__" ) \ - Entry( Decl_MSVC_Attribute, "__declspec" ) \ - Entry( Decl_Enum, "enum" ) \ - Entry( Decl_Extern_Linkage, "extern" ) \ - Entry( Decl_Friend, "friend" ) \ - Entry( Decl_Module, "module" ) \ - Entry( Decl_Namespace, "namespace" ) \ - Entry( Decl_Operator, "operator" ) \ - Entry( Decl_Struct, "struct" ) \ - Entry( Decl_Template, "template" ) \ - Entry( Decl_Typedef, "typedef" ) \ - Entry( Decl_Using, "using" ) \ - Entry( Decl_Union, "union" ) \ - Entry( Identifier, "__identifier__" ) \ - Entry( Module_Import, "import" ) \ - Entry( Module_Export, "export" ) \ - Entry( NewLine, "__NewLine__" ) \ - Entry( Number, "__number__" ) \ - Entry( Operator, "__operator__" ) \ - Entry( Preprocess_Hash, "#" ) \ - Entry( Preprocess_Define, "define") \ - Entry( Preprocess_If, "if") \ - Entry( Preprocess_IfDef, "ifdef") \ - Entry( Preprocess_IfNotDef, "ifndef") \ - Entry( Preprocess_ElIf, "elif") \ - Entry( Preprocess_Else, "else") \ - Entry( Preprocess_EndIf, "endif") \ - Entry( Preprocess_Include, "include" ) \ - Entry( Preprocess_Pragma, "pragma") \ - Entry( Preprocess_Content, "__macro_content__") \ - Entry( Preprocess_Macro, "__macro__") \ - Entry( Preprocess_Unsupported, "__unsupported__" ) \ - Entry( Spec_Alignas, "alignas" ) \ - Entry( Spec_Const, "const" ) \ - Entry( Spec_Consteval, "consteval" ) \ - Entry( Spec_Constexpr, "constexpr" ) \ - Entry( Spec_Constinit, "constinit" ) \ - Entry( Spec_Explicit, "explicit" ) \ - Entry( Spec_Extern, "extern" ) \ - Entry( Spec_ForceInline, "forceinline" ) \ - Entry( Spec_Final, "final" ) \ - Entry( Spec_Global, "global" ) \ - Entry( Spec_Inline, "inline" ) \ - Entry( Spec_Internal_Linkage, "internal" ) \ - Entry( Spec_LocalPersist, "local_persist" ) \ - Entry( Spec_Mutable, "mutable" ) \ - Entry( Spec_NeverInline, "neverinline" ) \ - Entry( Spec_Override, "override" ) \ - Entry( Spec_Static, "static" ) \ - Entry( Spec_ThreadLocal, "thread_local" ) \ - Entry( Spec_Virtual, "virtual" ) \ - Entry( Spec_Volatile, "volatile") \ - Entry( Star, "*" ) \ - Entry( Statement_End, ";" ) \ - Entry( StaticAssert, "static_assert" ) \ - Entry( String, "__string__" ) \ - Entry( Type_Unsigned, "unsigned" ) \ - Entry( Type_Signed, "signed" ) \ - Entry( Type_Short, "short" ) \ - Entry( Type_Long, "long" ) \ - Entry( Type_char, "char" ) \ - Entry( Type_int, "int" ) \ - Entry( Type_double, "double" ) \ - Entry( Type_MS_int8, "__int8" ) \ - Entry( Type_MS_int16, "__int16" ) \ - Entry( Type_MS_int32, "__int32" ) \ - Entry( Type_MS_int64, "__int64" ) \ - Entry( Type_MS_W64, "_W64" ) \ - Entry( Varadic_Argument, "..." ) \ - Entry( __Attributes_Start, "__attrib_start__" ) - - namespace ETokType - { - enum Type : u32 - { - # define Entry( Name_, Str_ ) Name_, - Define_TokType - GEN_DEFINE_ATTRIBUTE_TOKENS - # undef Entry - NumTokens, - }; - - internal inline - Type to_type( StrC str_tok ) - { - local_persist - StrC lookup[(u32)NumTokens] = - { - # define Entry( Name_, Str_ ) { sizeof(Str_), Str_ }, - Define_TokType - GEN_DEFINE_ATTRIBUTE_TOKENS - # undef Entry - }; - - for ( u32 index = 0; index < (u32)NumTokens; index++ ) - { - s32 lookup_len = lookup[index].Len - 1; - char const* lookup_str = lookup[index].Ptr; - - if ( lookup_len != str_tok.Len ) - continue; - - if ( str_compare( str_tok.Ptr, lookup_str, lookup_len ) == 0 ) - return scast(Type, index); - } - - return Invalid; - } - - internal inline - StrC to_str( Type type ) - { - local_persist - StrC lookup[(u32)NumTokens] = - { - # define Entry( Name_, Str_ ) { sizeof(Str_), Str_ }, - Define_TokType - GEN_DEFINE_ATTRIBUTE_TOKENS - # undef Entry - }; - - return lookup[(u32)type]; - } - # undef Define_TokType - }; - - using TokType = ETokType::Type; - using ETokType::to_str; - -} // Parser - diff --git a/project/gen.cpp b/project/gen.cpp index 693acc6..8a494aa 100644 --- a/project/gen.cpp +++ b/project/gen.cpp @@ -23,7 +23,7 @@ GEN_NS_BEGIN #include "components/interface.cpp" #include "components/interface.upfront.cpp" -#include "components/temp/etoktype.cpp" +#include "components/gen/etoktype.cpp" #include "components/interface.parsing.cpp" #include "components/interface.untyped.cpp" diff --git a/project/gen.hpp b/project/gen.hpp index b7158f3..d0499d5 100644 --- a/project/gen.hpp +++ b/project/gen.hpp @@ -14,9 +14,9 @@ GEN_NS_BEGIN #include "components/types.hpp" -#include "components/temp/ecode.hpp" -#include "components/temp/eoperator.hpp" -#include "components/temp/especifier.hpp" +#include "components/gen/ecode.hpp" +#include "components/gen/eoperator.hpp" +#include "components/gen/especifier.hpp" #include "components/ast.hpp" #include "components/ast_types.hpp" @@ -24,7 +24,7 @@ GEN_NS_BEGIN #include "components/interface.hpp" #include "components/inlines.hpp" -#include "components/temp/ast_inlines.hpp" +#include "components/gen/ast_inlines.hpp" #include "components/header_end.hpp" GEN_NS_END diff --git a/scripts/build.ci.ps1 b/scripts/build.ci.ps1 index e8cb735..6cedf58 100644 --- a/scripts/build.ci.ps1 +++ b/scripts/build.ci.ps1 @@ -307,8 +307,9 @@ $path_test = Join-Path $path_root test if ( $bootstrap ) { - $path_build = join-path $path_project build - $path_gen = join-path $path_project gen + $path_build = join-path $path_project build + $path_gen = join-path $path_project gen + $path_comp_gen = join-path $path_project components/gen if ( -not(Test-Path($path_build) )) { New-Item -ItemType Directory -Path $path_build @@ -316,6 +317,9 @@ if ( $bootstrap ) if ( -not(Test-Path($path_gen) )) { New-Item -ItemType Directory -Path $path_gen } + if ( -not(Test-Path($path_comp_gen) )) { + New-Item -ItemType Directory -Path $path_comp_gen + } $includes = @( $path_project) $unit = join-path $path_project "bootstrap.cpp" @@ -431,7 +435,8 @@ function format-cpp if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) ) { - $path_gen = join-path $path_project gen + $path_gen = join-path $path_project gen + $path_comp_gen = join-path $path_project components/gen $include = @( 'gen.hpp', 'gen.cpp', 'gen.dep.hpp', 'gen.dep.cpp', @@ -440,6 +445,7 @@ if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) ) ) $exclude = $null format-cpp $path_gen $include $exclude + format-cpp $path_comp_gen @( 'ast_inlines.hpp', 'ecode.hpp', 'especifier.hpp', 'eoperator.hpp', 'etoktype.cpp' ) $null } if ( $singleheader -and (Test-Path (Join-Path $path_singleheader "gen/gen.hpp")) ) diff --git a/singleheader/singleheader.cpp b/singleheader/singleheader.cpp index e62fd7b..9b637a3 100644 --- a/singleheader/singleheader.cpp +++ b/singleheader/singleheader.cpp @@ -150,14 +150,14 @@ int gen_main() if ( generate_builder ) { header.print_fmt( "#pragma region Builder\n\n" ); - header.print( scan_file( project_dir "auxillary/builder.hpp",DontSkipInitialDirectives ) ); + header.print( scan_file( project_dir "auxillary/builder.hpp" ) ); header.print_fmt( "#pragma endregion Builder\n\n" ); } if ( generate_scanner ) { header.print_fmt( "#pragma region Scanner\n\n" ); - header.print( scan_file( project_dir "auxillary/scanner.hpp", DontSkipInitialDirectives ) ); + header.print( scan_file( project_dir "auxillary/scanner.hpp" ) ); header.print_fmt( "#pragma endregion Scanner\n\n" ); } @@ -236,7 +236,7 @@ int gen_main() if ( generate_builder ) { header.print_fmt( "#pragma region Builder\n\n" ); - header.print( scan_file( project_dir "auxillary/builder.cpp", DontSkipInitialDirectives ) ); + header.print( scan_file( project_dir "auxillary/builder.cpp" ) ); header.print_fmt( "#pragma endregion Builder\n\n" ); } @@ -244,7 +244,7 @@ int gen_main() if ( generate_scanner ) { header.print_fmt( "#pragma region Scanner\n\n" ); - header.print( scan_file( project_dir "auxillary/scanner.cpp", DontSkipInitialDirectives ) ); + header.print( scan_file( project_dir "auxillary/scanner.cpp" ) ); header.print_fmt( "#pragma endregion Scanner\n\n" ); } #endif