mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-30 22:40:54 -07:00 
			
		
		
		
	WIP: Restructuring project
This commit is contained in:
		
							
								
								
									
										965
									
								
								base/components/gen/ast_inlines.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										965
									
								
								base/components/gen/ast_inlines.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,965 @@ | ||||
| #ifdef GEN_INTELLISENSE_DIRECTIVES | ||||
| #pragma once | ||||
| #include "components/types.hpp" | ||||
| #endif | ||||
|  | ||||
| // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) | ||||
|  | ||||
| #pragma region generated code inline implementation | ||||
|  | ||||
| inline Code& Code::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline Code::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeBody& CodeBody::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeBody::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeAttributes& CodeAttributes::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeAttributes::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeAttributes::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Attributes* CodeAttributes::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeComment& CodeComment::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeComment::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeComment::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Comment* CodeComment::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeConstructor& CodeConstructor::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeConstructor::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeConstructor::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Constructor* CodeConstructor::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeClass& CodeClass::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeClass::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeDefine& CodeDefine::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeDefine::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeDefine::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Define* CodeDefine::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeDestructor& CodeDestructor::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeDestructor::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeDestructor::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Destructor* CodeDestructor::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeEnum& CodeEnum::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeEnum::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeEnum::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Enum* CodeEnum::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeExec& CodeExec::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeExec::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeExec::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Exec* CodeExec::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeExtern& CodeExtern::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeExtern::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeExtern::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Extern* CodeExtern::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeFriend& CodeFriend::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeFriend::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeFriend::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Friend* CodeFriend::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeFn& CodeFn::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeFn::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeFn::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Fn* CodeFn::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeInclude& CodeInclude::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeInclude::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeInclude::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Include* CodeInclude::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeModule& CodeModule::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeModule::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeModule::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Module* CodeModule::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeNS& CodeNS::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeNS::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeNS::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_NS* CodeNS::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeOperator& CodeOperator::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeOperator::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeOperator::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Operator* CodeOperator::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeOpCast& CodeOpCast::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeOpCast::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeOpCast::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_OpCast* CodeOpCast::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeParam& CodeParam::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeParam::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodePragma& CodePragma::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodePragma::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodePragma::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Pragma* CodePragma::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodePreprocessCond& CodePreprocessCond::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodePreprocessCond::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodePreprocessCond::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_PreprocessCond* CodePreprocessCond::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeSpecifiers& CodeSpecifiers::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeSpecifiers::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeStruct& CodeStruct::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeStruct::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeTemplate& CodeTemplate::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeTemplate::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeTemplate::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Template* CodeTemplate::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeTypename& CodeTypename::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeTypename::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeTypename::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Typename* CodeTypename::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeTypedef& CodeTypedef::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeTypedef::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeTypedef::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Typedef* CodeTypedef::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeUnion& CodeUnion::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeUnion::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeUnion::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Union* CodeUnion::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeUsing& CodeUsing::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeUsing::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeUsing::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Using* CodeUsing::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| } | ||||
|  | ||||
| inline CodeVar& CodeVar::operator=( Code other ) | ||||
| { | ||||
| 	if ( other.ast != nullptr && other->Parent != nullptr ) | ||||
| 	{ | ||||
| 		ast         = rcast( decltype( ast ), code_duplicate( other ).ast ); | ||||
| 		ast->Parent = { nullptr }; | ||||
| 	} | ||||
| 	ast = rcast( decltype( ast ), other.ast ); | ||||
| 	return *this; | ||||
| } | ||||
|  | ||||
| inline CodeVar::operator bool() | ||||
| { | ||||
| 	return ast != nullptr; | ||||
| } | ||||
|  | ||||
| inline CodeVar::operator Code() | ||||
| { | ||||
| 	return *rcast( Code*, this ); | ||||
| } | ||||
|  | ||||
| inline AST_Var* CodeVar::operator->() | ||||
| { | ||||
| 	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 | ||||
| GEN_OPTIMIZE_MAPPINGS_BEGIN | ||||
|  | ||||
| forceinline Code::operator CodeBody() const | ||||
| { | ||||
| 	return { (AST_Body*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeAttributes() const | ||||
| { | ||||
| 	return { (AST_Attributes*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeComment() const | ||||
| { | ||||
| 	return { (AST_Comment*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeConstructor() const | ||||
| { | ||||
| 	return { (AST_Constructor*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeClass() const | ||||
| { | ||||
| 	return { (AST_Class*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeDefine() const | ||||
| { | ||||
| 	return { (AST_Define*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeDestructor() const | ||||
| { | ||||
| 	return { (AST_Destructor*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeEnum() const | ||||
| { | ||||
| 	return { (AST_Enum*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeExec() const | ||||
| { | ||||
| 	return { (AST_Exec*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeExtern() const | ||||
| { | ||||
| 	return { (AST_Extern*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeFriend() const | ||||
| { | ||||
| 	return { (AST_Friend*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeFn() const | ||||
| { | ||||
| 	return { (AST_Fn*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeInclude() const | ||||
| { | ||||
| 	return { (AST_Include*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeModule() const | ||||
| { | ||||
| 	return { (AST_Module*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeNS() const | ||||
| { | ||||
| 	return { (AST_NS*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeOperator() const | ||||
| { | ||||
| 	return { (AST_Operator*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeOpCast() const | ||||
| { | ||||
| 	return { (AST_OpCast*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeParam() const | ||||
| { | ||||
| 	return { (AST_Param*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodePragma() const | ||||
| { | ||||
| 	return { (AST_Pragma*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodePreprocessCond() const | ||||
| { | ||||
| 	return { (AST_PreprocessCond*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeSpecifiers() const | ||||
| { | ||||
| 	return { (AST_Specifiers*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeStruct() const | ||||
| { | ||||
| 	return { (AST_Struct*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeTemplate() const | ||||
| { | ||||
| 	return { (AST_Template*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeTypename() const | ||||
| { | ||||
| 	return { (AST_Typename*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeTypedef() const | ||||
| { | ||||
| 	return { (AST_Typedef*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeUnion() const | ||||
| { | ||||
| 	return { (AST_Union*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeUsing() const | ||||
| { | ||||
| 	return { (AST_Using*)ast }; | ||||
| } | ||||
|  | ||||
| forceinline Code::operator CodeVar() const | ||||
| { | ||||
| 	return { (AST_Var*)ast }; | ||||
| } | ||||
|  | ||||
| GEN_OPITMIZE_MAPPINGS_END | ||||
| #pragma endregion generated AST / Code cast implementation | ||||
							
								
								
									
										219
									
								
								base/components/gen/ecode.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										219
									
								
								base/components/gen/ecode.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,219 @@ | ||||
| #ifdef GEN_INTELLISENSE_DIRECTIVES | ||||
| #pragma once | ||||
| #include "components/types.hpp" | ||||
| #endif | ||||
|  | ||||
| // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) | ||||
|  | ||||
| enum CodeType : u32 | ||||
| { | ||||
| 	CT_Invalid, | ||||
| 	CT_Untyped, | ||||
| 	CT_NewLine, | ||||
| 	CT_Comment, | ||||
| 	CT_Access_Private, | ||||
| 	CT_Access_Protected, | ||||
| 	CT_Access_Public, | ||||
| 	CT_PlatformAttributes, | ||||
| 	CT_Class, | ||||
| 	CT_Class_Fwd, | ||||
| 	CT_Class_Body, | ||||
| 	CT_Constructor, | ||||
| 	CT_Constructor_Fwd, | ||||
| 	CT_Destructor, | ||||
| 	CT_Destructor_Fwd, | ||||
| 	CT_Enum, | ||||
| 	CT_Enum_Fwd, | ||||
| 	CT_Enum_Body, | ||||
| 	CT_Enum_Class, | ||||
| 	CT_Enum_Class_Fwd, | ||||
| 	CT_Execution, | ||||
| 	CT_Export_Body, | ||||
| 	CT_Extern_Linkage, | ||||
| 	CT_Extern_Linkage_Body, | ||||
| 	CT_Friend, | ||||
| 	CT_Function, | ||||
| 	CT_Function_Fwd, | ||||
| 	CT_Function_Body, | ||||
| 	CT_Global_Body, | ||||
| 	CT_Module, | ||||
| 	CT_Namespace, | ||||
| 	CT_Namespace_Body, | ||||
| 	CT_Operator, | ||||
| 	CT_Operator_Fwd, | ||||
| 	CT_Operator_Member, | ||||
| 	CT_Operator_Member_Fwd, | ||||
| 	CT_Operator_Cast, | ||||
| 	CT_Operator_Cast_Fwd, | ||||
| 	CT_Parameters, | ||||
| 	CT_Preprocess_Define, | ||||
| 	CT_Preprocess_Include, | ||||
| 	CT_Preprocess_If, | ||||
| 	CT_Preprocess_IfDef, | ||||
| 	CT_Preprocess_IfNotDef, | ||||
| 	CT_Preprocess_ElIf, | ||||
| 	CT_Preprocess_Else, | ||||
| 	CT_Preprocess_EndIf, | ||||
| 	CT_Preprocess_Pragma, | ||||
| 	CT_Specifiers, | ||||
| 	CT_Struct, | ||||
| 	CT_Struct_Fwd, | ||||
| 	CT_Struct_Body, | ||||
| 	CT_Template, | ||||
| 	CT_Typedef, | ||||
| 	CT_Typename, | ||||
| 	CT_Union, | ||||
| 	CT_Union_Fwd, | ||||
| 	CT_Union_Body, | ||||
| 	CT_Using, | ||||
| 	CT_Using_Namespace, | ||||
| 	CT_Variable, | ||||
| 	CT_NumTypes, | ||||
| 	CT_UnderlyingType = GEN_U32_MAX | ||||
| }; | ||||
|  | ||||
| inline StrC codetype_to_str( CodeType type ) | ||||
| { | ||||
| 	local_persist StrC lookup[61] = { | ||||
| 		{ 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_Fwd" ),           "Union_Fwd"           }, | ||||
| 		{ sizeof( "Union_Body" ),          "Union_Body"          }, | ||||
| 		{ sizeof( "Using" ),               "Using"               }, | ||||
| 		{ sizeof( "Using_Namespace" ),     "Using_Namespace"     }, | ||||
| 		{ sizeof( "Variable" ),            "Variable"            }, | ||||
| 	}; | ||||
| 	return lookup[type]; | ||||
| } | ||||
|  | ||||
| inline StrC codetype_to_keyword_str( CodeType type ) | ||||
| { | ||||
| 	local_persist StrC lookup[61] = { | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "//" ) - 1,              "//"              }, | ||||
| 		{ sizeof( "private" ) - 1,         "private"         }, | ||||
| 		{ sizeof( "protected" ) - 1,       "protected"       }, | ||||
| 		{ sizeof( "public" ) - 1,          "public"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "class" ) - 1,           "class"           }, | ||||
| 		{ sizeof( "clsss" ) - 1,           "clsss"           }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "enum" ) - 1,            "enum"            }, | ||||
| 		{ sizeof( "enum" ) - 1,            "enum"            }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "enum class" ) - 1,      "enum class"      }, | ||||
| 		{ sizeof( "enum class" ) - 1,      "enum class"      }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "extern" ) - 1,          "extern"          }, | ||||
| 		{ sizeof( "extern" ) - 1,          "extern"          }, | ||||
| 		{ sizeof( "friend" ) - 1,          "friend"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "module" ) - 1,          "module"          }, | ||||
| 		{ sizeof( "namespace" ) - 1,       "namespace"       }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | ||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | ||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | ||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | ||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | ||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "define" ) - 1,          "define"          }, | ||||
| 		{ sizeof( "include" ) - 1,         "include"         }, | ||||
| 		{ sizeof( "if" ) - 1,              "if"              }, | ||||
| 		{ sizeof( "ifdef" ) - 1,           "ifdef"           }, | ||||
| 		{ sizeof( "ifndef" ) - 1,          "ifndef"          }, | ||||
| 		{ sizeof( "elif" ) - 1,            "elif"            }, | ||||
| 		{ sizeof( "else" ) - 1,            "else"            }, | ||||
| 		{ sizeof( "endif" ) - 1,           "endif"           }, | ||||
| 		{ sizeof( "pragma" ) - 1,          "pragma"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "struct" ) - 1,          "struct"          }, | ||||
| 		{ sizeof( "struct" ) - 1,          "struct"          }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "template" ) - 1,        "template"        }, | ||||
| 		{ sizeof( "typedef" ) - 1,         "typedef"         }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "union" ) - 1,           "union"           }, | ||||
| 		{ sizeof( "union" ) - 1,           "union"           }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 		{ sizeof( "using" ) - 1,           "using"           }, | ||||
| 		{ sizeof( "using namespace" ) - 1, "using namespace" }, | ||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | ||||
| 	}; | ||||
| 	return lookup[type]; | ||||
| } | ||||
|  | ||||
| forceinline StrC to_str( CodeType type ) | ||||
| { | ||||
| 	return codetype_to_str( type ); | ||||
| } | ||||
|  | ||||
| forceinline StrC to_keyword_str( CodeType type ) | ||||
| { | ||||
| 	return codetype_to_keyword_str( type ); | ||||
| } | ||||
							
								
								
									
										118
									
								
								base/components/gen/eoperator.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								base/components/gen/eoperator.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,118 @@ | ||||
| #ifdef GEN_INTELLISENSE_DIRECTIVES | ||||
| #pragma once | ||||
| #include "components/types.hpp" | ||||
| #endif | ||||
|  | ||||
| // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) | ||||
|  | ||||
| enum Operator : u32 | ||||
| { | ||||
| 	Op_Invalid, | ||||
| 	Op_Assign, | ||||
| 	Op_Assign_Add, | ||||
| 	Op_Assign_Subtract, | ||||
| 	Op_Assign_Multiply, | ||||
| 	Op_Assign_Divide, | ||||
| 	Op_Assign_Modulo, | ||||
| 	Op_Assign_BAnd, | ||||
| 	Op_Assign_BOr, | ||||
| 	Op_Assign_BXOr, | ||||
| 	Op_Assign_LShift, | ||||
| 	Op_Assign_RShift, | ||||
| 	Op_Increment, | ||||
| 	Op_Decrement, | ||||
| 	Op_Unary_Plus, | ||||
| 	Op_Unary_Minus, | ||||
| 	Op_UnaryNot, | ||||
| 	Op_Add, | ||||
| 	Op_Subtract, | ||||
| 	Op_Multiply, | ||||
| 	Op_Divide, | ||||
| 	Op_Modulo, | ||||
| 	Op_BNot, | ||||
| 	Op_BAnd, | ||||
| 	Op_BOr, | ||||
| 	Op_BXOr, | ||||
| 	Op_LShift, | ||||
| 	Op_RShift, | ||||
| 	Op_LAnd, | ||||
| 	Op_LOr, | ||||
| 	Op_LEqual, | ||||
| 	Op_LNot, | ||||
| 	Op_Lesser, | ||||
| 	Op_Greater, | ||||
| 	Op_LesserEqual, | ||||
| 	Op_GreaterEqual, | ||||
| 	Op_Subscript, | ||||
| 	Op_Indirection, | ||||
| 	Op_AddressOf, | ||||
| 	Op_MemberOfPointer, | ||||
| 	Op_PtrToMemOfPtr, | ||||
| 	Op_FunctionCall, | ||||
| 	Op_Comma, | ||||
| 	Op_New, | ||||
| 	Op_NewArray, | ||||
| 	Op_Delete, | ||||
| 	Op_DeleteArray, | ||||
| 	Op_NumOps, | ||||
| 	Op_UnderlyingType = 0xffffffffu | ||||
| }; | ||||
|  | ||||
| inline StrC operator_to_str( Operator op ) | ||||
| { | ||||
| 	local_persist StrC lookup[47] = { | ||||
| 		{ 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( "," ),        ","        }, | ||||
| 		{ sizeof( "new" ),      "new"      }, | ||||
| 		{ sizeof( "new[]" ),    "new[]"    }, | ||||
| 		{ sizeof( "delete" ),   "delete"   }, | ||||
| 		{ sizeof( "delete[]" ), "delete[]" }, | ||||
| 	}; | ||||
| 	return lookup[op]; | ||||
| } | ||||
|  | ||||
| forceinline StrC to_str( Operator op ) | ||||
| { | ||||
| 	return operator_to_str( op ); | ||||
| } | ||||
							
								
								
									
										108
									
								
								base/components/gen/especifier.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								base/components/gen/especifier.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,108 @@ | ||||
| #ifdef GEN_INTELLISENSE_DIRECTIVES | ||||
| #pragma once | ||||
| #include "components/types.hpp" | ||||
| #endif | ||||
|  | ||||
| // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) | ||||
|  | ||||
| enum Specifier : u32 | ||||
| { | ||||
| 	Spec_Invalid, | ||||
| 	Spec_Consteval, | ||||
| 	Spec_Constexpr, | ||||
| 	Spec_Constinit, | ||||
| 	Spec_Explicit, | ||||
| 	Spec_External_Linkage, | ||||
| 	Spec_ForceInline, | ||||
| 	Spec_Global, | ||||
| 	Spec_Inline, | ||||
| 	Spec_Internal_Linkage, | ||||
| 	Spec_Local_Persist, | ||||
| 	Spec_Mutable, | ||||
| 	Spec_NeverInline, | ||||
| 	Spec_Ptr, | ||||
| 	Spec_Ref, | ||||
| 	Spec_Register, | ||||
| 	Spec_RValue, | ||||
| 	Spec_Static, | ||||
| 	Spec_Thread_Local, | ||||
| 	Spec_Virtual, | ||||
| 	Spec_Const, | ||||
| 	Spec_Final, | ||||
| 	Spec_NoExceptions, | ||||
| 	Spec_Override, | ||||
| 	Spec_Pure, | ||||
| 	Spec_Volatile, | ||||
| 	Spec_NumSpecifiers, | ||||
| 	Spec_UnderlyingType = 0xffffffffu | ||||
| }; | ||||
|  | ||||
| inline StrC spec_to_str( Specifier type ) | ||||
| { | ||||
| 	local_persist StrC lookup[26] = { | ||||
| 		{ 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( "virtual" ),       "virtual"       }, | ||||
| 		{ sizeof( "const" ),         "const"         }, | ||||
| 		{ sizeof( "final" ),         "final"         }, | ||||
| 		{ sizeof( "noexcept" ),      "noexcept"      }, | ||||
| 		{ sizeof( "override" ),      "override"      }, | ||||
| 		{ sizeof( "= 0" ),           "= 0"           }, | ||||
| 		{ sizeof( "volatile" ),      "volatile"      }, | ||||
| 	}; | ||||
| 	return lookup[type]; | ||||
| } | ||||
|  | ||||
| inline bool spec_is_trailing( Specifier specifier ) | ||||
| { | ||||
| 	return specifier > Spec_Virtual; | ||||
| } | ||||
|  | ||||
| inline Specifier strc_to_specifier( StrC str ) | ||||
| { | ||||
| 	local_persist u32 keymap[Spec_NumSpecifiers]; | ||||
| 	do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ ) | ||||
| 	{ | ||||
| 		StrC enum_str = spec_to_str( (Specifier)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 < Spec_NumSpecifiers; index++ ) | ||||
| 	{ | ||||
| 		if ( keymap[index] == hash ) | ||||
| 			return (Specifier)index; | ||||
| 	} | ||||
| 	return Spec_Invalid; | ||||
| } | ||||
|  | ||||
| forceinline StrC to_str( Specifier spec ) | ||||
| { | ||||
| 	return spec_to_str( spec ); | ||||
| } | ||||
|  | ||||
| forceinline Specifier to_type( StrC str ) | ||||
| { | ||||
| 	return strc_to_specifier( str ); | ||||
| } | ||||
|  | ||||
| forceinline bool is_trailing( Specifier specifier ) | ||||
| { | ||||
| 	return spec_is_trailing( specifier ); | ||||
| } | ||||
							
								
								
									
										235
									
								
								base/components/gen/etoktype.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										235
									
								
								base/components/gen/etoktype.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,235 @@ | ||||
| #ifdef GEN_INTELLISENSE_DIRECTIVES | ||||
| #pragma once | ||||
| #include "components/types.hpp" | ||||
| #endif | ||||
|  | ||||
| // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) | ||||
|  | ||||
| GEN_NS_PARSER_BEGIN | ||||
|  | ||||
| #define GEN_DEFINE_ATTRIBUTE_TOKENS Entry( Tok_Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Tok_Attribute_API_Import, "GEN_API_Import_Code" ) | ||||
|  | ||||
| enum TokType : u32 | ||||
| { | ||||
| 	Tok_Invalid, | ||||
| 	Tok_Access_Private, | ||||
| 	Tok_Access_Protected, | ||||
| 	Tok_Access_Public, | ||||
| 	Tok_Access_MemberSymbol, | ||||
| 	Tok_Access_StaticSymbol, | ||||
| 	Tok_Ampersand, | ||||
| 	Tok_Ampersand_DBL, | ||||
| 	Tok_Assign_Classifer, | ||||
| 	Tok_Attribute_Open, | ||||
| 	Tok_Attribute_Close, | ||||
| 	Tok_BraceCurly_Open, | ||||
| 	Tok_BraceCurly_Close, | ||||
| 	Tok_BraceSquare_Open, | ||||
| 	Tok_BraceSquare_Close, | ||||
| 	Tok_Capture_Start, | ||||
| 	Tok_Capture_End, | ||||
| 	Tok_Comment, | ||||
| 	Tok_Comment_End, | ||||
| 	Tok_Comment_Start, | ||||
| 	Tok_Char, | ||||
| 	Tok_Comma, | ||||
| 	Tok_Decl_Class, | ||||
| 	Tok_Decl_GNU_Attribute, | ||||
| 	Tok_Decl_MSVC_Attribute, | ||||
| 	Tok_Decl_Enum, | ||||
| 	Tok_Decl_Extern_Linkage, | ||||
| 	Tok_Decl_Friend, | ||||
| 	Tok_Decl_Module, | ||||
| 	Tok_Decl_Namespace, | ||||
| 	Tok_Decl_Operator, | ||||
| 	Tok_Decl_Struct, | ||||
| 	Tok_Decl_Template, | ||||
| 	Tok_Decl_Typedef, | ||||
| 	Tok_Decl_Using, | ||||
| 	Tok_Decl_Union, | ||||
| 	Tok_Identifier, | ||||
| 	Tok_Module_Import, | ||||
| 	Tok_Module_Export, | ||||
| 	Tok_NewLine, | ||||
| 	Tok_Number, | ||||
| 	Tok_Operator, | ||||
| 	Tok_Preprocess_Hash, | ||||
| 	Tok_Preprocess_Define, | ||||
| 	Tok_Preprocess_If, | ||||
| 	Tok_Preprocess_IfDef, | ||||
| 	Tok_Preprocess_IfNotDef, | ||||
| 	Tok_Preprocess_ElIf, | ||||
| 	Tok_Preprocess_Else, | ||||
| 	Tok_Preprocess_EndIf, | ||||
| 	Tok_Preprocess_Include, | ||||
| 	Tok_Preprocess_Pragma, | ||||
| 	Tok_Preprocess_Content, | ||||
| 	Tok_Preprocess_Macro, | ||||
| 	Tok_Preprocess_Unsupported, | ||||
| 	Tok_Spec_Alignas, | ||||
| 	Tok_Spec_Const, | ||||
| 	Tok_Spec_Consteval, | ||||
| 	Tok_Spec_Constexpr, | ||||
| 	Tok_Spec_Constinit, | ||||
| 	Tok_Spec_Explicit, | ||||
| 	Tok_Spec_Extern, | ||||
| 	Tok_Spec_Final, | ||||
| 	Tok_Spec_ForceInline, | ||||
| 	Tok_Spec_Global, | ||||
| 	Tok_Spec_Inline, | ||||
| 	Tok_Spec_Internal_Linkage, | ||||
| 	Tok_Spec_LocalPersist, | ||||
| 	Tok_Spec_Mutable, | ||||
| 	Tok_Spec_NeverInline, | ||||
| 	Tok_Spec_Override, | ||||
| 	Tok_Spec_Static, | ||||
| 	Tok_Spec_ThreadLocal, | ||||
| 	Tok_Spec_Volatile, | ||||
| 	Tok_Spec_Virtual, | ||||
| 	Tok_Star, | ||||
| 	Tok_Statement_End, | ||||
| 	Tok_StaticAssert, | ||||
| 	Tok_String, | ||||
| 	Tok_Type_Typename, | ||||
| 	Tok_Type_Unsigned, | ||||
| 	Tok_Type_Signed, | ||||
| 	Tok_Type_Short, | ||||
| 	Tok_Type_Long, | ||||
| 	Tok_Type_bool, | ||||
| 	Tok_Type_char, | ||||
| 	Tok_Type_int, | ||||
| 	Tok_Type_double, | ||||
| 	Tok_Type_MS_int8, | ||||
| 	Tok_Type_MS_int16, | ||||
| 	Tok_Type_MS_int32, | ||||
| 	Tok_Type_MS_int64, | ||||
| 	Tok_Type_MS_W64, | ||||
| 	Tok_Varadic_Argument, | ||||
| 	Tok___Attributes_Start, | ||||
| 	Tok_Attribute_API_Export, | ||||
| 	Tok_Attribute_API_Import, | ||||
| 	Tok_NumTokens | ||||
| }; | ||||
|  | ||||
| inline StrC toktype_to_str( TokType 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( "__comment__" ),         "__comment__"         }, | ||||
| 		{ 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( "typename" ),            "typename"            }, | ||||
| 		{ sizeof( "unsigned" ),            "unsigned"            }, | ||||
| 		{ sizeof( "signed" ),              "signed"              }, | ||||
| 		{ sizeof( "short" ),               "short"               }, | ||||
| 		{ sizeof( "long" ),                "long"                }, | ||||
| 		{ sizeof( "bool" ),                "bool"                }, | ||||
| 		{ 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]; | ||||
| } | ||||
|  | ||||
| inline TokType strc_to_toktype( StrC str ) | ||||
| { | ||||
| 	local_persist u32 keymap[Tok_NumTokens]; | ||||
| 	do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ ) | ||||
| 	{ | ||||
| 		StrC enum_str = toktype_to_str( (TokType)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 < Tok_NumTokens; index++ ) | ||||
| 	{ | ||||
| 		if ( keymap[index] == hash ) | ||||
| 			return (TokType)index; | ||||
| 	} | ||||
| 	return Tok_Invalid; | ||||
| } | ||||
|  | ||||
| GEN_NS_PARSER_END | ||||
		Reference in New Issue
	
	Block a user