mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-30 14:30:53 -07:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
			e3172057d3
			...
			v0.21-Alph
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| aa2170ba80 | |||
| 5705196710 | |||
| cf0d787196 | |||
| 8d436fe546 | |||
| e15ac22132 | |||
| bac57a5872 | |||
| 012fcb6bd5 | |||
| 6ffdca8595 | 
| @@ -148,7 +148,7 @@ The convention you'll see used throughout the upfront interface of the library i | |||||||
| 1. Check name or parameters to make sure they are valid for the construction requested | 1. Check name or parameters to make sure they are valid for the construction requested | ||||||
| 2. Create a code object using `make_code`. | 2. Create a code object using `make_code`. | ||||||
| 3. Populate immediate fields (Name, Type, ModuleFlags, etc) | 3. Populate immediate fields (Name, Type, ModuleFlags, etc) | ||||||
| 4. Populate sub-entires using `add_entry`. If using the default serialization function `to_string`, follow the order at which entires are expected to appear (there is a strong ordering expected). | 4. Populate sub-entires using `add_entry`. If using the default serialization function `to_strbuilder`, follow the order at which entires are expected to appear (there is a strong ordering expected). | ||||||
|  |  | ||||||
| Names or Content fields are interned strings and thus showed be cached using `get_cached_string` if its desired to preserve that behavior. | Names or Content fields are interned strings and thus showed be cached using `get_cached_string` if its desired to preserve that behavior. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ void builder_pad_lines( Builder* builder, s32 num ) | |||||||
|  |  | ||||||
| void builder_print( Builder* builder, Code code ) | void builder_print( Builder* builder, Code code ) | ||||||
| { | { | ||||||
| 	StrBuilder   str = code_to_string(code); | 	StrBuilder   str = code_to_strbuilder(code); | ||||||
| 	// const ssize len = str.length(); | 	// const ssize len = str.length(); | ||||||
| 	// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data ); | 	// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data ); | ||||||
| 	strbuilder_append_string( & builder->Buffer, str ); | 	strbuilder_append_string( & builder->Buffer, str ); | ||||||
|   | |||||||
| @@ -118,7 +118,7 @@ Code scan_file( char const* path ) | |||||||
|  |  | ||||||
| CodeBody parse_file( const char* path ) { | CodeBody parse_file( const char* path ) { | ||||||
| 	FileContents file    = file_read_contents( GlobalAllocator, true, path ); | 	FileContents file    = file_read_contents( GlobalAllocator, true, path ); | ||||||
| 	Str         content = { file.size, (char const*)file.data }; | 	Str          content = { (char const*)file.data, file.size }; | ||||||
| 	CodeBody     code    = parse_global_body( content ); | 	CodeBody     code    = parse_global_body( content ); | ||||||
| 	log_fmt("\nParsed: %s\n", path); | 	log_fmt("\nParsed: %s\n", path); | ||||||
| 	return code; | 	return code; | ||||||
|   | |||||||
| @@ -41,6 +41,7 @@ int gen_main() | |||||||
| 	CodeBody ecode       = gen_ecode     ( "enums/ECodeTypes.csv" ); | 	CodeBody ecode       = gen_ecode     ( "enums/ECodeTypes.csv" ); | ||||||
| 	CodeBody eoperator   = gen_eoperator ( "enums/EOperator.csv" ); | 	CodeBody eoperator   = gen_eoperator ( "enums/EOperator.csv" ); | ||||||
| 	CodeBody especifier  = gen_especifier( "enums/ESpecifier.csv" ); | 	CodeBody especifier  = gen_especifier( "enums/ESpecifier.csv" ); | ||||||
|  | 	CodeBody etoktype    = gen_etoktype  ( "enums/ETokType.csv", "enums/AttributeTokens.csv" ); | ||||||
| 	CodeBody ast_inlines = gen_ast_inlines(); | 	CodeBody ast_inlines = gen_ast_inlines(); | ||||||
|  |  | ||||||
| 	Builder header_ecode = builder_open( "components/gen/ecodetypes.hpp" ); | 	Builder header_ecode = builder_open( "components/gen/ecodetypes.hpp" ); | ||||||
| @@ -57,6 +58,11 @@ int gen_main() | |||||||
| 	builder_print( & header_especifier, gen_component_header ); | 	builder_print( & header_especifier, gen_component_header ); | ||||||
| 	builder_print( & header_especifier, format(especifier) ); | 	builder_print( & header_especifier, format(especifier) ); | ||||||
| 	builder_write( & header_especifier); | 	builder_write( & header_especifier); | ||||||
|  | 	 | ||||||
|  | 	Builder header_etoktype = builder_open( "components/gen/etoktype.cpp" ); | ||||||
|  | 	builder_print( & header_etoktype, gen_component_header ); | ||||||
|  | 	builder_print( & header_etoktype, format(etoktype) ); | ||||||
|  | 	builder_write( & header_etoktype); | ||||||
|  |  | ||||||
| 	Builder header_ast_inlines = builder_open( "components/gen/ast_inlines.hpp" ); | 	Builder header_ast_inlines = builder_open( "components/gen/ast_inlines.hpp" ); | ||||||
| 	builder_print( & header_ast_inlines, gen_component_header ); | 	builder_print( & header_ast_inlines, gen_component_header ); | ||||||
|   | |||||||
| @@ -62,11 +62,11 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt   : %S", self->InlineCmt  ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt   : %S", self->InlineCmt  ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes  : %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes  : %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParentAccess: %S", self->ParentType ? access_spec_to_str( self->ParentAccess )           : txt("No Parent") ); | 			strbuilder_append_fmt( result, "\n\tParentAccess: %S", self->ParentType ? access_spec_to_str( self->ParentAccess )                  : txt("No Parent") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParentType  : %S", self->ParentType ? code_type_str(self->ParentType)                    : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParentType  : %S", self->ParentType ? code_type_str(self->ParentType)                           : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody        : %S", self->Body       ? code_debug_str(self->Body)                         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody        : %S", self->Body       ? code_debug_str(self->Body)                                : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Class_Fwd: | 		case CT_Class_Fwd: | ||||||
| @@ -76,10 +76,10 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt   : %S", self->InlineCmt  ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt   : %S", self->InlineCmt  ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes  : %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes  : %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParentAccess: %S", self->ParentType ? access_spec_to_str( self->ParentAccess )           : txt("No Parent") ); | 			strbuilder_append_fmt( result, "\n\tParentAccess: %S", self->ParentType ? access_spec_to_str( self->ParentAccess )                  : txt("No Parent") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParentType  : %S", self->ParentType ? code_type_str(self->ParentType)                    : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParentType  : %S", self->ParentType ? code_type_str(self->ParentType)                           : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Constructor: | 		case CT_Constructor: | ||||||
| @@ -88,11 +88,11 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt      : %S", self->InlineCmt       ? self->InlineCmt->Content                                : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt      : %S", self->InlineCmt       ? self->InlineCmt->Content                                       : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs           ? strbuilder_to_str( code_to_string(self->Specs) )           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs           ? strbuilder_to_str( code_to_strbuilder(self->Specs) )           : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? strbuilder_to_str( code_to_string(self->InitializerList) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? strbuilder_to_str( code_to_strbuilder(self->InitializerList) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams         : %S", self->Params          ? strbuilder_to_str( code_to_string(self->Params) )          : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams         : %S", self->Params          ? strbuilder_to_str( code_to_strbuilder(self->Params) )          : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody           : %S", self->Body            ? code_debug_str(self->Body)                              : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody           : %S", self->Body            ? code_debug_str(self->Body)                                     : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Constructor_Fwd: | 		case CT_Constructor_Fwd: | ||||||
| @@ -101,10 +101,10 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt      : %S", self->InlineCmt       ? self->InlineCmt->Content                                : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt      : %S", self->InlineCmt       ? self->InlineCmt->Content                                       : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs           ? strbuilder_to_str( code_to_string(self->Specs) )           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs           ? strbuilder_to_str( code_to_strbuilder(self->Specs) )           : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? strbuilder_to_str( code_to_string(self->InitializerList) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInitializerList: %S", self->InitializerList ? strbuilder_to_str( code_to_strbuilder(self->InitializerList) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams         : %S", self->Params          ? strbuilder_to_str( code_to_string(self->Params) )          : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams         : %S", self->Params          ? strbuilder_to_str( code_to_strbuilder(self->Params) )          : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Destructor: | 		case CT_Destructor: | ||||||
| @@ -113,9 +113,9 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt      : %S", self->InlineCmt       ? self->InlineCmt->Content                      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt      : %S", self->InlineCmt       ? self->InlineCmt->Content                             : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs           ? strbuilder_to_str( code_to_string(self->Specs) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs           ? strbuilder_to_str( code_to_strbuilder(self->Specs) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody           : %S", self->Body            ? code_debug_str(self->Body)                    : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody           : %S", self->Body            ? code_debug_str(self->Body)                           : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Destructor_Fwd: | 		case CT_Destructor_Fwd: | ||||||
| @@ -128,10 +128,10 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt       : %S", self->InlineCmt      ? self->InlineCmt->Content                              : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt       : %S", self->InlineCmt      ? self->InlineCmt->Content                                     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes      : %S", self->Attributes     ? strbuilder_to_str( code_to_string(self->Attributes) )    : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes      : %S", self->Attributes     ? strbuilder_to_str( code_to_strbuilder(self->Attributes) )    : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? strbuilder_to_str( code_to_string(self->UnderlyingType)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? strbuilder_to_str( code_to_strbuilder(self->UnderlyingType)) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody            : %S", self->Body           ? code_debug_str(self->Body)                            : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody            : %S", self->Body           ? code_debug_str(self->Body)                                   : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Enum_Fwd: | 		case CT_Enum_Fwd: | ||||||
| @@ -141,9 +141,9 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt       : %S", self->InlineCmt      ? self->InlineCmt->Content                              : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt       : %S", self->InlineCmt      ? self->InlineCmt->Content                                     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes      : %S", self->Attributes     ? strbuilder_to_str( code_to_string(self->Attributes) )    : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes      : %S", self->Attributes     ? strbuilder_to_str( code_to_strbuilder(self->Attributes) )    : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? strbuilder_to_str( code_to_string(self->UnderlyingType)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tUnderlying Type : %S", self->UnderlyingType ? strbuilder_to_str( code_to_strbuilder(self->UnderlyingType)) : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Extern_Linkage: | 		case CT_Extern_Linkage: | ||||||
| @@ -162,8 +162,8 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt  : %S", self->InlineCmt   ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt  : %S", self->InlineCmt   ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? strbuilder_to_str( code_to_string(self->Declaration)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? strbuilder_to_str( code_to_strbuilder(self->Declaration)) : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Function: | 		case CT_Function: | ||||||
| @@ -172,12 +172,12 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs))       : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs))       : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_string(self->ReturnType))  : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_strbuilder(self->ReturnType))  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_string(self->Params))      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_strbuilder(self->Params))      : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                                : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Function_Fwd: | 		case CT_Function_Fwd: | ||||||
| @@ -186,11 +186,11 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs))       : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs))       : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_string(self->ReturnType))  : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_strbuilder(self->ReturnType))  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_string(self->Params))      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_strbuilder(self->Params))      : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Module: | 		case CT_Module: | ||||||
| @@ -207,12 +207,12 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs))       : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs))       : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_string(self->ReturnType))  : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_strbuilder(self->ReturnType))  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_string(self->Params))      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_strbuilder(self->Params))      : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                                : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tOp        : %S", operator_to_str( self->Op ) ); | 			strbuilder_append_fmt( result, "\n\tOp        : %S", operator_to_str( self->Op ) ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| @@ -223,11 +223,11 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                           : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                                  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs) )      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs) )      : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_string(self->ReturnType) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tReturnType: %S", self->ReturnType ? strbuilder_to_str( code_to_strbuilder(self->ReturnType) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_string(self->Params) )     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams    : %S", self->Params     ? strbuilder_to_str( code_to_strbuilder(self->Params) )     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tOp        : %S", operator_to_str( self->Op ) ); | 			strbuilder_append_fmt( result, "\n\tOp        : %S", operator_to_str( self->Op ) ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| @@ -237,10 +237,10 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                                : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs))     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs))     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tValueType : %S", self->ValueType  ? strbuilder_to_str( code_to_string(self->ValueType)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tValueType : %S", self->ValueType  ? strbuilder_to_str( code_to_strbuilder(self->ValueType)) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                       : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                              : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Operator_Cast_Fwd: | 		case CT_Operator_Cast_Fwd: | ||||||
| @@ -249,17 +249,17 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt : %S", self->InlineCmt  ? self->InlineCmt->Content                                : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs))     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs     : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs))     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tValueType : %S", self->ValueType  ? strbuilder_to_str( code_to_string(self->ValueType)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tValueType : %S", self->ValueType  ? strbuilder_to_str( code_to_strbuilder(self->ValueType)) : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Parameters: | 		case CT_Parameters: | ||||||
| 			strbuilder_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries ); | 			strbuilder_append_fmt( result, "\n\tNumEntries: %d", self->NumEntries ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tLast      : %S", self->Last->Name ); | 			strbuilder_append_fmt( result, "\n\tLast      : %S", self->Last->Name ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tNext      : %S", self->Next->Name ); | 			strbuilder_append_fmt( result, "\n\tNext      : %S", self->Next->Name ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tValueType : %S", self->ValueType ? strbuilder_to_str( code_to_string(self->ValueType)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tValueType : %S", self->ValueType ? strbuilder_to_str( code_to_strbuilder(self->ValueType)) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tValue     : %S", self->Value     ? strbuilder_to_str( code_to_string(self->Value))     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tValue     : %S", self->Value     ? strbuilder_to_str( code_to_strbuilder(self->Value))     : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Specifiers: | 		case CT_Specifiers: | ||||||
| @@ -285,8 +285,8 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams     : %S", self->Params      ? strbuilder_to_str( code_to_string(self->Params))      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams     : %S", self->Params      ? strbuilder_to_str( code_to_strbuilder(self->Params))      : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? strbuilder_to_str( code_to_string(self->Declaration)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tDeclaration: %S", self->Declaration ? strbuilder_to_str( code_to_strbuilder(self->Declaration)) : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Typedef: | 		case CT_Typedef: | ||||||
| @@ -295,16 +295,16 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt     : %S", self->InlineCmt      ? self->InlineCmt->Content                              : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt     : %S", self->InlineCmt      ? self->InlineCmt->Content                                     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? strbuilder_to_str( code_to_string(self->UnderlyingType)) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? strbuilder_to_str( code_to_strbuilder(self->UnderlyingType)) : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Typename: | 		case CT_Typename: | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes     : %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes     : %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs      ? strbuilder_to_str( code_to_string(self->Specs))       : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs          : %S", self->Specs      ? strbuilder_to_str( code_to_strbuilder(self->Specs))       : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tReturnType     : %S", self->ReturnType ? strbuilder_to_str( code_to_string(self->ReturnType))  : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tReturnType     : %S", self->ReturnType ? strbuilder_to_str( code_to_strbuilder(self->ReturnType))  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tParams         : %S", self->Params     ? strbuilder_to_str( code_to_string(self->Params))      : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tParams         : %S", self->Params     ? strbuilder_to_str( code_to_strbuilder(self->Params))      : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tArrExpr        : %S", self->ArrExpr    ? strbuilder_to_str( code_to_string(self->ArrExpr))     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tArrExpr        : %S", self->ArrExpr    ? strbuilder_to_str( code_to_strbuilder(self->ArrExpr))     : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Union: | 		case CT_Union: | ||||||
| @@ -313,8 +313,8 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_string(self->Attributes) ) : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes: %S", self->Attributes ? strbuilder_to_str( code_to_strbuilder(self->Attributes) ) : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)       : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBody      : %S", self->Body       ? code_debug_str(self->Body)                                : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Using: | 		case CT_Using: | ||||||
| @@ -323,9 +323,9 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt     : %S", self->InlineCmt      ? self->InlineCmt->Content                               : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt     : %S", self->InlineCmt      ? self->InlineCmt->Content                                      : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes    : %S", self->Attributes     ? strbuilder_to_str( code_to_string(self->Attributes) )     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes    : %S", self->Attributes     ? strbuilder_to_str( code_to_strbuilder(self->Attributes) )     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? strbuilder_to_str( code_to_string(self->UnderlyingType))  : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tUnderlyingType: %S", self->UnderlyingType ? strbuilder_to_str( code_to_strbuilder(self->UnderlyingType))  : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Variable: | 		case CT_Variable: | ||||||
| @@ -333,10 +333,10 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Parent && self->Parent->Type == CT_Variable ) | 			if ( self->Parent && self->Parent->Type == CT_Variable ) | ||||||
| 			{ | 			{ | ||||||
| 				// Its a NextVar | 				// Its a NextVar | ||||||
| 				strbuilder_append_fmt( result, "\n\tSpecs       : %S", self->Specs        ? strbuilder_to_str( code_to_string(self->Specs))        : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tSpecs       : %S", self->Specs        ? strbuilder_to_str( code_to_strbuilder(self->Specs))        : txt("Null") ); | ||||||
| 				strbuilder_append_fmt( result, "\n\tValue       : %S", self->Value        ? strbuilder_to_str( code_to_string(self->Value))        : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tValue       : %S", self->Value        ? strbuilder_to_str( code_to_strbuilder(self->Value))        : txt("Null") ); | ||||||
| 				strbuilder_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? strbuilder_to_str( code_to_string(self->BitfieldSize)) : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? strbuilder_to_str( code_to_strbuilder(self->BitfieldSize)) : txt("Null") ); | ||||||
| 				strbuilder_append_fmt( result, "\n\tNextVar     : %S", self->NextVar      ? code_debug_str(self->NextVar)                       : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNextVar     : %S", self->NextVar      ? code_debug_str(self->NextVar)                              : txt("Null") ); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -345,13 +345,13 @@ Str code_debug_str(Code self) | |||||||
| 			if ( self->Next ) | 			if ( self->Next ) | ||||||
| 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | 				strbuilder_append_fmt( result, "\n\tNext: %S %S", code_type_str(self->Prev), self->Prev->Name.Len ? self->Prev->Name : txt("Null") ); | ||||||
|  |  | ||||||
| 			strbuilder_append_fmt( result, "\n\tInlineCmt   : %S", self->InlineCmt    ? self->InlineCmt->Content                             : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tInlineCmt   : %S", self->InlineCmt    ? self->InlineCmt->Content                                    : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tAttributes  : %S", self->Attributes   ? strbuilder_to_str( code_to_string(self->Attributes) )   : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tAttributes  : %S", self->Attributes   ? strbuilder_to_str( code_to_strbuilder(self->Attributes) )   : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tSpecs       : %S", self->Specs        ? strbuilder_to_str( code_to_string(self->Specs))         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tSpecs       : %S", self->Specs        ? strbuilder_to_str( code_to_strbuilder(self->Specs))         : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tValueType   : %S", self->ValueType    ? strbuilder_to_str( code_to_string(self->ValueType))     : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tValueType   : %S", self->ValueType    ? strbuilder_to_str( code_to_strbuilder(self->ValueType))     : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? strbuilder_to_str( code_to_string(self->BitfieldSize))  : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tBitfieldSize: %S", self->BitfieldSize ? strbuilder_to_str( code_to_strbuilder(self->BitfieldSize))  : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tValue       : %S", self->Value        ? strbuilder_to_str( code_to_string(self->Value))         : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tValue       : %S", self->Value        ? strbuilder_to_str( code_to_strbuilder(self->Value))         : txt("Null") ); | ||||||
| 			strbuilder_append_fmt( result, "\n\tNextVar     : %S", self->NextVar      ? code_debug_str(self->NextVar)                        : txt("Null") ); | 			strbuilder_append_fmt( result, "\n\tNextVar     : %S", self->NextVar      ? code_debug_str(self->NextVar)                               : txt("Null") ); | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -370,7 +370,7 @@ Code code_duplicate(Code self) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder code_to_string(Code self) | StrBuilder code_to_strbuilder(Code self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_str( GlobalAllocator, txt("") ); | 	StrBuilder result = strbuilder_make_str( GlobalAllocator, txt("") ); | ||||||
| 	code_to_strbuilder_ptr( self, & result ); | 	code_to_strbuilder_ptr( self, & result ); | ||||||
| @@ -455,7 +455,7 @@ void code_to_strbuilder_ptr( Code self, StrBuilder* result ) | |||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Extern_Linkage: | 		case CT_Extern_Linkage: | ||||||
| 			extern_to_string(cast(CodeExtern, self), result ); | 			extern_to_strbuilder(cast(CodeExtern, self), result ); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
| 		case CT_Friend: | 		case CT_Friend: | ||||||
| @@ -624,8 +624,8 @@ bool code_is_equal( Code self, Code other ) | |||||||
| 	if ( self->val != other->val )                            \ | 	if ( self->val != other->val )                            \ | ||||||
| 	{                                                         \ | 	{                                                         \ | ||||||
| 		log_fmt("\nAST::is_equal: Member - " #val " failed\n" \ | 		log_fmt("\nAST::is_equal: Member - " #val " failed\n" \ | ||||||
| 		        "AST  : %S\n"                                \ | 		        "AST  : %S\n"                                 \ | ||||||
| 		        "Other: %S\n"                                \ | 		        "Other: %S\n"                                 \ | ||||||
| 		    , code_debug_str(self)                            \ | 		    , code_debug_str(self)                            \ | ||||||
| 		    ,code_debug_str(other)                            \ | 		    ,code_debug_str(other)                            \ | ||||||
| 		);                                                    \ | 		);                                                    \ | ||||||
| @@ -634,11 +634,11 @@ bool code_is_equal( Code self, Code other ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	#define check_member_str( str )                                 \ | 	#define check_member_str( str )                                 \ | ||||||
| 	if ( ! str_are_equal( self->str, other->str ) )                \ | 	if ( ! str_are_equal( self->str, other->str ) )                 \ | ||||||
| 	{                                                               \ | 	{                                                               \ | ||||||
| 		log_fmt("\nAST::is_equal: Member string - "#str " failed\n" \ | 		log_fmt("\nAST::is_equal: Member string - "#str " failed\n" \ | ||||||
| 				"AST  : %S\n"                                      \ | 				"AST  : %S\n"                                       \ | ||||||
| 				"Other: %S\n"                                      \ | 				"Other: %S\n"                                       \ | ||||||
| 			, code_debug_str(self)                                  \ | 			, code_debug_str(self)                                  \ | ||||||
| 			,code_debug_str(other)                                  \ | 			,code_debug_str(other)                                  \ | ||||||
| 		);                                                          \ | 		);                                                          \ | ||||||
| @@ -647,21 +647,21 @@ bool code_is_equal( Code self, Code other ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	#define check_member_content( content )                                \ | 	#define check_member_content( content )                                \ | ||||||
| 	if ( ! str_are_equal( self->content, other->content ))                \ | 	if ( ! str_are_equal( self->content, other->content ))                 \ | ||||||
| 	{                                                                      \ | 	{                                                                      \ | ||||||
| 		log_fmt("\nAST::is_equal: Member content - "#content " failed\n"   \ | 		log_fmt("\nAST::is_equal: Member content - "#content " failed\n"   \ | ||||||
| 				"AST  : %S\n"                                             \ | 				"AST  : %S\n"                                              \ | ||||||
| 				"Other: %S\n"                                             \ | 				"Other: %S\n"                                              \ | ||||||
| 			, code_debug_str(self)                                         \ | 			, code_debug_str(self)                                         \ | ||||||
| 			, code_debug_str(other)                                        \ | 			, code_debug_str(other)                                        \ | ||||||
| 		);                                                                 \ | 		);                                                                 \ | ||||||
|                                                                            \ |                                                                            \ | ||||||
| 		log_fmt("Content cannot be trusted to be unique with this check "  \ | 		log_fmt("Content cannot be trusted to be unique with this check "  \ | ||||||
| 			"so it must be verified by eye for now\n"                      \ | 			"so it must be verified by eye for now\n"                      \ | ||||||
| 			"AST   Content:\n%S\n"                                        \ | 			"AST   Content:\n%S\n"                                         \ | ||||||
| 			"Other Content:\n%S\n"                                        \ | 			"Other Content:\n%S\n"                                         \ | ||||||
| 			, str_visualize_whitespace(self->content, GlobalAllocator)    \ | 			, str_visualize_whitespace(self->content, GlobalAllocator)     \ | ||||||
| 			, str_visualize_whitespace(other->content, GlobalAllocator)   \ | 			, str_visualize_whitespace(other->content, GlobalAllocator)    \ | ||||||
| 		);                                                                 \ | 		);                                                                 \ | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -671,9 +671,9 @@ bool code_is_equal( Code self, Code other ) | |||||||
| 		if ( other->ast == nullptr )                                                               \ | 		if ( other->ast == nullptr )                                                               \ | ||||||
| 		{                                                                                          \ | 		{                                                                                          \ | ||||||
| 			log_fmt("\nAST::is_equal: Failed for member " #ast " other equivalent param is null\n" \ | 			log_fmt("\nAST::is_equal: Failed for member " #ast " other equivalent param is null\n" \ | ||||||
| 					"AST  : %S\n"                                                                 \ | 					"AST  : %S\n"                                                                  \ | ||||||
| 					"Other: %S\n"                                                                 \ | 					"Other: %S\n"                                                                  \ | ||||||
| 					"For ast member: %S\n"                                                        \ | 					"For ast member: %S\n"                                                         \ | ||||||
| 				, code_debug_str(self)                                                             \ | 				, code_debug_str(self)                                                             \ | ||||||
| 				, code_debug_str(other)                                                            \ | 				, code_debug_str(other)                                                            \ | ||||||
| 				, code_debug_str(self->ast)                                                        \ | 				, code_debug_str(self->ast)                                                        \ | ||||||
| @@ -685,10 +685,10 @@ bool code_is_equal( Code self, Code other ) | |||||||
| 		if ( ! code_is_equal(self->ast, other->ast ) )                                             \ | 		if ( ! code_is_equal(self->ast, other->ast ) )                                             \ | ||||||
| 		{                                                                                          \ | 		{                                                                                          \ | ||||||
| 			log_fmt( "\nAST::is_equal: Failed for " #ast"\n"                                       \ | 			log_fmt( "\nAST::is_equal: Failed for " #ast"\n"                                       \ | ||||||
| 					"AST  : %S\n"                                                                 \ | 					"AST  : %S\n"                                                                  \ | ||||||
| 					"Other: %S\n"                                                                 \ | 					"Other: %S\n"                                                                  \ | ||||||
| 					"For     ast member: %S\n"                                                    \ | 					"For     ast member: %S\n"                                                     \ | ||||||
| 					"other's ast member: %S\n"                                                    \ | 					"other's ast member: %S\n"                                                     \ | ||||||
| 				, code_debug_str(self)                                                             \ | 				, code_debug_str(self)                                                             \ | ||||||
| 				, code_debug_str(other)                                                            \ | 				, code_debug_str(other)                                                            \ | ||||||
| 				, code_debug_str(self->ast)                                                        \ | 				, code_debug_str(self->ast)                                                        \ | ||||||
|   | |||||||
| @@ -242,7 +242,7 @@ GEN_NS_PARSER_END | |||||||
| // I have ideas for ways to pack that into the typedef/using ast, but for now just keeping it like this | // I have ideas for ways to pack that into the typedef/using ast, but for now just keeping it like this | ||||||
| #define ParserTokenType GEN_NS_PARSER Token | #define ParserTokenType GEN_NS_PARSER Token | ||||||
| typedef ParserTokenType Token; | typedef ParserTokenType Token; | ||||||
| #undef ParserTokenType | #undef  ParserTokenType | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if GEN_COMPILER_CPP | #if GEN_COMPILER_CPP | ||||||
| @@ -251,19 +251,19 @@ template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast( | |||||||
|  |  | ||||||
| #pragma region Code C-Interface | #pragma region Code C-Interface | ||||||
|  |  | ||||||
| void   code_append       (Code code, Code other ); | void       code_append           (Code code, Code other ); | ||||||
| Str   code_debug_str    (Code code); | Str        code_debug_str        (Code code); | ||||||
| Code   code_duplicate    (Code code); | Code       code_duplicate        (Code code); | ||||||
| Code*  code_entry        (Code code, u32 idx ); | Code*      code_entry            (Code code, u32 idx ); | ||||||
| bool   code_has_entries  (Code code); | bool       code_has_entries      (Code code); | ||||||
| bool   code_is_body      (Code code); | bool       code_is_body          (Code code); | ||||||
| bool   code_is_equal     (Code code, Code other); | bool       code_is_equal         (Code code, Code other); | ||||||
| bool   code_is_valid     (Code code); | bool       code_is_valid         (Code code); | ||||||
| void   code_set_global   (Code code); | void       code_set_global       (Code code); | ||||||
| StrBuilder code_to_string    (Code self ); | StrBuilder code_to_strbuilder    (Code self ); | ||||||
| void   code_to_strbuilder_ptr(Code self, StrBuilder* result ); | void       code_to_strbuilder_ptr(Code self, StrBuilder* result ); | ||||||
| Str   code_type_str     (Code self ); | Str        code_type_str         (Code self ); | ||||||
| bool   code_validate_body(Code self ); | bool       code_validate_body    (Code self ); | ||||||
|  |  | ||||||
| #pragma endregion Code C-Interface | #pragma endregion Code C-Interface | ||||||
|  |  | ||||||
| @@ -278,7 +278,7 @@ struct Code | |||||||
| 	AST* ast; | 	AST* ast; | ||||||
|  |  | ||||||
| #	define Using_Code( Typename )                                                        \ | #	define Using_Code( Typename )                                                        \ | ||||||
| 	forceinline Str debug_str()                { return code_debug_str(* this); }       \ | 	forceinline Str  debug_str()                { return code_debug_str(* this); }       \ | ||||||
| 	forceinline Code duplicate()                { return code_duplicate(* this); }	     \ | 	forceinline Code duplicate()                { return code_duplicate(* this); }	     \ | ||||||
| 	forceinline bool is_equal( Code other )     { return code_is_equal(* this, other); } \ | 	forceinline bool is_equal( Code other )     { return code_is_equal(* this, other); } \ | ||||||
| 	forceinline bool is_body()                  { return code_is_body(* this); }         \ | 	forceinline bool is_body()                  { return code_is_body(* this); }         \ | ||||||
| @@ -295,16 +295,17 @@ struct Code | |||||||
|  |  | ||||||
| #if ! GEN_C_LIKE_CPP | #if ! GEN_C_LIKE_CPP | ||||||
| 	Using_Code( Code ); | 	Using_Code( Code ); | ||||||
| 	forceinline void   append(Code other)        { return code_append(* this, other); } | 	forceinline void       append(Code other)                { return code_append(* this, other); } | ||||||
| 	forceinline Code*  entry(u32 idx)            { return code_entry(* this, idx); } | 	forceinline Code*      entry(u32 idx)                    { return code_entry(* this, idx); } | ||||||
| 	forceinline bool   has_entries()             { return code_has_entries(* this); } | 	forceinline bool       has_entries()                     { return code_has_entries(* this); } | ||||||
| 	forceinline StrBuilder to_string()               { return code_to_string(* this); } | 	forceinline StrBuilder to_strbuilder()                   { return code_to_strbuilder(* this); } | ||||||
| 	forceinline void   to_string(StrBuilder& result) { return code_to_strbuilder_ptr(* this, & result); } | 	forceinline void       to_strbuilder(StrBuilder& result) { return code_to_strbuilder_ptr(* this, & result); } | ||||||
| 	forceinline Str   type_str()                { return code_type_str(* this); } | 	forceinline Str        type_str()                        { return code_type_str(* this); } | ||||||
| 	forceinline bool   validate_body()           { return code_validate_body(*this); } | 	forceinline bool       validate_body()                   { return code_validate_body(*this); } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 	Using_CodeOps( Code ); | 	Using_CodeOps( Code ); | ||||||
|  | 	forceinline Code operator *() { return * this; } // Required to support for-range iteration. | ||||||
| 	forceinline AST* operator ->() { return ast; } | 	forceinline AST* operator ->() { return ast; } | ||||||
|  |  | ||||||
| 	Code& operator ++(); | 	Code& operator ++(); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| inline | inline | ||||||
| StrBuilder attributes_to_string(CodeAttributes attributes) { | StrBuilder attributes_to_strbuilder(CodeAttributes attributes) { | ||||||
| 	GEN_ASSERT(attributes); | 	GEN_ASSERT(attributes); | ||||||
| 	char* raw = ccast(char*, str_duplicate( attributes->Content, GlobalAllocator ).Ptr); | 	char* raw = ccast(char*, str_duplicate( attributes->Content, GlobalAllocator ).Ptr); | ||||||
| 	StrBuilder result = { raw }; | 	StrBuilder result = { raw }; | ||||||
| @@ -18,7 +18,7 @@ void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result) | |||||||
| 	strbuilder_append_str(result, attributes->Content); | 	strbuilder_append_str(result, attributes->Content); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder body_to_string(CodeBody body) | StrBuilder body_to_strbuilder(CodeBody body) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(body); | 	GEN_ASSERT(body); | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | ||||||
| @@ -56,7 +56,7 @@ void body_to_strbuilder_ref( CodeBody body, StrBuilder* result ) | |||||||
| 	while ( left -- ) | 	while ( left -- ) | ||||||
| 	{ | 	{ | ||||||
| 		code_to_strbuilder_ptr(curr, result); | 		code_to_strbuilder_ptr(curr, result); | ||||||
| 		// strbuilder_append_fmt( result, "%SB", code_to_string(curr) ); | 		// strbuilder_append_fmt( result, "%SB", code_to_strbuilder(curr) ); | ||||||
| 		++curr; | 		++curr; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @@ -72,7 +72,7 @@ void body_to_strbuilder_export( CodeBody body, StrBuilder* result ) | |||||||
| 	while ( left-- ) | 	while ( left-- ) | ||||||
| 	{ | 	{ | ||||||
| 		code_to_strbuilder_ptr(curr, result); | 		code_to_strbuilder_ptr(curr, result); | ||||||
| 		// strbuilder_append_fmt( result, "%SB", code_to_string(curr) ); | 		// strbuilder_append_fmt( result, "%SB", code_to_strbuilder(curr) ); | ||||||
| 		++curr; | 		++curr; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -80,7 +80,7 @@ void body_to_strbuilder_export( CodeBody body, StrBuilder* result ) | |||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
| StrBuilder comment_to_string(CodeComment comment) { | StrBuilder comment_to_strbuilder(CodeComment comment) { | ||||||
| 	GEN_ASSERT(comment); | 	GEN_ASSERT(comment); | ||||||
| 	char* raw = ccast(char*, str_duplicate( comment->Content, GlobalAllocator ).Ptr); | 	char* raw = ccast(char*, str_duplicate( comment->Content, GlobalAllocator ).Ptr); | ||||||
| 	StrBuilder result = { raw }; | 	StrBuilder result = { raw }; | ||||||
| @@ -94,7 +94,7 @@ void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result) { | |||||||
| 	strbuilder_append_str(result, comment->Content); | 	strbuilder_append_str(result, comment->Content); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder constructor_to_string(CodeConstructor self) | StrBuilder constructor_to_strbuilder(CodeConstructor self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | ||||||
| 	switch (self->Type) | 	switch (self->Type) | ||||||
| @@ -120,17 +120,17 @@ void constructor_to_strbuilder_def(CodeConstructor self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "( %SB )", params_to_string(self->Params) ); | 		strbuilder_append_fmt( result, "( %SB )", params_to_strbuilder(self->Params) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_str( result, txt("()") ); | 		strbuilder_append_str( result, txt("()") ); | ||||||
|  |  | ||||||
| 	if ( self->InitializerList ) | 	if ( self->InitializerList ) | ||||||
| 		strbuilder_append_fmt( result, " : %SB", code_to_string(self->InitializerList) ); | 		strbuilder_append_fmt( result, " : %SB", code_to_strbuilder(self->InitializerList) ); | ||||||
|  |  | ||||||
| 	if ( self->InlineCmt ) | 	if ( self->InlineCmt ) | ||||||
| 		strbuilder_append_fmt( result, " // %S", self->InlineCmt->Content ); | 		strbuilder_append_fmt( result, " // %S", self->InlineCmt->Content ); | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n", code_to_string(self->Body) ); | 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n", code_to_strbuilder(self->Body) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| void constructor_to_strbuilder_fwd(CodeConstructor self, StrBuilder* result ) | void constructor_to_strbuilder_fwd(CodeConstructor self, StrBuilder* result ) | ||||||
| @@ -144,12 +144,12 @@ void constructor_to_strbuilder_fwd(CodeConstructor self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "( %SB )", params_to_string(self->Params) ); | 		strbuilder_append_fmt( result, "( %SB )", params_to_strbuilder(self->Params) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "()"); | 		strbuilder_append_fmt( result, "()"); | ||||||
|  |  | ||||||
| 	if (self->Body) | 	if (self->Body) | ||||||
| 		strbuilder_append_fmt( result, " = %SB", code_to_string(self->Body) ); | 		strbuilder_append_fmt( result, " = %SB", code_to_strbuilder(self->Body) ); | ||||||
|  |  | ||||||
| 	if ( self->InlineCmt ) | 	if ( self->InlineCmt ) | ||||||
| 		strbuilder_append_fmt( result, "; // %S\n", self->InlineCmt->Content ); | 		strbuilder_append_fmt( result, "; // %S\n", self->InlineCmt->Content ); | ||||||
| @@ -157,7 +157,7 @@ void constructor_to_strbuilder_fwd(CodeConstructor self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt(";\n") ); | 		strbuilder_append_str( result, txt(";\n") ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder class_to_string( CodeClass self ) | StrBuilder class_to_strbuilder( CodeClass self ) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -183,13 +183,13 @@ void class_to_strbuilder_def( CodeClass self, StrBuilder* result ) | |||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->ParentType ) | 	if ( self->ParentType ) | ||||||
| 	{ | 	{ | ||||||
| 		Str access_level = access_spec_to_str( self->ParentAccess ); | 		Str access_level = access_spec_to_str( self->ParentAccess ); | ||||||
| 		strbuilder_append_fmt( result, "%S : %S %SB", self->Name, access_level, typename_to_string(self->ParentType) ); | 		strbuilder_append_fmt( result, "%S : %S %SB", self->Name, access_level, typename_to_strbuilder(self->ParentType) ); | ||||||
|  |  | ||||||
| 		CodeTypename interface = cast(CodeTypename, self->ParentType->Next); | 		CodeTypename interface = cast(CodeTypename, self->ParentType->Next); | ||||||
| 		if ( interface ) | 		if ( interface ) | ||||||
| @@ -197,7 +197,7 @@ void class_to_strbuilder_def( CodeClass self, StrBuilder* result ) | |||||||
|  |  | ||||||
| 		while ( interface ) | 		while ( interface ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, ", public %SB", typename_to_string(interface) ); | 			strbuilder_append_fmt( result, ", public %SB", typename_to_strbuilder(interface) ); | ||||||
| 			interface = interface->Next ? cast(CodeTypename, interface->Next) : NullCode; | 			interface = interface->Next ? cast(CodeTypename, interface->Next) : NullCode; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -211,7 +211,7 @@ void class_to_strbuilder_def( CodeClass self, StrBuilder* result ) | |||||||
| 		strbuilder_append_fmt( result, " // %S", self->InlineCmt->Content ); | 		strbuilder_append_fmt( result, " // %S", self->InlineCmt->Content ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "\n{\n%SB\n}", body_to_string(self->Body) ); | 	strbuilder_append_fmt( result, "\n{\n%SB\n}", body_to_strbuilder(self->Body) ); | ||||||
|  |  | ||||||
| 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | ||||||
| 		strbuilder_append_str( result, txt(";\n") ); | 		strbuilder_append_str( result, txt(";\n") ); | ||||||
| @@ -225,7 +225,7 @@ void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "class %SB %S", attributes_to_string(self->Attributes), self->Name ); | 		strbuilder_append_fmt( result, "class %SB %S", attributes_to_strbuilder(self->Attributes), self->Name ); | ||||||
|  |  | ||||||
| 	else strbuilder_append_fmt( result, "class %S", self->Name ); | 	else strbuilder_append_fmt( result, "class %S", self->Name ); | ||||||
|  |  | ||||||
| @@ -239,7 +239,7 @@ void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder define_to_string(CodeDefine define) | StrBuilder define_to_strbuilder(CodeDefine define) | ||||||
| { | { | ||||||
| 	return strbuilder_fmt_buf( GlobalAllocator, "#define %S %S", define->Name, define->Content ); | 	return strbuilder_fmt_buf( GlobalAllocator, "#define %S %S", define->Name, define->Content ); | ||||||
| } | } | ||||||
| @@ -249,7 +249,7 @@ void define_to_strbuilder_ref(CodeDefine define, StrBuilder* result ) | |||||||
| 	strbuilder_append_fmt( result, "#define %S %S", define->Name, define->Content ); | 	strbuilder_append_fmt( result, "#define %S %S", define->Name, define->Content ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder destructor_to_string(CodeDestructor self) | StrBuilder destructor_to_strbuilder(CodeDestructor self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -280,7 +280,7 @@ void destructor_to_strbuilder_def(CodeDestructor self, StrBuilder* result ) | |||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "~%S()", self->Parent->Name ); | 		strbuilder_append_fmt( result, "~%S()", self->Parent->Name ); | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n", code_to_string(self->Body) ); | 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n", code_to_strbuilder(self->Body) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| void destructor_to_strbuilder_fwd(CodeDestructor self, StrBuilder* result ) | void destructor_to_strbuilder_fwd(CodeDestructor self, StrBuilder* result ) | ||||||
| @@ -295,7 +295,7 @@ void destructor_to_strbuilder_fwd(CodeDestructor self, StrBuilder* result ) | |||||||
| 		if ( specifiers_has(self->Specs, Spec_Pure ) ) | 		if ( specifiers_has(self->Specs, Spec_Pure ) ) | ||||||
| 			strbuilder_append_str( result, txt(" = 0;") ); | 			strbuilder_append_str( result, txt(" = 0;") ); | ||||||
| 		else if (self->Body) | 		else if (self->Body) | ||||||
| 			strbuilder_append_fmt( result, " = %SB;", code_to_string(self->Body) ); | 			strbuilder_append_fmt( result, " = %SB;", code_to_strbuilder(self->Body) ); | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "~%S();", self->Parent->Name ); | 		strbuilder_append_fmt( result, "~%S();", self->Parent->Name ); | ||||||
| @@ -306,7 +306,7 @@ void destructor_to_strbuilder_fwd(CodeDestructor self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("\n")); | 		strbuilder_append_str( result, txt("\n")); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder enum_to_string(CodeEnum self) | StrBuilder enum_to_strbuilder(CodeEnum self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -337,24 +337,24 @@ void enum_to_strbuilder_def(CodeEnum self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("enum ") ); | 		strbuilder_append_str( result, txt("enum ") ); | ||||||
|  |  | ||||||
| 		if ( self->Attributes ) | 		if ( self->Attributes ) | ||||||
| 			strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 			strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 		if ( self->UnderlyingType ) | 		if ( self->UnderlyingType ) | ||||||
| 			strbuilder_append_fmt( result, "%S : %SB\n{\n%SB\n}" | 			strbuilder_append_fmt( result, "%S : %SB\n{\n%SB\n}" | ||||||
| 				, self->Name | 				, self->Name | ||||||
| 				, typename_to_string(self->UnderlyingType) | 				, typename_to_strbuilder(self->UnderlyingType) | ||||||
| 				, body_to_string(self->Body) | 				, body_to_strbuilder(self->Body) | ||||||
| 			); | 			); | ||||||
| 		else if ( self->UnderlyingTypeMacro ) | 		else if ( self->UnderlyingTypeMacro ) | ||||||
| 			strbuilder_append_fmt( result, "%S %SB\n{\n%SB\n}" | 			strbuilder_append_fmt( result, "%S %SB\n{\n%SB\n}" | ||||||
| 				, self->Name | 				, self->Name | ||||||
| 				, code_to_string(self->UnderlyingTypeMacro) | 				, code_to_strbuilder(self->UnderlyingTypeMacro) | ||||||
| 				, body_to_string(self->Body) | 				, body_to_strbuilder(self->Body) | ||||||
| 			); | 			); | ||||||
|  |  | ||||||
| 		else strbuilder_append_fmt( result, "%S\n{\n%SB\n}", self->Name, body_to_string(self->Body) ); | 		else strbuilder_append_fmt( result, "%S\n{\n%SB\n}", self->Name, body_to_strbuilder(self->Body) ); | ||||||
| 	} | 	} | ||||||
| 	else strbuilder_append_fmt( result, "enum %S\n{\n%SB\n}", self->Name, body_to_string(self->Body) ); | 	else strbuilder_append_fmt( result, "enum %S\n{\n%SB\n}", self->Name, body_to_strbuilder(self->Body) ); | ||||||
|  |  | ||||||
| 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | ||||||
| 		strbuilder_append_str( result, txt(";\n")); | 		strbuilder_append_str( result, txt(";\n")); | ||||||
| @@ -366,14 +366,14 @@ void enum_to_strbuilder_fwd(CodeEnum self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->UnderlyingType ) | 	if ( self->UnderlyingType ) | ||||||
| 		strbuilder_append_fmt( result, "enum %S : %SB", self->Name, typename_to_string(self->UnderlyingType) ); | 		strbuilder_append_fmt( result, "enum %S : %SB", self->Name, typename_to_strbuilder(self->UnderlyingType) ); | ||||||
| 	else if (self->UnderlyingTypeMacro) | 	else if (self->UnderlyingTypeMacro) | ||||||
| 	{ | 	{ | ||||||
| 		log_fmt("IDENTIFIED A UNDERLYING ENUM MACRO"); | 		log_fmt("IDENTIFIED A UNDERLYING ENUM MACRO"); | ||||||
| 		strbuilder_append_fmt( result, "enum %S %SB", self->Name, code_to_string(self->UnderlyingTypeMacro) ); | 		strbuilder_append_fmt( result, "enum %S %SB", self->Name, code_to_strbuilder(self->UnderlyingTypeMacro) ); | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "enum %S", self->Name ); | 		strbuilder_append_fmt( result, "enum %S", self->Name ); | ||||||
| @@ -398,21 +398,21 @@ void enum_to_strbuilder_class_def(CodeEnum self, StrBuilder* result ) | |||||||
|  |  | ||||||
| 		if ( self->Attributes ) | 		if ( self->Attributes ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 			strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ( self->UnderlyingType ) | 		if ( self->UnderlyingType ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "%S : %SB\n{\n%SB\n}", self->Name, typename_to_string(self->UnderlyingType), body_to_string(self->Body) ); | 			strbuilder_append_fmt( result, "%S : %SB\n{\n%SB\n}", self->Name, typename_to_strbuilder(self->UnderlyingType), body_to_strbuilder(self->Body) ); | ||||||
| 		} | 		} | ||||||
| 		else | 		else | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "%S\n{\n%SB\n}", self->Name, body_to_string(self->Body) ); | 			strbuilder_append_fmt( result, "%S\n{\n%SB\n}", self->Name, body_to_strbuilder(self->Body) ); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "enum %S\n{\n%SB\n}", self->Name, body_to_string(self->Body) ); | 		strbuilder_append_fmt( result, "enum %S\n{\n%SB\n}", self->Name, body_to_strbuilder(self->Body) ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | ||||||
| @@ -427,9 +427,9 @@ void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result ) | |||||||
| 	strbuilder_append_str( result, txt("enum class ") ); | 	strbuilder_append_str( result, txt("enum class ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "%S : %SB", self->Name, typename_to_string(self->UnderlyingType) ); | 	strbuilder_append_fmt( result, "%S : %SB", self->Name, typename_to_strbuilder(self->UnderlyingType) ); | ||||||
|  |  | ||||||
| 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | ||||||
| 	{ | 	{ | ||||||
| @@ -440,7 +440,7 @@ void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder exec_to_string(CodeExec exec) | StrBuilder exec_to_strbuilder(CodeExec exec) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(exec); | 	GEN_ASSERT(exec); | ||||||
| 	char* raw = ccast(char*, str_duplicate( exec->Content, GlobalAllocator ).Ptr); | 	char* raw = ccast(char*, str_duplicate( exec->Content, GlobalAllocator ).Ptr); | ||||||
| @@ -448,15 +448,15 @@ StrBuilder exec_to_string(CodeExec exec) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
|  |  | ||||||
| void extern_to_string(CodeExtern self, StrBuilder* result ) | void extern_to_strbuilder(CodeExtern self, StrBuilder* result ) | ||||||
| { | { | ||||||
| 	if ( self->Body ) | 	if ( self->Body ) | ||||||
| 		strbuilder_append_fmt( result, "extern \"%S\"\n{\n%SB\n}\n", self->Name, body_to_string(self->Body) ); | 		strbuilder_append_fmt( result, "extern \"%S\"\n{\n%SB\n}\n", self->Name, body_to_strbuilder(self->Body) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "extern \"%S\"\n{}\n", self->Name ); | 		strbuilder_append_fmt( result, "extern \"%S\"\n{}\n", self->Name ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder include_to_string(CodeInclude include) | StrBuilder include_to_strbuilder(CodeInclude include) | ||||||
| { | { | ||||||
| 	return strbuilder_fmt_buf( GlobalAllocator, "#include %S\n", include->Content ); | 	return strbuilder_fmt_buf( GlobalAllocator, "#include %S\n", include->Content ); | ||||||
| } | } | ||||||
| @@ -466,7 +466,7 @@ void include_to_strbuilder_ref( CodeInclude include, StrBuilder* result ) | |||||||
| 	strbuilder_append_fmt( result, "#include %S\n", include->Content ); | 	strbuilder_append_fmt( result, "#include %S\n", include->Content ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder friend_to_string(CodeFriend self) | StrBuilder friend_to_strbuilder(CodeFriend self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | ||||||
| 	friend_to_strbuilder_ref( self, & result ); | 	friend_to_strbuilder_ref( self, & result ); | ||||||
| @@ -475,7 +475,7 @@ StrBuilder friend_to_string(CodeFriend self) | |||||||
|  |  | ||||||
| void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result ) | void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result ) | ||||||
| { | { | ||||||
| 	strbuilder_append_fmt( result, "friend %SB", code_to_string(self->Declaration) ); | 	strbuilder_append_fmt( result, "friend %SB", code_to_strbuilder(self->Declaration) ); | ||||||
|  |  | ||||||
| 	if ( self->Declaration->Type != CT_Function && self->Declaration->Type != CT_Operator && (* result)[ strbuilder_length(* result) - 1 ] != ';' ) | 	if ( self->Declaration->Type != CT_Function && self->Declaration->Type != CT_Operator && (* result)[ strbuilder_length(* result) - 1 ] != ';' ) | ||||||
| 	{ | 	{ | ||||||
| @@ -488,7 +488,7 @@ void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("\n")); | 		strbuilder_append_str( result, txt("\n")); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder fn_to_string(CodeFn self) | StrBuilder fn_to_strbuilder(CodeFn self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -509,7 +509,7 @@ void fn_to_strbuilder_def(CodeFn self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export") ); | 		strbuilder_append_str( result, txt("export") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, " %SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, " %SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	bool prefix_specs = false; | 	bool prefix_specs = false; | ||||||
| 	if ( self->Specs ) | 	if ( self->Specs ) | ||||||
| @@ -530,13 +530,13 @@ void fn_to_strbuilder_def(CodeFn self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("\n") ); | 		strbuilder_append_str( result, txt("\n") ); | ||||||
|  |  | ||||||
| 	if ( self->ReturnType ) | 	if ( self->ReturnType ) | ||||||
| 		strbuilder_append_fmt( result, "%SB %S(", typename_to_string(self->ReturnType), self->Name ); | 		strbuilder_append_fmt( result, "%SB %S(", typename_to_strbuilder(self->ReturnType), self->Name ); | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "%S(", self->Name ); | 		strbuilder_append_fmt( result, "%S(", self->Name ); | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "%SB)", params_to_string(self->Params) ); | 		strbuilder_append_fmt( result, "%SB)", params_to_strbuilder(self->Params) ); | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_str( result, txt(")") ); | 		strbuilder_append_str( result, txt(")") ); | ||||||
| @@ -553,7 +553,7 @@ void fn_to_strbuilder_def(CodeFn self, StrBuilder* result ) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n", body_to_string(self->Body) ); | 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n", body_to_strbuilder(self->Body) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | ||||||
| @@ -562,7 +562,7 @@ void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	b32 prefix_specs = false; | 	b32 prefix_specs = false; | ||||||
| 	if ( self->Specs ) | 	if ( self->Specs ) | ||||||
| @@ -585,13 +585,13 @@ void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->ReturnType ) | 	if ( self->ReturnType ) | ||||||
| 		strbuilder_append_fmt( result, "%SB %S(", typename_to_string(self->ReturnType), self->Name ); | 		strbuilder_append_fmt( result, "%SB %S(", typename_to_strbuilder(self->ReturnType), self->Name ); | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "%S(", self->Name ); | 		strbuilder_append_fmt( result, "%S(", self->Name ); | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "%SB)", params_to_string(self->Params) ); | 		strbuilder_append_fmt( result, "%SB)", params_to_strbuilder(self->Params) ); | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_str( result, txt(")") ); | 		strbuilder_append_str( result, txt(")") ); | ||||||
| @@ -611,7 +611,7 @@ void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | |||||||
| 	if ( self->Specs && specifiers_has(self->Specs, Spec_Pure ) >= 0 ) | 	if ( self->Specs && specifiers_has(self->Specs, Spec_Pure ) >= 0 ) | ||||||
| 		strbuilder_append_str( result, txt(" = 0;") ); | 		strbuilder_append_str( result, txt(" = 0;") ); | ||||||
| 	else if (self->Body) | 	else if (self->Body) | ||||||
| 		strbuilder_append_fmt( result, " = %SB;", body_to_string(self->Body) ); | 		strbuilder_append_fmt( result, " = %SB;", body_to_strbuilder(self->Body) ); | ||||||
|  |  | ||||||
| 	if ( self->InlineCmt ) | 	if ( self->InlineCmt ) | ||||||
| 		strbuilder_append_fmt( result, ";  %S", self->InlineCmt->Content ); | 		strbuilder_append_fmt( result, ";  %S", self->InlineCmt->Content ); | ||||||
| @@ -619,7 +619,7 @@ void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt(";\n") ); | 		strbuilder_append_str( result, txt(";\n") ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder module_to_string(CodeModule self) | StrBuilder module_to_strbuilder(CodeModule self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 64 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 64 ); | ||||||
| 	module_to_strbuilder_ref( self, & result ); | 	module_to_strbuilder_ref( self, & result ); | ||||||
| @@ -637,7 +637,7 @@ void module_to_strbuilder_ref(CodeModule self, StrBuilder* result ) | |||||||
| 	strbuilder_append_fmt( result, "%S;\n", self->Name ); | 	strbuilder_append_fmt( result, "%S;\n", self->Name ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder namespace_to_string(CodeNS self) | StrBuilder namespace_to_strbuilder(CodeNS self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | ||||||
| 	namespace_to_strbuilder_ref( self, & result ); | 	namespace_to_strbuilder_ref( self, & result ); | ||||||
| @@ -649,10 +649,10 @@ void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result ) | |||||||
| 	if ( bitfield_is_equal( u32, self->ModuleFlags, ModuleFlag_Export )) | 	if ( bitfield_is_equal( u32, self->ModuleFlags, ModuleFlag_Export )) | ||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "namespace %S\n{\n%SB\n}\n", self->Name, body_to_string(self->Body) ); | 	strbuilder_append_fmt( result, "namespace %S\n{\n%SB\n}\n", self->Name, body_to_strbuilder(self->Body) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder code_op_to_string(CodeOperator self) | StrBuilder code_op_to_strbuilder(CodeOperator self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -675,10 +675,10 @@ void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->Specs ) | 	if ( self->Specs ) | ||||||
| 	{ | 	{ | ||||||
| @@ -698,10 +698,10 @@ void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->ReturnType ) | 	if ( self->ReturnType ) | ||||||
| 		strbuilder_append_fmt( result, "%SB %S (", typename_to_string(self->ReturnType), self->Name ); | 		strbuilder_append_fmt( result, "%SB %S (", typename_to_strbuilder(self->ReturnType), self->Name ); | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "%SB)", params_to_string(self->Params) ); | 		strbuilder_append_fmt( result, "%SB)", params_to_strbuilder(self->Params) ); | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_str( result, txt(")") ); | 		strbuilder_append_str( result, txt(")") ); | ||||||
| @@ -719,7 +719,7 @@ void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n" | 	strbuilder_append_fmt( result, "\n{\n%SB\n}\n" | ||||||
| 		, body_to_string(self->Body) | 		, body_to_strbuilder(self->Body) | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -729,7 +729,7 @@ void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB\n", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB\n", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->Specs ) | 	if ( self->Specs ) | ||||||
| 	{ | 	{ | ||||||
| @@ -748,10 +748,10 @@ void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("\n") ); | 		strbuilder_append_str( result, txt("\n") ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "%SB %S (", typename_to_string(self->ReturnType), self->Name ); | 	strbuilder_append_fmt( result, "%SB %S (", typename_to_strbuilder(self->ReturnType), self->Name ); | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "%SB)", params_to_string(self->Params) ); | 		strbuilder_append_fmt( result, "%SB)", params_to_strbuilder(self->Params) ); | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, ")" ); | 		strbuilder_append_fmt( result, ")" ); | ||||||
| @@ -774,7 +774,7 @@ void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt(";\n") ); | 		strbuilder_append_str( result, txt(";\n") ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder opcast_to_string(CodeOpCast self) | StrBuilder opcast_to_strbuilder(CodeOpCast self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -803,9 +803,9 @@ void opcast_to_strbuilder_def(CodeOpCast self, StrBuilder* result ) | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ( self->Name.Ptr && self->Name.Len ) | 		if ( self->Name.Ptr && self->Name.Len ) | ||||||
| 			strbuilder_append_fmt( result, "%S operator %SB()", self->Name, typename_to_string(self->ValueType) ); | 			strbuilder_append_fmt( result, "%S operator %SB()", self->Name, typename_to_strbuilder(self->ValueType) ); | ||||||
| 		else | 		else | ||||||
| 			strbuilder_append_fmt( result, "operator %SB()", typename_to_string(self->ValueType) ); | 			strbuilder_append_fmt( result, "operator %SB()", typename_to_strbuilder(self->ValueType) ); | ||||||
|  |  | ||||||
| 		for ( Specifier* spec = begin_CodeSpecifiers(self->Specs); spec != end_CodeSpecifiers(self->Specs); spec = next_CodeSpecifiers(self->Specs, spec) ) | 		for ( Specifier* spec = begin_CodeSpecifiers(self->Specs); spec != end_CodeSpecifiers(self->Specs); spec = next_CodeSpecifiers(self->Specs, spec) ) | ||||||
| 		{ | 		{ | ||||||
| @@ -816,14 +816,14 @@ void opcast_to_strbuilder_def(CodeOpCast self, StrBuilder* result ) | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		strbuilder_append_fmt( result, "\n{\n%SB\n}\n", body_to_string(self->Body) ); | 		strbuilder_append_fmt( result, "\n{\n%SB\n}\n", body_to_strbuilder(self->Body) ); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->Name.Ptr && self->Name.Len ) | 	if ( self->Name.Ptr && self->Name.Len ) | ||||||
| 		strbuilder_append_fmt( result, "%S operator %SB()\n{\n%SB\n}\n", self->Name, typename_to_string(self->ValueType), body_to_string(self->Body) ); | 		strbuilder_append_fmt( result, "%S operator %SB()\n{\n%SB\n}\n", self->Name, typename_to_strbuilder(self->ValueType), body_to_strbuilder(self->Body) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "operator %SB()\n{\n%SB\n}\n", typename_to_string(self->ValueType), body_to_string(self->Body) ); | 		strbuilder_append_fmt( result, "operator %SB()\n{\n%SB\n}\n", typename_to_strbuilder(self->ValueType), body_to_strbuilder(self->Body) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| void opcast_to_strbuilder_fwd(CodeOpCast self, StrBuilder* result ) | void opcast_to_strbuilder_fwd(CodeOpCast self, StrBuilder* result ) | ||||||
| @@ -839,7 +839,7 @@ void opcast_to_strbuilder_fwd(CodeOpCast self, StrBuilder* result ) | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		strbuilder_append_fmt( result, "operator %SB()", typename_to_string(self->ValueType) ); | 		strbuilder_append_fmt( result, "operator %SB()", typename_to_strbuilder(self->ValueType) ); | ||||||
|  |  | ||||||
| 		for ( Specifier* spec = begin_CodeSpecifiers(self->Specs); spec != end_CodeSpecifiers(self->Specs); spec = next_CodeSpecifiers(self->Specs, spec) ) | 		for ( Specifier* spec = begin_CodeSpecifiers(self->Specs); spec != end_CodeSpecifiers(self->Specs); spec = next_CodeSpecifiers(self->Specs, spec) ) | ||||||
| 		{ | 		{ | ||||||
| @@ -858,12 +858,12 @@ void opcast_to_strbuilder_fwd(CodeOpCast self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->InlineCmt ) | 	if ( self->InlineCmt ) | ||||||
| 		strbuilder_append_fmt( result, "operator %SB();  %SB", typename_to_string(self->ValueType) ); | 		strbuilder_append_fmt( result, "operator %SB();  %SB", typename_to_strbuilder(self->ValueType) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "operator %SB();\n", typename_to_string(self->ValueType) ); | 		strbuilder_append_fmt( result, "operator %SB();\n", typename_to_strbuilder(self->ValueType) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder params_to_string(CodeParams self) | StrBuilder params_to_strbuilder(CodeParams self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| @@ -888,30 +888,30 @@ void params_to_strbuilder_ref( CodeParams self, StrBuilder* result ) | |||||||
| 		if ( self->ValueType == nullptr ) | 		if ( self->ValueType == nullptr ) | ||||||
| 			strbuilder_append_fmt( result, " %S", self->Name ); | 			strbuilder_append_fmt( result, " %S", self->Name ); | ||||||
| 		else | 		else | ||||||
| 			strbuilder_append_fmt( result, " %SB %S", typename_to_string(self->ValueType), self->Name ); | 			strbuilder_append_fmt( result, " %SB %S", typename_to_strbuilder(self->ValueType), self->Name ); | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
| 	else if ( self->ValueType ) | 	else if ( self->ValueType ) | ||||||
| 		strbuilder_append_fmt( result, " %SB", typename_to_string(self->ValueType) ); | 		strbuilder_append_fmt( result, " %SB", typename_to_strbuilder(self->ValueType) ); | ||||||
|  |  | ||||||
| 	if ( self->PostNameMacro ) | 	if ( self->PostNameMacro ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, " %SB", code_to_string(self->PostNameMacro) ); | 		strbuilder_append_fmt( result, " %SB", code_to_strbuilder(self->PostNameMacro) ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->Value ) | 	if ( self->Value ) | ||||||
| 		strbuilder_append_fmt( result, " = %SB", code_to_string(self->Value) ); | 		strbuilder_append_fmt( result, " = %SB", code_to_strbuilder(self->Value) ); | ||||||
|  |  | ||||||
| 	if ( self->NumEntries - 1 > 0 ) | 	if ( self->NumEntries - 1 > 0 ) | ||||||
| 	{ | 	{ | ||||||
| 		for ( CodeParams param = begin_CodeParams(self->Next); param != end_CodeParams(self->Next); param = next_CodeParams(self->Next, param) ) | 		for ( CodeParams param = begin_CodeParams(self->Next); param != end_CodeParams(self->Next); param = next_CodeParams(self->Next, param) ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, ", %SB", params_to_string(param) ); | 			strbuilder_append_fmt( result, ", %SB", params_to_strbuilder(param) ); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder preprocess_to_string(CodePreprocessCond self) | StrBuilder preprocess_to_strbuilder(CodePreprocessCond self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | ||||||
| @@ -975,7 +975,7 @@ void preprocess_to_strbuilder_endif(CodePreprocessCond cond, StrBuilder* result | |||||||
| 	strbuilder_append_str( result, txt("#endif\n") ); | 	strbuilder_append_str( result, txt("#endif\n") ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder pragma_to_string(CodePragma self) | StrBuilder pragma_to_strbuilder(CodePragma self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | ||||||
| @@ -988,7 +988,7 @@ void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result ) | |||||||
| 	strbuilder_append_fmt( result, "#pragma %S\n", self->Content ); | 	strbuilder_append_fmt( result, "#pragma %S\n", self->Content ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder specifiers_to_string(CodeSpecifiers self) | StrBuilder specifiers_to_strbuilder(CodeSpecifiers self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 64 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 64 ); | ||||||
| 	specifiers_to_strbuilder_ref( self, & result ); | 	specifiers_to_strbuilder_ref( self, & result ); | ||||||
| @@ -1009,7 +1009,7 @@ void specifiers_to_strbuilder_ref( CodeSpecifiers self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder struct_to_string(CodeStruct self) | StrBuilder struct_to_strbuilder(CodeStruct self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| @@ -1037,14 +1037,14 @@ void struct_to_strbuilder_def( CodeStruct self, StrBuilder* result ) | |||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->ParentType ) | 	if ( self->ParentType ) | ||||||
| 	{ | 	{ | ||||||
| 		Str access_level = access_spec_to_str( self->ParentAccess ); | 		Str access_level = access_spec_to_str( self->ParentAccess ); | ||||||
|  |  | ||||||
| 		strbuilder_append_fmt( result, "%S : %S %SB", self->Name, access_level, typename_to_string(self->ParentType) ); | 		strbuilder_append_fmt( result, "%S : %S %SB", self->Name, access_level, typename_to_strbuilder(self->ParentType) ); | ||||||
|  |  | ||||||
| 		CodeTypename interface = cast(CodeTypename, self->ParentType->Next); | 		CodeTypename interface = cast(CodeTypename, self->ParentType->Next); | ||||||
| 		if ( interface ) | 		if ( interface ) | ||||||
| @@ -1052,7 +1052,7 @@ void struct_to_strbuilder_def( CodeStruct self, StrBuilder* result ) | |||||||
|  |  | ||||||
| 		while ( interface ) | 		while ( interface ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, ", %SB", typename_to_string(interface) ); | 			strbuilder_append_fmt( result, ", %SB", typename_to_strbuilder(interface) ); | ||||||
| 			interface = interface->Next ? cast( CodeTypename, interface->Next) : NullCode; | 			interface = interface->Next ? cast( CodeTypename, interface->Next) : NullCode; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -1066,7 +1066,7 @@ void struct_to_strbuilder_def( CodeStruct self, StrBuilder* result ) | |||||||
| 		strbuilder_append_fmt( result, " // %S", self->InlineCmt->Content ); | 		strbuilder_append_fmt( result, " // %S", self->InlineCmt->Content ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( result, "\n{\n%SB\n}", body_to_string(self->Body) ); | 	strbuilder_append_fmt( result, "\n{\n%SB\n}", body_to_strbuilder(self->Body) ); | ||||||
|  |  | ||||||
| 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | 	if ( self->Parent == nullptr || ( self->Parent->Type != CT_Typedef && self->Parent->Type != CT_Variable ) ) | ||||||
| 		strbuilder_append_str( result, txt(";\n")); | 		strbuilder_append_str( result, txt(";\n")); | ||||||
| @@ -1080,7 +1080,7 @@ void struct_to_strbuilder_fwd( CodeStruct self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "struct %SB %S", attributes_to_string(self->Attributes), self->Name ); | 		strbuilder_append_fmt( result, "struct %SB %S", attributes_to_strbuilder(self->Attributes), self->Name ); | ||||||
|  |  | ||||||
| 	else strbuilder_append_fmt( result, "struct %S", self->Name ); | 	else strbuilder_append_fmt( result, "struct %S", self->Name ); | ||||||
|  |  | ||||||
| @@ -1093,7 +1093,7 @@ void struct_to_strbuilder_fwd( CodeStruct self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder template_to_string(CodeTemplate self) | StrBuilder template_to_strbuilder(CodeTemplate self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 1024 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 1024 ); | ||||||
| @@ -1109,12 +1109,12 @@ void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Params ) | 	if ( self->Params ) | ||||||
| 		strbuilder_append_fmt( result, "template< %SB >\n%SB", params_to_string(self->Params), code_to_string(self->Declaration) ); | 		strbuilder_append_fmt( result, "template< %SB >\n%SB", params_to_strbuilder(self->Params), code_to_strbuilder(self->Declaration) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "template<>\n%SB", code_to_string(self->Declaration) ); | 		strbuilder_append_fmt( result, "template<>\n%SB", code_to_strbuilder(self->Declaration) ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder typedef_to_string(CodeTypedef self) | StrBuilder typedef_to_strbuilder(CodeTypedef self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | ||||||
| 	typedef_to_strbuilder_ref( self, & result ); | 	typedef_to_strbuilder_ref( self, & result ); | ||||||
| @@ -1130,18 +1130,18 @@ void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result ) | |||||||
|  |  | ||||||
| 	// Determines if the typedef is a function typename | 	// Determines if the typedef is a function typename | ||||||
| 	if ( self->UnderlyingType->ReturnType ) | 	if ( self->UnderlyingType->ReturnType ) | ||||||
| 		strbuilder_append_string( result, code_to_string(self->UnderlyingType) ); | 		strbuilder_append_string( result, code_to_strbuilder(self->UnderlyingType) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "%SB %S", code_to_string(self->UnderlyingType), self->Name ); | 		strbuilder_append_fmt( result, "%SB %S", code_to_strbuilder(self->UnderlyingType), self->Name ); | ||||||
|  |  | ||||||
| 	if ( self->UnderlyingType->Type == CT_Typename && self->UnderlyingType->ArrExpr ) | 	if ( self->UnderlyingType->Type == CT_Typename && self->UnderlyingType->ArrExpr ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "[ %SB ];", code_to_string(self->UnderlyingType->ArrExpr) ); | 		strbuilder_append_fmt( result, "[ %SB ];", code_to_strbuilder(self->UnderlyingType->ArrExpr) ); | ||||||
|  |  | ||||||
| 		Code next_arr_expr = self->UnderlyingType->ArrExpr->Next; | 		Code next_arr_expr = self->UnderlyingType->ArrExpr->Next; | ||||||
| 		while ( next_arr_expr ) | 		while ( next_arr_expr ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "[ %SB ];", code_to_string(next_arr_expr) ); | 			strbuilder_append_fmt( result, "[ %SB ];", code_to_strbuilder(next_arr_expr) ); | ||||||
| 			next_arr_expr = next_arr_expr->Next; | 			next_arr_expr = next_arr_expr->Next; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -1156,7 +1156,7 @@ void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("\n")); | 		strbuilder_append_str( result, txt("\n")); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder typename_to_string(CodeTypename self) | StrBuilder typename_to_strbuilder(CodeTypename self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_str( GlobalAllocator, txt("") ); | 	StrBuilder result = strbuilder_make_str( GlobalAllocator, txt("") ); | ||||||
| 	typename_to_strbuilder_ref( self, & result ); | 	typename_to_strbuilder_ref( self, & result ); | ||||||
| @@ -1169,13 +1169,13 @@ void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result ) | |||||||
| 		if ( self->ReturnType && self->Params ) | 		if ( self->ReturnType && self->Params ) | ||||||
| 		{ | 		{ | ||||||
| 			if ( self->Attributes ) | 			if ( self->Attributes ) | ||||||
| 				strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 				strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 				if ( self->Specs ) | 				if ( self->Specs ) | ||||||
| 					strbuilder_append_fmt( result, "%SB ( %S ) ( %SB ) %SB", typename_to_string(self->ReturnType), self->Name, params_to_string(self->Params), specifiers_to_string(self->Specs) ); | 					strbuilder_append_fmt( result, "%SB ( %S ) ( %SB ) %SB", typename_to_strbuilder(self->ReturnType), self->Name, params_to_strbuilder(self->Params), specifiers_to_strbuilder(self->Specs) ); | ||||||
| 				else | 				else | ||||||
| 					strbuilder_append_fmt( result, "%SB ( %S ) ( %SB )", typename_to_string(self->ReturnType), self->Name, params_to_string(self->Params) ); | 					strbuilder_append_fmt( result, "%SB ( %S ) ( %SB )", typename_to_strbuilder(self->ReturnType), self->Name, params_to_strbuilder(self->Params) ); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			break; | 			break; | ||||||
| @@ -1184,13 +1184,13 @@ void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result ) | |||||||
| 		if ( self->ReturnType && self->Params ) | 		if ( self->ReturnType && self->Params ) | ||||||
| 		{ | 		{ | ||||||
| 			if ( self->Attributes ) | 			if ( self->Attributes ) | ||||||
| 				strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 				strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 				if ( self->Specs ) | 				if ( self->Specs ) | ||||||
| 					strbuilder_append_fmt( result, "%SB %S ( %SB ) %SB", typename_to_string(self->ReturnType), self->Name, params_to_string(self->Params), specifiers_to_string(self->Specs) ); | 					strbuilder_append_fmt( result, "%SB %S ( %SB ) %SB", typename_to_strbuilder(self->ReturnType), self->Name, params_to_strbuilder(self->Params), specifiers_to_strbuilder(self->Specs) ); | ||||||
| 				else | 				else | ||||||
| 					strbuilder_append_fmt( result, "%SB %S ( %SB )", typename_to_string(self->ReturnType), self->Name, params_to_string(self->Params) ); | 					strbuilder_append_fmt( result, "%SB %S ( %SB )", typename_to_strbuilder(self->ReturnType), self->Name, params_to_strbuilder(self->Params) ); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			return; | 			return; | ||||||
| @@ -1198,7 +1198,7 @@ void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result ) | |||||||
| 	#endif | 	#endif | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	switch ( self->TypeTag ) | 	switch ( self->TypeTag ) | ||||||
| 	{ | 	{ | ||||||
| @@ -1211,7 +1211,7 @@ void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->Specs ) | 	if ( self->Specs ) | ||||||
| 		strbuilder_append_fmt( result, "%S %SB", self->Name, specifiers_to_string(self->Specs) ); | 		strbuilder_append_fmt( result, "%S %SB", self->Name, specifiers_to_strbuilder(self->Specs) ); | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "%S", self->Name ); | 		strbuilder_append_fmt( result, "%S", self->Name ); | ||||||
|  |  | ||||||
| @@ -1219,7 +1219,7 @@ void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("...")); | 		strbuilder_append_str( result, txt("...")); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder union_to_string(CodeUnion self) | StrBuilder union_to_strbuilder(CodeUnion self) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 512 ); | ||||||
| 	switch ( self->Type ) | 	switch ( self->Type ) | ||||||
| @@ -1242,20 +1242,20 @@ void union_to_strbuilder_def(CodeUnion self, StrBuilder* result ) | |||||||
| 	strbuilder_append_str( result, txt("union ") ); | 	strbuilder_append_str( result, txt("union ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->Name.Len ) | 	if ( self->Name.Len ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "%S\n{\n%SB\n}" | 		strbuilder_append_fmt( result, "%S\n{\n%SB\n}" | ||||||
| 			, self->Name | 			, self->Name | ||||||
| 			, body_to_string(self->Body) | 			, body_to_strbuilder(self->Body) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
| 		// Anonymous union | 		// Anonymous union | ||||||
| 		strbuilder_append_fmt( result, "\n{\n%SB\n}" | 		strbuilder_append_fmt( result, "\n{\n%SB\n}" | ||||||
| 			, body_to_string(self->Body) | 			, body_to_strbuilder(self->Body) | ||||||
| 		); | 		); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -1273,7 +1273,7 @@ void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result ) | |||||||
| 	strbuilder_append_str( result, txt("union ") ); | 	strbuilder_append_str( result, txt("union ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->Name.Len ) | 	if ( self->Name.Len ) | ||||||
| 	{ | 	{ | ||||||
| @@ -1284,7 +1284,7 @@ void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt(";\n")); | 		strbuilder_append_str( result, txt(";\n")); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder using_to_string(CodeUsing self) | StrBuilder using_to_strbuilder(CodeUsing self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 128 ); | ||||||
| @@ -1308,20 +1308,20 @@ void using_to_strbuilder_ref(CodeUsing self, StrBuilder* result ) | |||||||
| 		strbuilder_append_str( result, txt("export ") ); | 		strbuilder_append_str( result, txt("export ") ); | ||||||
|  |  | ||||||
| 	if ( self->Attributes ) | 	if ( self->Attributes ) | ||||||
| 		strbuilder_append_fmt( result, "%SB ", attributes_to_string(self->Attributes) ); | 		strbuilder_append_fmt( result, "%SB ", attributes_to_strbuilder(self->Attributes) ); | ||||||
|  |  | ||||||
| 	if ( self->UnderlyingType ) | 	if ( self->UnderlyingType ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "using %S = %SB", self->Name, typename_to_string(self->UnderlyingType) ); | 		strbuilder_append_fmt( result, "using %S = %SB", self->Name, typename_to_strbuilder(self->UnderlyingType) ); | ||||||
|  |  | ||||||
| 		if ( self->UnderlyingType->ArrExpr ) | 		if ( self->UnderlyingType->ArrExpr ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "[ %SB ]", code_to_string(self->UnderlyingType->ArrExpr) ); | 			strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(self->UnderlyingType->ArrExpr) ); | ||||||
|  |  | ||||||
| 			Code next_arr_expr = self->UnderlyingType->ArrExpr->Next; | 			Code next_arr_expr = self->UnderlyingType->ArrExpr->Next; | ||||||
| 			while ( next_arr_expr ) | 			while ( next_arr_expr ) | ||||||
| 			{ | 			{ | ||||||
| 				strbuilder_append_fmt( result, "[ %SB ]", code_to_string(next_arr_expr) ); | 				strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(next_arr_expr) ); | ||||||
| 				next_arr_expr = next_arr_expr->Next; | 				next_arr_expr = next_arr_expr->Next; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -1349,7 +1349,7 @@ void using_to_strbuilder_ns(CodeUsing self, StrBuilder* result ) | |||||||
| } | } | ||||||
|  |  | ||||||
| inline | inline | ||||||
| StrBuilder var_to_string(CodeVar self) | StrBuilder var_to_strbuilder(CodeVar self) | ||||||
| { | { | ||||||
| 	GEN_ASSERT(self); | 	GEN_ASSERT(self); | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, 256 ); | ||||||
| @@ -1367,18 +1367,18 @@ void var_to_strbuilder_ref(CodeVar self, StrBuilder* result ) | |||||||
| 		// Its a comma-separated variable ( a NextVar ) | 		// Its a comma-separated variable ( a NextVar ) | ||||||
|  |  | ||||||
| 		if ( self->Specs ) | 		if ( self->Specs ) | ||||||
| 			strbuilder_append_fmt( result, "%SB ", specifiers_to_string(self->Specs) ); | 			strbuilder_append_fmt( result, "%SB ", specifiers_to_strbuilder(self->Specs) ); | ||||||
|  |  | ||||||
| 		strbuilder_append_str( result, self->Name ); | 		strbuilder_append_str( result, self->Name ); | ||||||
|  |  | ||||||
| 		if ( self->ValueType->ArrExpr ) | 		if ( self->ValueType->ArrExpr ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "[ %SB ]", code_to_string(self->ValueType->ArrExpr) ); | 			strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(self->ValueType->ArrExpr) ); | ||||||
|  |  | ||||||
| 			Code next_arr_expr = self->ValueType->ArrExpr->Next; | 			Code next_arr_expr = self->ValueType->ArrExpr->Next; | ||||||
| 			while ( next_arr_expr ) | 			while ( next_arr_expr ) | ||||||
| 			{ | 			{ | ||||||
| 				strbuilder_append_fmt( result, "[ %SB ]", code_to_string(next_arr_expr) ); | 				strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(next_arr_expr) ); | ||||||
| 				next_arr_expr = next_arr_expr->Next; | 				next_arr_expr = next_arr_expr->Next; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -1386,14 +1386,14 @@ void var_to_strbuilder_ref(CodeVar self, StrBuilder* result ) | |||||||
| 		if ( self->Value ) | 		if ( self->Value ) | ||||||
| 		{ | 		{ | ||||||
| 			if ( self->VarParenthesizedInit ) | 			if ( self->VarParenthesizedInit ) | ||||||
| 				strbuilder_append_fmt( result, "( %SB ", code_to_string(self->Value) ); | 				strbuilder_append_fmt( result, "( %SB ", code_to_strbuilder(self->Value) ); | ||||||
| 			else | 			else | ||||||
| 				strbuilder_append_fmt( result, " = %SB", code_to_string(self->Value) ); | 				strbuilder_append_fmt( result, " = %SB", code_to_strbuilder(self->Value) ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Keep the chain going... | 		// Keep the chain going... | ||||||
| 		if ( self->NextVar ) | 		if ( self->NextVar ) | ||||||
| 			strbuilder_append_fmt( result, ", %SB", var_to_string(self->NextVar) ); | 			strbuilder_append_fmt( result, ", %SB", var_to_strbuilder(self->NextVar) ); | ||||||
|  |  | ||||||
| 		if ( self->VarParenthesizedInit ) | 		if ( self->VarParenthesizedInit ) | ||||||
| 			strbuilder_append_str( result, txt(" )")); | 			strbuilder_append_str( result, txt(" )")); | ||||||
| @@ -1407,38 +1407,38 @@ void var_to_strbuilder_ref(CodeVar self, StrBuilder* result ) | |||||||
| 	if ( self->Attributes || self->Specs ) | 	if ( self->Attributes || self->Specs ) | ||||||
| 	{ | 	{ | ||||||
| 		if ( self->Attributes ) | 		if ( self->Attributes ) | ||||||
| 			strbuilder_append_fmt( result, "%SB ", specifiers_to_string(self->Specs) ); | 			strbuilder_append_fmt( result, "%SB ", specifiers_to_strbuilder(self->Specs) ); | ||||||
|  |  | ||||||
| 		if ( self->Specs ) | 		if ( self->Specs ) | ||||||
| 			strbuilder_append_fmt( result, "%SB\n", specifiers_to_string(self->Specs) ); | 			strbuilder_append_fmt( result, "%SB\n", specifiers_to_strbuilder(self->Specs) ); | ||||||
|  |  | ||||||
| 		strbuilder_append_fmt( result, "%SB %S", typename_to_string(self->ValueType), self->Name ); | 		strbuilder_append_fmt( result, "%SB %S", typename_to_strbuilder(self->ValueType), self->Name ); | ||||||
|  |  | ||||||
| 		if ( self->ValueType->ArrExpr ) | 		if ( self->ValueType && self->ValueType->ArrExpr ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "[ %SB ]", code_to_string(self->ValueType->ArrExpr) ); | 			strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(self->ValueType->ArrExpr) ); | ||||||
|  |  | ||||||
| 			Code next_arr_expr = self->ValueType->ArrExpr->Next; | 			Code next_arr_expr = self->ValueType->ArrExpr->Next; | ||||||
| 			while ( next_arr_expr ) | 			while ( next_arr_expr ) | ||||||
| 			{ | 			{ | ||||||
| 				strbuilder_append_fmt( result, "[ %SB ]", code_to_string(next_arr_expr) ); | 				strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(next_arr_expr) ); | ||||||
| 				next_arr_expr = next_arr_expr->Next; | 				next_arr_expr = next_arr_expr->Next; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ( self->BitfieldSize ) | 		if ( self->BitfieldSize ) | ||||||
| 			strbuilder_append_fmt( result, " : %SB", code_to_string(self->BitfieldSize) ); | 			strbuilder_append_fmt( result, " : %SB", code_to_strbuilder(self->BitfieldSize) ); | ||||||
|  |  | ||||||
| 		if ( self->Value ) | 		if ( self->Value ) | ||||||
| 		{ | 		{ | ||||||
| 			if ( self->VarParenthesizedInit ) | 			if ( self->VarParenthesizedInit ) | ||||||
| 				strbuilder_append_fmt( result, "( %SB ", code_to_string(self->Value) ); | 				strbuilder_append_fmt( result, "( %SB ", code_to_strbuilder(self->Value) ); | ||||||
| 			else | 			else | ||||||
| 				strbuilder_append_fmt( result, " = %SB", code_to_string(self->Value) ); | 				strbuilder_append_fmt( result, " = %SB", code_to_strbuilder(self->Value) ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ( self->NextVar ) | 		if ( self->NextVar ) | ||||||
| 			strbuilder_append_fmt( result, ", %SB", var_to_string(self->NextVar) ); | 			strbuilder_append_fmt( result, ", %SB", var_to_strbuilder(self->NextVar) ); | ||||||
|  |  | ||||||
| 		if ( self->VarParenthesizedInit ) | 		if ( self->VarParenthesizedInit ) | ||||||
| 			strbuilder_append_str( result, txt(" )")); | 			strbuilder_append_str( result, txt(" )")); | ||||||
| @@ -1452,33 +1452,33 @@ void var_to_strbuilder_ref(CodeVar self, StrBuilder* result ) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->BitfieldSize ) | 	if ( self->BitfieldSize ) | ||||||
| 		strbuilder_append_fmt( result, "%SB %S : %SB", typename_to_string(self->ValueType), self->Name, code_to_string(self->BitfieldSize) ); | 		strbuilder_append_fmt( result, "%SB %S : %SB", typename_to_strbuilder(self->ValueType), self->Name, code_to_strbuilder(self->BitfieldSize) ); | ||||||
|  |  | ||||||
| 	else if ( self->ValueType->ArrExpr ) | 	else if ( self->ValueType->ArrExpr ) | ||||||
| 	{ | 	{ | ||||||
| 		strbuilder_append_fmt( result, "%SB %S[ %SB ]", typename_to_string(self->ValueType), self->Name, code_to_string(self->ValueType->ArrExpr) ); | 		strbuilder_append_fmt( result, "%SB %S[ %SB ]", typename_to_strbuilder(self->ValueType), self->Name, code_to_strbuilder(self->ValueType->ArrExpr) ); | ||||||
|  |  | ||||||
| 		Code next_arr_expr = self->ValueType->ArrExpr->Next; | 		Code next_arr_expr = self->ValueType->ArrExpr->Next; | ||||||
| 		while ( next_arr_expr ) | 		while ( next_arr_expr ) | ||||||
| 		{ | 		{ | ||||||
| 			strbuilder_append_fmt( result, "[ %SB ]", code_to_string(next_arr_expr) ); | 			strbuilder_append_fmt( result, "[ %SB ]", code_to_strbuilder(next_arr_expr) ); | ||||||
| 			next_arr_expr = next_arr_expr->Next; | 			next_arr_expr = next_arr_expr->Next; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	else | 	else | ||||||
| 		strbuilder_append_fmt( result, "%SB %S", typename_to_string(self->ValueType), self->Name ); | 		strbuilder_append_fmt( result, "%SB %S", typename_to_strbuilder(self->ValueType), self->Name ); | ||||||
|  |  | ||||||
| 	if ( self->Value ) | 	if ( self->Value ) | ||||||
| 	{ | 	{ | ||||||
| 		if ( self->VarParenthesizedInit ) | 		if ( self->VarParenthesizedInit ) | ||||||
| 			strbuilder_append_fmt( result, "( %SB ", code_to_string(self->Value) ); | 			strbuilder_append_fmt( result, "( %SB ", code_to_strbuilder(self->Value) ); | ||||||
| 		else | 		else | ||||||
| 			strbuilder_append_fmt( result, " = %SB", code_to_string(self->Value) ); | 			strbuilder_append_fmt( result, " = %SB", code_to_strbuilder(self->Value) ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if ( self->NextVar ) | 	if ( self->NextVar ) | ||||||
| 		strbuilder_append_fmt( result, ", %SB", var_to_string( self->NextVar) ); | 		strbuilder_append_fmt( result, ", %SB", var_to_strbuilder( self->NextVar) ); | ||||||
|  |  | ||||||
| 	if ( self->VarParenthesizedInit ) | 	if ( self->VarParenthesizedInit ) | ||||||
| 		strbuilder_append_str( result, txt(" )")); | 		strbuilder_append_str( result, txt(" )")); | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -64,7 +64,7 @@ inline AST_Attributes* CodeAttributes::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -95,7 +95,7 @@ inline AST_Comment* CodeComment::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -126,7 +126,7 @@ inline AST_Constructor* CodeConstructor::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -173,7 +173,7 @@ inline AST_Define* CodeDefine::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -204,7 +204,7 @@ inline AST_Destructor* CodeDestructor::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -235,7 +235,7 @@ inline AST_Enum* CodeEnum::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -266,7 +266,7 @@ inline AST_Exec* CodeExec::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -297,7 +297,7 @@ inline AST_Extern* CodeExtern::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -328,7 +328,7 @@ inline AST_Friend* CodeFriend::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -359,7 +359,7 @@ inline AST_Fn* CodeFn::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -390,7 +390,7 @@ inline AST_Include* CodeInclude::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -421,7 +421,7 @@ inline AST_Module* CodeModule::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -452,7 +452,7 @@ inline AST_NS* CodeNS::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -483,7 +483,7 @@ inline AST_Operator* CodeOperator::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -514,7 +514,7 @@ inline AST_OpCast* CodeOpCast::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -561,7 +561,7 @@ inline AST_Pragma* CodePragma::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -592,7 +592,7 @@ inline AST_PreprocessCond* CodePreprocessCond::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -655,7 +655,7 @@ inline AST_Template* CodeTemplate::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -686,7 +686,7 @@ inline AST_Typename* CodeTypename::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -717,7 +717,7 @@ inline AST_Typedef* CodeTypedef::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -748,7 +748,7 @@ inline AST_Union* CodeUnion::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -779,7 +779,7 @@ inline AST_Using* CodeUsing::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
| @@ -810,7 +810,7 @@ inline AST_Var* CodeVar::operator->() | |||||||
| { | { | ||||||
| 	if ( ast == nullptr ) | 	if ( ast == nullptr ) | ||||||
| 	{ | 	{ | ||||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 		return nullptr; | 		return nullptr; | ||||||
| 	} | 	} | ||||||
| 	return ast; | 	return ast; | ||||||
|   | |||||||
| @@ -75,67 +75,67 @@ enum CodeType : u32 | |||||||
| inline Str codetype_to_str( CodeType type ) | inline Str codetype_to_str( CodeType type ) | ||||||
| { | { | ||||||
| 	local_persist Str lookup[61] = { | 	local_persist Str lookup[61] = { | ||||||
| 		{ sizeof( "Invalid" ),             "Invalid"             }, | 		{ "Invalid",             sizeof( "Invalid" ) - 1             }, | ||||||
| 		{ sizeof( "Untyped" ),             "Untyped"             }, | 		{ "Untyped",             sizeof( "Untyped" ) - 1             }, | ||||||
| 		{ sizeof( "NewLine" ),             "NewLine"             }, | 		{ "NewLine",             sizeof( "NewLine" ) - 1             }, | ||||||
| 		{ sizeof( "Comment" ),             "Comment"             }, | 		{ "Comment",             sizeof( "Comment" ) - 1             }, | ||||||
| 		{ sizeof( "Access_Private" ),      "Access_Private"      }, | 		{ "Access_Private",      sizeof( "Access_Private" ) - 1      }, | ||||||
| 		{ sizeof( "Access_Protected" ),    "Access_Protected"    }, | 		{ "Access_Protected",    sizeof( "Access_Protected" ) - 1    }, | ||||||
| 		{ sizeof( "Access_Public" ),       "Access_Public"       }, | 		{ "Access_Public",       sizeof( "Access_Public" ) - 1       }, | ||||||
| 		{ sizeof( "PlatformAttributes" ),  "PlatformAttributes"  }, | 		{ "PlatformAttributes",  sizeof( "PlatformAttributes" ) - 1  }, | ||||||
| 		{ sizeof( "Class" ),               "Class"               }, | 		{ "Class",               sizeof( "Class" ) - 1               }, | ||||||
| 		{ sizeof( "Class_Fwd" ),           "Class_Fwd"           }, | 		{ "Class_Fwd",           sizeof( "Class_Fwd" ) - 1           }, | ||||||
| 		{ sizeof( "Class_Body" ),          "Class_Body"          }, | 		{ "Class_Body",          sizeof( "Class_Body" ) - 1          }, | ||||||
| 		{ sizeof( "Constructor" ),         "Constructor"         }, | 		{ "Constructor",         sizeof( "Constructor" ) - 1         }, | ||||||
| 		{ sizeof( "Constructor_Fwd" ),     "Constructor_Fwd"     }, | 		{ "Constructor_Fwd",     sizeof( "Constructor_Fwd" ) - 1     }, | ||||||
| 		{ sizeof( "Destructor" ),          "Destructor"          }, | 		{ "Destructor",          sizeof( "Destructor" ) - 1          }, | ||||||
| 		{ sizeof( "Destructor_Fwd" ),      "Destructor_Fwd"      }, | 		{ "Destructor_Fwd",      sizeof( "Destructor_Fwd" ) - 1      }, | ||||||
| 		{ sizeof( "Enum" ),                "Enum"                }, | 		{ "Enum",                sizeof( "Enum" ) - 1                }, | ||||||
| 		{ sizeof( "Enum_Fwd" ),            "Enum_Fwd"            }, | 		{ "Enum_Fwd",            sizeof( "Enum_Fwd" ) - 1            }, | ||||||
| 		{ sizeof( "Enum_Body" ),           "Enum_Body"           }, | 		{ "Enum_Body",           sizeof( "Enum_Body" ) - 1           }, | ||||||
| 		{ sizeof( "Enum_Class" ),          "Enum_Class"          }, | 		{ "Enum_Class",          sizeof( "Enum_Class" ) - 1          }, | ||||||
| 		{ sizeof( "Enum_Class_Fwd" ),      "Enum_Class_Fwd"      }, | 		{ "Enum_Class_Fwd",      sizeof( "Enum_Class_Fwd" ) - 1      }, | ||||||
| 		{ sizeof( "Execution" ),           "Execution"           }, | 		{ "Execution",           sizeof( "Execution" ) - 1           }, | ||||||
| 		{ sizeof( "Export_Body" ),         "Export_Body"         }, | 		{ "Export_Body",         sizeof( "Export_Body" ) - 1         }, | ||||||
| 		{ sizeof( "Extern_Linkage" ),      "Extern_Linkage"      }, | 		{ "Extern_Linkage",      sizeof( "Extern_Linkage" ) - 1      }, | ||||||
| 		{ sizeof( "Extern_Linkage_Body" ), "Extern_Linkage_Body" }, | 		{ "Extern_Linkage_Body", sizeof( "Extern_Linkage_Body" ) - 1 }, | ||||||
| 		{ sizeof( "Friend" ),              "Friend"              }, | 		{ "Friend",              sizeof( "Friend" ) - 1              }, | ||||||
| 		{ sizeof( "Function" ),            "Function"            }, | 		{ "Function",            sizeof( "Function" ) - 1            }, | ||||||
| 		{ sizeof( "Function_Fwd" ),        "Function_Fwd"        }, | 		{ "Function_Fwd",        sizeof( "Function_Fwd" ) - 1        }, | ||||||
| 		{ sizeof( "Function_Body" ),       "Function_Body"       }, | 		{ "Function_Body",       sizeof( "Function_Body" ) - 1       }, | ||||||
| 		{ sizeof( "Global_Body" ),         "Global_Body"         }, | 		{ "Global_Body",         sizeof( "Global_Body" ) - 1         }, | ||||||
| 		{ sizeof( "Module" ),              "Module"              }, | 		{ "Module",              sizeof( "Module" ) - 1              }, | ||||||
| 		{ sizeof( "Namespace" ),           "Namespace"           }, | 		{ "Namespace",           sizeof( "Namespace" ) - 1           }, | ||||||
| 		{ sizeof( "Namespace_Body" ),      "Namespace_Body"      }, | 		{ "Namespace_Body",      sizeof( "Namespace_Body" ) - 1      }, | ||||||
| 		{ sizeof( "Operator" ),            "Operator"            }, | 		{ "Operator",            sizeof( "Operator" ) - 1            }, | ||||||
| 		{ sizeof( "Operator_Fwd" ),        "Operator_Fwd"        }, | 		{ "Operator_Fwd",        sizeof( "Operator_Fwd" ) - 1        }, | ||||||
| 		{ sizeof( "Operator_Member" ),     "Operator_Member"     }, | 		{ "Operator_Member",     sizeof( "Operator_Member" ) - 1     }, | ||||||
| 		{ sizeof( "Operator_Member_Fwd" ), "Operator_Member_Fwd" }, | 		{ "Operator_Member_Fwd", sizeof( "Operator_Member_Fwd" ) - 1 }, | ||||||
| 		{ sizeof( "Operator_Cast" ),       "Operator_Cast"       }, | 		{ "Operator_Cast",       sizeof( "Operator_Cast" ) - 1       }, | ||||||
| 		{ sizeof( "Operator_Cast_Fwd" ),   "Operator_Cast_Fwd"   }, | 		{ "Operator_Cast_Fwd",   sizeof( "Operator_Cast_Fwd" ) - 1   }, | ||||||
| 		{ sizeof( "Parameters" ),          "Parameters"          }, | 		{ "Parameters",          sizeof( "Parameters" ) - 1          }, | ||||||
| 		{ sizeof( "Preprocess_Define" ),   "Preprocess_Define"   }, | 		{ "Preprocess_Define",   sizeof( "Preprocess_Define" ) - 1   }, | ||||||
| 		{ sizeof( "Preprocess_Include" ),  "Preprocess_Include"  }, | 		{ "Preprocess_Include",  sizeof( "Preprocess_Include" ) - 1  }, | ||||||
| 		{ sizeof( "Preprocess_If" ),       "Preprocess_If"       }, | 		{ "Preprocess_If",       sizeof( "Preprocess_If" ) - 1       }, | ||||||
| 		{ sizeof( "Preprocess_IfDef" ),    "Preprocess_IfDef"    }, | 		{ "Preprocess_IfDef",    sizeof( "Preprocess_IfDef" ) - 1    }, | ||||||
| 		{ sizeof( "Preprocess_IfNotDef" ), "Preprocess_IfNotDef" }, | 		{ "Preprocess_IfNotDef", sizeof( "Preprocess_IfNotDef" ) - 1 }, | ||||||
| 		{ sizeof( "Preprocess_ElIf" ),     "Preprocess_ElIf"     }, | 		{ "Preprocess_ElIf",     sizeof( "Preprocess_ElIf" ) - 1     }, | ||||||
| 		{ sizeof( "Preprocess_Else" ),     "Preprocess_Else"     }, | 		{ "Preprocess_Else",     sizeof( "Preprocess_Else" ) - 1     }, | ||||||
| 		{ sizeof( "Preprocess_EndIf" ),    "Preprocess_EndIf"    }, | 		{ "Preprocess_EndIf",    sizeof( "Preprocess_EndIf" ) - 1    }, | ||||||
| 		{ sizeof( "Preprocess_Pragma" ),   "Preprocess_Pragma"   }, | 		{ "Preprocess_Pragma",   sizeof( "Preprocess_Pragma" ) - 1   }, | ||||||
| 		{ sizeof( "Specifiers" ),          "Specifiers"          }, | 		{ "Specifiers",          sizeof( "Specifiers" ) - 1          }, | ||||||
| 		{ sizeof( "Struct" ),              "Struct"              }, | 		{ "Struct",              sizeof( "Struct" ) - 1              }, | ||||||
| 		{ sizeof( "Struct_Fwd" ),          "Struct_Fwd"          }, | 		{ "Struct_Fwd",          sizeof( "Struct_Fwd" ) - 1          }, | ||||||
| 		{ sizeof( "Struct_Body" ),         "Struct_Body"         }, | 		{ "Struct_Body",         sizeof( "Struct_Body" ) - 1         }, | ||||||
| 		{ sizeof( "Template" ),            "Template"            }, | 		{ "Template",            sizeof( "Template" ) - 1            }, | ||||||
| 		{ sizeof( "Typedef" ),             "Typedef"             }, | 		{ "Typedef",             sizeof( "Typedef" ) - 1             }, | ||||||
| 		{ sizeof( "Typename" ),            "Typename"            }, | 		{ "Typename",            sizeof( "Typename" ) - 1            }, | ||||||
| 		{ sizeof( "Union" ),               "Union"               }, | 		{ "Union",               sizeof( "Union" ) - 1               }, | ||||||
| 		{ sizeof( "Union_Fwd" ),           "Union_Fwd"           }, | 		{ "Union_Fwd",           sizeof( "Union_Fwd" ) - 1           }, | ||||||
| 		{ sizeof( "Union_Body" ),          "Union_Body"          }, | 		{ "Union_Body",          sizeof( "Union_Body" ) - 1          }, | ||||||
| 		{ sizeof( "Using" ),               "Using"               }, | 		{ "Using",               sizeof( "Using" ) - 1               }, | ||||||
| 		{ sizeof( "Using_Namespace" ),     "Using_Namespace"     }, | 		{ "Using_Namespace",     sizeof( "Using_Namespace" ) - 1     }, | ||||||
| 		{ sizeof( "Variable" ),            "Variable"            }, | 		{ "Variable",            sizeof( "Variable" ) - 1            }, | ||||||
| 	}; | 	}; | ||||||
| 	return lookup[type]; | 	return lookup[type]; | ||||||
| } | } | ||||||
| @@ -143,67 +143,67 @@ inline Str codetype_to_str( CodeType type ) | |||||||
| inline Str codetype_to_keyword_str( CodeType type ) | inline Str codetype_to_keyword_str( CodeType type ) | ||||||
| { | { | ||||||
| 	local_persist Str lookup[61] = { | 	local_persist Str lookup[61] = { | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "//" ) - 1,              "//"              }, | 		{ "//",              sizeof( "//" ) - 1              }, | ||||||
| 		{ sizeof( "private" ) - 1,         "private"         }, | 		{ "private",         sizeof( "private" ) - 1         }, | ||||||
| 		{ sizeof( "protected" ) - 1,       "protected"       }, | 		{ "protected",       sizeof( "protected" ) - 1       }, | ||||||
| 		{ sizeof( "public" ) - 1,          "public"          }, | 		{ "public",          sizeof( "public" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "class" ) - 1,           "class"           }, | 		{ "class",           sizeof( "class" ) - 1           }, | ||||||
| 		{ sizeof( "clsss" ) - 1,           "clsss"           }, | 		{ "clsss",           sizeof( "clsss" ) - 1           }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "enum" ) - 1,            "enum"            }, | 		{ "enum",            sizeof( "enum" ) - 1            }, | ||||||
| 		{ sizeof( "enum" ) - 1,            "enum"            }, | 		{ "enum",            sizeof( "enum" ) - 1            }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "enum class" ) - 1,      "enum class"      }, | 		{ "enum class",      sizeof( "enum class" ) - 1      }, | ||||||
| 		{ sizeof( "enum class" ) - 1,      "enum class"      }, | 		{ "enum class",      sizeof( "enum class" ) - 1      }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "extern" ) - 1,          "extern"          }, | 		{ "extern",          sizeof( "extern" ) - 1          }, | ||||||
| 		{ sizeof( "extern" ) - 1,          "extern"          }, | 		{ "extern",          sizeof( "extern" ) - 1          }, | ||||||
| 		{ sizeof( "friend" ) - 1,          "friend"          }, | 		{ "friend",          sizeof( "friend" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "module" ) - 1,          "module"          }, | 		{ "module",          sizeof( "module" ) - 1          }, | ||||||
| 		{ sizeof( "namespace" ) - 1,       "namespace"       }, | 		{ "namespace",       sizeof( "namespace" ) - 1       }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | 		{ "operator",        sizeof( "operator" ) - 1        }, | ||||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | 		{ "operator",        sizeof( "operator" ) - 1        }, | ||||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | 		{ "operator",        sizeof( "operator" ) - 1        }, | ||||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | 		{ "operator",        sizeof( "operator" ) - 1        }, | ||||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | 		{ "operator",        sizeof( "operator" ) - 1        }, | ||||||
| 		{ sizeof( "operator" ) - 1,        "operator"        }, | 		{ "operator",        sizeof( "operator" ) - 1        }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "define" ) - 1,          "define"          }, | 		{ "define",          sizeof( "define" ) - 1          }, | ||||||
| 		{ sizeof( "include" ) - 1,         "include"         }, | 		{ "include",         sizeof( "include" ) - 1         }, | ||||||
| 		{ sizeof( "if" ) - 1,              "if"              }, | 		{ "if",              sizeof( "if" ) - 1              }, | ||||||
| 		{ sizeof( "ifdef" ) - 1,           "ifdef"           }, | 		{ "ifdef",           sizeof( "ifdef" ) - 1           }, | ||||||
| 		{ sizeof( "ifndef" ) - 1,          "ifndef"          }, | 		{ "ifndef",          sizeof( "ifndef" ) - 1          }, | ||||||
| 		{ sizeof( "elif" ) - 1,            "elif"            }, | 		{ "elif",            sizeof( "elif" ) - 1            }, | ||||||
| 		{ sizeof( "else" ) - 1,            "else"            }, | 		{ "else",            sizeof( "else" ) - 1            }, | ||||||
| 		{ sizeof( "endif" ) - 1,           "endif"           }, | 		{ "endif",           sizeof( "endif" ) - 1           }, | ||||||
| 		{ sizeof( "pragma" ) - 1,          "pragma"          }, | 		{ "pragma",          sizeof( "pragma" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "struct" ) - 1,          "struct"          }, | 		{ "struct",          sizeof( "struct" ) - 1          }, | ||||||
| 		{ sizeof( "struct" ) - 1,          "struct"          }, | 		{ "struct",          sizeof( "struct" ) - 1          }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "template" ) - 1,        "template"        }, | 		{ "template",        sizeof( "template" ) - 1        }, | ||||||
| 		{ sizeof( "typedef" ) - 1,         "typedef"         }, | 		{ "typedef",         sizeof( "typedef" ) - 1         }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "union" ) - 1,           "union"           }, | 		{ "union",           sizeof( "union" ) - 1           }, | ||||||
| 		{ sizeof( "union" ) - 1,           "union"           }, | 		{ "union",           sizeof( "union" ) - 1           }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 		{ sizeof( "using" ) - 1,           "using"           }, | 		{ "using",           sizeof( "using" ) - 1           }, | ||||||
| 		{ sizeof( "using namespace" ) - 1, "using namespace" }, | 		{ "using namespace", sizeof( "using namespace" ) - 1 }, | ||||||
| 		{ sizeof( "__NA__" ) - 1,          "__NA__"          }, | 		{ "__NA__",          sizeof( "__NA__" ) - 1          }, | ||||||
| 	}; | 	}; | ||||||
| 	return lookup[type]; | 	return lookup[type]; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -61,53 +61,53 @@ enum Operator : u32 | |||||||
| inline Str operator_to_str( Operator op ) | inline Str operator_to_str( Operator op ) | ||||||
| { | { | ||||||
| 	local_persist Str lookup[47] = { | 	local_persist Str lookup[47] = { | ||||||
| 		{ sizeof( "INVALID" ),  "INVALID"  }, | 		{ "INVALID",  sizeof( "INVALID" ) - 1  }, | ||||||
| 		{ sizeof( "=" ),        "="        }, | 		{ "=",        sizeof( "=" ) - 1        }, | ||||||
| 		{ sizeof( "+=" ),       "+="       }, | 		{ "+=",       sizeof( "+=" ) - 1       }, | ||||||
| 		{ sizeof( "-=" ),       "-="       }, | 		{ "-=",       sizeof( "-=" ) - 1       }, | ||||||
| 		{ sizeof( "*=" ),       "*="       }, | 		{ "*=",       sizeof( "*=" ) - 1       }, | ||||||
| 		{ sizeof( "/=" ),       "/="       }, | 		{ "/=",       sizeof( "/=" ) - 1       }, | ||||||
| 		{ sizeof( "%=" ),       "%="       }, | 		{ "%=",       sizeof( "%=" ) - 1       }, | ||||||
| 		{ sizeof( "&=" ),       "&="       }, | 		{ "&=",       sizeof( "&=" ) - 1       }, | ||||||
| 		{ sizeof( "|=" ),       "|="       }, | 		{ "|=",       sizeof( "|=" ) - 1       }, | ||||||
| 		{ sizeof( "^=" ),       "^="       }, | 		{ "^=",       sizeof( "^=" ) - 1       }, | ||||||
| 		{ sizeof( "<<=" ),      "<<="      }, | 		{ "<<=",      sizeof( "<<=" ) - 1      }, | ||||||
| 		{ sizeof( ">>=" ),      ">>="      }, | 		{ ">>=",      sizeof( ">>=" ) - 1      }, | ||||||
| 		{ sizeof( "++" ),       "++"       }, | 		{ "++",       sizeof( "++" ) - 1       }, | ||||||
| 		{ sizeof( "--" ),       "--"       }, | 		{ "--",       sizeof( "--" ) - 1       }, | ||||||
| 		{ sizeof( "+" ),        "+"        }, | 		{ "+",        sizeof( "+" ) - 1        }, | ||||||
| 		{ sizeof( "-" ),        "-"        }, | 		{ "-",        sizeof( "-" ) - 1        }, | ||||||
| 		{ sizeof( "!" ),        "!"        }, | 		{ "!",        sizeof( "!" ) - 1        }, | ||||||
| 		{ sizeof( "+" ),        "+"        }, | 		{ "+",        sizeof( "+" ) - 1        }, | ||||||
| 		{ sizeof( "-" ),        "-"        }, | 		{ "-",        sizeof( "-" ) - 1        }, | ||||||
| 		{ sizeof( "*" ),        "*"        }, | 		{ "*",        sizeof( "*" ) - 1        }, | ||||||
| 		{ sizeof( "/" ),        "/"        }, | 		{ "/",        sizeof( "/" ) - 1        }, | ||||||
| 		{ sizeof( "%" ),        "%"        }, | 		{ "%",        sizeof( "%" ) - 1        }, | ||||||
| 		{ sizeof( "~" ),        "~"        }, | 		{ "~",        sizeof( "~" ) - 1        }, | ||||||
| 		{ sizeof( "&" ),        "&"        }, | 		{ "&",        sizeof( "&" ) - 1        }, | ||||||
| 		{ sizeof( "|" ),        "|"        }, | 		{ "|",        sizeof( "|" ) - 1        }, | ||||||
| 		{ sizeof( "^" ),        "^"        }, | 		{ "^",        sizeof( "^" ) - 1        }, | ||||||
| 		{ sizeof( "<<" ),       "<<"       }, | 		{ "<<",       sizeof( "<<" ) - 1       }, | ||||||
| 		{ sizeof( ">>" ),       ">>"       }, | 		{ ">>",       sizeof( ">>" ) - 1       }, | ||||||
| 		{ sizeof( "&&" ),       "&&"       }, | 		{ "&&",       sizeof( "&&" ) - 1       }, | ||||||
| 		{ sizeof( "||" ),       "||"       }, | 		{ "||",       sizeof( "||" ) - 1       }, | ||||||
| 		{ sizeof( "==" ),       "=="       }, | 		{ "==",       sizeof( "==" ) - 1       }, | ||||||
| 		{ sizeof( "!=" ),       "!="       }, | 		{ "!=",       sizeof( "!=" ) - 1       }, | ||||||
| 		{ sizeof( "<" ),        "<"        }, | 		{ "<",        sizeof( "<" ) - 1        }, | ||||||
| 		{ sizeof( ">" ),        ">"        }, | 		{ ">",        sizeof( ">" ) - 1        }, | ||||||
| 		{ sizeof( "<=" ),       "<="       }, | 		{ "<=",       sizeof( "<=" ) - 1       }, | ||||||
| 		{ sizeof( ">=" ),       ">="       }, | 		{ ">=",       sizeof( ">=" ) - 1       }, | ||||||
| 		{ sizeof( "[]" ),       "[]"       }, | 		{ "[]",       sizeof( "[]" ) - 1       }, | ||||||
| 		{ sizeof( "*" ),        "*"        }, | 		{ "*",        sizeof( "*" ) - 1        }, | ||||||
| 		{ sizeof( "&" ),        "&"        }, | 		{ "&",        sizeof( "&" ) - 1        }, | ||||||
| 		{ sizeof( "->" ),       "->"       }, | 		{ "->",       sizeof( "->" ) - 1       }, | ||||||
| 		{ sizeof( "->*" ),      "->*"      }, | 		{ "->*",      sizeof( "->*" ) - 1      }, | ||||||
| 		{ sizeof( "()" ),       "()"       }, | 		{ "()",       sizeof( "()" ) - 1       }, | ||||||
| 		{ sizeof( "," ),        ","        }, | 		{ ",",        sizeof( "," ) - 1        }, | ||||||
| 		{ sizeof( "new" ),      "new"      }, | 		{ "new",      sizeof( "new" ) - 1      }, | ||||||
| 		{ sizeof( "new[]" ),    "new[]"    }, | 		{ "new[]",    sizeof( "new[]" ) - 1    }, | ||||||
| 		{ sizeof( "delete" ),   "delete"   }, | 		{ "delete",   sizeof( "delete" ) - 1   }, | ||||||
| 		{ sizeof( "delete[]" ), "delete[]" }, | 		{ "delete[]", sizeof( "delete[]" ) - 1 }, | ||||||
| 	}; | 	}; | ||||||
| 	return lookup[op]; | 	return lookup[op]; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -40,32 +40,32 @@ enum Specifier : u32 | |||||||
| inline Str spec_to_str( Specifier type ) | inline Str spec_to_str( Specifier type ) | ||||||
| { | { | ||||||
| 	local_persist Str lookup[26] = { | 	local_persist Str lookup[26] = { | ||||||
| 		{ sizeof( "INVALID" ),       "INVALID"       }, | 		{ "INVALID",       sizeof( "INVALID" ) - 1       }, | ||||||
| 		{ sizeof( "consteval" ),     "consteval"     }, | 		{ "consteval",     sizeof( "consteval" ) - 1     }, | ||||||
| 		{ sizeof( "constexpr" ),     "constexpr"     }, | 		{ "constexpr",     sizeof( "constexpr" ) - 1     }, | ||||||
| 		{ sizeof( "constinit" ),     "constinit"     }, | 		{ "constinit",     sizeof( "constinit" ) - 1     }, | ||||||
| 		{ sizeof( "explicit" ),      "explicit"      }, | 		{ "explicit",      sizeof( "explicit" ) - 1      }, | ||||||
| 		{ sizeof( "extern" ),        "extern"        }, | 		{ "extern",        sizeof( "extern" ) - 1        }, | ||||||
| 		{ sizeof( "forceinline" ),   "forceinline"   }, | 		{ "forceinline",   sizeof( "forceinline" ) - 1   }, | ||||||
| 		{ sizeof( "global" ),        "global"        }, | 		{ "global",        sizeof( "global" ) - 1        }, | ||||||
| 		{ sizeof( "inline" ),        "inline"        }, | 		{ "inline",        sizeof( "inline" ) - 1        }, | ||||||
| 		{ sizeof( "internal" ),      "internal"      }, | 		{ "internal",      sizeof( "internal" ) - 1      }, | ||||||
| 		{ sizeof( "local_persist" ), "local_persist" }, | 		{ "local_persist", sizeof( "local_persist" ) - 1 }, | ||||||
| 		{ sizeof( "mutable" ),       "mutable"       }, | 		{ "mutable",       sizeof( "mutable" ) - 1       }, | ||||||
| 		{ sizeof( "neverinline" ),   "neverinline"   }, | 		{ "neverinline",   sizeof( "neverinline" ) - 1   }, | ||||||
| 		{ sizeof( "*" ),             "*"             }, | 		{ "*",             sizeof( "*" ) - 1             }, | ||||||
| 		{ sizeof( "&" ),             "&"             }, | 		{ "&",             sizeof( "&" ) - 1             }, | ||||||
| 		{ sizeof( "register" ),      "register"      }, | 		{ "register",      sizeof( "register" ) - 1      }, | ||||||
| 		{ sizeof( "&&" ),            "&&"            }, | 		{ "&&",            sizeof( "&&" ) - 1            }, | ||||||
| 		{ sizeof( "static" ),        "static"        }, | 		{ "static",        sizeof( "static" ) - 1        }, | ||||||
| 		{ sizeof( "thread_local" ),  "thread_local"  }, | 		{ "thread_local",  sizeof( "thread_local" ) - 1  }, | ||||||
| 		{ sizeof( "virtual" ),       "virtual"       }, | 		{ "virtual",       sizeof( "virtual" ) - 1       }, | ||||||
| 		{ sizeof( "const" ),         "const"         }, | 		{ "const",         sizeof( "const" ) - 1         }, | ||||||
| 		{ sizeof( "final" ),         "final"         }, | 		{ "final",         sizeof( "final" ) - 1         }, | ||||||
| 		{ sizeof( "noexcept" ),      "noexcept"      }, | 		{ "noexcept",      sizeof( "noexcept" ) - 1      }, | ||||||
| 		{ sizeof( "override" ),      "override"      }, | 		{ "override",      sizeof( "override" ) - 1      }, | ||||||
| 		{ sizeof( "= 0" ),           "= 0"           }, | 		{ "= 0",           sizeof( "= 0" ) - 1           }, | ||||||
| 		{ sizeof( "volatile" ),      "volatile"      }, | 		{ "volatile",      sizeof( "volatile" ) - 1      }, | ||||||
| 	}; | 	}; | ||||||
| 	return lookup[type]; | 	return lookup[type]; | ||||||
| } | } | ||||||
| @@ -81,7 +81,7 @@ inline Specifier str_to_specifier( Str str ) | |||||||
| 	do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ ) | 	do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ ) | ||||||
| 	{ | 	{ | ||||||
| 		Str enum_str  = spec_to_str( (Specifier)index ); | 		Str enum_str  = spec_to_str( (Specifier)index ); | ||||||
| 		keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 ); | 		keymap[index] = crc32( enum_str.Ptr, enum_str.Len ); | ||||||
| 	} | 	} | ||||||
| 	do_once_end u32 hash = crc32( str.Ptr, str.Len ); | 	do_once_end u32 hash = crc32( str.Ptr, str.Len ); | ||||||
| 	for ( u32 index = 0; index < Spec_NumSpecifiers; index++ ) | 	for ( u32 index = 0; index < Spec_NumSpecifiers; index++ ) | ||||||
|   | |||||||
| @@ -114,103 +114,103 @@ enum TokType : u32 | |||||||
| inline Str toktype_to_str( TokType type ) | inline Str toktype_to_str( TokType type ) | ||||||
| { | { | ||||||
| 	local_persist Str lookup[] = { | 	local_persist Str lookup[] = { | ||||||
| 		{ sizeof( "__invalid__" ),         "__invalid__"         }, | 		{ "__invalid__",         sizeof( "__invalid__" ) - 1         }, | ||||||
| 		{ sizeof( "private" ),             "private"             }, | 		{ "private",             sizeof( "private" ) - 1             }, | ||||||
| 		{ sizeof( "protected" ),           "protected"           }, | 		{ "protected",           sizeof( "protected" ) - 1           }, | ||||||
| 		{ sizeof( "public" ),              "public"              }, | 		{ "public",              sizeof( "public" ) - 1              }, | ||||||
| 		{ sizeof( "." ),                   "."                   }, | 		{ ".",		           sizeof( "." ) - 1                   }, | ||||||
| 		{ sizeof( "::" ),                  "::"                  }, | 		{ "::",		          sizeof( "::" ) - 1                  }, | ||||||
| 		{ sizeof( "&" ),                   "&"                   }, | 		{ "&",		           sizeof( "&" ) - 1                   }, | ||||||
| 		{ sizeof( "&&" ),                  "&&"                  }, | 		{ "&&",		          sizeof( "&&" ) - 1                  }, | ||||||
| 		{ sizeof( ":" ),                   ":"                   }, | 		{ ":",		           sizeof( ":" ) - 1                   }, | ||||||
| 		{ sizeof( "[[" ),                  "[["                  }, | 		{ "[[",		          sizeof( "[[" ) - 1                  }, | ||||||
| 		{ sizeof( "]]" ),                  "]]"                  }, | 		{ "]]",		          sizeof( "]]" ) - 1                  }, | ||||||
| 		{ sizeof( "{" ),                   "{"                   }, | 		{ "{",		           sizeof( "{" ) - 1                   }, | ||||||
| 		{ sizeof( "}" ),                   "}"                   }, | 		{ "}",		           sizeof( "}" ) - 1                   }, | ||||||
| 		{ sizeof( "[" ),                   "["                   }, | 		{ "[",		           sizeof( "[" ) - 1                   }, | ||||||
| 		{ sizeof( "]" ),                   "]"                   }, | 		{ "]",		           sizeof( "]" ) - 1                   }, | ||||||
| 		{ sizeof( "(" ),                   "("                   }, | 		{ "(",		           sizeof( "(" ) - 1                   }, | ||||||
| 		{ sizeof( ")" ),                   ")"                   }, | 		{ ")",		           sizeof( ")" ) - 1                   }, | ||||||
| 		{ sizeof( "__comment__" ),         "__comment__"         }, | 		{ "__comment__",         sizeof( "__comment__" ) - 1         }, | ||||||
| 		{ sizeof( "__comment_end__" ),     "__comment_end__"     }, | 		{ "__comment_end__",     sizeof( "__comment_end__" ) - 1     }, | ||||||
| 		{ sizeof( "__comment_start__" ),   "__comment_start__"   }, | 		{ "__comment_start__",   sizeof( "__comment_start__" ) - 1   }, | ||||||
| 		{ sizeof( "__character__" ),       "__character__"       }, | 		{ "__character__",       sizeof( "__character__" ) - 1       }, | ||||||
| 		{ sizeof( "," ),                   ","                   }, | 		{ ",",		           sizeof( "," ) - 1                   }, | ||||||
| 		{ sizeof( "class" ),               "class"               }, | 		{ "class",               sizeof( "class" ) - 1               }, | ||||||
| 		{ sizeof( "__attribute__" ),       "__attribute__"       }, | 		{ "__attribute__",       sizeof( "__attribute__" ) - 1       }, | ||||||
| 		{ sizeof( "__declspec" ),          "__declspec"          }, | 		{ "__declspec",          sizeof( "__declspec" ) - 1          }, | ||||||
| 		{ sizeof( "enum" ),                "enum"                }, | 		{ "enum",                sizeof( "enum" ) - 1                }, | ||||||
| 		{ sizeof( "extern" ),              "extern"              }, | 		{ "extern",              sizeof( "extern" ) - 1              }, | ||||||
| 		{ sizeof( "friend" ),              "friend"              }, | 		{ "friend",              sizeof( "friend" ) - 1              }, | ||||||
| 		{ sizeof( "module" ),              "module"              }, | 		{ "module",              sizeof( "module" ) - 1              }, | ||||||
| 		{ sizeof( "namespace" ),           "namespace"           }, | 		{ "namespace",           sizeof( "namespace" ) - 1           }, | ||||||
| 		{ sizeof( "operator" ),            "operator"            }, | 		{ "operator",            sizeof( "operator" ) - 1            }, | ||||||
| 		{ sizeof( "struct" ),              "struct"              }, | 		{ "struct",              sizeof( "struct" ) - 1              }, | ||||||
| 		{ sizeof( "template" ),            "template"            }, | 		{ "template",            sizeof( "template" ) - 1            }, | ||||||
| 		{ sizeof( "typedef" ),             "typedef"             }, | 		{ "typedef",             sizeof( "typedef" ) - 1             }, | ||||||
| 		{ sizeof( "using" ),               "using"               }, | 		{ "using",               sizeof( "using" ) - 1               }, | ||||||
| 		{ sizeof( "union" ),               "union"               }, | 		{ "union",               sizeof( "union" ) - 1               }, | ||||||
| 		{ sizeof( "__identifier__" ),      "__identifier__"      }, | 		{ "__identifier__",      sizeof( "__identifier__" ) - 1      }, | ||||||
| 		{ sizeof( "import" ),              "import"              }, | 		{ "import",              sizeof( "import" ) - 1              }, | ||||||
| 		{ sizeof( "export" ),              "export"              }, | 		{ "export",              sizeof( "export" ) - 1              }, | ||||||
| 		{ sizeof( "__new_line__" ),        "__new_line__"        }, | 		{ "__new_line__",        sizeof( "__new_line__" ) - 1        }, | ||||||
| 		{ sizeof( "__number__" ),          "__number__"          }, | 		{ "__number__",          sizeof( "__number__" ) - 1          }, | ||||||
| 		{ sizeof( "__operator__" ),        "__operator__"        }, | 		{ "__operator__",        sizeof( "__operator__" ) - 1        }, | ||||||
| 		{ sizeof( "#" ),                   "#"                   }, | 		{ "#",		           sizeof( "#" ) - 1                   }, | ||||||
| 		{ sizeof( "define" ),              "define"              }, | 		{ "define",              sizeof( "define" ) - 1              }, | ||||||
| 		{ sizeof( "if" ),                  "if"                  }, | 		{ "if",		          sizeof( "if" ) - 1                  }, | ||||||
| 		{ sizeof( "ifdef" ),               "ifdef"               }, | 		{ "ifdef",               sizeof( "ifdef" ) - 1               }, | ||||||
| 		{ sizeof( "ifndef" ),              "ifndef"              }, | 		{ "ifndef",              sizeof( "ifndef" ) - 1              }, | ||||||
| 		{ sizeof( "elif" ),                "elif"                }, | 		{ "elif",                sizeof( "elif" ) - 1                }, | ||||||
| 		{ sizeof( "else" ),                "else"                }, | 		{ "else",                sizeof( "else" ) - 1                }, | ||||||
| 		{ sizeof( "endif" ),               "endif"               }, | 		{ "endif",               sizeof( "endif" ) - 1               }, | ||||||
| 		{ sizeof( "include" ),             "include"             }, | 		{ "include",             sizeof( "include" ) - 1             }, | ||||||
| 		{ sizeof( "pragma" ),              "pragma"              }, | 		{ "pragma",              sizeof( "pragma" ) - 1              }, | ||||||
| 		{ sizeof( "__macro_content__" ),   "__macro_content__"   }, | 		{ "__macro_content__",   sizeof( "__macro_content__" ) - 1   }, | ||||||
| 		{ sizeof( "__macro__" ),           "__macro__"           }, | 		{ "__macro__",           sizeof( "__macro__" ) - 1           }, | ||||||
| 		{ sizeof( "__unsupported__" ),     "__unsupported__"     }, | 		{ "__unsupported__",     sizeof( "__unsupported__" ) - 1     }, | ||||||
| 		{ sizeof( "alignas" ),             "alignas"             }, | 		{ "alignas",             sizeof( "alignas" ) - 1             }, | ||||||
| 		{ sizeof( "const" ),               "const"               }, | 		{ "const",               sizeof( "const" ) - 1               }, | ||||||
| 		{ sizeof( "consteval" ),           "consteval"           }, | 		{ "consteval",           sizeof( "consteval" ) - 1           }, | ||||||
| 		{ sizeof( "constexpr" ),           "constexpr"           }, | 		{ "constexpr",           sizeof( "constexpr" ) - 1           }, | ||||||
| 		{ sizeof( "constinit" ),           "constinit"           }, | 		{ "constinit",           sizeof( "constinit" ) - 1           }, | ||||||
| 		{ sizeof( "explicit" ),            "explicit"            }, | 		{ "explicit",            sizeof( "explicit" ) - 1            }, | ||||||
| 		{ sizeof( "extern" ),              "extern"              }, | 		{ "extern",              sizeof( "extern" ) - 1              }, | ||||||
| 		{ sizeof( "final" ),               "final"               }, | 		{ "final",               sizeof( "final" ) - 1               }, | ||||||
| 		{ sizeof( "forceinline" ),         "forceinline"         }, | 		{ "forceinline",         sizeof( "forceinline" ) - 1         }, | ||||||
| 		{ sizeof( "global" ),              "global"              }, | 		{ "global",              sizeof( "global" ) - 1              }, | ||||||
| 		{ sizeof( "inline" ),              "inline"              }, | 		{ "inline",              sizeof( "inline" ) - 1              }, | ||||||
| 		{ sizeof( "internal" ),            "internal"            }, | 		{ "internal",            sizeof( "internal" ) - 1            }, | ||||||
| 		{ sizeof( "local_persist" ),       "local_persist"       }, | 		{ "local_persist",       sizeof( "local_persist" ) - 1       }, | ||||||
| 		{ sizeof( "mutable" ),             "mutable"             }, | 		{ "mutable",             sizeof( "mutable" ) - 1             }, | ||||||
| 		{ sizeof( "neverinline" ),         "neverinline"         }, | 		{ "neverinline",         sizeof( "neverinline" ) - 1         }, | ||||||
| 		{ sizeof( "override" ),            "override"            }, | 		{ "override",            sizeof( "override" ) - 1            }, | ||||||
| 		{ sizeof( "static" ),              "static"              }, | 		{ "static",              sizeof( "static" ) - 1              }, | ||||||
| 		{ sizeof( "thread_local" ),        "thread_local"        }, | 		{ "thread_local",        sizeof( "thread_local" ) - 1        }, | ||||||
| 		{ sizeof( "volatile" ),            "volatile"            }, | 		{ "volatile",            sizeof( "volatile" ) - 1            }, | ||||||
| 		{ sizeof( "virtual" ),             "virtual"             }, | 		{ "virtual",             sizeof( "virtual" ) - 1             }, | ||||||
| 		{ sizeof( "*" ),                   "*"                   }, | 		{ "*",		           sizeof( "*" ) - 1                   }, | ||||||
| 		{ sizeof( ";" ),                   ";"                   }, | 		{ ";",		           sizeof( ";" ) - 1                   }, | ||||||
| 		{ sizeof( "static_assert" ),       "static_assert"       }, | 		{ "static_assert",       sizeof( "static_assert" ) - 1       }, | ||||||
| 		{ sizeof( "__strbuilder__" ),          "__strbuilder__"          }, | 		{ "__string__",          sizeof( "__string__" ) - 1          }, | ||||||
| 		{ sizeof( "typename" ),            "typename"            }, | 		{ "typename",            sizeof( "typename" ) - 1            }, | ||||||
| 		{ sizeof( "unsigned" ),            "unsigned"            }, | 		{ "unsigned",            sizeof( "unsigned" ) - 1            }, | ||||||
| 		{ sizeof( "signed" ),              "signed"              }, | 		{ "signed",              sizeof( "signed" ) - 1              }, | ||||||
| 		{ sizeof( "short" ),               "short"               }, | 		{ "short",               sizeof( "short" ) - 1               }, | ||||||
| 		{ sizeof( "long" ),                "long"                }, | 		{ "long",                sizeof( "long" ) - 1                }, | ||||||
| 		{ sizeof( "bool" ),                "bool"                }, | 		{ "bool",                sizeof( "bool" ) - 1                }, | ||||||
| 		{ sizeof( "char" ),                "char"                }, | 		{ "char",                sizeof( "char" ) - 1                }, | ||||||
| 		{ sizeof( "int" ),                 "int"                 }, | 		{ "int",		         sizeof( "int" ) - 1                 }, | ||||||
| 		{ sizeof( "double" ),              "double"              }, | 		{ "double",              sizeof( "double" ) - 1              }, | ||||||
| 		{ sizeof( "__int8" ),              "__int8"              }, | 		{ "__int8",              sizeof( "__int8" ) - 1              }, | ||||||
| 		{ sizeof( "__int16" ),             "__int16"             }, | 		{ "__int16",             sizeof( "__int16" ) - 1             }, | ||||||
| 		{ sizeof( "__int32" ),             "__int32"             }, | 		{ "__int32",             sizeof( "__int32" ) - 1             }, | ||||||
| 		{ sizeof( "__int64" ),             "__int64"             }, | 		{ "__int64",             sizeof( "__int64" ) - 1             }, | ||||||
| 		{ sizeof( "_W64" ),                "_W64"                }, | 		{ "_W64",                sizeof( "_W64" ) - 1                }, | ||||||
| 		{ sizeof( "..." ),                 "..."                 }, | 		{ "...",		         sizeof( "..." ) - 1                 }, | ||||||
| 		{ sizeof( "__attrib_start__" ),    "__attrib_start__"    }, | 		{ "__attrib_start__",    sizeof( "__attrib_start__" ) - 1    }, | ||||||
| 		{ sizeof( "GEN_API_Export_Code" ), "GEN_API_Export_Code" }, | 		{ "GEN_API_Export_Code", sizeof( "GEN_API_Export_Code" ) - 1 }, | ||||||
| 		{ sizeof( "GEN_API_Import_Code" ), "GEN_API_Import_Code" }, | 		{ "GEN_API_Import_Code", sizeof( "GEN_API_Import_Code" ) - 1 }, | ||||||
| 	}; | 	}; | ||||||
| 	return lookup[type]; | 	return lookup[type]; | ||||||
| } | } | ||||||
| @@ -220,8 +220,8 @@ inline TokType str_to_toktype( Str str ) | |||||||
| 	local_persist u32 keymap[Tok_NumTokens]; | 	local_persist u32 keymap[Tok_NumTokens]; | ||||||
| 	do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ ) | 	do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ ) | ||||||
| 	{ | 	{ | ||||||
| 		Str enum_str = toktype_to_str( (TokType)index ); | 		Str enum_str  = toktype_to_str( (TokType)index ); | ||||||
| 		keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 ); | 		keymap[index] = crc32( enum_str.Ptr, enum_str.Len ); | ||||||
| 	} | 	} | ||||||
| 	do_once_end u32 hash = crc32( str.Ptr, str.Len ); | 	do_once_end u32 hash = crc32( str.Ptr, str.Len ); | ||||||
| 	for ( u32 index = 0; index < Tok_NumTokens; index++ ) | 	for ( u32 index = 0; index < Tok_NumTokens; index++ ) | ||||||
|   | |||||||
| @@ -408,7 +408,7 @@ Str token_fmt_impl( ssize num, ... ) | |||||||
| 	ssize result = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num, va); | 	ssize result = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num, va); | ||||||
| 	va_end(va); | 	va_end(va); | ||||||
|  |  | ||||||
| 	Str str = { result, buf }; | 	Str str = { buf, result }; | ||||||
| 	return str; | 	return str; | ||||||
| } | } | ||||||
| #pragma endregion Interface | #pragma endregion Interface | ||||||
|   | |||||||
| @@ -289,12 +289,12 @@ Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... ); | |||||||
| #ifndef name | #ifndef name | ||||||
| //	Convienence for defining any name used with the gen api. | //	Convienence for defining any name used with the gen api. | ||||||
| //  Lets you provide the length and string literal to the functions without the need for the DSL. | //  Lets you provide the length and string literal to the functions without the need for the DSL. | ||||||
| #define name( Id_ )   { sizeof(stringize( Id_ )) - 1, stringize(Id_) } | #define name( Id_ )   { stringize(Id_), sizeof(stringize( Id_ )) - 1 } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifndef code | #ifndef code | ||||||
| //  Same as name just used to indicate intention of literal for code instead of names. | //  Same as name just used to indicate intention of literal for code instead of names. | ||||||
| #define code( ... ) { sizeof(stringize(__VA_ARGS__)) - 1, stringize( __VA_ARGS__ ) } | #define code( ... ) { stringize( __VA_ARGS__ ), sizeof(stringize(__VA_ARGS__)) - 1 } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifndef args | #ifndef args | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ CodeConstructor parse_constructor( Str def ) | |||||||
| 				break; | 				break; | ||||||
|  |  | ||||||
| 			default : | 			default : | ||||||
| 				log_failure( "Invalid specifier %s for variable\n%s", spec_to_str( spec ), parser_to_string(Context) ); | 				log_failure( "Invalid specifier %s for variable\n%S", spec_to_str( spec ), parser_to_strbuilder(Context) ); | ||||||
| 				parser_pop(& Context); | 				parser_pop(& Context); | ||||||
| 				return InvalidCode; | 				return InvalidCode; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -138,8 +138,8 @@ Code untyped_fmt( char const* fmt, ...) | |||||||
| 	ssize length = c_str_fmt_va(buf, GEN_PRINTF_MAXLEN, fmt, va); | 	ssize length = c_str_fmt_va(buf, GEN_PRINTF_MAXLEN, fmt, va); | ||||||
| 	va_end(va); | 	va_end(va); | ||||||
|  |  | ||||||
| 	Str buf_str      = { c_str_len_capped(fmt, MaxNameLength), fmt }; | 	Str buf_str      = { fmt, c_str_len_capped(fmt, MaxNameLength) }; | ||||||
|     Str uncapped_str = { length, buf }; |     Str uncapped_str = { buf, length }; | ||||||
|  |  | ||||||
| 	Code | 	Code | ||||||
| 	result          = make_code(); | 	result          = make_code(); | ||||||
| @@ -172,7 +172,7 @@ Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... ) | |||||||
| 	ssize length = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num_tokens, va); | 	ssize length = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num_tokens, va); | ||||||
| 	va_end(va); | 	va_end(va); | ||||||
|  |  | ||||||
| 	Str buf_str = { length, buf }; | 	Str buf_str = { buf, length }; | ||||||
|  |  | ||||||
| 	Code | 	Code | ||||||
| 	result          = make_code(); | 	result          = make_code(); | ||||||
|   | |||||||
| @@ -461,7 +461,7 @@ CodeComment def_comment( Str content ) | |||||||
| 	if ( * strbuilder_back(cmt_formatted) != '\n' ) | 	if ( * strbuilder_back(cmt_formatted) != '\n' ) | ||||||
| 		strbuilder_append_str( & cmt_formatted, txt("\n") ); | 		strbuilder_append_str( & cmt_formatted, txt("\n") ); | ||||||
|  |  | ||||||
| 	Str name = { strbuilder_length(cmt_formatted), cmt_formatted }; | 	Str name = strbuilder_to_str(cmt_formatted); | ||||||
|  |  | ||||||
| 	Code | 	Code | ||||||
| 	result          = make_code(); | 	result          = make_code(); | ||||||
| @@ -589,7 +589,7 @@ CodeDefine def_define( Str name, Str content, Opts_def_define p ) | |||||||
| 			if ( result->Name.Ptr[lex_id_len] == '(' ) | 			if ( result->Name.Ptr[lex_id_len] == '(' ) | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 		Str lex_id = { lex_id_len, result->Name.Ptr }; | 		Str lex_id = { result->Name.Ptr,  lex_id_len }; | ||||||
| 		array_append(PreprocessorDefines, lex_id ); | 		array_append(PreprocessorDefines, lex_id ); | ||||||
| 	} | 	} | ||||||
| 	return result; | 	return result; | ||||||
| @@ -895,7 +895,7 @@ CodeOperator def_operator( Operator op, Str nspace, Opts_def_operator p ) | |||||||
| 	else | 	else | ||||||
| 		name = c_str_fmt_buf( "operator %.*s", op_str.Len, op_str.Ptr ); | 		name = c_str_fmt_buf( "operator %.*s", op_str.Len, op_str.Ptr ); | ||||||
|  |  | ||||||
| 	Str name_resolved = { c_str_len(name), name }; | 	Str name_resolved = { name, c_str_len(name) }; | ||||||
|  |  | ||||||
| 	CodeOperator | 	CodeOperator | ||||||
| 	result              = (CodeOperator) make_code(); | 	result              = (CodeOperator) make_code(); | ||||||
|   | |||||||
| @@ -26,88 +26,84 @@ enum TokFlags : u32 | |||||||
|  |  | ||||||
| struct Token | struct Token | ||||||
| { | { | ||||||
| 	char const* Text; | 	Str     Text; | ||||||
| 	sptr        Length; | 	TokType Type; | ||||||
| 	TokType     Type; | 	s32     Line; | ||||||
| 	s32         Line; | 	s32     Column; | ||||||
| 	s32         Column; | 	u32     Flags; | ||||||
| 	u32         Flags; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| constexpr Token NullToken { nullptr, 0, Tok_Invalid, false, 0, TF_Null }; | constexpr Token NullToken { nullptr, 0, Tok_Invalid, false, 0, TF_Null }; | ||||||
|  |  | ||||||
| AccessSpec tok_to_access_specifier(Token tok) | forceinline | ||||||
| { | AccessSpec tok_to_access_specifier(Token tok) { | ||||||
| 	return scast(AccessSpec, tok.Type); | 	return scast(AccessSpec, tok.Type); | ||||||
| } | } | ||||||
|  |  | ||||||
| Str tok_to_str(Token tok) | forceinline | ||||||
| { | Str tok_to_str(Token tok) { | ||||||
| 	Str str = { tok.Length, tok.Text }; | 	return tok.Text; | ||||||
| 	return str; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_valid( Token tok ) | forceinline | ||||||
| { | bool tok_is_valid( Token tok ) { | ||||||
| 	return tok.Text && tok.Length && tok.Type != Tok_Invalid; | 	return tok.Text.Ptr && tok.Text.Len && tok.Type != Tok_Invalid; | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_access_operator(Token tok) | forceinline | ||||||
| { | bool tok_is_access_operator(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_AccessOperator ); | 	return bitfield_is_equal( u32, tok.Flags, TF_AccessOperator ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_access_specifier(Token tok) | forceinline | ||||||
| { | bool tok_is_access_specifier(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_AccessSpecifier ); | 	return bitfield_is_equal( u32, tok.Flags, TF_AccessSpecifier ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_attribute(Token tok) | forceinline | ||||||
| { | bool tok_is_attribute(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_Attribute ); | 	return bitfield_is_equal( u32, tok.Flags, TF_Attribute ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_operator(Token tok) | forceinline | ||||||
| { | bool tok_is_operator(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_Operator ); | 	return bitfield_is_equal( u32, tok.Flags, TF_Operator ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_preprocessor(Token tok) | forceinline | ||||||
| { | bool tok_is_preprocessor(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_Preprocess ); | 	return bitfield_is_equal( u32, tok.Flags, TF_Preprocess ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_preprocess_cond(Token tok) | forceinline | ||||||
| { | bool tok_is_preprocess_cond(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_Preprocess_Cond ); | 	return bitfield_is_equal( u32, tok.Flags, TF_Preprocess_Cond ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_specifier(Token tok) | forceinline | ||||||
| { | bool tok_is_specifier(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_Specifier ); | 	return bitfield_is_equal( u32, tok.Flags, TF_Specifier ); | ||||||
| } | } | ||||||
|  |  | ||||||
| bool tok_is_end_definition(Token tok) | forceinline | ||||||
| { | bool tok_is_end_definition(Token tok) { | ||||||
| 	return bitfield_is_equal( u32, tok.Flags, TF_EndDefinition ); | 	return bitfield_is_equal( u32, tok.Flags, TF_EndDefinition ); | ||||||
| } | } | ||||||
|  |  | ||||||
| StrBuilder tok_to_string(Token tok) | StrBuilder tok_to_strbuilder(Token tok) | ||||||
| { | { | ||||||
| 	StrBuilder result = strbuilder_make_reserve( GlobalAllocator, kilobytes(4) ); | 	StrBuilder result   = strbuilder_make_reserve( GlobalAllocator, kilobytes(4) ); | ||||||
|  | 	Str        type_str = toktype_to_str( tok.Type ); | ||||||
| 	Str type_str = toktype_to_str( tok.Type ); |  | ||||||
|  |  | ||||||
| 	strbuilder_append_fmt( & result, "Line: %d Column: %d, Type: %.*s Content: %.*s" | 	strbuilder_append_fmt( & result, "Line: %d Column: %d, Type: %.*s Content: %.*s" | ||||||
| 		, tok.Line, tok.Column | 		, tok.Line, tok.Column | ||||||
| 		, type_str.Len, type_str.Ptr | 		, type_str.Len, type_str.Ptr | ||||||
| 		, tok.Length, tok.Text | 		, tok.Text.Len, tok.Text.Ptr | ||||||
| 	); | 	); | ||||||
|  |  | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
|  |  | ||||||
| struct TokArray | struct TokArray  | ||||||
| { | { | ||||||
| 	Array(Token) Arr; | 	Array(Token) Arr; | ||||||
| 	s32          Idx; | 	s32          Idx; | ||||||
| @@ -122,14 +118,12 @@ Token* lex_current(TokArray* self, bool skip_formatting ) | |||||||
| 		while ( self->Arr[self->Idx].Type == Tok_NewLine || self->Arr[self->Idx].Type == Tok_Comment  ) | 		while ( self->Arr[self->Idx].Type == Tok_NewLine || self->Arr[self->Idx].Type == Tok_Comment  ) | ||||||
| 			self->Idx++; | 			self->Idx++; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return & self->Arr[self->Idx]; | 	return & self->Arr[self->Idx]; | ||||||
| } | } | ||||||
|  |  | ||||||
| Token* lex_peek(TokArray self, bool skip_formatting) | Token* lex_peek(TokArray self, bool skip_formatting) | ||||||
| { | { | ||||||
| 	s32 idx = self.Idx; | 	s32 idx = self.Idx; | ||||||
|  |  | ||||||
| 	if ( skip_formatting ) | 	if ( skip_formatting ) | ||||||
| 	{ | 	{ | ||||||
| 		while ( self.Arr[idx].Type == Tok_NewLine ) | 		while ( self.Arr[idx].Type == Tok_NewLine ) | ||||||
| @@ -137,14 +131,12 @@ Token* lex_peek(TokArray self, bool skip_formatting) | |||||||
|  |  | ||||||
| 		return & self.Arr[idx]; | 		return & self.Arr[idx]; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return & self.Arr[idx]; | 	return & self.Arr[idx]; | ||||||
| } | } | ||||||
|  |  | ||||||
| Token* lex_previous(TokArray self, bool skip_formatting) | Token* lex_previous(TokArray self, bool skip_formatting) | ||||||
| { | { | ||||||
| 	s32 idx = self.Idx; | 	s32 idx = self.Idx; | ||||||
|  |  | ||||||
| 	if ( skip_formatting ) | 	if ( skip_formatting ) | ||||||
| 	{ | 	{ | ||||||
| 		while ( self.Arr[idx].Type == Tok_NewLine ) | 		while ( self.Arr[idx].Type == Tok_NewLine ) | ||||||
| @@ -152,14 +144,12 @@ Token* lex_previous(TokArray self, bool skip_formatting) | |||||||
|  |  | ||||||
| 		return & self.Arr[idx]; | 		return & self.Arr[idx]; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return & self.Arr[idx - 1]; | 	return & self.Arr[idx - 1]; | ||||||
| } | } | ||||||
|  |  | ||||||
| Token* lex_next(TokArray self, bool skip_formatting) | Token* lex_next(TokArray self, bool skip_formatting) | ||||||
| { | { | ||||||
| 	s32 idx = self.Idx; | 	s32 idx = self.Idx; | ||||||
|  |  | ||||||
| 	if ( skip_formatting ) | 	if ( skip_formatting ) | ||||||
| 	{ | 	{ | ||||||
| 		while ( self.Arr[idx].Type == Tok_NewLine ) | 		while ( self.Arr[idx].Type == Tok_NewLine ) | ||||||
| @@ -167,7 +157,6 @@ Token* lex_next(TokArray self, bool skip_formatting) | |||||||
|  |  | ||||||
| 		return & self.Arr[idx + 1]; | 		return & self.Arr[idx + 1]; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return & self.Arr[idx + 1]; | 	return & self.Arr[idx + 1]; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -183,7 +172,7 @@ enum | |||||||
|  |  | ||||||
| struct LexContext | struct LexContext | ||||||
| { | { | ||||||
| 	Str            content; | 	Str             content; | ||||||
| 	s32             left; | 	s32             left; | ||||||
| 	char const*     scanner; | 	char const*     scanner; | ||||||
| 	s32             line; | 	s32             line; | ||||||
| @@ -234,17 +223,17 @@ forceinline | |||||||
| s32 lex_preprocessor_directive( LexContext* ctx ) | s32 lex_preprocessor_directive( LexContext* ctx ) | ||||||
| { | { | ||||||
| 	char const* hash = ctx->scanner; | 	char const* hash = ctx->scanner; | ||||||
| 	Token hash_tok = { hash, 1, Tok_Preprocess_Hash, ctx->line, ctx->column, TF_Preprocess }; | 	Token hash_tok = { { hash, 1 }, Tok_Preprocess_Hash, ctx->line, ctx->column, TF_Preprocess }; | ||||||
| 	array_append( Lexer_Tokens, hash_tok  ); | 	array_append( Lexer_Tokens, hash_tok  ); | ||||||
|  |  | ||||||
| 	move_forward(); | 	move_forward(); | ||||||
| 	skip_whitespace(); | 	skip_whitespace(); | ||||||
|  |  | ||||||
| 	ctx->token.Text = ctx->scanner; | 	ctx->token.Text.Ptr = ctx->scanner; | ||||||
| 	while (ctx->left && ! char_is_space((* ctx->scanner)) ) | 	while (ctx->left && ! char_is_space((* ctx->scanner)) ) | ||||||
| 	{ | 	{ | ||||||
| 		move_forward(); | 		move_forward(); | ||||||
| 		ctx->token.Length++; | 		ctx->token.Text.Len++; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ctx->token.Type = str_to_toktype( tok_to_str(ctx->token) ); | 	ctx->token.Type = str_to_toktype( tok_to_str(ctx->token) ); | ||||||
| @@ -268,18 +257,18 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
| 			if ( * ctx->scanner == '\\' && ! within_string && ! within_char ) | 			if ( * ctx->scanner == '\\' && ! within_string && ! within_char ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				ctx->token.Length++; | 				ctx->token.Text.Len++; | ||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '\r' ) | 				if ( (* ctx->scanner) == '\r' ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					ctx->token.Length++; | 					ctx->token.Text.Len++; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '\n' ) | 				if ( (* ctx->scanner) == '\n' ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					ctx->token.Length++; | 					ctx->token.Text.Len++; | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
| 				else | 				else | ||||||
| @@ -295,22 +284,22 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
| 			if ( (* ctx->scanner) == '\r' ) | 			if ( (* ctx->scanner) == '\r' ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				ctx->token.Length++; | 				ctx->token.Text.Len++; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ( (* ctx->scanner) == '\n' ) | 			if ( (* ctx->scanner) == '\n' ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				ctx->token.Length++; | 				ctx->token.Text.Len++; | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			ctx->token.Length++; | 			ctx->token.Text.Len++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		ctx->token.Length = ctx->token.Length + ctx->token.Text - hash; | 		ctx->token.Text.Len = ctx->token.Text.Len + ctx->token.Text.Ptr - hash; | ||||||
| 		ctx->token.Text   = hash; | 		ctx->token.Text.Ptr = hash; | ||||||
| 		array_append( Lexer_Tokens, ctx->token ); | 		array_append( Lexer_Tokens, ctx->token ); | ||||||
| 		return Lex_Continue; // Skip found token, its all handled here. | 		return Lex_Continue; // Skip found token, its all handled here. | ||||||
| 	} | 	} | ||||||
| @@ -333,31 +322,31 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
|  |  | ||||||
| 	if ( ctx->token.Type == Tok_Preprocess_Define ) | 	if ( ctx->token.Type == Tok_Preprocess_Define ) | ||||||
| 	{ | 	{ | ||||||
| 		Token name = { ctx->scanner, 0, Tok_Identifier, ctx->line, ctx->column, TF_Preprocess }; | 		Token name = { { ctx->scanner, 0 }, Tok_Identifier, ctx->line, ctx->column, TF_Preprocess }; | ||||||
|  |  | ||||||
| 		name.Text   = ctx->scanner; | 		name.Text.Ptr = ctx->scanner; | ||||||
| 		name.Length = 1; | 		name.Text.Len = 1; | ||||||
| 		move_forward(); | 		move_forward(); | ||||||
|  |  | ||||||
| 		while ( ctx->left && ( char_is_alphanumeric((* ctx->scanner)) || (* ctx->scanner) == '_' ) ) | 		while ( ctx->left && ( char_is_alphanumeric((* ctx->scanner)) || (* ctx->scanner) == '_' ) ) | ||||||
| 		{ | 		{ | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			name.Length++; | 			name.Text.Len++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ( ctx->left && (* ctx->scanner) == '(' ) | 		if ( ctx->left && (* ctx->scanner) == '(' ) | ||||||
| 		{ | 		{ | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			name.Length++; | 			name.Text.Len++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		array_append( Lexer_Tokens, name ); | 		array_append( Lexer_Tokens, name ); | ||||||
|  |  | ||||||
| 		u64 key = crc32( name.Text, name.Length ); | 		u64 key = crc32( name.Text.Ptr, name.Text.Len ); | ||||||
| 		hashtable_set(ctx->defines, key, tok_to_str(name) ); | 		hashtable_set(ctx->defines, key, tok_to_str(name) ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Token preprocess_content = { ctx->scanner, 0, Tok_Preprocess_Content, ctx->line, ctx->column, TF_Preprocess }; | 	Token preprocess_content = { { ctx->scanner, 0 }, Tok_Preprocess_Content, ctx->line, ctx->column, TF_Preprocess }; | ||||||
|  |  | ||||||
| 	if ( ctx->token.Type == Tok_Preprocess_Include ) | 	if ( ctx->token.Type == Tok_Preprocess_Include ) | ||||||
| 	{ | 	{ | ||||||
| @@ -365,7 +354,7 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
|  |  | ||||||
| 		if ( (* ctx->scanner) != '"' && (* ctx->scanner) != '<' ) | 		if ( (* ctx->scanner) != '"' && (* ctx->scanner) != '<' ) | ||||||
| 		{ | 		{ | ||||||
| 			StrBuilder directive_str = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 80, ctx->left + preprocess_content.Length ), ctx->token.Text ); | 			StrBuilder directive_str = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 80, ctx->left + preprocess_content.Text.Len ), ctx->token.Text.Ptr ); | ||||||
|  |  | ||||||
| 			log_failure( "gen::Parser::lex: Expected '\"' or '<' after #include, not '%c' (%d, %d)\n%s" | 			log_failure( "gen::Parser::lex: Expected '\"' or '<' after #include, not '%c' (%d, %d)\n%s" | ||||||
| 				, (* ctx->scanner) | 				, (* ctx->scanner) | ||||||
| @@ -376,16 +365,16 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
| 			return Lex_ReturnNull; | 			return Lex_ReturnNull; | ||||||
| 		} | 		} | ||||||
| 		move_forward(); | 		move_forward(); | ||||||
| 		preprocess_content.Length++; | 		preprocess_content.Text.Len++; | ||||||
|  |  | ||||||
| 		while ( ctx->left && (* ctx->scanner) != '"' && (* ctx->scanner) != '>' ) | 		while ( ctx->left && (* ctx->scanner) != '"' && (* ctx->scanner) != '>' ) | ||||||
| 		{ | 		{ | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			preprocess_content.Length++; | 			preprocess_content.Text.Len++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		move_forward(); | 		move_forward(); | ||||||
| 		preprocess_content.Length++; | 		preprocess_content.Text.Len++; | ||||||
|  |  | ||||||
| 		if ( (* ctx->scanner) == '\r' && ctx->scanner[1] == '\n' ) | 		if ( (* ctx->scanner) == '\r' && ctx->scanner[1] == '\n' ) | ||||||
| 		{ | 		{ | ||||||
| @@ -416,24 +405,24 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
| 		if ( (* ctx->scanner) == '\\' && ! within_string && ! within_char ) | 		if ( (* ctx->scanner) == '\\' && ! within_string && ! within_char ) | ||||||
| 		{ | 		{ | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			preprocess_content.Length++; | 			preprocess_content.Text.Len++; | ||||||
|  |  | ||||||
| 			if ( (* ctx->scanner) == '\r' ) | 			if ( (* ctx->scanner) == '\r' ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				preprocess_content.Length++; | 				preprocess_content.Text.Len++; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ( (* ctx->scanner) == '\n' ) | 			if ( (* ctx->scanner) == '\n' ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				preprocess_content.Length++; | 				preprocess_content.Text.Len++; | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 				StrBuilder directive_str = strbuilder_make_length( GlobalAllocator, ctx->token.Text, ctx->token.Length ); | 				StrBuilder directive_str = strbuilder_make_length( GlobalAllocator, ctx->token.Text.Ptr, ctx->token.Text.Len ); | ||||||
| 				StrBuilder content_str   = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 400, ctx->left + preprocess_content.Length ), preprocess_content.Text ); | 				StrBuilder content_str   = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 400, ctx->left + preprocess_content.Text.Len ), preprocess_content.Text.Ptr ); | ||||||
|  |  | ||||||
| 				log_failure( "gen::Parser::lex: Invalid escape sequence '\\%c' (%d, %d)" | 				log_failure( "gen::Parser::lex: Invalid escape sequence '\\%c' (%d, %d)" | ||||||
| 							" in preprocessor directive '%s' (%d, %d)\n%s" | 							" in preprocessor directive '%s' (%d, %d)\n%s" | ||||||
| @@ -457,7 +446,7 @@ s32 lex_preprocessor_directive( LexContext* ctx ) | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		move_forward(); | 		move_forward(); | ||||||
| 		preprocess_content.Length++; | 		preprocess_content.Text.Len++; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	array_append( Lexer_Tokens, preprocess_content ); | 	array_append( Lexer_Tokens, preprocess_content ); | ||||||
| @@ -520,9 +509,9 @@ void lex_found_token( LexContext* ctx ) | |||||||
|  |  | ||||||
| 	u64 key = 0; | 	u64 key = 0; | ||||||
| 	if ( (* ctx->scanner) == '(') | 	if ( (* ctx->scanner) == '(') | ||||||
| 		key = crc32( ctx->token.Text, ctx->token.Length + 1 ); | 		key = crc32( ctx->token.Text.Ptr, ctx->token.Text.Len + 1 ); | ||||||
| 	else | 	else | ||||||
| 		key = crc32( ctx->token.Text, ctx->token.Length ); | 		key = crc32( ctx->token.Text.Ptr, ctx->token.Text.Len ); | ||||||
|  |  | ||||||
| 	Str* define = hashtable_get(ctx->defines, key ); | 	Str* define = hashtable_get(ctx->defines, key ); | ||||||
| 	if ( define ) | 	if ( define ) | ||||||
| @@ -533,7 +522,7 @@ void lex_found_token( LexContext* ctx ) | |||||||
| 		if ( ctx->left && (* ctx->scanner) == '(' ) | 		if ( ctx->left && (* ctx->scanner) == '(' ) | ||||||
| 		{ | 		{ | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			ctx->token.Length++; | 			ctx->token.Text.Len++; | ||||||
|  |  | ||||||
| 			s32 level = 0; | 			s32 level = 0; | ||||||
| 			while ( ctx->left && ((* ctx->scanner) != ')' || level > 0) ) | 			while ( ctx->left && ((* ctx->scanner) != ')' || level > 0) ) | ||||||
| @@ -545,22 +534,22 @@ void lex_found_token( LexContext* ctx ) | |||||||
| 					level--; | 					level--; | ||||||
|  |  | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				ctx->token.Length++; | 				ctx->token.Text.Len++; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| 			ctx->token.Length++; | 			ctx->token.Text.Len++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//if ( (* ctx->scanner) == '\r' && ctx->scanner[1] == '\n' ) | 		//if ( (* ctx->scanner) == '\r' && ctx->scanner[1] == '\n' ) | ||||||
| 		//{ | 		//{ | ||||||
| 		//	move_forward(); | 		//	move_forward(); | ||||||
| 		//	ctx->token.Length++; | 		//	ctx->token..Text.Length++; | ||||||
| 		//} | 		//} | ||||||
| 		//else if ( (* ctx->scanner) == '\n' ) | 		//else if ( (* ctx->scanner) == '\n' ) | ||||||
| 		//{ | 		//{ | ||||||
| 		//	move_forward(); | 		//	move_forward(); | ||||||
| 		//	ctx->token.Length++; | 		//	ctx->token..Text.Length++; | ||||||
| 		//} | 		//} | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| @@ -620,12 +609,12 @@ TokArray lex( Str content ) | |||||||
| 		#if 0 | 		#if 0 | ||||||
| 		if (Tokens.num()) | 		if (Tokens.num()) | ||||||
| 		{ | 		{ | ||||||
| 			log_fmt("\nLastTok: %SB", Tokens.back().to_string()); | 			log_fmt("\nLastTok: %SB", Tokens.back().to_strbuilder()); | ||||||
| 		} | 		} | ||||||
| 		#endif | 		#endif | ||||||
|  |  | ||||||
| 		{ | 		{ | ||||||
| 			Token thanks_c = { c.scanner, 0, Tok_Invalid, c.line, c.column, TF_Null }; | 			Token thanks_c = { { c.scanner, 0 }, Tok_Invalid, c.line, c.column, TF_Null }; | ||||||
| 			c.token = thanks_c; | 			c.token = thanks_c; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -636,7 +625,7 @@ TokArray lex( Str content ) | |||||||
| 			if ( (* ctx->scanner) == '\r') | 			if ( (* ctx->scanner) == '\r') | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				c.token.Length = 1; | 				c.token.Text.Len = 1; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ( (* ctx->scanner) == '\n' ) | 			if ( (* ctx->scanner) == '\n' ) | ||||||
| @@ -644,14 +633,14 @@ TokArray lex( Str content ) | |||||||
| 				move_forward(); | 				move_forward(); | ||||||
|  |  | ||||||
| 				c.token.Type = Tok_NewLine; | 				c.token.Type = Tok_NewLine; | ||||||
| 				c.token.Length++; | 				c.token.Text.Len++; | ||||||
|  |  | ||||||
| 				array_append( Lexer_Tokens, c.token ); | 				array_append( Lexer_Tokens, c.token ); | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		c.token.Length = 0; | 		c.token.Text.Len = 0; | ||||||
|  |  | ||||||
| 		skip_whitespace(); | 		skip_whitespace(); | ||||||
| 		if ( c.left <= 0 ) | 		if ( c.left <= 0 ) | ||||||
| @@ -670,19 +659,19 @@ TokArray lex( Str content ) | |||||||
| 						//if ( last_type == Tok_Preprocess_Pragma ) | 						//if ( last_type == Tok_Preprocess_Pragma ) | ||||||
| 						{ | 						{ | ||||||
| 							{ | 							{ | ||||||
| 								Token thanks_c = { c.scanner, 0, Tok_Invalid, c.line, c.column, TF_Null }; | 								Token thanks_c = { { c.scanner, 0 }, Tok_Invalid, c.line, c.column, TF_Null }; | ||||||
| 								c.token = thanks_c; | 								c.token = thanks_c; | ||||||
| 							} | 							} | ||||||
| 							if ( (* ctx->scanner) == '\r') | 							if ( (* ctx->scanner) == '\r') | ||||||
| 							{ | 							{ | ||||||
| 								move_forward(); | 								move_forward(); | ||||||
| 								c.token.Length = 1; | 								c.token.Text.Len = 1; | ||||||
| 							} | 							} | ||||||
|  |  | ||||||
| 							if ( (* ctx->scanner) == '\n' ) | 							if ( (* ctx->scanner) == '\n' ) | ||||||
| 							{ | 							{ | ||||||
| 								c.token.Type = Tok_NewLine; | 								c.token.Type = Tok_NewLine; | ||||||
| 								c.token.Length++; | 								c.token.Text.Len++; | ||||||
| 								move_forward(); | 								move_forward(); | ||||||
|  |  | ||||||
| 								array_append( Lexer_Tokens, c.token ); | 								array_append( Lexer_Tokens, c.token ); | ||||||
| @@ -700,8 +689,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '.': | 			case '.': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Access_MemberSymbol; | 				c.token.Type   = Tok_Access_MemberSymbol; | ||||||
| 				c.token.Flags  = TF_AccessOperator; | 				c.token.Flags  = TF_AccessOperator; | ||||||
|  |  | ||||||
| @@ -714,9 +703,9 @@ TokArray lex( Str content ) | |||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					if( (* ctx->scanner) == '.' ) | 					if( (* ctx->scanner) == '.' ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Length = 3; | 						c.token.Text.Len = 3; | ||||||
| 						c.token.Type   = Tok_Varadic_Argument; | 						c.token.Type     = Tok_Varadic_Argument; | ||||||
| 						c.token.Flags  = TF_Null; | 						c.token.Flags    = TF_Null; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 					} | 					} | ||||||
| 					else | 					else | ||||||
| @@ -731,8 +720,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '&' : | 			case '&' : | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Ampersand; | 				c.token.Type   = Tok_Ampersand; | ||||||
| 				c.token.Flags |= TF_Operator; | 				c.token.Flags |= TF_Operator; | ||||||
| 				c.token.Flags |= TF_Specifier; | 				c.token.Flags |= TF_Specifier; | ||||||
| @@ -742,8 +731,8 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '&' )	// && | 				if ( (* ctx->scanner) == '&' )	// && | ||||||
| 				{ | 				{ | ||||||
| 					c.token.Length  = 2; | 					c.token.Text.Len = 2; | ||||||
| 					c.token.Type    = Tok_Ampersand_DBL; | 					c.token.Type     = Tok_Ampersand_DBL; | ||||||
|  |  | ||||||
| 					if (c.left) | 					if (c.left) | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| @@ -753,9 +742,9 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case ':': | 			case ':': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text = text; | ||||||
| 				c.token.Type   = Tok_Assign_Classifer; | 				c.token.Type = Tok_Assign_Classifer; | ||||||
| 				// Can be either a classifier (ParentType, Bitfield width), or ternary else | 				// Can be either a classifier (ParentType, Bitfield width), or ternary else | ||||||
| 				// token.Type   = Tok_Colon; | 				// token.Type   = Tok_Colon; | ||||||
|  |  | ||||||
| @@ -765,15 +754,15 @@ TokArray lex( Str content ) | |||||||
| 				if ( (* ctx->scanner) == ':' ) | 				if ( (* ctx->scanner) == ':' ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Type  = Tok_Access_StaticSymbol; | 					c.token.Type = Tok_Access_StaticSymbol; | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 				} | 				} | ||||||
| 				goto FoundToken; | 				goto FoundToken; | ||||||
| 			} | 			} | ||||||
| 			case '{': | 			case '{': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_BraceCurly_Open; | 				c.token.Type   = Tok_BraceCurly_Open; | ||||||
|  |  | ||||||
| 				if (c.left) | 				if (c.left) | ||||||
| @@ -782,8 +771,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '}': | 			case '}': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_BraceCurly_Close; | 				c.token.Type   = Tok_BraceCurly_Close; | ||||||
| 				c.token.Flags  = TF_EndDefinition; | 				c.token.Flags  = TF_EndDefinition; | ||||||
|  |  | ||||||
| @@ -795,8 +784,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '[': | 			case '[': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_BraceSquare_Open; | 				c.token.Type   = Tok_BraceSquare_Open; | ||||||
| 				if ( c.left ) | 				if ( c.left ) | ||||||
| 				{ | 				{ | ||||||
| @@ -804,8 +793,8 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 					if ( (* ctx->scanner) == ']' ) | 					if ( (* ctx->scanner) == ']' ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Length = 2; | 						c.token.Text.Len = 2; | ||||||
| 						c.token.Type   = Tok_Operator; | 						c.token.Type     = Tok_Operator; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| @@ -813,8 +802,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case ']': | 			case ']': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_BraceSquare_Close; | 				c.token.Type   = Tok_BraceSquare_Close; | ||||||
|  |  | ||||||
| 				if (c.left) | 				if (c.left) | ||||||
| @@ -823,8 +812,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '(': | 			case '(': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Capture_Start; | 				c.token.Type   = Tok_Capture_Start; | ||||||
|  |  | ||||||
| 				if (c.left) | 				if (c.left) | ||||||
| @@ -833,8 +822,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case ')': | 			case ')': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Capture_End; | 				c.token.Type   = Tok_Capture_End; | ||||||
|  |  | ||||||
| 				if (c.left) | 				if (c.left) | ||||||
| @@ -843,8 +832,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '\'': | 			case '\'': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Char; | 				c.token.Type   = Tok_Char; | ||||||
| 				c.token.Flags  = TF_Literal; | 				c.token.Flags  = TF_Literal; | ||||||
|  |  | ||||||
| @@ -853,32 +842,32 @@ TokArray lex( Str content ) | |||||||
| 				if ( c.left && (* ctx->scanner) == '\\' ) | 				if ( c.left && (* ctx->scanner) == '\\' ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
|  |  | ||||||
| 					if ( (* ctx->scanner) == '\'' ) | 					if ( (* ctx->scanner) == '\'' ) | ||||||
| 					{ | 					{ | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				while ( c.left && (* ctx->scanner) != '\'' ) | 				while ( c.left && (* ctx->scanner) != '\'' ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				if ( c.left ) | 				if ( c.left ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 				} | 				} | ||||||
| 				goto FoundToken; | 				goto FoundToken; | ||||||
| 			} | 			} | ||||||
| 			case ',': | 			case ',': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Comma; | 				c.token.Type   = Tok_Comma; | ||||||
| 				c.token.Flags  = TF_Operator; | 				c.token.Flags  = TF_Operator; | ||||||
|  |  | ||||||
| @@ -888,8 +877,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '*': | 			case '*': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Star; | 				c.token.Type   = Tok_Star; | ||||||
| 				c.token.Flags |= TF_Specifier; | 				c.token.Flags |= TF_Specifier; | ||||||
| 				c.token.Flags |= TF_Operator; | 				c.token.Flags |= TF_Operator; | ||||||
| @@ -899,7 +888,7 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '=' ) | 				if ( (* ctx->scanner) == '=' ) | ||||||
| 				{ | 				{ | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 					c.token.Flags |= TF_Assign; | 					c.token.Flags |= TF_Assign; | ||||||
| 					// c.token.Type = Tok_Assign_Multiply; | 					// c.token.Type = Tok_Assign_Multiply; | ||||||
|  |  | ||||||
| @@ -911,8 +900,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case ';': | 			case ';': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Statement_End; | 				c.token.Type   = Tok_Statement_End; | ||||||
| 				c.token.Flags  = TF_EndDefinition; | 				c.token.Flags  = TF_EndDefinition; | ||||||
|  |  | ||||||
| @@ -924,8 +913,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '"': | 			case '"': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_String; | 				c.token.Type   = Tok_String; | ||||||
| 				c.token.Flags |= TF_Literal; | 				c.token.Flags |= TF_Literal; | ||||||
|  |  | ||||||
| @@ -941,25 +930,25 @@ TokArray lex( Str content ) | |||||||
| 					if ( (* ctx->scanner) == '\\' ) | 					if ( (* ctx->scanner) == '\\' ) | ||||||
| 					{ | 					{ | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
|  |  | ||||||
| 						if ( c.left ) | 						if ( c.left ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 						} | 						} | ||||||
| 						continue; | 						continue; | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 				} | 				} | ||||||
| 				goto FoundToken; | 				goto FoundToken; | ||||||
| 			} | 			} | ||||||
| 			case '?': | 			case '?': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text     = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length   = 1; | 				c.token.Text     = text; | ||||||
| 				c.token.Type     = Tok_Operator; | 				c.token.Type     = Tok_Operator; | ||||||
| 				// c.token.Type     = Tok_Ternary; | 				// c.token.Type     = Tok_Ternary; | ||||||
| 				c.token.Flags    = TF_Operator; | 				c.token.Flags    = TF_Operator; | ||||||
| @@ -971,8 +960,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '=': | 			case '=': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text     = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length   = 1; | 				c.token.Text     = text; | ||||||
| 				c.token.Type     = Tok_Operator; | 				c.token.Type     = Tok_Operator; | ||||||
| 				// c.token.Type     = Tok_Assign; | 				// c.token.Type     = Tok_Assign; | ||||||
| 				c.token.Flags    = TF_Operator; | 				c.token.Flags    = TF_Operator; | ||||||
| @@ -983,7 +972,7 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '=' ) | 				if ( (* ctx->scanner) == '=' ) | ||||||
| 				{ | 				{ | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 					c.token.Flags = TF_Operator; | 					c.token.Flags = TF_Operator; | ||||||
|  |  | ||||||
| 					if (c.left) | 					if (c.left) | ||||||
| @@ -1027,8 +1016,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '|': | 			case '|': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Operator; | 				c.token.Type   = Tok_Operator; | ||||||
| 				c.token.Flags  = TF_Operator; | 				c.token.Flags  = TF_Operator; | ||||||
| 				// token.Type   = Tok_L_Or; | 				// token.Type   = Tok_L_Or; | ||||||
| @@ -1038,7 +1027,7 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '=' ) | 				if ( (* ctx->scanner) == '=' ) | ||||||
| 				{ | 				{ | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 					c.token.Flags |= TF_Assign; | 					c.token.Flags |= TF_Assign; | ||||||
| 					// token.Flags |= TokFlags::Assignment; | 					// token.Flags |= TokFlags::Assignment; | ||||||
| 					// token.Type = Tok_Assign_L_Or; | 					// token.Type = Tok_Assign_L_Or; | ||||||
| @@ -1046,9 +1035,9 @@ TokArray lex( Str content ) | |||||||
| 					if (c.left) | 					if (c.left) | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 				} | 				} | ||||||
| 				else while ( c.left && (* ctx->scanner) == *(c.scanner - 1) && c.token.Length < 3 ) | 				else while ( c.left && (* ctx->scanner) == *(c.scanner - 1) && c.token.Text.Len < 3 ) | ||||||
| 				{ | 				{ | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
|  |  | ||||||
| 					if (c.left) | 					if (c.left) | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| @@ -1059,8 +1048,8 @@ TokArray lex( Str content ) | |||||||
| 			// Dash is unfortunatlly a bit more complicated... | 			// Dash is unfortunatlly a bit more complicated... | ||||||
| 			case '-': | 			case '-': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Operator; | 				c.token.Type   = Tok_Operator; | ||||||
| 				// token.Type = Tok_Subtract; | 				// token.Type = Tok_Subtract; | ||||||
| 				c.token.Flags  = TF_Operator; | 				c.token.Flags  = TF_Operator; | ||||||
| @@ -1070,7 +1059,7 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 					if ( (* ctx->scanner) == '>'  ) | 					if ( (* ctx->scanner) == '>'  ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
| //						token.Type = Tok_Access_PointerToMemberSymbol; | //						token.Type = Tok_Access_PointerToMemberSymbol; | ||||||
| 						c.token.Flags |= TF_AccessOperator; | 						c.token.Flags |= TF_AccessOperator; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| @@ -1078,22 +1067,22 @@ TokArray lex( Str content ) | |||||||
| 						if ( (* ctx->scanner) == '*' ) | 						if ( (* ctx->scanner) == '*' ) | ||||||
| 						{ | 						{ | ||||||
| //							token.Type = Tok_Access_PointerToMemberOfPointerSymbol; | //							token.Type = Tok_Access_PointerToMemberOfPointerSymbol; | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 					else if ( (* ctx->scanner) == '=' ) | 					else if ( (* ctx->scanner) == '=' ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
| 						// token.Type = Tok_Assign_Subtract; | 						// token.Type = Tok_Assign_Subtract; | ||||||
| 						c.token.Flags |= TF_Assign; | 						c.token.Flags |= TF_Assign; | ||||||
|  |  | ||||||
| 						if (c.left) | 						if (c.left) | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 					} | 					} | ||||||
| 					else while ( c.left && (* ctx->scanner) == *(c.scanner - 1) && c.token.Length < 3 ) | 					else while ( c.left && (* ctx->scanner) == *(c.scanner - 1) && c.token.Text.Len < 3 ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
|  |  | ||||||
| 						if (c.left) | 						if (c.left) | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| @@ -1103,8 +1092,8 @@ TokArray lex( Str content ) | |||||||
| 			} | 			} | ||||||
| 			case '/': | 			case '/': | ||||||
| 			{ | 			{ | ||||||
| 				c.token.Text   = c.scanner; | 				Str text = { c.scanner, 1 }; | ||||||
| 				c.token.Length = 1; | 				c.token.Text   = text; | ||||||
| 				c.token.Type   = Tok_Operator; | 				c.token.Type   = Tok_Operator; | ||||||
| 				// token.Type   = Tok_Divide; | 				// token.Type   = Tok_Divide; | ||||||
| 				c.token.Flags  = TF_Operator; | 				c.token.Flags  = TF_Operator; | ||||||
| @@ -1116,40 +1105,40 @@ TokArray lex( Str content ) | |||||||
| 					{ | 					{ | ||||||
| 						// token.Type = TokeType::Assign_Divide; | 						// token.Type = TokeType::Assign_Divide; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
| 						c.token.Flags = TF_Assign; | 						c.token.Flags = TF_Assign; | ||||||
| 					} | 					} | ||||||
| 					else if ( (* ctx->scanner) == '/' ) | 					else if ( (* ctx->scanner) == '/' ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Type   = Tok_Comment; | 						c.token.Type     = Tok_Comment; | ||||||
| 						c.token.Length = 2; | 						c.token.Text.Len = 2; | ||||||
| 						c.token.Flags  = TF_Null; | 						c.token.Flags    = TF_Null; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
|  |  | ||||||
| 						while ( c.left && (* ctx->scanner) != '\n' && (* ctx->scanner) != '\r' ) | 						while ( c.left && (* ctx->scanner) != '\n' && (* ctx->scanner) != '\r' ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 						} | 						} | ||||||
|  |  | ||||||
| 						if ( (* ctx->scanner) == '\r' ) | 						if ( (* ctx->scanner) == '\r' ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 						} | 						} | ||||||
| 						if ( (* ctx->scanner) == '\n' ) | 						if ( (* ctx->scanner) == '\n' ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 						} | 						} | ||||||
| 						array_append( Lexer_Tokens, c.token ); | 						array_append( Lexer_Tokens, c.token ); | ||||||
| 						continue; | 						continue; | ||||||
| 					} | 					} | ||||||
| 					else if ( (* ctx->scanner) == '*' ) | 					else if ( (* ctx->scanner) == '*' ) | ||||||
| 					{ | 					{ | ||||||
| 						c.token.Type   = Tok_Comment; | 						c.token.Type     = Tok_Comment; | ||||||
| 						c.token.Length = 2; | 						c.token.Text.Len = 2; | ||||||
| 						c.token.Flags  = TF_Null; | 						c.token.Flags    = TF_Null; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
|  |  | ||||||
| 						bool star   = (* ctx->scanner)    == '*'; | 						bool star   = (* ctx->scanner)    == '*'; | ||||||
| @@ -1158,25 +1147,25 @@ TokArray lex( Str content ) | |||||||
| 						while ( c.left && ! at_end  ) | 						while ( c.left && ! at_end  ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
|  |  | ||||||
| 							star   = (* ctx->scanner)    == '*'; | 							star   = (* ctx->scanner)    == '*'; | ||||||
| 							slash  = c.scanner[1] == '/'; | 							slash  = c.scanner[1] == '/'; | ||||||
| 							at_end = star && slash; | 							at_end = star && slash; | ||||||
| 						} | 						} | ||||||
| 						c.token.Length += 2; | 						c.token.Text.Len += 2; | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
|  |  | ||||||
| 						if ( (* ctx->scanner) == '\r' ) | 						if ( (* ctx->scanner) == '\r' ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 						} | 						} | ||||||
| 						if ( (* ctx->scanner) == '\n' ) | 						if ( (* ctx->scanner) == '\n' ) | ||||||
| 						{ | 						{ | ||||||
| 							move_forward(); | 							move_forward(); | ||||||
| 							c.token.Length++; | 							c.token.Text.Len++; | ||||||
| 						} | 						} | ||||||
| 						array_append( Lexer_Tokens, c.token ); | 						array_append( Lexer_Tokens, c.token ); | ||||||
| 						// end_line(); | 						// end_line(); | ||||||
| @@ -1189,14 +1178,14 @@ TokArray lex( Str content ) | |||||||
|  |  | ||||||
| 		if ( char_is_alpha( (* ctx->scanner) ) || (* ctx->scanner) == '_' ) | 		if ( char_is_alpha( (* ctx->scanner) ) || (* ctx->scanner) == '_' ) | ||||||
| 		{ | 		{ | ||||||
| 			c.token.Text   = c.scanner; | 			Str text = { c.scanner, 1 }; | ||||||
| 			c.token.Length = 1; | 			c.token.Text = text; | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
|  |  | ||||||
| 			while ( c.left && ( char_is_alphanumeric((* ctx->scanner)) || (* ctx->scanner) == '_' ) ) | 			while ( c.left && ( char_is_alphanumeric((* ctx->scanner)) || (* ctx->scanner) == '_' ) ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				c.token.Length++; | 				c.token.Text.Len++; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			goto FoundToken; | 			goto FoundToken; | ||||||
| @@ -1205,8 +1194,8 @@ TokArray lex( Str content ) | |||||||
| 		{ | 		{ | ||||||
| 			// This is a very brute force lex, no checks are done for validity of literal. | 			// This is a very brute force lex, no checks are done for validity of literal. | ||||||
|  |  | ||||||
| 			c.token.Text   = c.scanner; | 			Str text = { c.scanner, 1 }; | ||||||
| 			c.token.Length = 1; | 			c.token.Text   = text; | ||||||
| 			c.token.Type   = Tok_Number; | 			c.token.Type   = Tok_Number; | ||||||
| 			c.token.Flags  = TF_Literal; | 			c.token.Flags  = TF_Literal; | ||||||
| 			move_forward(); | 			move_forward(); | ||||||
| @@ -1218,12 +1207,12 @@ TokArray lex( Str content ) | |||||||
| 			) | 			) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				c.token.Length++; | 				c.token.Text.Len++; | ||||||
|  |  | ||||||
| 				while ( c.left && char_is_hex_digit((* ctx->scanner)) ) | 				while ( c.left && char_is_hex_digit((* ctx->scanner)) ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				goto FoundToken; | 				goto FoundToken; | ||||||
| @@ -1232,18 +1221,18 @@ TokArray lex( Str content ) | |||||||
| 			while ( c.left && char_is_digit((* ctx->scanner)) ) | 			while ( c.left && char_is_digit((* ctx->scanner)) ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				c.token.Length++; | 				c.token.Text.Len++; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ( c.left && (* ctx->scanner) == '.' ) | 			if ( c.left && (* ctx->scanner) == '.' ) | ||||||
| 			{ | 			{ | ||||||
| 				move_forward(); | 				move_forward(); | ||||||
| 				c.token.Length++; | 				c.token.Text.Len++; | ||||||
|  |  | ||||||
| 				while ( c.left && char_is_digit((* ctx->scanner)) ) | 				while ( c.left && char_is_digit((* ctx->scanner)) ) | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				// Handle number literal suffixes in a botched way | 				// Handle number literal suffixes in a botched way | ||||||
| @@ -1256,13 +1245,13 @@ TokArray lex( Str content ) | |||||||
| 				{ | 				{ | ||||||
| 					char prev = (* ctx->scanner); | 					char prev = (* ctx->scanner); | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
|  |  | ||||||
| 					// Handle 'll'/'LL' as a special case when we just processed an 'l'/'L' | 					// Handle 'll'/'LL' as a special case when we just processed an 'l'/'L' | ||||||
| 					if (c.left && (prev == 'l' || prev == 'L') && ((* ctx->scanner) == 'l' || (* ctx->scanner) == 'L')) | 					if (c.left && (prev == 'l' || prev == 'L') && ((* ctx->scanner) == 'l' || (* ctx->scanner) == 'L')) | ||||||
| 					{ | 					{ | ||||||
| 						move_forward(); | 						move_forward(); | ||||||
| 						c.token.Length++; | 						c.token.Text.Len++; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| @@ -1278,7 +1267,7 @@ TokArray lex( Str content ) | |||||||
| 				log_fmt( "Token %d Type: %s : %.*s\n" | 				log_fmt( "Token %d Type: %s : %.*s\n" | ||||||
| 					, idx | 					, idx | ||||||
| 					, toktype_to_str( Lexer_Tokens[ idx ].Type ).Ptr | 					, toktype_to_str( Lexer_Tokens[ idx ].Type ).Ptr | ||||||
| 					, Lexer_Tokens[ idx ].Length, Lexer_Tokens[ idx ].Text | 					, Lexer_Tokens[ idx ].Text.Len, Lexer_Tokens[ idx ].Text.Ptr | ||||||
| 				); | 				); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -1298,18 +1287,18 @@ TokArray lex( Str content ) | |||||||
| 			TokType last_type = array_back(Lexer_Tokens)->Type; | 			TokType last_type = array_back(Lexer_Tokens)->Type; | ||||||
| 			if ( last_type == Tok_Preprocess_Macro ) | 			if ( last_type == Tok_Preprocess_Macro ) | ||||||
| 			{ | 			{ | ||||||
| 				Token thanks_c = { c.scanner, 0, Tok_Invalid, c.line, c.column, TF_Null }; | 				Token thanks_c = { { c.scanner, 0 }, Tok_Invalid, c.line, c.column, TF_Null }; | ||||||
| 				c.token = thanks_c; | 				c.token = thanks_c; | ||||||
| 				if ( (* ctx->scanner) == '\r') | 				if ( (* ctx->scanner) == '\r') | ||||||
| 				{ | 				{ | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
| 					c.token.Length = 1; | 					c.token.Text.Len = 1; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				if ( (* ctx->scanner) == '\n' ) | 				if ( (* ctx->scanner) == '\n' ) | ||||||
| 				{ | 				{ | ||||||
| 					c.token.Type = Tok_NewLine; | 					c.token.Type = Tok_NewLine; | ||||||
| 					c.token.Length++; | 					c.token.Text.Len++; | ||||||
| 					move_forward(); | 					move_forward(); | ||||||
|  |  | ||||||
| 					array_append( Lexer_Tokens, c.token ); | 					array_append( Lexer_Tokens, c.token ); | ||||||
|   | |||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -48,13 +48,13 @@ Str access_spec_to_str( AccessSpec type ) | |||||||
| { | { | ||||||
| 	local_persist | 	local_persist | ||||||
| 	Str lookup[ (u32)AccessSpec_Num_AccessSpec ] = { | 	Str lookup[ (u32)AccessSpec_Num_AccessSpec ] = { | ||||||
| 		{ sizeof("") - 1,          "" }, | 		{ "",        sizeof( "" )        - 1 }, | ||||||
| 		{ sizeof("prviate") - 1,   "private" }, | 		{ "private", sizeof("prviate")   - 1 }, | ||||||
| 		{ sizeof("protected") - 1, "private" }, | 		{ "private", sizeof("protected") - 1 }, | ||||||
| 		{ sizeof("public") - 1,    "public" }, | 		{ "public",  sizeof("public")    - 1 }, | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	Str invalid = { sizeof("Invalid") - 1, "Invalid" }; | 	Str invalid = { "Invalid", sizeof("Invalid") - 1 }; | ||||||
| 	if ( type > AccessSpec_Public ) | 	if ( type > AccessSpec_Public ) | ||||||
| 		return invalid; | 		return invalid; | ||||||
|  |  | ||||||
| @@ -101,13 +101,13 @@ Str module_flag_to_str( ModuleFlag flag ) | |||||||
| { | { | ||||||
| 	local_persist | 	local_persist | ||||||
| 	Str lookup[ (u32)Num_ModuleFlags ] = { | 	Str lookup[ (u32)Num_ModuleFlags ] = { | ||||||
| 		{ sizeof("__none__"), "__none__" }, | 		{ "__none__", sizeof("__none__") - 1 }, | ||||||
| 		{ sizeof("export"), "export" }, | 		{ "export",   sizeof("export")   - 1 }, | ||||||
| 		{ sizeof("import"), "import" }, | 		{ "import",   sizeof("import")   - 1 }, | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	local_persist | 	local_persist | ||||||
| 	Str invalid_flag = { sizeof("invalid"), "invalid" }; | 	Str invalid_flag = { "invalid", sizeof("invalid") }; | ||||||
| 	if ( flag > ModuleFlag_Import ) | 	if ( flag > ModuleFlag_Import ) | ||||||
| 		return invalid_flag; | 		return invalid_flag; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -102,16 +102,16 @@ struct Array | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if GEN_COMPILER_CPP && 0 | #if GEN_COMPILER_CPP && 0 | ||||||
| template<class Type> bool         append(Array<Type>& array, Array<Type> other)                         { return append( & array, other ); } | template<class Type> bool append(Array<Type>& array, Array<Type> other)                         { return append( & array, other ); } | ||||||
| template<class Type> bool         append(Array<Type>& array, Type value)                                { return append( & array, value ); } | template<class Type> bool append(Array<Type>& array, Type value)                                { return append( & array, value ); } | ||||||
| template<class Type> bool         append(Array<Type>& array, Type* items, usize item_num)               { return append( & array, items, item_num ); } | template<class Type> bool append(Array<Type>& array, Type* items, usize item_num)               { return append( & array, items, item_num ); } | ||||||
| template<class Type> bool         append_at(Array<Type>& array, Type item, usize idx)                   { return append_at( & array, item, idx ); } | template<class Type> bool append_at(Array<Type>& array, Type item, usize idx)                   { return append_at( & array, item, idx ); } | ||||||
| template<class Type> bool         append_at(Array<Type>& array, Type* items, usize item_num, usize idx) { return append_at( & array, items, item_num, idx ); } | template<class Type> bool append_at(Array<Type>& array, Type* items, usize item_num, usize idx) { return append_at( & array, items, item_num, idx ); } | ||||||
| template<class Type> void         free(Array<Type>& array)                                              { return free( & array ); } | template<class Type> void free(Array<Type>& array)                                              { return free( & array ); } | ||||||
| template<class Type> bool         grow(Array<Type>& array, usize min_capacity)                          { return grow( & array, min_capacity); } | template<class Type> bool grow(Array<Type>& array, usize min_capacity)                          { return grow( & array, min_capacity); } | ||||||
| template<class Type> bool         reserve(Array<Type>& array, usize new_capacity)                       { return reserve( & array, new_capacity); } | template<class Type> bool reserve(Array<Type>& array, usize new_capacity)                       { return reserve( & array, new_capacity); } | ||||||
| template<class Type> bool         resize(Array<Type>& array, usize num)                                 { return resize( & array, num); } | template<class Type> bool resize(Array<Type>& array, usize num)                                 { return resize( & array, num); } | ||||||
| template<class Type> bool         set_capacity(Array<Type>& array, usize new_capacity)                  { return set_capacity( & array, new_capacity); } | template<class Type> bool set_capacity(Array<Type>& array, usize new_capacity)                  { return set_capacity( & array, new_capacity); } | ||||||
|  |  | ||||||
| template<class Type> forceinline Type* begin(Array<Type>& array)             { return array;      } | template<class Type> forceinline Type* begin(Array<Type>& array)             { return array;      } | ||||||
| template<class Type> forceinline Type* end(Array<Type>& array)               { return array + array_get_header(array)->Num; } | template<class Type> forceinline Type* end(Array<Type>& array)               { return array + array_get_header(array)->Num; } | ||||||
|   | |||||||
| @@ -11,8 +11,10 @@ | |||||||
| #if GEN_BUILD_DEBUG | #if GEN_BUILD_DEBUG | ||||||
| #	if defined( GEN_COMPILER_MSVC ) | #	if defined( GEN_COMPILER_MSVC ) | ||||||
| #		if _MSC_VER < 1300 | #		if _MSC_VER < 1300 | ||||||
|  | #pragma message("GEN_BUILD_DEBUG: __asm int 3") | ||||||
| #			define GEN_DEBUG_TRAP() __asm int 3 /* Trap to debugger! */ | #			define GEN_DEBUG_TRAP() __asm int 3 /* Trap to debugger! */ | ||||||
| #		else | #		else | ||||||
|  | #pragma message("GEN_BUILD_DEBUG: __debugbreak()") | ||||||
| #			define GEN_DEBUG_TRAP() __debugbreak() | #			define GEN_DEBUG_TRAP() __debugbreak() | ||||||
| #		endif | #		endif | ||||||
| #	elif defined( GEN_COMPILER_TINYC ) | #	elif defined( GEN_COMPILER_TINYC ) | ||||||
| @@ -21,6 +23,7 @@ | |||||||
| #		define GEN_DEBUG_TRAP() __builtin_trap() | #		define GEN_DEBUG_TRAP() __builtin_trap() | ||||||
| #	endif | #	endif | ||||||
| #else | #else | ||||||
|  | #pragma message("GEN_BUILD_DEBUG: omitted") | ||||||
| #	define GEN_DEBUG_TRAP() | #	define GEN_DEBUG_TRAP() | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -48,7 +51,7 @@ | |||||||
| 		local_persist thread_local                         \ | 		local_persist thread_local                         \ | ||||||
| 		char buf[GEN_PRINTF_MAXLEN] = { 0 };               \ | 		char buf[GEN_PRINTF_MAXLEN] = { 0 };               \ | ||||||
| 		                                                   \ | 		                                                   \ | ||||||
| 		c_str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__);      \ | 		c_str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__);    \ | ||||||
| 		GEN_PANIC(buf);                                    \ | 		GEN_PANIC(buf);                                    \ | ||||||
| 	}                                                      \ | 	}                                                      \ | ||||||
| 	while (0) | 	while (0) | ||||||
| @@ -57,7 +60,8 @@ | |||||||
| #	define GEN_FATAL( ... )                  \ | #	define GEN_FATAL( ... )                  \ | ||||||
| 	do                                       \ | 	do                                       \ | ||||||
| 	{                                        \ | 	{                                        \ | ||||||
| 		c_str_fmt_out_err( __VA_ARGS__ );      \ | 		c_str_fmt_out_err( __VA_ARGS__ );    \ | ||||||
|  | 		GEN_DEBUG_TRAP();                    \ | ||||||
| 		process_exit(1);                     \ | 		process_exit(1);                     \ | ||||||
| 	}                                        \ | 	}                                        \ | ||||||
| 	while (0) | 	while (0) | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
| #	include "debug.cpp" | #	include "debug.cpp" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #pragma region StrBuilder Ops | #pragma region String Ops | ||||||
|  |  | ||||||
| internal | internal | ||||||
| ssize _scan_zpl_i64( const char* text, s32 base, s64* value ) | ssize _scan_zpl_i64( const char* text, s32 base, s64* value ) | ||||||
| @@ -211,4 +211,4 @@ f64 c_str_to_f64( const char* str, char** end_ptr ) | |||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
|  |  | ||||||
| #pragma endregion StrBuilder Ops | #pragma endregion String Ops | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
| #	include "memory.hpp" | #	include "memory.hpp" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #pragma region StrBuilder Ops | #pragma region String Ops | ||||||
|  |  | ||||||
| const char* char_first_occurence( const char* str, char c ); | const char* char_first_occurence( const char* str, char c ); | ||||||
|  |  | ||||||
| @@ -284,4 +284,4 @@ void c_str_to_upper( char* str ) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| #pragma endregion StrBuilder Ops | #pragma endregion String Ops | ||||||
|   | |||||||
| @@ -18,8 +18,8 @@ Str         str_visualize_whitespace(Str str, AllocatorInfo allocator); | |||||||
| // Constant string with length. | // Constant string with length. | ||||||
| struct Str | struct Str | ||||||
| { | { | ||||||
| 	ssize       Len; |  | ||||||
| 	char const* Ptr; | 	char const* Ptr; | ||||||
|  | 	ssize       Len; | ||||||
|  |  | ||||||
| #if GEN_COMPILER_CPP | #if GEN_COMPILER_CPP | ||||||
| 	forceinline operator char const* ()               const { return Ptr; } | 	forceinline operator char const* ()               const { return Ptr; } | ||||||
| @@ -40,9 +40,9 @@ struct Str | |||||||
|  |  | ||||||
| #ifndef txt | #ifndef txt | ||||||
| #	if GEN_COMPILER_CPP | #	if GEN_COMPILER_CPP | ||||||
| #		define txt( text )          Str { sizeof( text ) - 1, ( text ) } | #		define txt( text )          Str { ( text ), sizeof( text ) - 1 } | ||||||
| #	else | #	else | ||||||
| #		define txt( text )         (Str){ sizeof( text ) - 1, ( text ) } | #		define txt( text )         (Str){ ( text ), sizeof( text ) - 1 } | ||||||
| #	endif | #	endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -103,7 +103,7 @@ b32 str_starts_with(Str str, Str substring) { | |||||||
|  |  | ||||||
| inline | inline | ||||||
| Str to_str_from_c_str( char const* bad_str ) { | Str to_str_from_c_str( char const* bad_str ) { | ||||||
| 	Str result = { c_str_len( bad_str ), bad_str }; | 	Str result = { bad_str, c_str_len( bad_str ) }; | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -170,7 +170,7 @@ struct StrBuilder | |||||||
|  |  | ||||||
| 	forceinline operator char*()             { return Data; } | 	forceinline operator char*()             { return Data; } | ||||||
| 	forceinline operator char const*() const { return Data; } | 	forceinline operator char const*() const { return Data; } | ||||||
| 	forceinline operator Str()         const { return { strbuilder_length(* this), Data }; } | 	forceinline operator Str()         const { return { Data, strbuilder_length(* this) }; } | ||||||
|  |  | ||||||
| 	StrBuilder const& operator=(StrBuilder const& other) const { | 	StrBuilder const& operator=(StrBuilder const& other) const { | ||||||
| 		if (this == &other) | 		if (this == &other) | ||||||
| @@ -222,31 +222,31 @@ struct StrBuilder | |||||||
| 		return strbuilder_make_length(allocator, buf, res); | 		return strbuilder_make_length(allocator, buf, res); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	forceinline bool          make_space_for(char const* str, ssize add_len) { return strbuilder_make_space_for(this, str, add_len); } | 	forceinline bool              make_space_for(char const* str, ssize add_len) { return strbuilder_make_space_for(this, str, add_len); } | ||||||
| 	forceinline bool          append(char c)                                 { return strbuilder_append_char(this, c); } | 	forceinline bool              append(char c)                                 { return strbuilder_append_char(this, c); } | ||||||
| 	forceinline bool          append(char const* str)                        { return strbuilder_append_c_str(this, str); } | 	forceinline bool              append(char const* str)                        { return strbuilder_append_c_str(this, str); } | ||||||
| 	forceinline bool          append(char const* str, ssize length)          { return strbuilder_append_c_str_len(this, str, length); } | 	forceinline bool              append(char const* str, ssize length)          { return strbuilder_append_c_str_len(this, str, length); } | ||||||
| 	forceinline bool          append(Str str)                                { return strbuilder_append_str(this, str); } | 	forceinline bool              append(Str str)                                { return strbuilder_append_str(this, str); } | ||||||
| 	forceinline bool          append(const StrBuilder other)                 { return strbuilder_append_string(this, other); } | 	forceinline bool              append(const StrBuilder other)                 { return strbuilder_append_string(this, other); } | ||||||
| 	forceinline ssize         avail_space() const                            { return strbuilder_avail_space(* this); } | 	forceinline ssize             avail_space() const                            { return strbuilder_avail_space(* this); } | ||||||
| 	forceinline char*         back()                                         { return strbuilder_back(* this); } | 	forceinline char*             back()                                         { return strbuilder_back(* this); } | ||||||
| 	forceinline bool          contains(Str substring) const                  { return strbuilder_contains_str(* this, substring); } | 	forceinline bool              contains(Str substring) const                  { return strbuilder_contains_str(* this, substring); } | ||||||
| 	forceinline bool          contains(StrBuilder const& substring) const    { return strbuilder_contains_string(* this, substring); } | 	forceinline bool              contains(StrBuilder const& substring) const    { return strbuilder_contains_string(* this, substring); } | ||||||
| 	forceinline ssize         capacity() const                               { return strbuilder_capacity(* this); } | 	forceinline ssize             capacity() const                               { return strbuilder_capacity(* this); } | ||||||
| 	forceinline void          clear()                                        {        strbuilder_clear(* this); } | 	forceinline void              clear()                                        {        strbuilder_clear(* this); } | ||||||
| 	forceinline StrBuilder    duplicate(AllocatorInfo allocator) const       { return strbuilder_duplicate(* this, allocator); } | 	forceinline StrBuilder        duplicate(AllocatorInfo allocator) const       { return strbuilder_duplicate(* this, allocator); } | ||||||
| 	forceinline void          free()                                         {        strbuilder_free(this); } | 	forceinline void              free()                                         {        strbuilder_free(this); } | ||||||
| 	forceinline bool          is_equal(StrBuilder const& other) const        { return strbuilder_are_equal(* this, other); } | 	forceinline bool              is_equal(StrBuilder const& other) const        { return strbuilder_are_equal(* this, other); } | ||||||
| 	forceinline bool          is_equal(Str other) const                      { return strbuilder_are_equal_str(* this, other); } | 	forceinline bool              is_equal(Str other) const                      { return strbuilder_are_equal_str(* this, other); } | ||||||
| 	forceinline ssize         length() const                                 { return strbuilder_length(* this); } | 	forceinline ssize             length() const                                 { return strbuilder_length(* this); } | ||||||
| 	forceinline b32           starts_with(Str substring) const               { return strbuilder_starts_with_str(* this, substring); } | 	forceinline b32               starts_with(Str substring) const               { return strbuilder_starts_with_str(* this, substring); } | ||||||
| 	forceinline b32           starts_with(StrBuilder substring) const        { return strbuilder_starts_with_string(* this, substring); } | 	forceinline b32               starts_with(StrBuilder substring) const        { return strbuilder_starts_with_string(* this, substring); } | ||||||
| 	forceinline void          skip_line()                                    {        strbuilder_skip_line(* this); } | 	forceinline void              skip_line()                                    {        strbuilder_skip_line(* this); } | ||||||
| 	forceinline void          strip_space()                                  {        strbuilder_strip_space(* this); } | 	forceinline void              strip_space()                                  {        strbuilder_strip_space(* this); } | ||||||
| 	forceinline Str           to_str()                                       { return { strbuilder_length(*this), Data}; } | 	forceinline Str               to_str()                                       { return { Data, strbuilder_length(*this) }; } | ||||||
| 	forceinline void          trim(char const* cut_set)                      {        strbuilder_trim(* this, cut_set); } | 	forceinline void              trim(char const* cut_set)                      {        strbuilder_trim(* this, cut_set); } | ||||||
| 	forceinline void          trim_space()                                   {        strbuilder_trim_space(* this); } | 	forceinline void              trim_space()                                   {        strbuilder_trim_space(* this); } | ||||||
| 	forceinline StrBuilder    visualize_whitespace() const                   { return strbuilder_visualize_whitespace(* this); } | 	forceinline StrBuilder        visualize_whitespace() const                   { return strbuilder_visualize_whitespace(* this); } | ||||||
| 	forceinline StrBuilderHeader& get_header()                                   { return * strbuilder_get_header(* this); } | 	forceinline StrBuilderHeader& get_header()                                   { return * strbuilder_get_header(* this); } | ||||||
|  |  | ||||||
| 	bool append_fmt(char const* fmt, ...) { | 	bool append_fmt(char const* fmt, ...) { | ||||||
| @@ -621,7 +621,7 @@ void strip_space(StrBuilder str) | |||||||
|  |  | ||||||
| forceinline | forceinline | ||||||
| Str strbuilder_to_str(StrBuilder str) { | Str strbuilder_to_str(StrBuilder str) { | ||||||
| 	Str result = { strbuilder_length(str), (char const*)str }; | 	Str result = { (char const*)str, strbuilder_length(str) }; | ||||||
| 	return result; | 	return result; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,8 +22,8 @@ CodeBody gen_ecode( char const* path, bool use_c_definition = false ) | |||||||
| 		char const* keyword = csv_enum.Col_2[idx].string; | 		char const* keyword = csv_enum.Col_2[idx].string; | ||||||
| 		// TODO(Ed): to_c_str_entries and the others in here didn't have proper sizing of the Str slice. | 		// TODO(Ed): to_c_str_entries and the others in here didn't have proper sizing of the Str slice. | ||||||
| 		strbuilder_append_fmt( & enum_entries,             "CT_%s,\n", code ); | 		strbuilder_append_fmt( & enum_entries,             "CT_%s,\n", code ); | ||||||
| 		strbuilder_append_fmt( & to_c_str_entries,         "{ sizeof(\"%s\"), \"%s\" },\n", code, code ); | 		strbuilder_append_fmt( & to_c_str_entries,         "{ \"%s\",  sizeof(\"%s\") - 1 },\n", code,    code ); | ||||||
| 		strbuilder_append_fmt( & to_keyword_c_str_entries, "{ sizeof(\"%s\") - 1, \"%s\" },\n", keyword, keyword ); | 		strbuilder_append_fmt( & to_keyword_c_str_entries, "{  \"%s\", sizeof(\"%s\") - 1 },\n", keyword, keyword ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	CodeEnum enum_code; | 	CodeEnum enum_code; | ||||||
| @@ -40,7 +40,7 @@ CodeBody gen_ecode( char const* path, bool use_c_definition = false ) | |||||||
|  |  | ||||||
| #pragma push_macro("local_persist") | #pragma push_macro("local_persist") | ||||||
| #undef local_persist | #undef local_persist | ||||||
| 	Str lookup_size = strbuilder_to_str(strbuilder_fmt_buf(GlobalAllocator, "%d", array_num(csv_enum.Col_1) )); | 	Str      lookup_size  = strbuilder_to_str(strbuilder_fmt_buf(GlobalAllocator, "%d", array_num(csv_enum.Col_1) )); | ||||||
| 	CodeBody to_c_str_fns = parse_global_body( token_fmt( | 	CodeBody to_c_str_fns = parse_global_body( token_fmt( | ||||||
| 		"entries",  strbuilder_to_str(to_c_str_entries) | 		"entries",  strbuilder_to_str(to_c_str_entries) | ||||||
| 	,	"keywords", strbuilder_to_str(to_keyword_c_str_entries) | 	,	"keywords", strbuilder_to_str(to_keyword_c_str_entries) | ||||||
| @@ -104,7 +104,7 @@ CodeBody gen_eoperator( char const* path, bool use_c_definition = false ) | |||||||
| 		char const* enum_str     = csv_enum.Col_1[idx].string; | 		char const* enum_str     = csv_enum.Col_1[idx].string; | ||||||
| 		char const* entry_to_str = csv_enum.Col_2[idx].string; | 		char const* entry_to_str = csv_enum.Col_2[idx].string; | ||||||
| 		strbuilder_append_fmt( & enum_entries,     "Op_%s,\n", enum_str ); | 		strbuilder_append_fmt( & enum_entries,     "Op_%s,\n", enum_str ); | ||||||
| 		strbuilder_append_fmt( & to_c_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str); | 		strbuilder_append_fmt( & to_c_str_entries, "{ \"%s\", sizeof(\"%s\") - 1 },\n", entry_to_str, entry_to_str); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	CodeEnum  enum_code; | 	CodeEnum  enum_code; | ||||||
| @@ -181,7 +181,7 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false ) | |||||||
| 	FixedArena_16KB scratch;       fixed_arena_init(& scratch); | 	FixedArena_16KB scratch;       fixed_arena_init(& scratch); | ||||||
| 	AllocatorInfo   scratch_info = fixed_arena_allocator_info(& scratch); | 	AllocatorInfo   scratch_info = fixed_arena_allocator_info(& scratch); | ||||||
|  |  | ||||||
| 	CSV_Columns2 csv_enum       = parse_csv_two_columns( scratch_info, path ); | 	CSV_Columns2 csv_enum       = parse_csv_two_columns(   scratch_info, path ); | ||||||
| 	StrBuilder enum_entries     = strbuilder_make_reserve( scratch_info, kilobytes(1) ); | 	StrBuilder enum_entries     = strbuilder_make_reserve( scratch_info, kilobytes(1) ); | ||||||
| 	StrBuilder to_c_str_entries = strbuilder_make_reserve( scratch_info, kilobytes(1) ); | 	StrBuilder to_c_str_entries = strbuilder_make_reserve( scratch_info, kilobytes(1) ); | ||||||
|  |  | ||||||
| @@ -190,7 +190,7 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false ) | |||||||
| 		char const* enum_str     = csv_enum.Col_1[idx].string; | 		char const* enum_str     = csv_enum.Col_1[idx].string; | ||||||
| 		char const* entry_to_str = csv_enum.Col_2[idx].string; | 		char const* entry_to_str = csv_enum.Col_2[idx].string; | ||||||
| 		strbuilder_append_fmt( & enum_entries,     "Spec_%s,\n", enum_str ); | 		strbuilder_append_fmt( & enum_entries,     "Spec_%s,\n", enum_str ); | ||||||
| 		strbuilder_append_fmt( & to_c_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str); | 		strbuilder_append_fmt( & to_c_str_entries, "{ \"%s\", sizeof(\"%s\") - 1 },\n", entry_to_str, entry_to_str); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	CodeEnum enum_code; | 	CodeEnum enum_code; | ||||||
| @@ -267,7 +267,7 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false ) | |||||||
|  |  | ||||||
| 					// We subtract 1 to remove the null terminator | 					// We subtract 1 to remove the null terminator | ||||||
| 					// This is because the tokens lexed are not null terminated. | 					// This is because the tokens lexed are not null terminated. | ||||||
| 					keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1); | 					keymap[index] = crc32( enum_str.Ptr, enum_str.Len  ); | ||||||
| 				} | 				} | ||||||
| 			do_once_end | 			do_once_end | ||||||
|  |  | ||||||
| @@ -317,7 +317,7 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false ) | |||||||
|  |  | ||||||
| CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_definition = false ) | CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_definition = false ) | ||||||
| { | { | ||||||
| 	FixedArena_64KB scratch; fixed_arena_init(& scratch); | 	FixedArena_64KB scratch;       fixed_arena_init(& scratch); | ||||||
| 	AllocatorInfo   scratch_info = fixed_arena_allocator_info(& scratch); | 	AllocatorInfo   scratch_info = fixed_arena_allocator_info(& scratch); | ||||||
|  |  | ||||||
| 	FileContents enum_content = file_read_contents( scratch_info, file_zero_terminate, etok_path ); | 	FileContents enum_content = file_read_contents( scratch_info, file_zero_terminate, etok_path ); | ||||||
| @@ -330,15 +330,15 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_ | |||||||
| 	CSV_Object csv_attr_nodes; | 	CSV_Object csv_attr_nodes; | ||||||
| 	csv_parse( &csv_attr_nodes, rcast(char*, attrib_content.data), scratch_info, false ); | 	csv_parse( &csv_attr_nodes, rcast(char*, attrib_content.data), scratch_info, false ); | ||||||
|  |  | ||||||
| 	Array<ADT_Node> enum_strs          = csv_enum_nodes.nodes[0].nodes; | 	Array<ADT_Node> enum_strs            = csv_enum_nodes.nodes[0].nodes; | ||||||
| 	Array<ADT_Node> enum_c_str_strs      = csv_enum_nodes.nodes[1].nodes; | 	Array<ADT_Node> enum_c_str_strs      = csv_enum_nodes.nodes[1].nodes; | ||||||
| 	Array<ADT_Node> attribute_strs     = csv_attr_nodes.nodes[0].nodes; | 	Array<ADT_Node> attribute_strs       = csv_attr_nodes.nodes[0].nodes; | ||||||
| 	Array<ADT_Node> attribute_c_str_strs = csv_attr_nodes.nodes[1].nodes; | 	Array<ADT_Node> attribute_c_str_strs = csv_attr_nodes.nodes[1].nodes; | ||||||
|  |  | ||||||
| 	StrBuilder enum_entries             = strbuilder_make_reserve( scratch_info, kilobytes(2) ); | 	StrBuilder enum_entries             = strbuilder_make_reserve( scratch_info, kilobytes(2) ); | ||||||
| 	StrBuilder to_c_str_entries           = strbuilder_make_reserve( scratch_info, kilobytes(4) ); | 	StrBuilder to_c_str_entries         = strbuilder_make_reserve( scratch_info, kilobytes(4) ); | ||||||
| 	StrBuilder attribute_entries        = strbuilder_make_reserve( scratch_info, kilobytes(2) ); | 	StrBuilder attribute_entries        = strbuilder_make_reserve( scratch_info, kilobytes(2) ); | ||||||
| 	StrBuilder to_c_str_attributes        = strbuilder_make_reserve( scratch_info, kilobytes(4) ); | 	StrBuilder to_c_str_attributes      = strbuilder_make_reserve( scratch_info, kilobytes(4) ); | ||||||
| 	StrBuilder attribute_define_entries = strbuilder_make_reserve( scratch_info, kilobytes(4) ); | 	StrBuilder attribute_define_entries = strbuilder_make_reserve( scratch_info, kilobytes(4) ); | ||||||
|  |  | ||||||
| 	for (usize idx = 0; idx < array_num(enum_strs); idx++) | 	for (usize idx = 0; idx < array_num(enum_strs); idx++) | ||||||
| @@ -346,8 +346,8 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_ | |||||||
| 		char const* enum_str     = enum_strs[idx].string; | 		char const* enum_str     = enum_strs[idx].string; | ||||||
| 		char const* entry_to_str = enum_c_str_strs [idx].string; | 		char const* entry_to_str = enum_c_str_strs [idx].string; | ||||||
|  |  | ||||||
| 		strbuilder_append_fmt( & enum_entries, "Tok_%s,\n", enum_str ); | 		strbuilder_append_fmt( & enum_entries,     "Tok_%s,\n",                         enum_str ); | ||||||
| 		strbuilder_append_fmt( & to_c_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str); | 		strbuilder_append_fmt( & to_c_str_entries, "{ \"%s\", sizeof(\"%s\") - 1 },\n", entry_to_str, entry_to_str); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	for ( usize idx = 0; idx < array_num(attribute_strs); idx++ ) | 	for ( usize idx = 0; idx < array_num(attribute_strs); idx++ ) | ||||||
| @@ -355,8 +355,8 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_ | |||||||
| 		char const* attribute_str = attribute_strs[idx].string; | 		char const* attribute_str = attribute_strs[idx].string; | ||||||
| 		char const* entry_to_str  = attribute_c_str_strs [idx].string; | 		char const* entry_to_str  = attribute_c_str_strs [idx].string; | ||||||
|  |  | ||||||
| 		strbuilder_append_fmt( & attribute_entries, "Tok_Attribute_%s,\n", attribute_str ); | 		strbuilder_append_fmt( & attribute_entries,        "Tok_Attribute_%s,\n",               attribute_str ); | ||||||
| 		strbuilder_append_fmt( & to_c_str_attributes, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str); | 		strbuilder_append_fmt( & to_c_str_attributes,      "{ \"%s\", sizeof(\"%s\") - 1 },\n", entry_to_str, entry_to_str); | ||||||
| 		strbuilder_append_fmt( & attribute_define_entries, "Entry( Tok_Attribute_%s, \"%s\" )", attribute_str, entry_to_str ); | 		strbuilder_append_fmt( & attribute_define_entries, "Entry( Tok_Attribute_%s, \"%s\" )", attribute_str, entry_to_str ); | ||||||
|  |  | ||||||
| 		if ( idx < array_num(attribute_strs) - 1 ) | 		if ( idx < array_num(attribute_strs) - 1 ) | ||||||
| @@ -429,7 +429,7 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_ | |||||||
|  |  | ||||||
| 					// We subtract 1 to remove the null terminator | 					// We subtract 1 to remove the null terminator | ||||||
| 					// This is because the tokens lexed are not null terminated. | 					// This is because the tokens lexed are not null terminated. | ||||||
| 					keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1); | 					keymap[index] = crc32( enum_str.Ptr, enum_str.Len); | ||||||
| 				} | 				} | ||||||
| 			do_once_end | 			do_once_end | ||||||
|  |  | ||||||
| @@ -505,7 +505,7 @@ CodeBody gen_ast_inlines() | |||||||
| 		{ | 		{ | ||||||
| 			if ( ast == nullptr ) | 			if ( ast == nullptr ) | ||||||
| 			{ | 			{ | ||||||
| 				log_failure( "Attempt to dereference a nullptr!" ); | 				log_failure( "Attempt to dereference a nullptr!\n" ); | ||||||
| 				return nullptr; | 				return nullptr; | ||||||
| 			} | 			} | ||||||
| 			return ast; | 			return ast; | ||||||
|   | |||||||
| @@ -46,13 +46,13 @@ The C/C++ interface procedures are located with `ast.hpp` (for the Code type), a | |||||||
| All code types can either serialize using a function of the pattern: | All code types can either serialize using a function of the pattern: | ||||||
|  |  | ||||||
| ```c | ```c | ||||||
| StrBuilder <prefix>_to_string(Code code); | StrBuilder <prefix>_to_strbuilder(Code code); | ||||||
| // or | // or | ||||||
| <prefix>_to_string(Code code, StrBuilder& result); | <prefix>_to_strbuilder(Code code, StrBuilder& result); | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Where the first generates strings allocated using Allocator_StringArena and the other appends an existing strings with their backed allocator. | Where the first generates strings allocated using Allocator_StringArena and the other appends an existing strings with their backed allocator. | ||||||
|  |  | ||||||
| Serialization of for the AST is defined for `Code` in [`ast.chpp`](../base/components/ast.cpp) with `code_to_strbuilder_ptr` & `code_to_string`.   | Serialization of for the AST is defined for `Code` in [`ast.chpp`](../base/components/ast.cpp) with `code_to_strbuilder_ptr` & `code_to_strbuilder`.   | ||||||
| Serializtion for the rest of the code types is within [`code_serialization.cpp`](../base/components/code_serialization.cpp).   | Serializtion for the rest of the code types is within [`code_serialization.cpp`](../base/components/code_serialization.cpp).   | ||||||
| Gencpp's serialization does not provide coherent formatting of the code. The user should use a formatter after serializing. | Gencpp's serialization does not provide coherent formatting of the code. The user should use a formatter after serializing. | ||||||
|   | |||||||
| @@ -126,7 +126,7 @@ int gen_main() | |||||||
| 			if (fn->Specs) { | 			if (fn->Specs) { | ||||||
| 				s32 constexpr_found = fn->Specs.remove( Spec_Constexpr ); | 				s32 constexpr_found = fn->Specs.remove( Spec_Constexpr ); | ||||||
| 				if (constexpr_found > -1) { | 				if (constexpr_found > -1) { | ||||||
| 					//log_fmt("Found constexpr: %SB\n", entry.to_string()); | 					//log_fmt("Found constexpr: %SB\n", entry.to_strbuilder()); | ||||||
| 					fn->Specs.append(Spec_Inline); | 					fn->Specs.append(Spec_Inline); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| @@ -549,9 +549,9 @@ do                          \ | |||||||
| 			{ | 			{ | ||||||
| 				CodeTypename type       = using_ver->UnderlyingType; | 				CodeTypename type       = using_ver->UnderlyingType; | ||||||
| 				CodeTypedef typedef_ver = parse_typedef(token_fmt( | 				CodeTypedef typedef_ver = parse_typedef(token_fmt( | ||||||
| 					"ReturnType", to_string(type->ReturnType).to_str() | 					"ReturnType", to_strbuilder(type->ReturnType).to_str() | ||||||
| 				,	"Name"      , using_ver->Name | 				,	"Name"      , using_ver->Name | ||||||
| 				,	"Parameters", to_string(type->Params).to_str() | 				,	"Parameters", to_strbuilder(type->Params).to_str() | ||||||
| 				,	stringize( | 				,	stringize( | ||||||
| 						typedef <ReturnType>( * <Name>)(<Parameters>); | 						typedef <ReturnType>( * <Name>)(<Parameters>); | ||||||
| 				))); | 				))); | ||||||
| @@ -646,7 +646,7 @@ do                          \ | |||||||
| 					if (fn->Name.starts_with(txt("code_"))) | 					if (fn->Name.starts_with(txt("code_"))) | ||||||
| 					{ | 					{ | ||||||
| 						Str   old_prefix  = txt("code_"); | 						Str   old_prefix  = txt("code_"); | ||||||
| 						Str   actual_name = { fn->Name.Len  - old_prefix.Len, fn->Name.Ptr + old_prefix.Len }; | 						Str   actual_name = { fn->Name.Ptr + old_prefix.Len, fn->Name.Len  - old_prefix.Len }; | ||||||
| 						StrBuilder new_name    = StrBuilder::fmt_buf(GlobalAllocator, "code__%S", actual_name ); | 						StrBuilder new_name    = StrBuilder::fmt_buf(GlobalAllocator, "code__%S", actual_name ); | ||||||
|  |  | ||||||
| 						fn->Name = get_cached_string(new_name); | 						fn->Name = get_cached_string(new_name); | ||||||
| @@ -694,7 +694,7 @@ do                          \ | |||||||
|  |  | ||||||
| 			s32 constexpr_found = var->Specs ? var->Specs.remove( Spec_Constexpr ) : - 1; | 			s32 constexpr_found = var->Specs ? var->Specs.remove( Spec_Constexpr ) : - 1; | ||||||
| 			if (constexpr_found > -1) { | 			if (constexpr_found > -1) { | ||||||
| 				//log_fmt("Found constexpr: %SB\n", entry.to_string()); | 				//log_fmt("Found constexpr: %SB\n", entry.to_strbuilder()); | ||||||
| 				if (var->Name.contains(txt("AST_ArrSpecs_Cap"))) | 				if (var->Name.contains(txt("AST_ArrSpecs_Cap"))) | ||||||
| 				{ | 				{ | ||||||
| 					Code def = untyped_str(txt( | 					Code def = untyped_str(txt( | ||||||
| @@ -716,7 +716,7 @@ R"(#define AST_ArrSpecs_Cap \ | |||||||
| 					ast.append(def); | 					ast.append(def); | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 				CodeDefine def = def_define(var->Name, var->Value.to_string()); | 				CodeDefine def = def_define(var->Name, var->Value.to_strbuilder()); | ||||||
| 				ast.append(def); | 				ast.append(def); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| @@ -796,7 +796,7 @@ R"(#define AST_ArrSpecs_Cap \ | |||||||
| 			{ | 			{ | ||||||
| 				generic_selector.clear(); | 				generic_selector.clear(); | ||||||
| 				Str   private_prefix  = txt("code__"); | 				Str   private_prefix  = txt("code__"); | ||||||
| 				Str   actual_name     = { fn->Name.Len - private_prefix.Len, fn->Name.Ptr + private_prefix.Len }; | 				Str   actual_name     = { fn->Name.Ptr + private_prefix.Len, fn->Name.Len - private_prefix.Len }; | ||||||
| 				StrBuilder interface_name  = StrBuilder::fmt_buf(GlobalAllocator, "code_%S", actual_name ); | 				StrBuilder interface_name  = StrBuilder::fmt_buf(GlobalAllocator, "code_%S", actual_name ); | ||||||
|  |  | ||||||
| 				// Resolve generic's arguments | 				// Resolve generic's arguments | ||||||
| @@ -941,7 +941,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 			{ | 			{ | ||||||
| 				// Convert the definition to use a default struct: https://vxtwitter.com/vkrajacic/status/1749816169736073295 | 				// Convert the definition to use a default struct: https://vxtwitter.com/vkrajacic/status/1749816169736073295 | ||||||
| 				Str prefix      = txt("def_"); | 				Str prefix      = txt("def_"); | ||||||
| 				Str actual_name = { fn->Name.Len  - prefix.Len, fn->Name.Ptr + prefix.Len }; | 				Str actual_name = { fn->Name.Ptr + prefix.Len, fn->Name.Len  - prefix.Len }; | ||||||
| 				Str new_name    = StrBuilder::fmt_buf(GlobalAllocator, "def__%S", actual_name ).to_str(); | 				Str new_name    = StrBuilder::fmt_buf(GlobalAllocator, "def__%S", actual_name ).to_str(); | ||||||
|  |  | ||||||
| 				// Resolve define's arguments | 				// Resolve define's arguments | ||||||
| @@ -1020,7 +1020,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 			if (fn->Name.starts_with(txt("code_"))) | 			if (fn->Name.starts_with(txt("code_"))) | ||||||
| 			{ | 			{ | ||||||
| 				Str   old_prefix  = txt("code_"); | 				Str   old_prefix  = txt("code_"); | ||||||
| 				Str   actual_name = { fn->Name.Len  - old_prefix.Len, fn->Name.Ptr + old_prefix.Len }; | 				Str   actual_name = { fn->Name.Ptr + old_prefix.Len, fn->Name.Len  - old_prefix.Len }; | ||||||
| 				StrBuilder new_name    = StrBuilder::fmt_buf(GlobalAllocator, "code__%S", actual_name ); | 				StrBuilder new_name    = StrBuilder::fmt_buf(GlobalAllocator, "code__%S", actual_name ); | ||||||
|  |  | ||||||
| 				fn->Name = get_cached_string(new_name); | 				fn->Name = get_cached_string(new_name); | ||||||
| @@ -1175,7 +1175,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 			if (fn->Name.starts_with(txt("code_"))) | 			if (fn->Name.starts_with(txt("code_"))) | ||||||
| 			{ | 			{ | ||||||
| 				Str   old_prefix  = txt("code_"); | 				Str   old_prefix  = txt("code_"); | ||||||
| 				Str   actual_name = { fn->Name.Len  - old_prefix.Len, fn->Name.Ptr + old_prefix.Len }; | 				Str   actual_name = { fn->Name.Ptr + old_prefix.Len, fn->Name.Len  - old_prefix.Len }; | ||||||
| 				StrBuilder new_name    = StrBuilder::fmt_buf(GlobalAllocator, "code__%S", actual_name ); | 				StrBuilder new_name    = StrBuilder::fmt_buf(GlobalAllocator, "code__%S", actual_name ); | ||||||
|  |  | ||||||
| 				fn->Name = get_cached_string(new_name); | 				fn->Name = get_cached_string(new_name); | ||||||
| @@ -1227,7 +1227,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 			for ( CodeParams opt_param : fn->Params ) if (opt_param->ValueType->Name.starts_with(txt("Opts_"))) | 			for ( CodeParams opt_param : fn->Params ) if (opt_param->ValueType->Name.starts_with(txt("Opts_"))) | ||||||
| 			{ | 			{ | ||||||
| 				Str prefix      = txt("def_"); | 				Str prefix      = txt("def_"); | ||||||
| 				Str actual_name = { fn->Name.Len  - prefix.Len, fn->Name.Ptr + prefix.Len }; | 				Str actual_name = { fn->Name.Ptr + prefix.Len, fn->Name.Len  - prefix.Len }; | ||||||
| 				Str new_name    = StrBuilder::fmt_buf(GlobalAllocator, "def__%S", actual_name ).to_str(); | 				Str new_name    = StrBuilder::fmt_buf(GlobalAllocator, "def__%S", actual_name ).to_str(); | ||||||
|  |  | ||||||
| 				fn->Name = get_cached_string(new_name); | 				fn->Name = get_cached_string(new_name); | ||||||
| @@ -1319,7 +1319,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 				Code define_ver = untyped_str(token_fmt( | 				Code define_ver = untyped_str(token_fmt( | ||||||
| 						"name",  var->Name | 						"name",  var->Name | ||||||
| 					,	"value", var->Value->Content | 					,	"value", var->Value->Content | ||||||
| 					,	"type",  var->ValueType.to_string().to_str() | 					,	"type",  var->ValueType.to_strbuilder().to_str() | ||||||
| 					,	"#define <name> (<type>) <value>\n" | 					,	"#define <name> (<type>) <value>\n" | ||||||
| 				)); | 				)); | ||||||
| 				src_lexer.append(define_ver); | 				src_lexer.append(define_ver); | ||||||
| @@ -1364,7 +1364,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 				Code define_ver = untyped_str(token_fmt( | 				Code define_ver = untyped_str(token_fmt( | ||||||
| 						"name",  var->Name | 						"name",  var->Name | ||||||
| 					,	"value", var->Value->Content | 					,	"value", var->Value->Content | ||||||
| 					,	"type",  var->ValueType.to_string().to_str() | 					,	"type",  var->ValueType.to_strbuilder().to_str() | ||||||
| 					,	"#define <name> (<type>) <value>\n" | 					,	"#define <name> (<type>) <value>\n" | ||||||
| 				)); | 				)); | ||||||
| 				src_parser.append(define_ver); | 				src_parser.append(define_ver); | ||||||
| @@ -1481,6 +1481,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 		header.print_fmt( roll_own_dependencies_guard_start ); | 		header.print_fmt( roll_own_dependencies_guard_start ); | ||||||
| 		header.print( r_header_platform ); | 		header.print( r_header_platform ); | ||||||
| 		header.print_fmt( "\nGEN_NS_BEGIN\n" ); | 		header.print_fmt( "\nGEN_NS_BEGIN\n" ); | ||||||
|  | 		header.print_fmt( "GEN_API_C_BEGIN\n" ); | ||||||
|  |  | ||||||
| 		header.print( r_header_macros ); | 		header.print( r_header_macros ); | ||||||
| 		header.print( header_generic_macros ); | 		header.print( header_generic_macros ); | ||||||
| @@ -1497,7 +1498,8 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 		header.print( r_header_timing ); | 		header.print( r_header_timing ); | ||||||
| 		header.print(rf_header_parsing ); | 		header.print(rf_header_parsing ); | ||||||
|  |  | ||||||
| 		header.print_fmt( "\nGEN_NS_END\n" ); | 		header.print_fmt( "\nGEN_API_C_END\n" ); | ||||||
|  | 		header.print_fmt( "GEN_NS_END\n" ); | ||||||
| 		header.print_fmt( roll_own_dependencies_guard_end ); | 		header.print_fmt( roll_own_dependencies_guard_end ); | ||||||
| 	#pragma endregion Print Dependencies | 	#pragma endregion Print Dependencies | ||||||
|  |  | ||||||
| @@ -1548,7 +1550,7 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
|  |  | ||||||
| 	#pragma region Print Dependencies | 	#pragma region Print Dependencies | ||||||
| 		header.print_fmt( roll_own_dependencies_guard_start ); | 		header.print_fmt( roll_own_dependencies_guard_start ); | ||||||
| 		header.print_fmt( "GEN_NS_BEGIN\n"); | 		header.print_fmt( "\nGEN_NS_BEGIN\n"); | ||||||
| 		header.print_fmt( "GEN_API_C_BEGIN\n" ); | 		header.print_fmt( "GEN_API_C_BEGIN\n" ); | ||||||
|  |  | ||||||
| 		header.print( r_src_dep_start ); | 		header.print( r_src_dep_start ); | ||||||
| @@ -1562,12 +1564,14 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 		header.print( r_src_timing ); | 		header.print( r_src_timing ); | ||||||
| 		header.print( rf_src_parsing ); | 		header.print( rf_src_parsing ); | ||||||
|  |  | ||||||
|  | 		header.print_fmt( "\nGEN_API_C_END\n" ); | ||||||
| 		header.print_fmt( "GEN_NS_END\n"); | 		header.print_fmt( "GEN_NS_END\n"); | ||||||
| 		header.print_fmt( roll_own_dependencies_guard_end ); | 		header.print_fmt( roll_own_dependencies_guard_end ); | ||||||
| 	#pragma endregion Print Dependencies | 	#pragma endregion Print Dependencies | ||||||
|  |  | ||||||
| 	#pragma region Print Components | 	#pragma region Print Components | ||||||
| 		header.print_fmt( "\nGEN_NS_BEGIN\n"); | 		header.print_fmt( "\nGEN_NS_BEGIN\n"); | ||||||
|  | 		header.print_fmt( "GEN_API_C_BEGIN\n" ); | ||||||
|  |  | ||||||
| 		header.print( fmt_newline); | 		header.print( fmt_newline); | ||||||
| 		header.print( rf_array_arena ); | 		header.print( rf_array_arena ); | ||||||
| @@ -1596,12 +1600,13 @@ R"(#define <interface_name>( code ) _Generic( (code), \ | |||||||
| 		header.print( r_src_parsing ); | 		header.print( r_src_parsing ); | ||||||
| 		header.print_fmt( "\n#pragma endregion Parsing\n" ); | 		header.print_fmt( "\n#pragma endregion Parsing\n" ); | ||||||
| 		header.print( r_src_untyped ); | 		header.print( r_src_untyped ); | ||||||
| 		header.print_fmt( "\n#pragma endregion Interface\n\n"); | 		header.print_fmt( "\n#pragma endregion Interface\n"); | ||||||
|  |  | ||||||
| 		header.print( rf_src_builder ); | 		header.print( rf_src_builder ); | ||||||
| 		header.print( rf_src_scanner ); | 		header.print( rf_src_scanner ); | ||||||
|  |  | ||||||
| 		header.print_fmt( "GEN_API_C_END\n" ); | 		header.print_fmt( "\nGEN_API_C_END\n" ); | ||||||
|  | 		header.print_fmt( "GEN_NS_END\n"); | ||||||
| 	#pragma endregion Print Components | 	#pragma endregion Print Components | ||||||
|  |  | ||||||
| 		header.print_fmt( implementation_guard_end ); | 		header.print_fmt( implementation_guard_end ); | ||||||
|   | |||||||
| @@ -173,7 +173,7 @@ word PrintF_Buffer,     gen_PrintF_Buffer | |||||||
| word Msg_Invalid_Value, gen_Msg_Invalid_Value | word Msg_Invalid_Value, gen_Msg_Invalid_Value | ||||||
| word log_fmt,           gen_log_fmt | word log_fmt,           gen_log_fmt | ||||||
|  |  | ||||||
| // StrBuilder Ops | // String Ops | ||||||
|  |  | ||||||
| namespace char_, gen_char_ | namespace char_, gen_char_ | ||||||
|  |  | ||||||
| @@ -468,6 +468,10 @@ word Allocator_TypeTable,     gen_Allocator_TypeTable | |||||||
| word      Builder,  gen_Builder | word      Builder,  gen_Builder | ||||||
| namespace builder_, gen_builder_ | namespace builder_, gen_builder_ | ||||||
|  |  | ||||||
|  | // Scanner | ||||||
|  |  | ||||||
|  | word scan_file, gen_scan_file | ||||||
|  |  | ||||||
| // Implementation (prviate) | // Implementation (prviate) | ||||||
|  |  | ||||||
| word _format_info, gen__format_info | word _format_info, gen__format_info | ||||||
|   | |||||||
| @@ -171,7 +171,7 @@ int gen_main() | |||||||
| 		builder_print_fmt( header, "#pragma endregion Inlines\n" ); | 		builder_print_fmt( header, "#pragma endregion Inlines\n" ); | ||||||
|  |  | ||||||
| 		builder_print( header, header_end ); | 		builder_print( header, header_end ); | ||||||
| 		builder_print_fmt( header, "GEN_NS_END\n\n" ); | 		builder_print_fmt( header, "\nGEN_NS_END\n\n" ); | ||||||
| 		builder_print( header, pop_ignores ); | 		builder_print( header, pop_ignores ); | ||||||
| 		builder_write(header); | 		builder_write(header); | ||||||
| 	} | 	} | ||||||
| @@ -238,7 +238,7 @@ int gen_main() | |||||||
| 		builder_print( & header, def_include( txt("gen.hpp") )); | 		builder_print( & header, def_include( txt("gen.hpp") )); | ||||||
| 		builder_print_fmt( & header, "\nGEN_NS_BEGIN\n" ); | 		builder_print_fmt( & header, "\nGEN_NS_BEGIN\n" ); | ||||||
| 		builder_print( & header, builder ); | 		builder_print( & header, builder ); | ||||||
| 		builder_print_fmt( & header, "GEN_NS_END\n" ); | 		builder_print_fmt( & header, "\nGEN_NS_END\n" ); | ||||||
| 		builder_write( & header); | 		builder_write( & header); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -278,7 +278,7 @@ int gen_main() | |||||||
| 		builder_print( & src, def_include( txt("gen.scanner.hpp") ) ); | 		builder_print( & src, def_include( txt("gen.scanner.hpp") ) ); | ||||||
| 		builder_print_fmt( & src, "\nGEN_NS_BEGIN\n" ); | 		builder_print_fmt( & src, "\nGEN_NS_BEGIN\n" ); | ||||||
| 		builder_print( & src, scanner ); | 		builder_print( & src, scanner ); | ||||||
| 		builder_print_fmt( & src, "GEN_NS_END\n" ); | 		builder_print_fmt( & src, "\nGEN_NS_END\n" ); | ||||||
| 		builder_write( & src); | 		builder_write( & src); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -105,6 +105,7 @@ int gen_main() | |||||||
| 				header.print( scan_file( path_base "dependencies/parsing.hpp" ) ); | 				header.print( scan_file( path_base "dependencies/parsing.hpp" ) ); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | 			header.print(fmt_newline); | ||||||
| 			header.print_fmt( "GEN_NS_END\n" ); | 			header.print_fmt( "GEN_NS_END\n" ); | ||||||
| 			header.print_fmt( roll_own_dependencies_guard_end ); | 			header.print_fmt( roll_own_dependencies_guard_end ); | ||||||
| 			header.print( fmt_newline ); | 			header.print( fmt_newline ); | ||||||
| @@ -155,7 +156,11 @@ int gen_main() | |||||||
| 		if ( generate_builder ) { | 		if ( generate_builder ) { | ||||||
| 			header.print( scan_file( path_base "auxillary/builder.hpp" ) ); | 			header.print( scan_file( path_base "auxillary/builder.hpp" ) ); | ||||||
| 		} | 		} | ||||||
|  | 		if ( generate_scanner ) { | ||||||
|  | 			header.print( scan_file( path_base "auxillary/scanner.hpp" ) ); | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		header.print(fmt_newline); | ||||||
| 		header.print_fmt( "GEN_NS_END\n" ); | 		header.print_fmt( "GEN_NS_END\n" ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -176,9 +181,10 @@ int gen_main() | |||||||
| 			Code timing     = scan_file( path_base "dependencies/timing.cpp" ); | 			Code timing     = scan_file( path_base "dependencies/timing.cpp" ); | ||||||
|  |  | ||||||
| 			header.print_fmt( roll_own_dependencies_guard_start ); | 			header.print_fmt( roll_own_dependencies_guard_start ); | ||||||
| 			header.print_fmt( "GEN_NS_BEGIN\n\n"); |  | ||||||
|  |  | ||||||
| 			header.print( impl_start ); | 			header.print( impl_start ); | ||||||
|  | 			header.print( fmt_newline ); | ||||||
|  | 			header.print_fmt( "GEN_NS_BEGIN\n"); | ||||||
|  |  | ||||||
| 			header.print( debug ); | 			header.print( debug ); | ||||||
| 			header.print( string_ops ); | 			header.print( string_ops ); | ||||||
| 			header.print( printing ); | 			header.print( printing ); | ||||||
| @@ -209,8 +215,7 @@ int gen_main() | |||||||
| 		Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" ); | 		Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" ); | ||||||
| 		Code untyped           = scan_file( path_base "components/interface.untyped.cpp" ); | 		Code untyped           = scan_file( path_base "components/interface.untyped.cpp" ); | ||||||
|  |  | ||||||
| 		CodeBody etoktype      = gen_etoktype( path_base "enums/ETokType.csv", path_base "enums/AttributeTokens.csv" ); | 		CodeBody etoktype = gen_etoktype( path_base "enums/ETokType.csv", path_base "enums/AttributeTokens.csv" ); | ||||||
| 		CodeNS   parser_nspace = def_namespace( name(parser), def_namespace_body( args(etoktype)) ); |  | ||||||
|  |  | ||||||
| 		header.print_fmt( "\nGEN_NS_BEGIN\n"); | 		header.print_fmt( "\nGEN_NS_BEGIN\n"); | ||||||
| 		header.print( static_data ); | 		header.print( static_data ); | ||||||
| @@ -225,27 +230,23 @@ int gen_main() | |||||||
| 		header.print( interface ); | 		header.print( interface ); | ||||||
| 		header.print( upfront ); | 		header.print( upfront ); | ||||||
| 		header.print_fmt( "\n#pragma region Parsing\n\n" ); | 		header.print_fmt( "\n#pragma region Parsing\n\n" ); | ||||||
| 		header.print( format(parser_nspace) ); | 		header.print( format(etoktype) ); | ||||||
| 		header.print( lexer ); | 		header.print( lexer ); | ||||||
| 		header.print( parser ); | 		header.print( parser ); | ||||||
| 		header.print( parsing_interface ); | 		header.print( parsing_interface ); | ||||||
| 		header.print_fmt( "\n#pragma endregion Parsing\n" ); | 		header.print_fmt( "\n#pragma endregion Parsing\n" ); | ||||||
| 		header.print( untyped ); | 		header.print( untyped ); | ||||||
| 		header.print_fmt( "\n#pragma endregion Interface\n\n"); | 		header.print_fmt( "\n#pragma endregion Interface\n"); | ||||||
|  |  | ||||||
| 		if ( generate_builder ) { | 		if ( generate_builder ) { | ||||||
| 			header.print( scan_file( path_base "auxillary/builder.cpp"  ) ); | 			header.print( scan_file( path_base "auxillary/builder.cpp"  ) ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Scanner header depends on implementation |  | ||||||
| 		if ( generate_scanner ) { |  | ||||||
| 			header.print( scan_file( path_base "auxillary/scanner.hpp" ) ); |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		if ( generate_scanner ) { | 		if ( generate_scanner ) { | ||||||
| 			header.print( scan_file( path_base "auxillary/scanner.cpp" ) ); | 			header.print( scan_file( path_base "auxillary/scanner.cpp" ) ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		header.print( fmt_newline); | ||||||
| 		header.print_fmt( "GEN_NS_END\n"); | 		header.print_fmt( "GEN_NS_END\n"); | ||||||
|  |  | ||||||
| 		header.print_fmt( "%s\n", (char const*) implementation_guard_end ); | 		header.print_fmt( "%s\n", (char const*) implementation_guard_end ); | ||||||
|   | |||||||
| @@ -68,7 +68,7 @@ int gen_main() | |||||||
| 		CodeBody macros = def_body( CT_Global_Body ); | 		CodeBody macros = def_body( CT_Global_Body ); | ||||||
| 		{ | 		{ | ||||||
| 			FileContents content    = file_read_contents( GlobalAllocator, true, path_base "dependencies/macros.hpp" ); | 			FileContents content    = file_read_contents( GlobalAllocator, true, path_base "dependencies/macros.hpp" ); | ||||||
| 			CodeBody     ori_macros = parse_global_body( Str { content.size, (char const*)content.data }); | 			CodeBody     ori_macros = parse_global_body( Str { (char const*)content.data, content.size }); | ||||||
|  |  | ||||||
| 			for (Code	code =  ori_macros.begin(); | 			for (Code	code =  ori_macros.begin(); | ||||||
| 						code != ori_macros.end(); | 						code != ori_macros.end(); | ||||||
| @@ -223,7 +223,7 @@ int gen_main() | |||||||
| 		header.print_fmt( "#pragma endregion Inlines\n" ); | 		header.print_fmt( "#pragma endregion Inlines\n" ); | ||||||
|  |  | ||||||
| 		header.print( header_end ); | 		header.print( header_end ); | ||||||
| 		header.print_fmt( "GEN_NS_END\n\n" ); | 		header.print_fmt( "\nGEN_NS_END\n\n" ); | ||||||
| 		header.print( pop_ignores ); | 		header.print( pop_ignores ); | ||||||
| 		header.write(); | 		header.write(); | ||||||
| 	} | 	} | ||||||
| @@ -294,7 +294,7 @@ int gen_main() | |||||||
| 		header.print( def_include( txt("gen.hpp") )); | 		header.print( def_include( txt("gen.hpp") )); | ||||||
| 		header.print_fmt( "\nGEN_NS_BEGIN\n" ); | 		header.print_fmt( "\nGEN_NS_BEGIN\n" ); | ||||||
| 		header.print( builder ); | 		header.print( builder ); | ||||||
| 		header.print_fmt( "GEN_NS_END\n" ); | 		header.print_fmt( "\nGEN_NS_END\n" ); | ||||||
| 		header.print( fmt_newline ); | 		header.print( fmt_newline ); | ||||||
| 		header.print( pop_ignores ); | 		header.print( pop_ignores ); | ||||||
| 		header.write(); | 		header.write(); | ||||||
| @@ -333,7 +333,7 @@ int gen_main() | |||||||
| 		header.print_fmt( "\nGEN_NS_BEGIN\n" ); | 		header.print_fmt( "\nGEN_NS_BEGIN\n" ); | ||||||
| 		header.print( parsing ); | 		header.print( parsing ); | ||||||
| 		header.print( scanner ); | 		header.print( scanner ); | ||||||
| 		header.print_fmt( "GEN_NS_END\n" ); | 		header.print_fmt( "\nGEN_NS_END\n" ); | ||||||
| 		header.print( fmt_newline ); | 		header.print( fmt_newline ); | ||||||
| 		header.print( pop_ignores ); | 		header.print( pop_ignores ); | ||||||
| 		header.write(); | 		header.write(); | ||||||
| @@ -353,7 +353,7 @@ int gen_main() | |||||||
| 		src.print_fmt( "\nGEN_NS_BEGIN\n" ); | 		src.print_fmt( "\nGEN_NS_BEGIN\n" ); | ||||||
| 		src.print( parsing ); | 		src.print( parsing ); | ||||||
| 		// src.print( scanner ); | 		// src.print( scanner ); | ||||||
| 		src.print_fmt( "GEN_NS_END\n" ); | 		src.print_fmt( "\nGEN_NS_END\n" ); | ||||||
| 		src.print( fmt_newline ); | 		src.print( fmt_newline ); | ||||||
| 		src.print( pop_ignores ); | 		src.print( pop_ignores ); | ||||||
| 		src.write(); | 		src.write(); | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ | |||||||
| 		<Action>NoStepInto</Action> | 		<Action>NoStepInto</Action> | ||||||
| 	</Function> | 	</Function> | ||||||
| 	<Function> | 	<Function> | ||||||
| 		<Name>gen::Code.*::to_string</Name> | 		<Name>gen::Code.*::to_strbuilder</Name> | ||||||
| 		<Action>NoStepInto</Action> | 		<Action>NoStepInto</Action> | ||||||
| 	</Function> | 	</Function> | ||||||
| 	<Function> | 	<Function> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user