mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 07:44:45 -08:00
Corrected enum serialization of ecodetypes, eoperator, especifier, and etoktype, some more naming refactors for strbuilder... formatting
This commit is contained in:
parent
012fcb6bd5
commit
bac57a5872
@ -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 );
|
||||||
|
@ -63,7 +63,7 @@ Str code_debug_str(Code self)
|
|||||||
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") );
|
||||||
@ -77,7 +77,7 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
@ -89,9 +89,9 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
|
|
||||||
@ -102,9 +102,9 @@ Str code_debug_str(Code self)
|
|||||||
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:
|
||||||
@ -114,7 +114,7 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
|
|
||||||
@ -129,8 +129,8 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
|
|
||||||
@ -142,8 +142,8 @@ Str code_debug_str(Code self)
|
|||||||
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:
|
||||||
@ -163,7 +163,7 @@ Str code_debug_str(Code self)
|
|||||||
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:
|
||||||
@ -173,10 +173,10 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
|
|
||||||
@ -187,10 +187,10 @@ Str code_debug_str(Code self)
|
|||||||
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:
|
||||||
@ -208,10 +208,10 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
@ -224,10 +224,10 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
|
|
||||||
@ -238,8 +238,8 @@ Str code_debug_str(Code self)
|
|||||||
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;
|
||||||
|
|
||||||
@ -250,16 +250,16 @@ Str code_debug_str(Code self)
|
|||||||
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:
|
||||||
@ -296,15 +296,15 @@ Str code_debug_str(Code self)
|
|||||||
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,7 +313,7 @@ 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;
|
||||||
|
|
||||||
@ -324,8 +324,8 @@ Str code_debug_str(Code self)
|
|||||||
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,9 +333,9 @@ 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;
|
||||||
}
|
}
|
||||||
@ -346,11 +346,11 @@ Str code_debug_str(Code self)
|
|||||||
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:
|
||||||
|
@ -260,7 +260,7 @@ 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 );
|
||||||
@ -298,14 +298,14 @@ struct 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 for for-range iteration.
|
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 && 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(" )"));
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
void body_append ( CodeBody body, Code other );
|
void body_append ( CodeBody body, Code other );
|
||||||
void body_append_body ( CodeBody body, CodeBody other );
|
void body_append_body ( CodeBody body, CodeBody other );
|
||||||
StrBuilder body_to_string ( CodeBody body );
|
StrBuilder body_to_strbuilder ( CodeBody body );
|
||||||
void body_to_strbuilder_ref ( CodeBody body, StrBuilder* result );
|
void body_to_strbuilder_ref ( CodeBody body, StrBuilder* result );
|
||||||
void body_to_strbuilder_export( CodeBody body, StrBuilder* result );
|
void body_to_strbuilder_export( CodeBody body, StrBuilder* result );
|
||||||
|
|
||||||
@ -28,14 +28,14 @@ Code end_CodeBody ( CodeBody body );
|
|||||||
Code next_CodeBody ( CodeBody body, Code entry_iter );
|
Code next_CodeBody ( CodeBody body, Code entry_iter );
|
||||||
|
|
||||||
void class_add_interface ( CodeClass self, CodeTypename interface );
|
void class_add_interface ( CodeClass self, CodeTypename interface );
|
||||||
StrBuilder class_to_string ( CodeClass self );
|
StrBuilder class_to_strbuilder ( CodeClass self );
|
||||||
void class_to_strbuilder_def( CodeClass self, StrBuilder* result );
|
void class_to_strbuilder_def( CodeClass self, StrBuilder* result );
|
||||||
void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result );
|
void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result );
|
||||||
|
|
||||||
void params_append (CodeParams params, CodeParams param );
|
void params_append (CodeParams params, CodeParams param );
|
||||||
CodeParams params_get (CodeParams params, s32 idx);
|
CodeParams params_get (CodeParams params, s32 idx);
|
||||||
bool params_has_entries (CodeParams params );
|
bool params_has_entries (CodeParams params );
|
||||||
StrBuilder params_to_string (CodeParams params );
|
StrBuilder params_to_strbuilder (CodeParams params );
|
||||||
void params_to_strbuilder_ref(CodeParams params, StrBuilder* result );
|
void params_to_strbuilder_ref(CodeParams params, StrBuilder* result );
|
||||||
|
|
||||||
CodeParams begin_CodeParams(CodeParams params);
|
CodeParams begin_CodeParams(CodeParams params);
|
||||||
@ -45,7 +45,7 @@ CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter);
|
|||||||
bool specifiers_append (CodeSpecifiers specifiers, Specifier spec);
|
bool specifiers_append (CodeSpecifiers specifiers, Specifier spec);
|
||||||
s32 specifiers_has (CodeSpecifiers specifiers, Specifier spec);
|
s32 specifiers_has (CodeSpecifiers specifiers, Specifier spec);
|
||||||
s32 specifiers_remove (CodeSpecifiers specifiers, Specifier to_remove );
|
s32 specifiers_remove (CodeSpecifiers specifiers, Specifier to_remove );
|
||||||
StrBuilder specifiers_to_string (CodeSpecifiers specifiers);
|
StrBuilder specifiers_to_strbuilder (CodeSpecifiers specifiers);
|
||||||
void specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result);
|
void specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result);
|
||||||
|
|
||||||
Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers);
|
Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers);
|
||||||
@ -53,66 +53,66 @@ Specifier* end_CodeSpecifiers (CodeSpecifiers specifiers);
|
|||||||
Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter);
|
Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter);
|
||||||
|
|
||||||
void struct_add_interface (CodeStruct self, CodeTypename interface);
|
void struct_add_interface (CodeStruct self, CodeTypename interface);
|
||||||
StrBuilder struct_to_string (CodeStruct self);
|
StrBuilder struct_to_strbuilder (CodeStruct self);
|
||||||
void struct_to_strbuilder_fwd(CodeStruct self, StrBuilder* result);
|
void struct_to_strbuilder_fwd(CodeStruct self, StrBuilder* result);
|
||||||
void struct_to_strbuilder_def(CodeStruct self, StrBuilder* result);
|
void struct_to_strbuilder_def(CodeStruct self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder attributes_to_string (CodeAttributes attributes);
|
StrBuilder attributes_to_strbuilder (CodeAttributes attributes);
|
||||||
void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result);
|
void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder comment_to_string (CodeComment comment );
|
StrBuilder comment_to_strbuilder (CodeComment comment );
|
||||||
void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result );
|
void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder constructor_to_string (CodeConstructor constructor);
|
StrBuilder constructor_to_strbuilder (CodeConstructor constructor);
|
||||||
void constructor_to_strbuilder_def(CodeConstructor constructor, StrBuilder* result );
|
void constructor_to_strbuilder_def(CodeConstructor constructor, StrBuilder* result );
|
||||||
void constructor_to_strbuilder_fwd(CodeConstructor constructor, StrBuilder* result );
|
void constructor_to_strbuilder_fwd(CodeConstructor constructor, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder define_to_string (CodeDefine self);
|
StrBuilder define_to_strbuilder (CodeDefine self);
|
||||||
void define_to_strbuilder_ref(CodeDefine self, StrBuilder* result);
|
void define_to_strbuilder_ref(CodeDefine self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder destructor_to_string (CodeDestructor destructor);
|
StrBuilder destructor_to_strbuilder (CodeDestructor destructor);
|
||||||
void destructor_to_strbuilder_def(CodeDestructor destructor, StrBuilder* result );
|
|
||||||
void destructor_to_strbuilder_fwd(CodeDestructor destructor, StrBuilder* result );
|
void destructor_to_strbuilder_fwd(CodeDestructor destructor, StrBuilder* result );
|
||||||
|
void destructor_to_strbuilder_def(CodeDestructor destructor, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder enum_to_string (CodeEnum self);
|
StrBuilder enum_to_strbuilder (CodeEnum self);
|
||||||
void enum_to_strbuilder_def (CodeEnum self, StrBuilder* result );
|
void enum_to_strbuilder_def (CodeEnum self, StrBuilder* result );
|
||||||
void enum_to_strbuilder_fwd (CodeEnum self, StrBuilder* result );
|
void enum_to_strbuilder_fwd (CodeEnum self, StrBuilder* result );
|
||||||
void enum_to_strbuilder_class_def(CodeEnum self, StrBuilder* result );
|
void enum_to_strbuilder_class_def(CodeEnum self, StrBuilder* result );
|
||||||
void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result );
|
void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder exec_to_string (CodeExec exec);
|
StrBuilder exec_to_strbuilder (CodeExec exec);
|
||||||
void exec_to_strbuilder_ref(CodeExec exec, StrBuilder* result);
|
void exec_to_strbuilder_ref(CodeExec exec, StrBuilder* result);
|
||||||
|
|
||||||
void extern_to_string(CodeExtern self, StrBuilder* result);
|
void extern_to_strbuilder(CodeExtern self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder include_to_string (CodeInclude self);
|
StrBuilder include_to_strbuilder (CodeInclude self);
|
||||||
void include_to_strbuilder_ref(CodeInclude self, StrBuilder* result);
|
void include_to_strbuilder_ref(CodeInclude self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder friend_to_string (CodeFriend self);
|
StrBuilder friend_to_strbuilder (CodeFriend self);
|
||||||
void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result);
|
void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder fn_to_string (CodeFn self);
|
StrBuilder fn_to_strbuilder (CodeFn self);
|
||||||
void fn_to_strbuilder_def(CodeFn self, StrBuilder* result);
|
void fn_to_strbuilder_def(CodeFn self, StrBuilder* result);
|
||||||
void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result);
|
void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder module_to_string (CodeModule self);
|
StrBuilder module_to_strbuilder (CodeModule self);
|
||||||
void module_to_strbuilder_ref(CodeModule self, StrBuilder* result);
|
void module_to_strbuilder_ref(CodeModule self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder namespace_to_string (CodeNS self);
|
StrBuilder namespace_to_strbuilder (CodeNS self);
|
||||||
void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result);
|
void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder code_op_to_string (CodeOperator self);
|
StrBuilder code_op_to_strbuilder (CodeOperator self);
|
||||||
void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result );
|
void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result );
|
||||||
void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result );
|
void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder opcast_to_string (CodeOpCast op_cast );
|
StrBuilder opcast_to_strbuilder (CodeOpCast op_cast );
|
||||||
void opcast_to_strbuilder_def(CodeOpCast op_cast, StrBuilder* result );
|
void opcast_to_strbuilder_def(CodeOpCast op_cast, StrBuilder* result );
|
||||||
void opcast_to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder* result );
|
void opcast_to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder pragma_to_string (CodePragma self);
|
StrBuilder pragma_to_strbuilder (CodePragma self);
|
||||||
void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result);
|
void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder preprocess_to_string (CodePreprocessCond cond);
|
StrBuilder preprocess_to_strbuilder (CodePreprocessCond cond);
|
||||||
void preprocess_to_strbuilder_if (CodePreprocessCond cond, StrBuilder* result );
|
void preprocess_to_strbuilder_if (CodePreprocessCond cond, StrBuilder* result );
|
||||||
void preprocess_to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder* result );
|
void preprocess_to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder* result );
|
||||||
void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result );
|
void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result );
|
||||||
@ -120,24 +120,24 @@ void preprocess_to_strbuilder_elif (CodePreprocessCond cond, StrBuilder* resu
|
|||||||
void preprocess_to_strbuilder_else (CodePreprocessCond cond, StrBuilder* result );
|
void preprocess_to_strbuilder_else (CodePreprocessCond cond, StrBuilder* result );
|
||||||
void preprocess_to_strbuilder_endif (CodePreprocessCond cond, StrBuilder* result );
|
void preprocess_to_strbuilder_endif (CodePreprocessCond cond, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder template_to_string (CodeTemplate self);
|
StrBuilder template_to_strbuilder (CodeTemplate self);
|
||||||
void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result);
|
void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder typename_to_string (CodeTypename self);
|
StrBuilder typename_to_strbuilder (CodeTypename self);
|
||||||
void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result);
|
void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder typedef_to_string (CodeTypedef self);
|
StrBuilder typedef_to_strbuilder (CodeTypedef self);
|
||||||
void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result );
|
void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder union_to_string (CodeUnion self);
|
StrBuilder union_to_strbuilder (CodeUnion self);
|
||||||
void union_to_strbuilder_def(CodeUnion self, StrBuilder* result);
|
void union_to_strbuilder_def(CodeUnion self, StrBuilder* result);
|
||||||
void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result);
|
void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result);
|
||||||
|
|
||||||
StrBuilder using_to_string (CodeUsing op_cast );
|
StrBuilder using_to_strbuilder (CodeUsing op_cast );
|
||||||
void using_to_strbuilder_ref(CodeUsing op_cast, StrBuilder* result );
|
void using_to_strbuilder_ref(CodeUsing op_cast, StrBuilder* result );
|
||||||
void using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result );
|
void using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result );
|
||||||
|
|
||||||
StrBuilder var_to_string (CodeVar self);
|
StrBuilder var_to_strbuilder (CodeVar self);
|
||||||
void var_to_strbuilder_ref(CodeVar self, StrBuilder* result);
|
void var_to_strbuilder_ref(CodeVar self, StrBuilder* result);
|
||||||
|
|
||||||
#pragma endregion Code Type C-Interface
|
#pragma endregion Code Type C-Interface
|
||||||
@ -157,8 +157,8 @@ struct CodeBody
|
|||||||
forceinline void append( Code other ) { return body_append( *this, other ); }
|
forceinline void append( Code other ) { return body_append( *this, other ); }
|
||||||
forceinline void append( CodeBody body ) { return body_append(*this, body); }
|
forceinline void append( CodeBody body ) { return body_append(*this, body); }
|
||||||
forceinline bool has_entries() { return code_has_entries(* this); }
|
forceinline bool has_entries() { return code_has_entries(* this); }
|
||||||
forceinline StrBuilder to_string() { return body_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return body_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return body_to_strbuilder_ref(* this, & result ); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return body_to_strbuilder_ref(* this, & result ); }
|
||||||
forceinline void to_strbuilder_export( StrBuilder& result ) { return body_to_strbuilder_export(* this, & result); }
|
forceinline void to_strbuilder_export( StrBuilder& result ) { return body_to_strbuilder_export(* this, & result); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -175,7 +175,7 @@ struct CodeClass
|
|||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeClass );
|
Using_Code( CodeClass );
|
||||||
forceinline void add_interface( CodeType interface );
|
forceinline void add_interface( CodeType interface );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result );
|
forceinline void to_strbuilder_def( StrBuilder& result );
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result );
|
forceinline void to_strbuilder_fwd( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
@ -195,15 +195,15 @@ struct CodeParams
|
|||||||
forceinline void append( CodeParams other );
|
forceinline void append( CodeParams other );
|
||||||
forceinline CodeParams get( s32 idx );
|
forceinline CodeParams get( s32 idx );
|
||||||
forceinline bool has_entries();
|
forceinline bool has_entries();
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
|
|
||||||
forceinline CodeParams begin() { return begin_CodeParams(* this); }
|
|
||||||
forceinline CodeParams end() { return end_CodeParams(* this); }
|
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps( CodeParams );
|
Using_CodeOps( CodeParams );
|
||||||
|
forceinline CodeParams begin() { return begin_CodeParams(* this); }
|
||||||
|
forceinline CodeParams end() { return end_CodeParams(* this); }
|
||||||
forceinline operator Code() { return { (AST*)ast }; }
|
forceinline operator Code() { return { (AST*)ast }; }
|
||||||
forceinline CodeParams operator*() { return * this; }
|
forceinline CodeParams operator *() { return * this; } // Required to support for-range iteration.
|
||||||
forceinline AST_Params* operator->() {
|
forceinline AST_Params* operator->() {
|
||||||
GEN_ASSERT(ast);
|
GEN_ASSERT(ast);
|
||||||
return ast;
|
return ast;
|
||||||
@ -219,11 +219,12 @@ struct CodeSpecifiers
|
|||||||
bool append( Specifier spec ) { return specifiers_append(* this, spec); }
|
bool append( Specifier spec ) { return specifiers_append(* this, spec); }
|
||||||
s32 has( Specifier spec ) { return specifiers_has(* this, spec); }
|
s32 has( Specifier spec ) { return specifiers_has(* this, spec); }
|
||||||
s32 remove( Specifier to_remove ) { return specifiers_remove(* this, to_remove); }
|
s32 remove( Specifier to_remove ) { return specifiers_remove(* this, to_remove); }
|
||||||
StrBuilder to_string() { return specifiers_to_string(* this ); }
|
StrBuilder to_strbuilder() { return specifiers_to_strbuilder(* this ); }
|
||||||
void to_string( StrBuilder& result ) { return specifiers_to_strbuilder_ref(* this, & result); }
|
void to_strbuilder( StrBuilder& result ) { return specifiers_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeSpecifiers);
|
Using_CodeOps(CodeSpecifiers);
|
||||||
forceinline operator Code() { return { (AST*) ast }; }
|
forceinline operator Code() { return { (AST*) ast }; }
|
||||||
|
forceinline Code operator *() { return * this; } // Required to support for-range iteration.
|
||||||
forceinline AST_Specifiers* operator->() {
|
forceinline AST_Specifiers* operator->() {
|
||||||
GEN_ASSERT(ast);
|
GEN_ASSERT(ast);
|
||||||
return ast;
|
return ast;
|
||||||
@ -235,8 +236,8 @@ struct CodeAttributes
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code(CodeAttributes);
|
Using_Code(CodeAttributes);
|
||||||
forceinline StrBuilder to_string() { return attributes_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return attributes_to_strbuilder(* this); }
|
||||||
forceinline void to_string(StrBuilder& result) { return attributes_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder(StrBuilder& result) { return attributes_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeAttributes);
|
Using_CodeOps(CodeAttributes);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -250,8 +251,8 @@ struct CodeComment
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code(CodeComment);
|
Using_Code(CodeComment);
|
||||||
forceinline StrBuilder to_string() { return comment_to_string (* this); }
|
forceinline StrBuilder to_strbuilder() { return comment_to_strbuilder (* this); }
|
||||||
forceinline void to_string(StrBuilder& result) { return comment_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder(StrBuilder& result) { return comment_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeComment);
|
Using_CodeOps(CodeComment);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -263,7 +264,7 @@ struct CodeConstructor
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeConstructor );
|
Using_Code( CodeConstructor );
|
||||||
forceinline StrBuilder to_string() { return constructor_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return constructor_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return constructor_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return constructor_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return constructor_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return constructor_to_strbuilder_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -277,8 +278,8 @@ struct CodeDefine
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeDefine );
|
Using_Code( CodeDefine );
|
||||||
forceinline StrBuilder to_string() { return define_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return define_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return define_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return define_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeDefine);
|
Using_CodeOps(CodeDefine);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -290,7 +291,7 @@ struct CodeDestructor
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeDestructor );
|
Using_Code( CodeDestructor );
|
||||||
forceinline StrBuilder to_string() { return destructor_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return destructor_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return destructor_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return destructor_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return destructor_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return destructor_to_strbuilder_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -304,7 +305,7 @@ struct CodeEnum
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeEnum );
|
Using_Code( CodeEnum );
|
||||||
forceinline StrBuilder to_string() { return enum_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return enum_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return enum_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return enum_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return enum_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return enum_to_strbuilder_fwd(* this, & result); }
|
||||||
forceinline void to_strbuilder_class_def( StrBuilder& result ) { return enum_to_strbuilder_class_def(* this, & result); }
|
forceinline void to_strbuilder_class_def( StrBuilder& result ) { return enum_to_strbuilder_class_def(* this, & result); }
|
||||||
@ -320,8 +321,8 @@ struct CodeExec
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code(CodeExec);
|
Using_Code(CodeExec);
|
||||||
forceinline StrBuilder to_string() { return exec_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return exec_to_strbuilder(* this); }
|
||||||
forceinline void to_string(StrBuilder& result) { return exec_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder(StrBuilder& result) { return exec_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeExec);
|
Using_CodeOps(CodeExec);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -334,7 +335,7 @@ struct CodeExpr
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr );
|
Using_Code( CodeExpr );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr* operator->();
|
AST_Expr* operator->();
|
||||||
@ -345,7 +346,7 @@ struct CodeExpr_Assign
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Assign );
|
Using_Code( CodeExpr_Assign );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Assign* operator->();
|
AST_Expr_Assign* operator->();
|
||||||
@ -356,7 +357,7 @@ struct CodeExpr_Alignof
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Alignof );
|
Using_Code( CodeExpr_Alignof );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Alignof* operator->();
|
AST_Expr_Alignof* operator->();
|
||||||
@ -367,7 +368,7 @@ struct CodeExpr_Binary
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Binary );
|
Using_Code( CodeExpr_Binary );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Binary* operator->();
|
AST_Expr_Binary* operator->();
|
||||||
@ -378,7 +379,7 @@ struct CodeExpr_CStyleCast
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_CStyleCast );
|
Using_Code( CodeExpr_CStyleCast );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_CStyleCast* operator->();
|
AST_Expr_CStyleCast* operator->();
|
||||||
@ -389,7 +390,7 @@ struct CodeExpr_FunctionalCast
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_FunctionalCast );
|
Using_Code( CodeExpr_FunctionalCast );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_FunctionalCast* operator->();
|
AST_Expr_FunctionalCast* operator->();
|
||||||
@ -400,7 +401,7 @@ struct CodeExpr_CppCast
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_CppCast );
|
Using_Code( CodeExpr_CppCast );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_CppCast* operator->();
|
AST_Expr_CppCast* operator->();
|
||||||
@ -411,7 +412,7 @@ struct CodeExpr_Element
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Element );
|
Using_Code( CodeExpr_Element );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Element* operator->();
|
AST_Expr_Element* operator->();
|
||||||
@ -422,7 +423,7 @@ struct CodeExpr_ProcCall
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_ProcCall );
|
Using_Code( CodeExpr_ProcCall );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_ProcCall* operator->();
|
AST_Expr_ProcCall* operator->();
|
||||||
@ -433,7 +434,7 @@ struct CodeExpr_Decltype
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Decltype );
|
Using_Code( CodeExpr_Decltype );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Decltype* operator->();
|
AST_Expr_Decltype* operator->();
|
||||||
@ -444,7 +445,7 @@ struct CodeExpr_Comma
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Comma );
|
Using_Code( CodeExpr_Comma );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Comma* operator->();
|
AST_Expr_Comma* operator->();
|
||||||
@ -455,7 +456,7 @@ struct CodeExpr_AMS
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_AMS );
|
Using_Code( CodeExpr_AMS );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_AMS* operator->();
|
AST_Expr_AMS* operator->();
|
||||||
@ -466,7 +467,7 @@ struct CodeExpr_Sizeof
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Sizeof );
|
Using_Code( CodeExpr_Sizeof );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Sizeof* operator->();
|
AST_Expr_Sizeof* operator->();
|
||||||
@ -477,7 +478,7 @@ struct CodeExpr_Subscript
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Subscript );
|
Using_Code( CodeExpr_Subscript );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Subscript* operator->();
|
AST_Expr_Subscript* operator->();
|
||||||
@ -488,7 +489,7 @@ struct CodeExpr_Ternary
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_Ternary );
|
Using_Code( CodeExpr_Ternary );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_Ternary* operator->();
|
AST_Expr_Ternary* operator->();
|
||||||
@ -499,7 +500,7 @@ struct CodeExpr_UnaryPrefix
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_UnaryPrefix );
|
Using_Code( CodeExpr_UnaryPrefix );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Expr_UnaryPrefix* operator->();
|
AST_Expr_UnaryPrefix* operator->();
|
||||||
@ -510,7 +511,7 @@ struct CodeExpr_UnaryPostfix
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExpr_UnaryPostfix );
|
Using_Code( CodeExpr_UnaryPostfix );
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
AST* raw();
|
AST* raw();
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -523,7 +524,7 @@ struct CodeExtern
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeExtern );
|
Using_Code( CodeExtern );
|
||||||
forceinline void to_string( StrBuilder& result ) { return extern_to_string(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return extern_to_strbuilder(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeExtern);
|
Using_CodeOps(CodeExtern);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -535,8 +536,8 @@ struct CodeInclude
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeInclude );
|
Using_Code( CodeInclude );
|
||||||
StrBuilder to_string() { return include_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return include_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return include_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return include_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeInclude);
|
Using_CodeOps(CodeInclude);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -548,8 +549,8 @@ struct CodeFriend
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeFriend );
|
Using_Code( CodeFriend );
|
||||||
forceinline StrBuilder to_string() { return friend_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return friend_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return friend_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return friend_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeFriend);
|
Using_CodeOps(CodeFriend);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -561,7 +562,7 @@ struct CodeFn
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeFn );
|
Using_Code( CodeFn );
|
||||||
forceinline StrBuilder to_string() { return fn_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return fn_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return fn_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return fn_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return fn_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return fn_to_strbuilder_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -575,8 +576,8 @@ struct CodeModule
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeModule );
|
Using_Code( CodeModule );
|
||||||
forceinline StrBuilder to_string() { return module_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return module_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return module_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return module_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeModule);
|
Using_CodeOps(CodeModule);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -588,8 +589,8 @@ struct CodeNS
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeNS );
|
Using_Code( CodeNS );
|
||||||
forceinline StrBuilder to_string() { return namespace_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return namespace_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return namespace_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return namespace_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeNS);
|
Using_CodeOps(CodeNS);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -601,7 +602,7 @@ struct CodeOperator
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeOperator );
|
Using_Code( CodeOperator );
|
||||||
forceinline StrBuilder to_string() { return code_op_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return code_op_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return code_op_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return code_op_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return code_op_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return code_op_to_strbuilder_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -615,7 +616,7 @@ struct CodeOpCast
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeOpCast );
|
Using_Code( CodeOpCast );
|
||||||
forceinline StrBuilder to_string() { return opcast_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return opcast_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return opcast_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return opcast_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return opcast_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return opcast_to_strbuilder_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -629,8 +630,8 @@ struct CodePragma
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodePragma );
|
Using_Code( CodePragma );
|
||||||
forceinline StrBuilder to_string() { return pragma_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return pragma_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return pragma_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return pragma_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps( CodePragma );
|
Using_CodeOps( CodePragma );
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -642,7 +643,7 @@ struct CodePreprocessCond
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodePreprocessCond );
|
Using_Code( CodePreprocessCond );
|
||||||
forceinline StrBuilder to_string() { return preprocess_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return preprocess_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_if( StrBuilder& result ) { return preprocess_to_strbuilder_if(* this, & result); }
|
forceinline void to_strbuilder_if( StrBuilder& result ) { return preprocess_to_strbuilder_if(* this, & result); }
|
||||||
forceinline void to_strbuilder_ifdef( StrBuilder& result ) { return preprocess_to_strbuilder_ifdef(* this, & result); }
|
forceinline void to_strbuilder_ifdef( StrBuilder& result ) { return preprocess_to_strbuilder_ifdef(* this, & result); }
|
||||||
forceinline void to_strbuilder_ifndef( StrBuilder& result ) { return preprocess_to_strbuilder_ifndef(* this, & result); }
|
forceinline void to_strbuilder_ifndef( StrBuilder& result ) { return preprocess_to_strbuilder_ifndef(* this, & result); }
|
||||||
@ -661,8 +662,8 @@ struct CodeStmt
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt );
|
Using_Code( CodeStmt );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt* operator->();
|
AST_Stmt* operator->();
|
||||||
@ -673,8 +674,8 @@ struct CodeStmt_Break
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Break );
|
Using_Code( CodeStmt_Break );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Break* operator->();
|
AST_Stmt_Break* operator->();
|
||||||
@ -685,8 +686,8 @@ struct CodeStmt_Case
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Case );
|
Using_Code( CodeStmt_Case );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Case* operator->();
|
AST_Stmt_Case* operator->();
|
||||||
@ -697,8 +698,8 @@ struct CodeStmt_Continue
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Continue );
|
Using_Code( CodeStmt_Continue );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Continue* operator->();
|
AST_Stmt_Continue* operator->();
|
||||||
@ -709,8 +710,8 @@ struct CodeStmt_Decl
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Decl );
|
Using_Code( CodeStmt_Decl );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Decl* operator->();
|
AST_Stmt_Decl* operator->();
|
||||||
@ -721,8 +722,8 @@ struct CodeStmt_Do
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Do );
|
Using_Code( CodeStmt_Do );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Do* operator->();
|
AST_Stmt_Do* operator->();
|
||||||
@ -733,8 +734,8 @@ struct CodeStmt_Expr
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Expr );
|
Using_Code( CodeStmt_Expr );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Expr* operator->();
|
AST_Stmt_Expr* operator->();
|
||||||
@ -745,8 +746,8 @@ struct CodeStmt_Else
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Else );
|
Using_Code( CodeStmt_Else );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Else* operator->();
|
AST_Stmt_Else* operator->();
|
||||||
@ -757,8 +758,8 @@ struct CodeStmt_If
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_If );
|
Using_Code( CodeStmt_If );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_If* operator->();
|
AST_Stmt_If* operator->();
|
||||||
@ -769,8 +770,8 @@ struct CodeStmt_For
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_For );
|
Using_Code( CodeStmt_For );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_For* operator->();
|
AST_Stmt_For* operator->();
|
||||||
@ -781,8 +782,8 @@ struct CodeStmt_Goto
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Goto );
|
Using_Code( CodeStmt_Goto );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Goto* operator->();
|
AST_Stmt_Goto* operator->();
|
||||||
@ -793,8 +794,8 @@ struct CodeStmt_Label
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Label );
|
Using_Code( CodeStmt_Label );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Label* operator->();
|
AST_Stmt_Label* operator->();
|
||||||
@ -805,8 +806,8 @@ struct CodeStmt_Switch
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_Switch );
|
Using_Code( CodeStmt_Switch );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_Switch* operator->();
|
AST_Stmt_Switch* operator->();
|
||||||
@ -817,8 +818,8 @@ struct CodeStmt_While
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStmt_While );
|
Using_Code( CodeStmt_While );
|
||||||
forceinline StrBuilder to_string();
|
forceinline StrBuilder to_strbuilder();
|
||||||
forceinline void to_string( StrBuilder& result );
|
forceinline void to_strbuilder( StrBuilder& result );
|
||||||
#endif
|
#endif
|
||||||
operator Code();
|
operator Code();
|
||||||
AST_Stmt_While* operator->();
|
AST_Stmt_While* operator->();
|
||||||
@ -830,8 +831,8 @@ struct CodeTemplate
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeTemplate );
|
Using_Code( CodeTemplate );
|
||||||
forceinline StrBuilder to_string() { return template_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return template_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return template_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return template_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps( CodeTemplate );
|
Using_CodeOps( CodeTemplate );
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -843,8 +844,8 @@ struct CodeTypename
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeTypename );
|
Using_Code( CodeTypename );
|
||||||
forceinline StrBuilder to_string() { return typename_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return typename_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return typename_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return typename_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps( CodeTypename );
|
Using_CodeOps( CodeTypename );
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -856,8 +857,8 @@ struct CodeTypedef
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeTypedef );
|
Using_Code( CodeTypedef );
|
||||||
forceinline StrBuilder to_string() { return typedef_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return typedef_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return typedef_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return typedef_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps( CodeTypedef );
|
Using_CodeOps( CodeTypedef );
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -869,7 +870,7 @@ struct CodeUnion
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeUnion );
|
Using_Code( CodeUnion );
|
||||||
forceinline StrBuilder to_string() { return union_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return union_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return union_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return union_to_strbuilder_def(* this, & result); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return union_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return union_to_strbuilder_fwd(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -883,8 +884,8 @@ struct CodeUsing
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeUsing );
|
Using_Code( CodeUsing );
|
||||||
forceinline StrBuilder to_string() { return using_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return using_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return using_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return using_to_strbuilder_ref(* this, & result); }
|
||||||
forceinline void to_strbuilder_ns( StrBuilder& result ) { return using_to_strbuilder_ns(* this, & result); }
|
forceinline void to_strbuilder_ns( StrBuilder& result ) { return using_to_strbuilder_ns(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeUsing);
|
Using_CodeOps(CodeUsing);
|
||||||
@ -897,8 +898,8 @@ struct CodeVar
|
|||||||
{
|
{
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeVar );
|
Using_Code( CodeVar );
|
||||||
forceinline StrBuilder to_string() { return var_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return var_to_strbuilder(* this); }
|
||||||
forceinline void to_string( StrBuilder& result ) { return var_to_strbuilder_ref(* this, & result); }
|
forceinline void to_strbuilder( StrBuilder& result ) { return var_to_strbuilder_ref(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
Using_CodeOps(CodeVar);
|
Using_CodeOps(CodeVar);
|
||||||
operator Code();
|
operator Code();
|
||||||
@ -911,7 +912,7 @@ struct CodeStruct
|
|||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
Using_Code( CodeStruct );
|
Using_Code( CodeStruct );
|
||||||
forceinline void add_interface( CodeTypename interface ) { return struct_add_interface(* this, interface); }
|
forceinline void add_interface( CodeTypename interface ) { return struct_add_interface(* this, interface); }
|
||||||
forceinline StrBuilder to_string() { return struct_to_string(* this); }
|
forceinline StrBuilder to_strbuilder() { return struct_to_strbuilder(* this); }
|
||||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return struct_to_strbuilder_fwd(* this, & result); }
|
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return struct_to_strbuilder_fwd(* this, & result); }
|
||||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return struct_to_strbuilder_def(* this, & result); }
|
forceinline void to_strbuilder_def( StrBuilder& result ) { return struct_to_strbuilder_def(* this, & result); }
|
||||||
#endif
|
#endif
|
||||||
@ -997,105 +998,105 @@ struct NullCode_ImplicitCaster
|
|||||||
operator CodeVar () const { return {nullptr}; }
|
operator CodeVar () const { return {nullptr}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
forceinline Code begin( CodeBody body) { return begin_CodeBody(body); }
|
||||||
|
forceinline Code end ( CodeBody body ) { return end_CodeBody(body); }
|
||||||
|
forceinline Code next ( CodeBody body, Code entry_iter ) { return next_CodeBody(body, entry_iter); }
|
||||||
|
|
||||||
|
forceinline CodeParams begin(CodeParams params) { return begin_CodeParams(params); }
|
||||||
|
forceinline CodeParams end (CodeParams params) { return end_CodeParams(params); }
|
||||||
|
forceinline CodeParams next (CodeParams params, CodeParams entry_iter) { return next_CodeParams(params, entry_iter); }
|
||||||
|
|
||||||
|
forceinline Specifier* begin(CodeSpecifiers specifiers) { return begin_CodeSpecifiers(specifiers); }
|
||||||
|
forceinline Specifier* end (CodeSpecifiers specifiers) { return end_CodeSpecifiers(specifiers); }
|
||||||
|
forceinline Specifier* next (CodeSpecifiers specifiers, Specifier& spec_iter) { return next_CodeSpecifiers(specifiers, & spec_iter); }
|
||||||
|
|
||||||
#if ! GEN_C_LIKE_CPP
|
#if ! GEN_C_LIKE_CPP
|
||||||
GEN_OPTIMIZE_MAPPINGS_BEGIN
|
GEN_OPTIMIZE_MAPPINGS_BEGIN
|
||||||
|
|
||||||
forceinline void append ( CodeBody body, Code other ) { return body_append(body, other); }
|
forceinline void append ( CodeBody body, Code other ) { return body_append(body, other); }
|
||||||
forceinline void append ( CodeBody body, CodeBody other ) { return body_append_body(body, other); }
|
forceinline void append ( CodeBody body, CodeBody other ) { return body_append_body(body, other); }
|
||||||
forceinline StrBuilder to_string ( CodeBody body ) { return body_to_string(body); }
|
forceinline StrBuilder to_strbuilder ( CodeBody body ) { return body_to_strbuilder(body); }
|
||||||
forceinline void to_string ( CodeBody body, StrBuilder& result ) { return body_to_strbuilder_ref(body, & result); }
|
forceinline void to_strbuilder ( CodeBody body, StrBuilder& result ) { return body_to_strbuilder_ref(body, & result); }
|
||||||
forceinline void to_strbuilder_export( CodeBody body, StrBuilder& result ) { return body_to_strbuilder_export(body, & result); }
|
forceinline void to_strbuilder_export( CodeBody body, StrBuilder& result ) { return body_to_strbuilder_export(body, & result); }
|
||||||
|
|
||||||
forceinline Code begin( CodeBody body) { return begin_CodeBody(body); }
|
|
||||||
forceinline Code end ( CodeBody body ) { return end_CodeBody(body); }
|
|
||||||
forceinline Code next ( CodeBody body, Code entry_iter ) { return next_CodeBody(body, entry_iter); }
|
|
||||||
|
|
||||||
forceinline void add_interface ( CodeClass self, CodeTypename interface ) { return class_add_interface(self, interface); }
|
forceinline void add_interface ( CodeClass self, CodeTypename interface ) { return class_add_interface(self, interface); }
|
||||||
forceinline StrBuilder to_string ( CodeClass self ) { return class_to_string(self); }
|
forceinline StrBuilder to_strbuilder ( CodeClass self ) { return class_to_strbuilder(self); }
|
||||||
forceinline void to_strbuilder_def( CodeClass self, StrBuilder& result ) { return class_to_strbuilder_def(self, & result); }
|
forceinline void to_strbuilder_def( CodeClass self, StrBuilder& result ) { return class_to_strbuilder_def(self, & result); }
|
||||||
forceinline void to_strbuilder_fwd( CodeClass self, StrBuilder& result ) { return class_to_strbuilder_fwd(self, & result); }
|
forceinline void to_strbuilder_fwd( CodeClass self, StrBuilder& result ) { return class_to_strbuilder_fwd(self, & result); }
|
||||||
|
|
||||||
forceinline void append (CodeParams params, CodeParams param ) { return params_append(params, param); }
|
forceinline void append (CodeParams params, CodeParams param ) { return params_append(params, param); }
|
||||||
forceinline CodeParams get (CodeParams params, s32 idx) { return params_get(params, idx); }
|
forceinline CodeParams get (CodeParams params, s32 idx) { return params_get(params, idx); }
|
||||||
forceinline bool has_entries (CodeParams params ) { return params_has_entries(params); }
|
forceinline bool has_entries (CodeParams params ) { return params_has_entries(params); }
|
||||||
forceinline StrBuilder to_string (CodeParams params ) { return params_to_string(params); }
|
forceinline StrBuilder to_strbuilder(CodeParams params ) { return params_to_strbuilder(params); }
|
||||||
forceinline void to_string (CodeParams params, StrBuilder& result ) { return params_to_strbuilder_ref(params, & result); }
|
forceinline void to_strbuilder(CodeParams params, StrBuilder& result ) { return params_to_strbuilder_ref(params, & result); }
|
||||||
|
|
||||||
forceinline CodeParams begin(CodeParams params) { return begin_CodeParams(params); }
|
|
||||||
forceinline CodeParams end (CodeParams params) { return end_CodeParams(params); }
|
|
||||||
forceinline CodeParams next (CodeParams params, CodeParams entry_iter) { return next_CodeParams(params, entry_iter); }
|
|
||||||
|
|
||||||
forceinline bool append (CodeSpecifiers specifiers, Specifier spec) { return specifiers_append(specifiers, spec); }
|
forceinline bool append (CodeSpecifiers specifiers, Specifier spec) { return specifiers_append(specifiers, spec); }
|
||||||
forceinline s32 has (CodeSpecifiers specifiers, Specifier spec) { return specifiers_has(specifiers, spec); }
|
forceinline s32 has (CodeSpecifiers specifiers, Specifier spec) { return specifiers_has(specifiers, spec); }
|
||||||
forceinline s32 remove (CodeSpecifiers specifiers, Specifier to_remove ) { return specifiers_remove(specifiers, to_remove); }
|
forceinline s32 remove (CodeSpecifiers specifiers, Specifier to_remove ) { return specifiers_remove(specifiers, to_remove); }
|
||||||
forceinline StrBuilder to_string(CodeSpecifiers specifiers) { return specifiers_to_string(specifiers); }
|
forceinline StrBuilder to_strbuilder(CodeSpecifiers specifiers) { return specifiers_to_strbuilder(specifiers); }
|
||||||
forceinline void to_string(CodeSpecifiers specifiers, StrBuilder& result) { return specifiers_to_strbuilder_ref(specifiers, & result); }
|
forceinline void to_strbuilder(CodeSpecifiers specifiers, StrBuilder& result) { return specifiers_to_strbuilder_ref(specifiers, & result); }
|
||||||
|
|
||||||
forceinline Specifier* begin(CodeSpecifiers specifiers) { return begin_CodeSpecifiers(specifiers); }
|
|
||||||
forceinline Specifier* end (CodeSpecifiers specifiers) { return end_CodeSpecifiers(specifiers); }
|
|
||||||
forceinline Specifier* next (CodeSpecifiers specifiers, Specifier& spec_iter) { return next_CodeSpecifiers(specifiers, & spec_iter); }
|
|
||||||
|
|
||||||
forceinline void add_interface (CodeStruct self, CodeTypename interface) { return struct_add_interface(self, interface); }
|
forceinline void add_interface (CodeStruct self, CodeTypename interface) { return struct_add_interface(self, interface); }
|
||||||
forceinline StrBuilder to_string (CodeStruct self) { return struct_to_string(self); }
|
forceinline StrBuilder to_strbuilder (CodeStruct self) { return struct_to_strbuilder(self); }
|
||||||
forceinline void to_strbuilder_fwd(CodeStruct self, StrBuilder& result) { return struct_to_strbuilder_fwd(self, & result); }
|
forceinline void to_strbuilder_fwd(CodeStruct self, StrBuilder& result) { return struct_to_strbuilder_fwd(self, & result); }
|
||||||
forceinline void to_strbuilder_def(CodeStruct self, StrBuilder& result) { return struct_to_strbuilder_def(self, & result); }
|
forceinline void to_strbuilder_def(CodeStruct self, StrBuilder& result) { return struct_to_strbuilder_def(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeAttributes attributes) { return attributes_to_string(attributes); }
|
forceinline StrBuilder to_strbuilder(CodeAttributes attributes) { return attributes_to_strbuilder(attributes); }
|
||||||
forceinline void to_string(CodeAttributes attributes, StrBuilder& result) { return attributes_to_strbuilder_ref(attributes, & result); }
|
forceinline void to_strbuilder(CodeAttributes attributes, StrBuilder& result) { return attributes_to_strbuilder_ref(attributes, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeComment comment ) { return comment_to_string(comment); }
|
forceinline StrBuilder to_strbuilder(CodeComment comment ) { return comment_to_strbuilder(comment); }
|
||||||
forceinline void to_string(CodeComment comment, StrBuilder& result ) { return comment_to_strbuilder_ref(comment, & result); }
|
forceinline void to_strbuilder(CodeComment comment, StrBuilder& result ) { return comment_to_strbuilder_ref(comment, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeConstructor constructor) { return constructor_to_string(constructor); }
|
forceinline StrBuilder to_strbuilder (CodeConstructor constructor) { return constructor_to_strbuilder(constructor); }
|
||||||
forceinline void to_strbuilder_def(CodeConstructor constructor, StrBuilder& result ) { return constructor_to_strbuilder_def(constructor, & result); }
|
forceinline void to_strbuilder_def(CodeConstructor constructor, StrBuilder& result ) { return constructor_to_strbuilder_def(constructor, & result); }
|
||||||
forceinline void to_strbuilder_fwd(CodeConstructor constructor, StrBuilder& result ) { return constructor_to_strbuilder_fwd(constructor, & result); }
|
forceinline void to_strbuilder_fwd(CodeConstructor constructor, StrBuilder& result ) { return constructor_to_strbuilder_fwd(constructor, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeDefine self) { return define_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeDefine self) { return define_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeDefine self, StrBuilder& result) { return define_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeDefine self, StrBuilder& result) { return define_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeDestructor destructor) { return destructor_to_string(destructor); }
|
forceinline StrBuilder to_strbuilder (CodeDestructor destructor) { return destructor_to_strbuilder(destructor); }
|
||||||
forceinline void to_strbuilder_def(CodeDestructor destructor, StrBuilder& result ) { return destructor_to_strbuilder_def(destructor, & result); }
|
forceinline void to_strbuilder_def(CodeDestructor destructor, StrBuilder& result ) { return destructor_to_strbuilder_def(destructor, & result); }
|
||||||
forceinline void to_strbuilder_fwd(CodeDestructor destructor, StrBuilder& result ) { return destructor_to_strbuilder_fwd(destructor, & result); }
|
forceinline void to_strbuilder_fwd(CodeDestructor destructor, StrBuilder& result ) { return destructor_to_strbuilder_fwd(destructor, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeEnum self) { return enum_to_string(self); }
|
forceinline StrBuilder to_strbuilder (CodeEnum self) { return enum_to_strbuilder(self); }
|
||||||
forceinline void to_strbuilder_def (CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_def(self, & result); }
|
forceinline void to_strbuilder_def (CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_def(self, & result); }
|
||||||
forceinline void to_strbuilder_fwd (CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_fwd(self, & result); }
|
forceinline void to_strbuilder_fwd (CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_fwd(self, & result); }
|
||||||
forceinline void to_strbuilder_class_def(CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_class_def(self, & result); }
|
forceinline void to_strbuilder_class_def(CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_class_def(self, & result); }
|
||||||
forceinline void to_strbuilder_class_fwd(CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_class_fwd(self, & result); }
|
forceinline void to_strbuilder_class_fwd(CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_class_fwd(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeExec exec) { return exec_to_string(exec); }
|
forceinline StrBuilder to_strbuilder(CodeExec exec) { return exec_to_strbuilder(exec); }
|
||||||
forceinline void to_string(CodeExec exec, StrBuilder& result) { return exec_to_strbuilder_ref(exec, & result); }
|
forceinline void to_strbuilder(CodeExec exec, StrBuilder& result) { return exec_to_strbuilder_ref(exec, & result); }
|
||||||
|
|
||||||
forceinline void to_string(CodeExtern self, StrBuilder& result) { return extern_to_string(self, & result); }
|
forceinline void to_strbuilder(CodeExtern self, StrBuilder& result) { return extern_to_strbuilder(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeInclude self) { return include_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeInclude self) { return include_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeInclude self, StrBuilder& result) { return include_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeInclude self, StrBuilder& result) { return include_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeFriend self) { return friend_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeFriend self) { return friend_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeFriend self, StrBuilder& result) { return friend_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeFriend self, StrBuilder& result) { return friend_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeFn self) { return fn_to_string(self); }
|
forceinline StrBuilder to_strbuilder (CodeFn self) { return fn_to_strbuilder(self); }
|
||||||
forceinline void to_strbuilder_def(CodeFn self, StrBuilder& result) { return fn_to_strbuilder_def(self, & result); }
|
forceinline void to_strbuilder_def(CodeFn self, StrBuilder& result) { return fn_to_strbuilder_def(self, & result); }
|
||||||
forceinline void to_strbuilder_fwd(CodeFn self, StrBuilder& result) { return fn_to_strbuilder_fwd(self, & result); }
|
forceinline void to_strbuilder_fwd(CodeFn self, StrBuilder& result) { return fn_to_strbuilder_fwd(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeModule self) { return module_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeModule self) { return module_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeModule self, StrBuilder& result) { return module_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeModule self, StrBuilder& result) { return module_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeNS self) { return namespace_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeNS self) { return namespace_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeNS self, StrBuilder& result) { return namespace_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeNS self, StrBuilder& result) { return namespace_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeOperator self) { return code_op_to_string(self); }
|
forceinline StrBuilder to_strbuilder (CodeOperator self) { return code_op_to_strbuilder(self); }
|
||||||
forceinline void to_strbuilder_fwd(CodeOperator self, StrBuilder& result ) { return code_op_to_strbuilder_fwd(self, & result); }
|
forceinline void to_strbuilder_fwd(CodeOperator self, StrBuilder& result ) { return code_op_to_strbuilder_fwd(self, & result); }
|
||||||
forceinline void to_strbuilder_def(CodeOperator self, StrBuilder& result ) { return code_op_to_strbuilder_def(self, & result); }
|
forceinline void to_strbuilder_def(CodeOperator self, StrBuilder& result ) { return code_op_to_strbuilder_def(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeOpCast op_cast ) { return opcast_to_string(op_cast); }
|
forceinline StrBuilder to_strbuilder (CodeOpCast op_cast ) { return opcast_to_strbuilder(op_cast); }
|
||||||
forceinline void to_strbuilder_def(CodeOpCast op_cast, StrBuilder& result ) { return opcast_to_strbuilder_def(op_cast, & result); }
|
forceinline void to_strbuilder_def(CodeOpCast op_cast, StrBuilder& result ) { return opcast_to_strbuilder_def(op_cast, & result); }
|
||||||
forceinline void to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder& result ) { return opcast_to_strbuilder_fwd(op_cast, & result); }
|
forceinline void to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder& result ) { return opcast_to_strbuilder_fwd(op_cast, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodePragma self) { return pragma_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodePragma self) { return pragma_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodePragma self, StrBuilder& result) { return pragma_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodePragma self, StrBuilder& result) { return pragma_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodePreprocessCond cond) { return preprocess_to_string(cond); }
|
forceinline StrBuilder to_strbuilder (CodePreprocessCond cond) { return preprocess_to_strbuilder(cond); }
|
||||||
forceinline void to_strbuilder_if (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_if(cond, & result); }
|
forceinline void to_strbuilder_if (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_if(cond, & result); }
|
||||||
forceinline void to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_ifdef(cond, & result); }
|
forceinline void to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_ifdef(cond, & result); }
|
||||||
forceinline void to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_ifndef(cond, & result); }
|
forceinline void to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_ifndef(cond, & result); }
|
||||||
@ -1103,25 +1104,25 @@ forceinline void to_strbuilder_elif (CodePreprocessCond cond, StrBuilder& res
|
|||||||
forceinline void to_strbuilder_else (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_else(cond, & result); }
|
forceinline void to_strbuilder_else (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_else(cond, & result); }
|
||||||
forceinline void to_strbuilder_endif (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_endif(cond, & result); }
|
forceinline void to_strbuilder_endif (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_endif(cond, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeTemplate self) { return template_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeTemplate self) { return template_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeTemplate self, StrBuilder& result) { return template_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeTemplate self, StrBuilder& result) { return template_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeTypename self) { return typename_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeTypename self) { return typename_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeTypename self, StrBuilder& result) { return typename_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeTypename self, StrBuilder& result) { return typename_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeTypedef self) { return typedef_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeTypedef self) { return typedef_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeTypedef self, StrBuilder& result ) { return typedef_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeTypedef self, StrBuilder& result ) { return typedef_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeUnion self) { return union_to_string(self); }
|
forceinline StrBuilder to_strbuilder (CodeUnion self) { return union_to_strbuilder(self); }
|
||||||
forceinline void to_strbuilder_def(CodeUnion self, StrBuilder& result) { return union_to_strbuilder_def(self, & result); }
|
forceinline void to_strbuilder_def(CodeUnion self, StrBuilder& result) { return union_to_strbuilder_def(self, & result); }
|
||||||
forceinline void to_strbuilder_fwd(CodeUnion self, StrBuilder& result) { return union_to_strbuilder_fwd(self, & result); }
|
forceinline void to_strbuilder_fwd(CodeUnion self, StrBuilder& result) { return union_to_strbuilder_fwd(self, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string (CodeUsing op_cast ) { return using_to_string(op_cast); }
|
forceinline StrBuilder to_strbuilder (CodeUsing op_cast ) { return using_to_strbuilder(op_cast); }
|
||||||
forceinline void to_string (CodeUsing op_cast, StrBuilder& result ) { return using_to_strbuilder_ref(op_cast, & result); }
|
forceinline void to_strbuilder (CodeUsing op_cast, StrBuilder& result ) { return using_to_strbuilder_ref(op_cast, & result); }
|
||||||
forceinline void to_strbuilder_ns(CodeUsing op_cast, StrBuilder& result ) { return using_to_strbuilder_ns(op_cast, & result); }
|
forceinline void to_strbuilder_ns(CodeUsing op_cast, StrBuilder& result ) { return using_to_strbuilder_ns(op_cast, & result); }
|
||||||
|
|
||||||
forceinline StrBuilder to_string(CodeVar self) { return var_to_string(self); }
|
forceinline StrBuilder to_strbuilder(CodeVar self) { return var_to_strbuilder(self); }
|
||||||
forceinline void to_string(CodeVar self, StrBuilder& result) { return var_to_strbuilder_ref(self, & result); }
|
forceinline void to_strbuilder(CodeVar self, StrBuilder& result) { return var_to_strbuilder_ref(self, & result); }
|
||||||
|
|
||||||
GEN_OPITMIZE_MAPPINGS_END
|
GEN_OPITMIZE_MAPPINGS_END
|
||||||
#endif //if GEN_C_LIKE_CPP
|
#endif //if GEN_C_LIKE_CPP
|
||||||
|
@ -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] = {
|
||||||
{ "Invalid", sizeof( "Invalid" ) },
|
{ "Invalid", sizeof( "Invalid" ) - 1 },
|
||||||
{ "Untyped", sizeof( "Untyped" ) },
|
{ "Untyped", sizeof( "Untyped" ) - 1 },
|
||||||
{ "NewLine", sizeof( "NewLine" ) },
|
{ "NewLine", sizeof( "NewLine" ) - 1 },
|
||||||
{ "Comment", sizeof( "Comment" ) },
|
{ "Comment", sizeof( "Comment" ) - 1 },
|
||||||
{ "Access_Private", sizeof( "Access_Private" ) },
|
{ "Access_Private", sizeof( "Access_Private" ) - 1 },
|
||||||
{ "Access_Protected", sizeof( "Access_Protected" ) },
|
{ "Access_Protected", sizeof( "Access_Protected" ) - 1 },
|
||||||
{ "Access_Public", sizeof( "Access_Public" ) },
|
{ "Access_Public", sizeof( "Access_Public" ) - 1 },
|
||||||
{ "PlatformAttributes", sizeof( "PlatformAttributes" ) },
|
{ "PlatformAttributes", sizeof( "PlatformAttributes" ) - 1 },
|
||||||
{ "Class", sizeof( "Class" ) },
|
{ "Class", sizeof( "Class" ) - 1 },
|
||||||
{ "Class_Fwd", sizeof( "Class_Fwd" ) },
|
{ "Class_Fwd", sizeof( "Class_Fwd" ) - 1 },
|
||||||
{ "Class_Body", sizeof( "Class_Body" ) },
|
{ "Class_Body", sizeof( "Class_Body" ) - 1 },
|
||||||
{ "Constructor", sizeof( "Constructor" ) },
|
{ "Constructor", sizeof( "Constructor" ) - 1 },
|
||||||
{ "Constructor_Fwd", sizeof( "Constructor_Fwd" ) },
|
{ "Constructor_Fwd", sizeof( "Constructor_Fwd" ) - 1 },
|
||||||
{ "Destructor", sizeof( "Destructor" ) },
|
{ "Destructor", sizeof( "Destructor" ) - 1 },
|
||||||
{ "Destructor_Fwd", sizeof( "Destructor_Fwd" ) },
|
{ "Destructor_Fwd", sizeof( "Destructor_Fwd" ) - 1 },
|
||||||
{ "Enum", sizeof( "Enum" ) },
|
{ "Enum", sizeof( "Enum" ) - 1 },
|
||||||
{ "Enum_Fwd", sizeof( "Enum_Fwd" ) },
|
{ "Enum_Fwd", sizeof( "Enum_Fwd" ) - 1 },
|
||||||
{ "Enum_Body", sizeof( "Enum_Body" ) },
|
{ "Enum_Body", sizeof( "Enum_Body" ) - 1 },
|
||||||
{ "Enum_Class", sizeof( "Enum_Class" ) },
|
{ "Enum_Class", sizeof( "Enum_Class" ) - 1 },
|
||||||
{ "Enum_Class_Fwd", sizeof( "Enum_Class_Fwd" ) },
|
{ "Enum_Class_Fwd", sizeof( "Enum_Class_Fwd" ) - 1 },
|
||||||
{ "Execution", sizeof( "Execution" ) },
|
{ "Execution", sizeof( "Execution" ) - 1 },
|
||||||
{ "Export_Body", sizeof( "Export_Body" ) },
|
{ "Export_Body", sizeof( "Export_Body" ) - 1 },
|
||||||
{ "Extern_Linkage", sizeof( "Extern_Linkage" ) },
|
{ "Extern_Linkage", sizeof( "Extern_Linkage" ) - 1 },
|
||||||
{ "Extern_Linkage_Body", sizeof( "Extern_Linkage_Body" ) },
|
{ "Extern_Linkage_Body", sizeof( "Extern_Linkage_Body" ) - 1 },
|
||||||
{ "Friend", sizeof( "Friend" ) },
|
{ "Friend", sizeof( "Friend" ) - 1 },
|
||||||
{ "Function", sizeof( "Function" ) },
|
{ "Function", sizeof( "Function" ) - 1 },
|
||||||
{ "Function_Fwd", sizeof( "Function_Fwd" ) },
|
{ "Function_Fwd", sizeof( "Function_Fwd" ) - 1 },
|
||||||
{ "Function_Body", sizeof( "Function_Body" ) },
|
{ "Function_Body", sizeof( "Function_Body" ) - 1 },
|
||||||
{ "Global_Body", sizeof( "Global_Body" ) },
|
{ "Global_Body", sizeof( "Global_Body" ) - 1 },
|
||||||
{ "Module", sizeof( "Module" ) },
|
{ "Module", sizeof( "Module" ) - 1 },
|
||||||
{ "Namespace", sizeof( "Namespace" ) },
|
{ "Namespace", sizeof( "Namespace" ) - 1 },
|
||||||
{ "Namespace_Body", sizeof( "Namespace_Body" ) },
|
{ "Namespace_Body", sizeof( "Namespace_Body" ) - 1 },
|
||||||
{ "Operator", sizeof( "Operator" ) },
|
{ "Operator", sizeof( "Operator" ) - 1 },
|
||||||
{ "Operator_Fwd", sizeof( "Operator_Fwd" ) },
|
{ "Operator_Fwd", sizeof( "Operator_Fwd" ) - 1 },
|
||||||
{ "Operator_Member", sizeof( "Operator_Member" ) },
|
{ "Operator_Member", sizeof( "Operator_Member" ) - 1 },
|
||||||
{ "Operator_Member_Fwd", sizeof( "Operator_Member_Fwd" ) },
|
{ "Operator_Member_Fwd", sizeof( "Operator_Member_Fwd" ) - 1 },
|
||||||
{ "Operator_Cast", sizeof( "Operator_Cast" ) },
|
{ "Operator_Cast", sizeof( "Operator_Cast" ) - 1 },
|
||||||
{ "Operator_Cast_Fwd", sizeof( "Operator_Cast_Fwd" ) },
|
{ "Operator_Cast_Fwd", sizeof( "Operator_Cast_Fwd" ) - 1 },
|
||||||
{ "Parameters", sizeof( "Parameters" ) },
|
{ "Parameters", sizeof( "Parameters" ) - 1 },
|
||||||
{ "Preprocess_Define", sizeof( "Preprocess_Define" ) },
|
{ "Preprocess_Define", sizeof( "Preprocess_Define" ) - 1 },
|
||||||
{ "Preprocess_Include", sizeof( "Preprocess_Include" ) },
|
{ "Preprocess_Include", sizeof( "Preprocess_Include" ) - 1 },
|
||||||
{ "Preprocess_If", sizeof( "Preprocess_If" ) },
|
{ "Preprocess_If", sizeof( "Preprocess_If" ) - 1 },
|
||||||
{ "Preprocess_IfDef", sizeof( "Preprocess_IfDef" ) },
|
{ "Preprocess_IfDef", sizeof( "Preprocess_IfDef" ) - 1 },
|
||||||
{ "Preprocess_IfNotDef", sizeof( "Preprocess_IfNotDef" ) },
|
{ "Preprocess_IfNotDef", sizeof( "Preprocess_IfNotDef" ) - 1 },
|
||||||
{ "Preprocess_ElIf", sizeof( "Preprocess_ElIf" ) },
|
{ "Preprocess_ElIf", sizeof( "Preprocess_ElIf" ) - 1 },
|
||||||
{ "Preprocess_Else", sizeof( "Preprocess_Else" ) },
|
{ "Preprocess_Else", sizeof( "Preprocess_Else" ) - 1 },
|
||||||
{ "Preprocess_EndIf", sizeof( "Preprocess_EndIf" ) },
|
{ "Preprocess_EndIf", sizeof( "Preprocess_EndIf" ) - 1 },
|
||||||
{ "Preprocess_Pragma", sizeof( "Preprocess_Pragma" ) },
|
{ "Preprocess_Pragma", sizeof( "Preprocess_Pragma" ) - 1 },
|
||||||
{ "Specifiers", sizeof( "Specifiers" ) },
|
{ "Specifiers", sizeof( "Specifiers" ) - 1 },
|
||||||
{ "Struct", sizeof( "Struct" ) },
|
{ "Struct", sizeof( "Struct" ) - 1 },
|
||||||
{ "Struct_Fwd", sizeof( "Struct_Fwd" ) },
|
{ "Struct_Fwd", sizeof( "Struct_Fwd" ) - 1 },
|
||||||
{ "Struct_Body", sizeof( "Struct_Body" ) },
|
{ "Struct_Body", sizeof( "Struct_Body" ) - 1 },
|
||||||
{ "Template", sizeof( "Template" ) },
|
{ "Template", sizeof( "Template" ) - 1 },
|
||||||
{ "Typedef", sizeof( "Typedef" ) },
|
{ "Typedef", sizeof( "Typedef" ) - 1 },
|
||||||
{ "Typename", sizeof( "Typename" ) },
|
{ "Typename", sizeof( "Typename" ) - 1 },
|
||||||
{ "Union", sizeof( "Union" ) },
|
{ "Union", sizeof( "Union" ) - 1 },
|
||||||
{ "Union_Fwd", sizeof( "Union_Fwd" ) },
|
{ "Union_Fwd", sizeof( "Union_Fwd" ) - 1 },
|
||||||
{ "Union_Body", sizeof( "Union_Body" ) },
|
{ "Union_Body", sizeof( "Union_Body" ) - 1 },
|
||||||
{ "Using", sizeof( "Using" ) },
|
{ "Using", sizeof( "Using" ) - 1 },
|
||||||
{ "Using_Namespace", sizeof( "Using_Namespace" ) },
|
{ "Using_Namespace", sizeof( "Using_Namespace" ) - 1 },
|
||||||
{ "Variable", sizeof( "Variable" ) },
|
{ "Variable", sizeof( "Variable" ) - 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] = {
|
||||||
{ "INVALID", sizeof( "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 },
|
||||||
{ "new", sizeof( "new" ) },
|
{ "new", sizeof( "new" ) - 1 },
|
||||||
{ "new[]", sizeof( "new[]" ) },
|
{ "new[]", sizeof( "new[]" ) - 1 },
|
||||||
{ "delete", sizeof( "delete" ) },
|
{ "delete", sizeof( "delete" ) - 1 },
|
||||||
{ "delete[]", sizeof( "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] = {
|
||||||
{ "INVALID", sizeof( "INVALID" ) },
|
{ "INVALID", sizeof( "INVALID" ) - 1 },
|
||||||
{ "consteval", sizeof( "consteval" ) },
|
{ "consteval", sizeof( "consteval" ) - 1 },
|
||||||
{ "constexpr", sizeof( "constexpr" ) },
|
{ "constexpr", sizeof( "constexpr" ) - 1 },
|
||||||
{ "constinit", sizeof( "constinit" ) },
|
{ "constinit", sizeof( "constinit" ) - 1 },
|
||||||
{ "explicit", sizeof( "explicit" ) },
|
{ "explicit", sizeof( "explicit" ) - 1 },
|
||||||
{ "extern", sizeof( "extern" ) },
|
{ "extern", sizeof( "extern" ) - 1 },
|
||||||
{ "forceinline", sizeof( "forceinline" ) },
|
{ "forceinline", sizeof( "forceinline" ) - 1 },
|
||||||
{ "global", sizeof( "global" ) },
|
{ "global", sizeof( "global" ) - 1 },
|
||||||
{ "inline", sizeof( "inline" ) },
|
{ "inline", sizeof( "inline" ) - 1 },
|
||||||
{ "internal", sizeof( "internal" ) },
|
{ "internal", sizeof( "internal" ) - 1 },
|
||||||
{ "local_persist", sizeof( "local_persist" ) },
|
{ "local_persist", sizeof( "local_persist" ) - 1 },
|
||||||
{ "mutable", sizeof( "mutable" ) },
|
{ "mutable", sizeof( "mutable" ) - 1 },
|
||||||
{ "neverinline", sizeof( "neverinline" ) },
|
{ "neverinline", sizeof( "neverinline" ) - 1 },
|
||||||
{ "*", sizeof( "*" ) },
|
{ "*", sizeof( "*" ) - 1 },
|
||||||
{ "&", sizeof( "&" ) },
|
{ "&", sizeof( "&" ) - 1 },
|
||||||
{ "register", sizeof( "register" ) },
|
{ "register", sizeof( "register" ) - 1 },
|
||||||
{ "&&", sizeof( "&&" ) },
|
{ "&&", sizeof( "&&" ) - 1 },
|
||||||
{ "static", sizeof( "static" ) },
|
{ "static", sizeof( "static" ) - 1 },
|
||||||
{ "thread_local", sizeof( "thread_local" ) },
|
{ "thread_local", sizeof( "thread_local" ) - 1 },
|
||||||
{ "virtual", sizeof( "virtual" ) },
|
{ "virtual", sizeof( "virtual" ) - 1 },
|
||||||
{ "const", sizeof( "const" ) },
|
{ "const", sizeof( "const" ) - 1 },
|
||||||
{ "final", sizeof( "final" ) },
|
{ "final", sizeof( "final" ) - 1 },
|
||||||
{ "noexcept", sizeof( "noexcept" ) },
|
{ "noexcept", sizeof( "noexcept" ) - 1 },
|
||||||
{ "override", sizeof( "override" ) },
|
{ "override", sizeof( "override" ) - 1 },
|
||||||
{ "= 0", sizeof( "= 0" ) },
|
{ "= 0", sizeof( "= 0" ) - 1 },
|
||||||
{ "volatile", sizeof( "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[] = {
|
||||||
{ "__invalid__", sizeof( "__invalid__" ) },
|
{ "__invalid__", sizeof( "__invalid__" ) - 1 },
|
||||||
{ "private", sizeof( "private" ) },
|
{ "private", sizeof( "private" ) - 1 },
|
||||||
{ "protected", sizeof( "protected" ) },
|
{ "protected", sizeof( "protected" ) - 1 },
|
||||||
{ "public", sizeof( "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 },
|
||||||
{ "__comment__", sizeof( "__comment__" ) },
|
{ "__comment__", sizeof( "__comment__" ) - 1 },
|
||||||
{ "__comment_end__", sizeof( "__comment_end__" ) },
|
{ "__comment_end__", sizeof( "__comment_end__" ) - 1 },
|
||||||
{ "__comment_start__", sizeof( "__comment_start__" ) },
|
{ "__comment_start__", sizeof( "__comment_start__" ) - 1 },
|
||||||
{ "__character__", sizeof( "__character__" ) },
|
{ "__character__", sizeof( "__character__" ) - 1 },
|
||||||
{ ",", sizeof( "," ) },
|
{ ",", sizeof( "," ) - 1 },
|
||||||
{ "class", sizeof( "class" ) },
|
{ "class", sizeof( "class" ) - 1 },
|
||||||
{ "__attribute__", sizeof( "__attribute__" ) },
|
{ "__attribute__", sizeof( "__attribute__" ) - 1 },
|
||||||
{ "__declspec", sizeof( "__declspec" ) },
|
{ "__declspec", sizeof( "__declspec" ) - 1 },
|
||||||
{ "enum", sizeof( "enum" ) },
|
{ "enum", sizeof( "enum" ) - 1 },
|
||||||
{ "extern", sizeof( "extern" ) },
|
{ "extern", sizeof( "extern" ) - 1 },
|
||||||
{ "friend", sizeof( "friend" ) },
|
{ "friend", sizeof( "friend" ) - 1 },
|
||||||
{ "module", sizeof( "module" ) },
|
{ "module", sizeof( "module" ) - 1 },
|
||||||
{ "namespace", sizeof( "namespace" ) },
|
{ "namespace", sizeof( "namespace" ) - 1 },
|
||||||
{ "operator", sizeof( "operator" ) },
|
{ "operator", sizeof( "operator" ) - 1 },
|
||||||
{ "struct", sizeof( "struct" ) },
|
{ "struct", sizeof( "struct" ) - 1 },
|
||||||
{ "template", sizeof( "template" ) },
|
{ "template", sizeof( "template" ) - 1 },
|
||||||
{ "typedef", sizeof( "typedef" ) },
|
{ "typedef", sizeof( "typedef" ) - 1 },
|
||||||
{ "using", sizeof( "using" ) },
|
{ "using", sizeof( "using" ) - 1 },
|
||||||
{ "union", sizeof( "union" ) },
|
{ "union", sizeof( "union" ) - 1 },
|
||||||
{ "__identifier__", sizeof( "__identifier__" ) },
|
{ "__identifier__", sizeof( "__identifier__" ) - 1 },
|
||||||
{ "import", sizeof( "import" ) },
|
{ "import", sizeof( "import" ) - 1 },
|
||||||
{ "export", sizeof( "export" ) },
|
{ "export", sizeof( "export" ) - 1 },
|
||||||
{ "__new_line__", sizeof( "__new_line__" ) },
|
{ "__new_line__", sizeof( "__new_line__" ) - 1 },
|
||||||
{ "__number__", sizeof( "__number__" ) },
|
{ "__number__", sizeof( "__number__" ) - 1 },
|
||||||
{ "__operator__", sizeof( "__operator__" ) },
|
{ "__operator__", sizeof( "__operator__" ) - 1 },
|
||||||
{ "#", sizeof( "#" ) },
|
{ "#", sizeof( "#" ) - 1 },
|
||||||
{ "define", sizeof( "define" ) },
|
{ "define", sizeof( "define" ) - 1 },
|
||||||
{ "if", sizeof( "if" ) },
|
{ "if", sizeof( "if" ) - 1 },
|
||||||
{ "ifdef", sizeof( "ifdef" ) },
|
{ "ifdef", sizeof( "ifdef" ) - 1 },
|
||||||
{ "ifndef", sizeof( "ifndef" ) },
|
{ "ifndef", sizeof( "ifndef" ) - 1 },
|
||||||
{ "elif", sizeof( "elif" ) },
|
{ "elif", sizeof( "elif" ) - 1 },
|
||||||
{ "else", sizeof( "else" ) },
|
{ "else", sizeof( "else" ) - 1 },
|
||||||
{ "endif", sizeof( "endif" ) },
|
{ "endif", sizeof( "endif" ) - 1 },
|
||||||
{ "include", sizeof( "include" ) },
|
{ "include", sizeof( "include" ) - 1 },
|
||||||
{ "pragma", sizeof( "pragma" ) },
|
{ "pragma", sizeof( "pragma" ) - 1 },
|
||||||
{ "__macro_content__", sizeof( "__macro_content__" ) },
|
{ "__macro_content__", sizeof( "__macro_content__" ) - 1 },
|
||||||
{ "__macro__", sizeof( "__macro__" ) },
|
{ "__macro__", sizeof( "__macro__" ) - 1 },
|
||||||
{ "__unsupported__", sizeof( "__unsupported__" ) },
|
{ "__unsupported__", sizeof( "__unsupported__" ) - 1 },
|
||||||
{ "alignas", sizeof( "alignas" ) },
|
{ "alignas", sizeof( "alignas" ) - 1 },
|
||||||
{ "const", sizeof( "const" ) },
|
{ "const", sizeof( "const" ) - 1 },
|
||||||
{ "consteval", sizeof( "consteval" ) },
|
{ "consteval", sizeof( "consteval" ) - 1 },
|
||||||
{ "constexpr", sizeof( "constexpr" ) },
|
{ "constexpr", sizeof( "constexpr" ) - 1 },
|
||||||
{ "constinit", sizeof( "constinit" ) },
|
{ "constinit", sizeof( "constinit" ) - 1 },
|
||||||
{ "explicit", sizeof( "explicit" ) },
|
{ "explicit", sizeof( "explicit" ) - 1 },
|
||||||
{ "extern", sizeof( "extern" ) },
|
{ "extern", sizeof( "extern" ) - 1 },
|
||||||
{ "final", sizeof( "final" ) },
|
{ "final", sizeof( "final" ) - 1 },
|
||||||
{ "forceinline", sizeof( "forceinline" ) },
|
{ "forceinline", sizeof( "forceinline" ) - 1 },
|
||||||
{ "global", sizeof( "global" ) },
|
{ "global", sizeof( "global" ) - 1 },
|
||||||
{ "inline", sizeof( "inline" ) },
|
{ "inline", sizeof( "inline" ) - 1 },
|
||||||
{ "internal", sizeof( "internal" ) },
|
{ "internal", sizeof( "internal" ) - 1 },
|
||||||
{ "local_persist", sizeof( "local_persist" ) },
|
{ "local_persist", sizeof( "local_persist" ) - 1 },
|
||||||
{ "mutable", sizeof( "mutable" ) },
|
{ "mutable", sizeof( "mutable" ) - 1 },
|
||||||
{ "neverinline", sizeof( "neverinline" ) },
|
{ "neverinline", sizeof( "neverinline" ) - 1 },
|
||||||
{ "override", sizeof( "override" ) },
|
{ "override", sizeof( "override" ) - 1 },
|
||||||
{ "static", sizeof( "static" ) },
|
{ "static", sizeof( "static" ) - 1 },
|
||||||
{ "thread_local", sizeof( "thread_local" ) },
|
{ "thread_local", sizeof( "thread_local" ) - 1 },
|
||||||
{ "volatile", sizeof( "volatile" ) },
|
{ "volatile", sizeof( "volatile" ) - 1 },
|
||||||
{ "virtual", sizeof( "virtual" ) },
|
{ "virtual", sizeof( "virtual" ) - 1 },
|
||||||
{ "*", sizeof( "*" ) },
|
{ "*", sizeof( "*" ) - 1 },
|
||||||
{ ";", sizeof( ";" ) },
|
{ ";", sizeof( ";" ) - 1 },
|
||||||
{ "static_assert", sizeof( "static_assert" ) },
|
{ "static_assert", sizeof( "static_assert" ) - 1 },
|
||||||
{ "__string__", sizeof( "__string__" ) },
|
{ "__string__", sizeof( "__string__" ) - 1 },
|
||||||
{ "typename", sizeof( "typename" ) },
|
{ "typename", sizeof( "typename" ) - 1 },
|
||||||
{ "unsigned", sizeof( "unsigned" ) },
|
{ "unsigned", sizeof( "unsigned" ) - 1 },
|
||||||
{ "signed", sizeof( "signed" ) },
|
{ "signed", sizeof( "signed" ) - 1 },
|
||||||
{ "short", sizeof( "short" ) },
|
{ "short", sizeof( "short" ) - 1 },
|
||||||
{ "long", sizeof( "long" ) },
|
{ "long", sizeof( "long" ) - 1 },
|
||||||
{ "bool", sizeof( "bool" ) },
|
{ "bool", sizeof( "bool" ) - 1 },
|
||||||
{ "char", sizeof( "char" ) },
|
{ "char", sizeof( "char" ) - 1 },
|
||||||
{ "int", sizeof( "int" ) },
|
{ "int", sizeof( "int" ) - 1 },
|
||||||
{ "double", sizeof( "double" ) },
|
{ "double", sizeof( "double" ) - 1 },
|
||||||
{ "__int8", sizeof( "__int8" ) },
|
{ "__int8", sizeof( "__int8" ) - 1 },
|
||||||
{ "__int16", sizeof( "__int16" ) },
|
{ "__int16", sizeof( "__int16" ) - 1 },
|
||||||
{ "__int32", sizeof( "__int32" ) },
|
{ "__int32", sizeof( "__int32" ) - 1 },
|
||||||
{ "__int64", sizeof( "__int64" ) },
|
{ "__int64", sizeof( "__int64" ) - 1 },
|
||||||
{ "_W64", sizeof( "_W64" ) },
|
{ "_W64", sizeof( "_W64" ) - 1 },
|
||||||
{ "...", sizeof( "..." ) },
|
{ "...", sizeof( "..." ) - 1 },
|
||||||
{ "__attrib_start__", sizeof( "__attrib_start__" ) },
|
{ "__attrib_start__", sizeof( "__attrib_start__" ) - 1 },
|
||||||
{ "GEN_API_Export_Code", sizeof( "GEN_API_Export_Code" ) },
|
{ "GEN_API_Export_Code", sizeof( "GEN_API_Export_Code" ) - 1 },
|
||||||
{ "GEN_API_Import_Code", sizeof( "GEN_API_Import_Code" ) },
|
{ "GEN_API_Import_Code", sizeof( "GEN_API_Import_Code" ) - 1 },
|
||||||
};
|
};
|
||||||
return lookup[type];
|
return lookup[type];
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ inline TokType str_to_toktype( Str str )
|
|||||||
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++ )
|
||||||
|
@ -1,235 +0,0 @@
|
|||||||
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
|
||||||
#pragma once
|
|
||||||
#include "components/types.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
|
||||||
|
|
||||||
GEN_NS_PARSER_BEGIN
|
|
||||||
|
|
||||||
#define GEN_DEFINE_ATTRIBUTE_TOKENS Entry( Tok_Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Tok_Attribute_API_Import, "GEN_API_Import_Code" )
|
|
||||||
|
|
||||||
enum TokType : u32
|
|
||||||
{
|
|
||||||
Tok_Invalid,
|
|
||||||
Tok_Access_Private,
|
|
||||||
Tok_Access_Protected,
|
|
||||||
Tok_Access_Public,
|
|
||||||
Tok_Access_MemberSymbol,
|
|
||||||
Tok_Access_StaticSymbol,
|
|
||||||
Tok_Ampersand,
|
|
||||||
Tok_Ampersand_DBL,
|
|
||||||
Tok_Assign_Classifer,
|
|
||||||
Tok_Attribute_Open,
|
|
||||||
Tok_Attribute_Close,
|
|
||||||
Tok_BraceCurly_Open,
|
|
||||||
Tok_BraceCurly_Close,
|
|
||||||
Tok_BraceSquare_Open,
|
|
||||||
Tok_BraceSquare_Close,
|
|
||||||
Tok_Capture_Start,
|
|
||||||
Tok_Capture_End,
|
|
||||||
Tok_Comment,
|
|
||||||
Tok_Comment_End,
|
|
||||||
Tok_Comment_Start,
|
|
||||||
Tok_Char,
|
|
||||||
Tok_Comma,
|
|
||||||
Tok_Decl_Class,
|
|
||||||
Tok_Decl_GNU_Attribute,
|
|
||||||
Tok_Decl_MSVC_Attribute,
|
|
||||||
Tok_Decl_Enum,
|
|
||||||
Tok_Decl_Extern_Linkage,
|
|
||||||
Tok_Decl_Friend,
|
|
||||||
Tok_Decl_Module,
|
|
||||||
Tok_Decl_Namespace,
|
|
||||||
Tok_Decl_Operator,
|
|
||||||
Tok_Decl_Struct,
|
|
||||||
Tok_Decl_Template,
|
|
||||||
Tok_Decl_Typedef,
|
|
||||||
Tok_Decl_Using,
|
|
||||||
Tok_Decl_Union,
|
|
||||||
Tok_Identifier,
|
|
||||||
Tok_Module_Import,
|
|
||||||
Tok_Module_Export,
|
|
||||||
Tok_NewLine,
|
|
||||||
Tok_Number,
|
|
||||||
Tok_Operator,
|
|
||||||
Tok_Preprocess_Hash,
|
|
||||||
Tok_Preprocess_Define,
|
|
||||||
Tok_Preprocess_If,
|
|
||||||
Tok_Preprocess_IfDef,
|
|
||||||
Tok_Preprocess_IfNotDef,
|
|
||||||
Tok_Preprocess_ElIf,
|
|
||||||
Tok_Preprocess_Else,
|
|
||||||
Tok_Preprocess_EndIf,
|
|
||||||
Tok_Preprocess_Include,
|
|
||||||
Tok_Preprocess_Pragma,
|
|
||||||
Tok_Preprocess_Content,
|
|
||||||
Tok_Preprocess_Macro,
|
|
||||||
Tok_Preprocess_Unsupported,
|
|
||||||
Tok_Spec_Alignas,
|
|
||||||
Tok_Spec_Const,
|
|
||||||
Tok_Spec_Consteval,
|
|
||||||
Tok_Spec_Constexpr,
|
|
||||||
Tok_Spec_Constinit,
|
|
||||||
Tok_Spec_Explicit,
|
|
||||||
Tok_Spec_Extern,
|
|
||||||
Tok_Spec_Final,
|
|
||||||
Tok_Spec_ForceInline,
|
|
||||||
Tok_Spec_Global,
|
|
||||||
Tok_Spec_Inline,
|
|
||||||
Tok_Spec_Internal_Linkage,
|
|
||||||
Tok_Spec_LocalPersist,
|
|
||||||
Tok_Spec_Mutable,
|
|
||||||
Tok_Spec_NeverInline,
|
|
||||||
Tok_Spec_Override,
|
|
||||||
Tok_Spec_Static,
|
|
||||||
Tok_Spec_ThreadLocal,
|
|
||||||
Tok_Spec_Volatile,
|
|
||||||
Tok_Spec_Virtual,
|
|
||||||
Tok_Star,
|
|
||||||
Tok_Statement_End,
|
|
||||||
Tok_StaticAssert,
|
|
||||||
Tok_String,
|
|
||||||
Tok_Type_Typename,
|
|
||||||
Tok_Type_Unsigned,
|
|
||||||
Tok_Type_Signed,
|
|
||||||
Tok_Type_Short,
|
|
||||||
Tok_Type_Long,
|
|
||||||
Tok_Type_bool,
|
|
||||||
Tok_Type_char,
|
|
||||||
Tok_Type_int,
|
|
||||||
Tok_Type_double,
|
|
||||||
Tok_Type_MS_int8,
|
|
||||||
Tok_Type_MS_int16,
|
|
||||||
Tok_Type_MS_int32,
|
|
||||||
Tok_Type_MS_int64,
|
|
||||||
Tok_Type_MS_W64,
|
|
||||||
Tok_Varadic_Argument,
|
|
||||||
Tok___Attributes_Start,
|
|
||||||
Tok_Attribute_API_Export,
|
|
||||||
Tok_Attribute_API_Import,
|
|
||||||
Tok_NumTokens
|
|
||||||
};
|
|
||||||
|
|
||||||
inline Str toktype_to_str( TokType type )
|
|
||||||
{
|
|
||||||
local_persist Str lookup[] = {
|
|
||||||
{ "__invalid__", sizeof( "__invalid__" ) },
|
|
||||||
{ "private", sizeof( "private" ) },
|
|
||||||
{ "protected", sizeof( "protected" ) },
|
|
||||||
{ "public", sizeof( "public" ) },
|
|
||||||
{ ".", sizeof( "." ) },
|
|
||||||
{ "::", sizeof( "::" ) },
|
|
||||||
{ "&", sizeof( "&" ) },
|
|
||||||
{ "&&", sizeof( "&&" ) },
|
|
||||||
{ ":", sizeof( ":" ) },
|
|
||||||
{ "[[", sizeof( "[[" ) },
|
|
||||||
{ "]]", sizeof( "]]" ) },
|
|
||||||
{ "{", sizeof( "{" ) },
|
|
||||||
{ "}", sizeof( "}" ) },
|
|
||||||
{ "[", sizeof( "[" ) },
|
|
||||||
{ "]", sizeof( "]" ) },
|
|
||||||
{ "(", sizeof( "(" ) },
|
|
||||||
{ ")", sizeof( ")" ) },
|
|
||||||
{ "__comment__", sizeof( "__comment__" ) },
|
|
||||||
{ "__comment_end__", sizeof( "__comment_end__" ) },
|
|
||||||
{ "__comment_start__", sizeof( "__comment_start__" ) },
|
|
||||||
{ "__character__", sizeof( "__character__" ) },
|
|
||||||
{ ",", sizeof( "," ) },
|
|
||||||
{ "class", sizeof( "class" ) },
|
|
||||||
{ "__attribute__", sizeof( "__attribute__" ) },
|
|
||||||
{ "__declspec", sizeof( "__declspec" ) },
|
|
||||||
{ "enum", sizeof( "enum" ) },
|
|
||||||
{ "extern", sizeof( "extern" ) },
|
|
||||||
{ "friend", sizeof( "friend" ) },
|
|
||||||
{ "module", sizeof( "module" ) },
|
|
||||||
{ "namespace", sizeof( "namespace" ) },
|
|
||||||
{ "operator", sizeof( "operator" ) },
|
|
||||||
{ "struct", sizeof( "struct" ) },
|
|
||||||
{ "template", sizeof( "template" ) },
|
|
||||||
{ "typedef", sizeof( "typedef" ) },
|
|
||||||
{ "using", sizeof( "using" ) },
|
|
||||||
{ "union", sizeof( "union" ) },
|
|
||||||
{ "__identifier__", sizeof( "__identifier__" ) },
|
|
||||||
{ "import", sizeof( "import" ) },
|
|
||||||
{ "export", sizeof( "export" ) },
|
|
||||||
{ "__new_line__", sizeof( "__new_line__" ) },
|
|
||||||
{ "__number__", sizeof( "__number__" ) },
|
|
||||||
{ "__operator__", sizeof( "__operator__" ) },
|
|
||||||
{ "#", sizeof( "#" ) },
|
|
||||||
{ "define", sizeof( "define" ) },
|
|
||||||
{ "if", sizeof( "if" ) },
|
|
||||||
{ "ifdef", sizeof( "ifdef" ) },
|
|
||||||
{ "ifndef", sizeof( "ifndef" ) },
|
|
||||||
{ "elif", sizeof( "elif" ) },
|
|
||||||
{ "else", sizeof( "else" ) },
|
|
||||||
{ "endif", sizeof( "endif" ) },
|
|
||||||
{ "include", sizeof( "include" ) },
|
|
||||||
{ "pragma", sizeof( "pragma" ) },
|
|
||||||
{ "__macro_content__", sizeof( "__macro_content__" ) },
|
|
||||||
{ "__macro__", sizeof( "__macro__" ) },
|
|
||||||
{ "__unsupported__", sizeof( "__unsupported__" ) },
|
|
||||||
{ "alignas", sizeof( "alignas" ) },
|
|
||||||
{ "const", sizeof( "const" ) },
|
|
||||||
{ "consteval", sizeof( "consteval" ) },
|
|
||||||
{ "constexpr", sizeof( "constexpr" ) },
|
|
||||||
{ "constinit", sizeof( "constinit" ) },
|
|
||||||
{ "explicit", sizeof( "explicit" ) },
|
|
||||||
{ "extern", sizeof( "extern" ) },
|
|
||||||
{ "final", sizeof( "final" ) },
|
|
||||||
{ "forceinline", sizeof( "forceinline" ) },
|
|
||||||
{ "global", sizeof( "global" ) },
|
|
||||||
{ "inline", sizeof( "inline" ) },
|
|
||||||
{ "internal", sizeof( "internal" ) },
|
|
||||||
{ "local_persist", sizeof( "local_persist" ) },
|
|
||||||
{ "mutable", sizeof( "mutable" ) },
|
|
||||||
{ "neverinline", sizeof( "neverinline" ) },
|
|
||||||
{ "override", sizeof( "override" ) },
|
|
||||||
{ "static", sizeof( "static" ) },
|
|
||||||
{ "thread_local", sizeof( "thread_local" ) },
|
|
||||||
{ "volatile", sizeof( "volatile" ) },
|
|
||||||
{ "virtual", sizeof( "virtual" ) },
|
|
||||||
{ "*", sizeof( "*" ) },
|
|
||||||
{ ";", sizeof( ";" ) },
|
|
||||||
{ "static_assert", sizeof( "static_assert" ) },
|
|
||||||
{ "__string__", sizeof( "__string__" ) },
|
|
||||||
{ "typename", sizeof( "typename" ) },
|
|
||||||
{ "unsigned", sizeof( "unsigned" ) },
|
|
||||||
{ "signed", sizeof( "signed" ) },
|
|
||||||
{ "short", sizeof( "short" ) },
|
|
||||||
{ "long", sizeof( "long" ) },
|
|
||||||
{ "bool", sizeof( "bool" ) },
|
|
||||||
{ "char", sizeof( "char" ) },
|
|
||||||
{ "int", sizeof( "int" ) },
|
|
||||||
{ "double", sizeof( "double" ) },
|
|
||||||
{ "__int8", sizeof( "__int8" ) },
|
|
||||||
{ "__int16", sizeof( "__int16" ) },
|
|
||||||
{ "__int32", sizeof( "__int32" ) },
|
|
||||||
{ "__int64", sizeof( "__int64" ) },
|
|
||||||
{ "_W64", sizeof( "_W64" ) },
|
|
||||||
{ "...", sizeof( "..." ) },
|
|
||||||
{ "__attrib_start__", sizeof( "__attrib_start__" ) },
|
|
||||||
{ "GEN_API_Export_Code", sizeof( "GEN_API_Export_Code" ) },
|
|
||||||
{ "GEN_API_Import_Code", sizeof( "GEN_API_Import_Code" ) },
|
|
||||||
};
|
|
||||||
return lookup[type];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline TokType str_to_toktype( Str str )
|
|
||||||
{
|
|
||||||
local_persist u32 keymap[Tok_NumTokens];
|
|
||||||
do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ )
|
|
||||||
{
|
|
||||||
Str enum_str = toktype_to_str( (TokType)index );
|
|
||||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
|
||||||
}
|
|
||||||
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
|
||||||
for ( u32 index = 0; index < Tok_NumTokens; index++ )
|
|
||||||
{
|
|
||||||
if ( keymap[index] == hash )
|
|
||||||
return (TokType)index;
|
|
||||||
}
|
|
||||||
return Tok_Invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
GEN_NS_PARSER_END
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ 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) );
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ 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
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void parser_pop(ParseContext* ctx)
|
|||||||
ctx->Scope = ctx->Scope->Prev;
|
ctx->Scope = ctx->Scope->Prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
StrBuilder parser_to_string(ParseContext ctx)
|
StrBuilder parser_to_strbuilder(ParseContext ctx)
|
||||||
{
|
{
|
||||||
StrBuilder result = strbuilder_make_reserve( GlobalAllocator, kilobytes(4) );
|
StrBuilder result = strbuilder_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ bool lex__eat(TokArray* self, TokType type )
|
|||||||
{
|
{
|
||||||
if ( array_num(self->Arr) - self->Idx <= 0 )
|
if ( array_num(self->Arr) - self->Idx <= 0 )
|
||||||
{
|
{
|
||||||
log_failure( "No tokens left.\n%s", parser_to_string(Context) );
|
log_failure( "No tokens left.\n%s", parser_to_strbuilder(Context) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,14 +122,14 @@ bool lex__eat(TokArray* self, TokType type )
|
|||||||
, at_idx.Length, at_idx.Text
|
, at_idx.Length, at_idx.Text
|
||||||
, tok.Line
|
, tok.Line
|
||||||
, tok.Column
|
, tok.Column
|
||||||
, parser_to_string(Context)
|
, parser_to_strbuilder(Context)
|
||||||
);
|
);
|
||||||
GEN_DEBUG_TRAP();
|
GEN_DEBUG_TRAP();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 && GEN_BUILD_DEBUG
|
#if 0 && GEN_BUILD_DEBUG
|
||||||
log_fmt("Ate: %SB\n", self->Arr[Idx].to_string() );
|
log_fmt("Ate: %SB\n", self->Arr[Idx].to_strbuilder() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
self->Idx ++;
|
self->Idx ++;
|
||||||
@ -530,14 +530,14 @@ Code parse_array_decl()
|
|||||||
|
|
||||||
if ( left == 0 )
|
if ( left == 0 )
|
||||||
{
|
{
|
||||||
log_failure( "Error, unexpected end of array declaration ( '[]' scope started )\n%s", parser_to_string(Context) );
|
log_failure( "Error, unexpected end of array declaration ( '[]' scope started )\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( currtok.Type == Tok_BraceSquare_Close )
|
if ( currtok.Type == Tok_BraceSquare_Close )
|
||||||
{
|
{
|
||||||
log_failure( "Error, empty array expression in definition\n%s", parser_to_string(Context) );
|
log_failure( "Error, empty array expression in definition\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -556,14 +556,14 @@ Code parse_array_decl()
|
|||||||
|
|
||||||
if ( left == 0 )
|
if ( left == 0 )
|
||||||
{
|
{
|
||||||
log_failure( "Error, unexpected end of array declaration, expected ]\n%s", parser_to_string(Context) );
|
log_failure( "Error, unexpected end of array declaration, expected ]\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( currtok.Type != Tok_BraceSquare_Close )
|
if ( currtok.Type != Tok_BraceSquare_Close )
|
||||||
{
|
{
|
||||||
log_failure( "%s: Error, expected ] in array declaration, not %s\n%s", toktype_to_str( currtok.Type ), parser_to_string(Context) );
|
log_failure( "%s: Error, expected ] in array declaration, not %s\n%s", toktype_to_str( currtok.Type ), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -704,7 +704,7 @@ Code parse_class_struct( TokType which, bool inplace_def )
|
|||||||
{
|
{
|
||||||
if ( which != Tok_Decl_Class && which != Tok_Decl_Struct )
|
if ( which != Tok_Decl_Class && which != Tok_Decl_Struct )
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected class or struct, not %s\n%s", toktype_to_str( which ), parser_to_string(Context) );
|
log_failure( "Error, expected class or struct, not %s\n%s", toktype_to_str( which ), parser_to_strbuilder(Context) );
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
case Tok_Statement_End:
|
case Tok_Statement_End:
|
||||||
{
|
{
|
||||||
// TODO(Ed): Convert this to a general warning procedure
|
// TODO(Ed): Convert this to a general warning procedure
|
||||||
log_fmt("Dangling end statement found %SB\n", tok_to_string(currtok_noskip));
|
log_fmt("Dangling end statement found %SB\n", tok_to_strbuilder(currtok_noskip));
|
||||||
eat( Tok_Statement_End );
|
eat( Tok_Statement_End );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -928,7 +928,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
case Tok_Operator:
|
case Tok_Operator:
|
||||||
//if ( currtok.Text[0] != '~' )
|
//if ( currtok.Text[0] != '~' )
|
||||||
//{
|
//{
|
||||||
// log_failure( "Operator token found in global body but not destructor unary negation\n%s", to_string(Context) );
|
// log_failure( "Operator token found in global body but not destructor unary negation\n%s", to_strbuilder(Context) );
|
||||||
// return InvalidCode;
|
// return InvalidCode;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
@ -1042,7 +1042,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
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), strbuilder_to_str( parser_to_strbuilder(Context)) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1128,7 +1128,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
|
|
||||||
if ( member == Code_Invalid )
|
if ( member == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse member\n%s", parser_to_string(Context) );
|
log_failure( "Failed to parse member\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1162,7 +1162,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
|||||||
|
|
||||||
if ( member == Code_Invalid )
|
if ( member == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse member\n%s", parser_to_string(Context) );
|
log_failure( "Failed to parse member\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1249,7 +1249,7 @@ Code parse_complicated_definition( TokType which )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_failure( "Unsupported or bad member definition after %s declaration\n%s", toktype_to_str(which), parser_to_string(Context) );
|
log_failure( "Unsupported or bad member definition after %s declaration\n%s", toktype_to_str(which), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1294,7 +1294,7 @@ Code parse_complicated_definition( TokType which )
|
|||||||
|
|
||||||
if ( ! ok_to_parse )
|
if ( ! ok_to_parse )
|
||||||
{
|
{
|
||||||
log_failure( "Unsupported or bad member definition after %s declaration\n%s", toktype_to_str(which), parser_to_string(Context) );
|
log_failure( "Unsupported or bad member definition after %s declaration\n%s", toktype_to_str(which), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1313,7 +1313,7 @@ Code parse_complicated_definition( TokType which )
|
|||||||
&& ( tokens.Arr[idx - 4].Type != which))
|
&& ( tokens.Arr[idx - 4].Type != which))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
log_failure( "Unsupported or bad member definition after %s declaration\n%s", toktype_to_str(which), parser_to_string(Context) );
|
log_failure( "Unsupported or bad member definition after %s declaration\n%s", toktype_to_str(which), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1343,7 @@ Code parse_complicated_definition( TokType which )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_failure( "Unsupported or bad member definition after %s declaration\n%SB", toktype_to_str(which).Ptr, parser_to_string(Context) );
|
log_failure( "Unsupported or bad member definition after %s declaration\n%SB", toktype_to_str(which).Ptr, parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1362,7 +1362,7 @@ CodeDefine parse_define()
|
|||||||
|
|
||||||
if ( ! check( Tok_Identifier ) )
|
if ( ! check( Tok_Identifier ) )
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected identifier after #define\n%s", parser_to_string(Context) );
|
log_failure( "Error, expected identifier after #define\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1374,7 +1374,7 @@ CodeDefine parse_define()
|
|||||||
|
|
||||||
if ( ! check( Tok_Preprocess_Content ))
|
if ( ! check( Tok_Preprocess_Content ))
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected content after #define %s\n%s", define->Name, parser_to_string(Context) );
|
log_failure( "Error, expected content after #define %s\n%s", define->Name, parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1409,7 +1409,7 @@ Code parse_assignment_expression()
|
|||||||
|
|
||||||
if ( currtok.Type == Tok_Statement_End && currtok.Type != Tok_Comma )
|
if ( currtok.Type == Tok_Statement_End && currtok.Type != Tok_Comma )
|
||||||
{
|
{
|
||||||
log_failure( "Expected expression after assignment operator\n%s", parser_to_string(Context) );
|
log_failure( "Expected expression after assignment operator\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1461,7 +1461,7 @@ Code parse_forward_or_definition( TokType which, bool is_inplace )
|
|||||||
default:
|
default:
|
||||||
log_failure( "Error, wrong token type given to parse_complicated_definition "
|
log_failure( "Error, wrong token type given to parse_complicated_definition "
|
||||||
"(only supports class, enum, struct, union) \n%s"
|
"(only supports class, enum, struct, union) \n%s"
|
||||||
, parser_to_string(Context) );
|
, parser_to_strbuilder(Context) );
|
||||||
|
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1552,7 +1552,7 @@ CodeFn parse_function_after_name(
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", code_debug_str(body), parser_to_string(Context));
|
log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", code_debug_str(body), parser_to_strbuilder(Context));
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1661,7 +1661,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
{
|
{
|
||||||
case Tok_Comma:
|
case Tok_Comma:
|
||||||
{
|
{
|
||||||
log_failure("Dangling comma found: %SB\nContext:\n%SB", tok_to_string(currtok), parser_to_string(Context));
|
log_failure("Dangling comma found: %SB\nContext:\n%SB", tok_to_strbuilder(currtok), parser_to_strbuilder(Context));
|
||||||
parser_pop( & Context);
|
parser_pop( & Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1669,7 +1669,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
case Tok_Statement_End:
|
case Tok_Statement_End:
|
||||||
{
|
{
|
||||||
// TODO(Ed): Convert this to a general warning procedure
|
// TODO(Ed): Convert this to a general warning procedure
|
||||||
log_fmt("Dangling end statement found %SB\n", tok_to_string(currtok_noskip));
|
log_fmt("Dangling end statement found %SB\n", tok_to_strbuilder(currtok_noskip));
|
||||||
eat( Tok_Statement_End );
|
eat( Tok_Statement_End );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1695,7 +1695,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
|
|
||||||
case Tok_Decl_Extern_Linkage:
|
case Tok_Decl_Extern_Linkage:
|
||||||
if ( which == CT_Extern_Linkage_Body )
|
if ( which == CT_Extern_Linkage_Body )
|
||||||
log_failure( "Nested extern linkage\n%s", parser_to_string(Context) );
|
log_failure( "Nested extern linkage\n%s", parser_to_strbuilder(Context) );
|
||||||
|
|
||||||
member = cast(Code, parser_parse_extern_link());
|
member = cast(Code, parser_parse_extern_link());
|
||||||
// extern "..." { ... }
|
// extern "..." { ... }
|
||||||
@ -1788,7 +1788,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
|
|
||||||
case Tok_Module_Export: {
|
case Tok_Module_Export: {
|
||||||
if ( which == CT_Export_Body )
|
if ( which == CT_Export_Body )
|
||||||
log_failure( "Nested export declaration\n%s", parser_to_string(Context) );
|
log_failure( "Nested export declaration\n%s", parser_to_strbuilder(Context) );
|
||||||
|
|
||||||
member = cast(Code, parser_parse_export_body());
|
member = cast(Code, parser_parse_export_body());
|
||||||
// export { ... }
|
// export { ... }
|
||||||
@ -1858,7 +1858,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
default:
|
default:
|
||||||
Str spec_str = spec_to_str(spec);
|
Str spec_str = spec_to_str(spec);
|
||||||
|
|
||||||
log_failure( "Invalid specifier %.*s for variable\n%s", spec_str.Len, spec_str, parser_to_string(Context) );
|
log_failure( "Invalid specifier %S for variable\n%S", spec_str, strbuilder_to_str( parser_to_strbuilder(Context)) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1941,7 +1941,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
|
|
||||||
if ( member == Code_Invalid )
|
if ( member == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse member\n%s", parser_to_string(Context) );
|
log_failure( "Failed to parse member\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -1960,7 +1960,7 @@ CodeBody parse_global_nspace( CodeType which )
|
|||||||
Member_Resolved_To_Lone_Macro:
|
Member_Resolved_To_Lone_Macro:
|
||||||
if ( member == Code_Invalid )
|
if ( member == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse member\nToken: %SB\nContext:\n%SB", tok_to_string(currtok_noskip), parser_to_string(Context) );
|
log_failure( "Failed to parse member\nToken: %SB\nContext:\n%SB", tok_to_strbuilder(currtok_noskip), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2129,7 +2129,7 @@ Token parse_identifier( bool* possible_member_function )
|
|||||||
Token invalid = { nullptr, 0, Tok_Invalid };
|
Token invalid = { nullptr, 0, Tok_Invalid };
|
||||||
if ( left == 0 )
|
if ( left == 0 )
|
||||||
{
|
{
|
||||||
log_failure( "Error, unexpected end of static symbol identifier\n%s", parser_to_string(Context) );
|
log_failure( "Error, unexpected end of static symbol identifier\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
@ -2144,7 +2144,7 @@ Token parse_identifier( bool* possible_member_function )
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_failure( "Error, had a ~ operator after %SB but not a destructor\n%s", toktype_to_str( prevtok.Type ), parser_to_string(Context) );
|
log_failure( "Error, had a ~ operator after %SB but not a destructor\n%s", toktype_to_str( prevtok.Type ), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
@ -2156,7 +2156,7 @@ Token parse_identifier( bool* possible_member_function )
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_failure( "Found a member function pointer identifier but the parsing context did not expect it\n%s", parser_to_string(Context) );
|
log_failure( "Found a member function pointer identifier but the parsing context did not expect it\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
@ -2164,7 +2164,7 @@ Token parse_identifier( bool* possible_member_function )
|
|||||||
|
|
||||||
if ( currtok.Type != Tok_Identifier )
|
if ( currtok.Type != Tok_Identifier )
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected static symbol identifier, not %s\n%s", toktype_to_str( currtok.Type ), parser_to_string(Context) );
|
log_failure( "Error, expected static symbol identifier, not %s\n%s", toktype_to_str( currtok.Type ), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
@ -2195,7 +2195,7 @@ CodeInclude parse_include()
|
|||||||
|
|
||||||
if ( ! check( Tok_String ))
|
if ( ! check( Tok_String ))
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected include string after #include\n%s", parser_to_string(Context) );
|
log_failure( "Error, expected include string after #include\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2243,7 +2243,7 @@ CodeOperator parse_operator_after_ret_type(
|
|||||||
&& currtok.Type != Tok_Ampersand
|
&& currtok.Type != Tok_Ampersand
|
||||||
&& currtok.Type != Tok_Ampersand_DBL )
|
&& currtok.Type != Tok_Ampersand_DBL )
|
||||||
{
|
{
|
||||||
log_failure( "Expected operator after 'operator' keyword\n%s", parser_to_string(Context) );
|
log_failure( "Expected operator after 'operator' keyword\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2496,7 +2496,7 @@ CodeOperator parse_operator_after_ret_type(
|
|||||||
{
|
{
|
||||||
if ( op == Op_Invalid )
|
if ( op == Op_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Invalid operator '%s'\n%s", prevtok.Text, parser_to_string(Context) );
|
log_failure( "Invalid operator '%s'\n%s", prevtok.Text, parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2506,7 +2506,7 @@ CodeOperator parse_operator_after_ret_type(
|
|||||||
|
|
||||||
if ( op == Op_Invalid )
|
if ( op == Op_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Invalid operator '%s'\n%s", currtok.Text, parser_to_string(Context) );
|
log_failure( "Invalid operator '%s'\n%s", currtok.Text, parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2650,7 +2650,7 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
|
|||||||
{
|
{
|
||||||
if ( expects_function )
|
if ( expects_function )
|
||||||
{
|
{
|
||||||
log_failure( "Expected function declaration (consteval was used)\n%s", parser_to_string(Context) );
|
log_failure( "Expected function declaration (consteval was used)\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2678,7 +2678,7 @@ CodePragma parse_pragma()
|
|||||||
|
|
||||||
if ( ! check( Tok_Preprocess_Content ))
|
if ( ! check( Tok_Preprocess_Content ))
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected content after #pragma\n%s", parser_to_string(Context) );
|
log_failure( "Error, expected content after #pragma\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2791,7 +2791,7 @@ CodeParams parse_params( bool use_template_capture )
|
|||||||
|
|
||||||
if ( currtok.Type == Tok_Comma )
|
if ( currtok.Type == Tok_Comma )
|
||||||
{
|
{
|
||||||
log_failure( "Expected value after assignment operator\n%s.", parser_to_string(Context) );
|
log_failure( "Expected value after assignment operator\n%s.", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2904,7 +2904,7 @@ CodeParams parse_params( bool use_template_capture )
|
|||||||
|
|
||||||
if ( currtok.Type == Tok_Comma )
|
if ( currtok.Type == Tok_Comma )
|
||||||
{
|
{
|
||||||
log_failure( "Expected value after assignment operator\n%s", parser_to_string(Context) );
|
log_failure( "Expected value after assignment operator\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2965,7 +2965,7 @@ CodeParams parse_params( bool use_template_capture )
|
|||||||
{
|
{
|
||||||
if ( ! check( Tok_Operator ) || currtok.Text[ 0 ] != '>' )
|
if ( ! check( Tok_Operator ) || currtok.Text[ 0 ] != '>' )
|
||||||
{
|
{
|
||||||
log_failure( "Expected '<' after 'template' keyword\n%s", parser_to_string(Context) );
|
log_failure( "Expected '<' after 'template' keyword\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2985,7 +2985,7 @@ CodePreprocessCond parse_preprocess_cond()
|
|||||||
|
|
||||||
if ( ! tok_is_preprocess_cond(currtok) )
|
if ( ! tok_is_preprocess_cond(currtok) )
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected preprocess conditional\n%s", parser_to_string(Context) );
|
log_failure( "Error, expected preprocess conditional\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -2998,7 +2998,7 @@ CodePreprocessCond parse_preprocess_cond()
|
|||||||
|
|
||||||
if ( ! check( Tok_Preprocess_Content ))
|
if ( ! check( Tok_Preprocess_Content ))
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected content after #define\n%s", parser_to_string(Context) );
|
log_failure( "Error, expected content after #define\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -3289,7 +3289,7 @@ CodeVar parse_variable_after_name(
|
|||||||
|
|
||||||
if ( currtok.Type == Tok_Statement_End )
|
if ( currtok.Type == Tok_Statement_End )
|
||||||
{
|
{
|
||||||
log_failure( "Expected expression after bitfield \n%SB", parser_to_string(Context) );
|
log_failure( "Expected expression after bitfield \n%SB", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -3407,7 +3407,7 @@ CodeVar parse_variable_declaration_list()
|
|||||||
{
|
{
|
||||||
log_failure( "Error, const specifier must come after pointer specifier for variable declaration proceeding comma\n"
|
log_failure( "Error, const specifier must come after pointer specifier for variable declaration proceeding comma\n"
|
||||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%SB"
|
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%SB"
|
||||||
, parser_to_string(Context) );
|
, parser_to_strbuilder(Context) );
|
||||||
|
|
||||||
specifiers_append(specifiers, spec );
|
specifiers_append(specifiers, spec );
|
||||||
}
|
}
|
||||||
@ -3420,9 +3420,9 @@ CodeVar parse_variable_declaration_list()
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
log_failure( "Error, invalid specifier '%s' proceeding comma\n"
|
log_failure( "Error, invalid specifier '%S' proceeding comma\n"
|
||||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%S"
|
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%S"
|
||||||
, tok_to_str(currtok), parser_to_string(Context) );
|
, tok_to_str(currtok), strbuilder_to_str( parser_to_strbuilder(Context)) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3586,7 +3586,7 @@ CodeDestructor parser_parse_destructor( CodeSpecifiers specifiers )
|
|||||||
eat( Tok_Operator );
|
eat( Tok_Operator );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_failure( "Expected destructor '~' token\n%s", parser_to_string(Context) );
|
log_failure( "Expected destructor '~' token\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop( & Context);
|
parser_pop( & Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -3624,7 +3624,7 @@ CodeDestructor parser_parse_destructor( CodeSpecifiers specifiers )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_failure( "Pure or default specifier expected due to '=' token\n%s", parser_to_string(Context) );
|
log_failure( "Pure or default specifier expected due to '=' token\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop( & Context);
|
parser_pop( & Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -3722,7 +3722,7 @@ CodeEnum parser_parse_enum( bool inplace_def )
|
|||||||
type = parser_parse_type(parser_not_from_template, nullptr);
|
type = parser_parse_type(parser_not_from_template, nullptr);
|
||||||
if ( cast(Code, type) == Code_Invalid )
|
if ( cast(Code, type) == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse enum classifier\n%s", parser_to_string(Context) );
|
log_failure( "Failed to parse enum classifier\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -3755,7 +3755,7 @@ CodeEnum parser_parse_enum( bool inplace_def )
|
|||||||
{
|
{
|
||||||
if ( ! expects_entry )
|
if ( ! expects_entry )
|
||||||
{
|
{
|
||||||
log_failure( "Did not expect an entry after last member of enum body.\n%s", parser_to_string(Context) );
|
log_failure( "Did not expect an entry after last member of enum body.\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3862,7 +3862,7 @@ CodeEnum parser_parse_enum( bool inplace_def )
|
|||||||
|
|
||||||
if ( member == Code_Invalid )
|
if ( member == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse member\n%s", parser_to_string(Context) );
|
log_failure( "Failed to parse member\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -3957,7 +3957,7 @@ CodeExtern parser_parse_extern_link()
|
|||||||
CodeBody entry = parser_parse_extern_link_body();
|
CodeBody entry = parser_parse_extern_link_body();
|
||||||
if ( cast(Code, entry) == Code_Invalid )
|
if ( cast(Code, entry) == Code_Invalid )
|
||||||
{
|
{
|
||||||
log_failure( "Failed to parse body\n%s", parser_to_string(Context) );
|
log_failure( "Failed to parse body\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -3998,7 +3998,7 @@ CodeFriend parser_parse_friend()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
log_failure( "Invalid specifier %s for friend definition\n%s", spec_to_str( spec ), parser_to_string(Context) );
|
log_failure( "Invalid specifier %S for friend definition\n%S", spec_to_str( spec ), strbuilder_to_str( parser_to_strbuilder(Context)) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4127,7 +4127,7 @@ CodeFn parser_parse_function()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "Invalid specifier %s for functon\n%s", spec_to_str(spec), parser_to_string(Context) );
|
log_failure( "Invalid specifier %S for functon\n%SB", spec_to_str(spec), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4238,7 +4238,7 @@ CodeOperator parser_parse_operator()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_failure( "Invalid specifier " "%S" " for operator\n%SB", spec_to_str(spec), parser_to_string(Context) );
|
log_failure( "Invalid specifier " "%S" " for operator\n%SB", spec_to_str(spec), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4490,7 +4490,7 @@ CodeTemplate parser_parse_template()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
log_failure( "Invalid specifier %s for variable or function\n%s", spec_to_str( spec ), parser_to_string(Context) );
|
log_failure( "Invalid specifier %S for variable or function\n%SB", spec_to_str( spec ), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4614,7 +4614,7 @@ CodeTypename parser_parse_type( bool from_template, bool* typedef_is_function )
|
|||||||
|
|
||||||
if ( spec != Spec_Const )
|
if ( spec != Spec_Const )
|
||||||
{
|
{
|
||||||
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", tok_to_str(currtok), parser_to_string(Context) );
|
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", tok_to_str(currtok), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4627,7 +4627,7 @@ CodeTypename parser_parse_type( bool from_template, bool* typedef_is_function )
|
|||||||
|
|
||||||
if ( left == 0 )
|
if ( left == 0 )
|
||||||
{
|
{
|
||||||
log_failure( "Error, unexpected end of type definition\n%SB", parser_to_string(Context) );
|
log_failure( "Error, unexpected end of type definition\n%SB", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4719,7 +4719,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
Context.Scope->Name = name;
|
Context.Scope->Name = name;
|
||||||
if ( ! tok_is_valid(name) )
|
if ( ! tok_is_valid(name) )
|
||||||
{
|
{
|
||||||
log_failure( "Error, failed to type signature\n%s", parser_to_string(Context) );
|
log_failure( "Error, failed to type signature\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4738,7 +4738,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
Context.Scope->Name = name;
|
Context.Scope->Name = name;
|
||||||
if ( ! tok_is_valid(name) )
|
if ( ! tok_is_valid(name) )
|
||||||
{
|
{
|
||||||
log_failure( "Error, failed to type signature\n%s", parser_to_string(Context) );
|
log_failure( "Error, failed to type signature\n%s", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4753,7 +4753,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
|
|
||||||
if ( spec != Spec_Const && spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
if ( spec != Spec_Const && spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
||||||
{
|
{
|
||||||
log_failure( "Error, invalid specifier used in type definition: %s\n%s", currtok.Text, parser_to_string(Context) );
|
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", tok_to_str(currtok), parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4885,7 +4885,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
|
|
||||||
if ( spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
if ( spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
||||||
{
|
{
|
||||||
log_failure( "Error, invalid specifier used in type definition: %s\n%s", currtok.Text, to_string(Context) );
|
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", toktype_to_str(currtok), to_strbuilder(Context) );
|
||||||
pop(& Context);
|
pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4955,7 +4955,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
// && spec != Spec_NoExcept
|
// && spec != Spec_NoExcept
|
||||||
&& spec != Spec_RValue )
|
&& spec != Spec_RValue )
|
||||||
{
|
{
|
||||||
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", tok_to_str(currtok), parser_to_string(Context) );
|
log_failure( "Error, invalid specifier used in type definition: %S\n%S", tok_to_str(currtok), strbuilder_to_str( parser_to_strbuilder(Context)) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -4996,7 +4996,7 @@ else if ( currtok.Type == Tok_DeclType )
|
|||||||
#ifdef GEN_USE_NEW_TYPENAME_PARSING
|
#ifdef GEN_USE_NEW_TYPENAME_PARSING
|
||||||
if ( params_nested )
|
if ( params_nested )
|
||||||
{
|
{
|
||||||
name_stripped.append( params_nested->to_string() );
|
name_stripped.append( params_nested->to_strbuilder() );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -5161,7 +5161,7 @@ CodeTypedef parser_parse_typedef()
|
|||||||
|
|
||||||
if ( ! ok_to_parse )
|
if ( ! ok_to_parse )
|
||||||
{
|
{
|
||||||
log_failure( "Unsupported or bad member definition after struct declaration\n%SB", parser_to_string(Context) );
|
log_failure( "Unsupported or bad member definition after struct declaration\n%SB", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -5187,7 +5187,7 @@ CodeTypedef parser_parse_typedef()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log_failure( "Unsupported or bad member definition after struct declaration\n%SB", parser_to_string(Context) );
|
log_failure( "Unsupported or bad member definition after struct declaration\n%SB", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -5208,7 +5208,7 @@ CodeTypedef parser_parse_typedef()
|
|||||||
}
|
}
|
||||||
else if ( ! is_function )
|
else if ( ! is_function )
|
||||||
{
|
{
|
||||||
log_failure( "Error, expected identifier for typedef\n%SB", parser_to_string(Context) );
|
log_failure( "Error, expected identifier for typedef\n%SB", parser_to_strbuilder(Context) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
@ -5544,7 +5544,7 @@ CodeVar parser_parse_variable()
|
|||||||
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 ), strbuilder_to_str( parser_to_strbuilder(Context)) );
|
||||||
parser_pop(& Context);
|
parser_pop(& Context);
|
||||||
return InvalidCode;
|
return InvalidCode;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
@ -58,6 +61,7 @@
|
|||||||
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)
|
||||||
|
@ -22,7 +22,7 @@ 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, "{ \"%s\", sizeof(\"%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, "{ \"%s\", sizeof(\"%s\") - 1 },\n", keyword, keyword );
|
strbuilder_append_fmt( & to_keyword_c_str_entries, "{ \"%s\", sizeof(\"%s\") - 1 },\n", keyword, keyword );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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, "{ \"%s\", sizeof(\"%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;
|
||||||
@ -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, "{ \"%s\", sizeof(\"%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
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_
|
|||||||
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, "{ \"%s\", sizeof(\"%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++ )
|
||||||
@ -356,7 +356,7 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path, bool use_c_
|
|||||||
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, "{ \"%s\", sizeof(\"%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
|
||||||
|
|
||||||
|
@ -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>);
|
||||||
)));
|
)));
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user