This commit is contained in:
2024-12-12 12:55:15 -05:00
parent 8d48da0b9e
commit e3172057d3
57 changed files with 2098 additions and 2522 deletions

View File

@ -72,9 +72,9 @@ enum CodeType : u32
CT_UnderlyingType = GEN_U32_MAX
};
inline StrC codetype_to_str( CodeType type )
inline Str codetype_to_str( CodeType type )
{
local_persist StrC lookup[61] = {
local_persist Str lookup[61] = {
{ sizeof( "Invalid" ), "Invalid" },
{ sizeof( "Untyped" ), "Untyped" },
{ sizeof( "NewLine" ), "NewLine" },
@ -140,9 +140,9 @@ inline StrC codetype_to_str( CodeType type )
return lookup[type];
}
inline StrC codetype_to_keyword_str( CodeType type )
inline Str codetype_to_keyword_str( CodeType type )
{
local_persist StrC lookup[61] = {
local_persist Str lookup[61] = {
{ sizeof( "__NA__" ) - 1, "__NA__" },
{ sizeof( "__NA__" ) - 1, "__NA__" },
{ sizeof( "__NA__" ) - 1, "__NA__" },
@ -208,12 +208,12 @@ inline StrC codetype_to_keyword_str( CodeType type )
return lookup[type];
}
forceinline StrC to_str( CodeType type )
forceinline Str to_str( CodeType type )
{
return codetype_to_str( type );
}
forceinline StrC to_keyword_str( CodeType type )
forceinline Str to_keyword_str( CodeType type )
{
return codetype_to_keyword_str( type );
}

View File

@ -58,9 +58,9 @@ enum Operator : u32
Op_UnderlyingType = 0xffffffffu
};
inline StrC operator_to_str( Operator op )
inline Str operator_to_str( Operator op )
{
local_persist StrC lookup[47] = {
local_persist Str lookup[47] = {
{ sizeof( "INVALID" ), "INVALID" },
{ sizeof( "=" ), "=" },
{ sizeof( "+=" ), "+=" },
@ -112,7 +112,7 @@ inline StrC operator_to_str( Operator op )
return lookup[op];
}
forceinline StrC to_str( Operator op )
forceinline Str to_str( Operator op )
{
return operator_to_str( op );
}

View File

@ -37,9 +37,9 @@ enum Specifier : u32
Spec_UnderlyingType = 0xffffffffu
};
inline StrC spec_to_str( Specifier type )
inline Str spec_to_str( Specifier type )
{
local_persist StrC lookup[26] = {
local_persist Str lookup[26] = {
{ sizeof( "INVALID" ), "INVALID" },
{ sizeof( "consteval" ), "consteval" },
{ sizeof( "constexpr" ), "constexpr" },
@ -75,12 +75,12 @@ inline bool spec_is_trailing( Specifier specifier )
return specifier > Spec_Virtual;
}
inline Specifier strc_to_specifier( StrC str )
inline Specifier str_to_specifier( Str str )
{
local_persist u32 keymap[Spec_NumSpecifiers];
do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
{
StrC enum_str = spec_to_str( (Specifier)index );
Str enum_str = spec_to_str( (Specifier)index );
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
}
do_once_end u32 hash = crc32( str.Ptr, str.Len );
@ -92,14 +92,14 @@ inline Specifier strc_to_specifier( StrC str )
return Spec_Invalid;
}
forceinline StrC to_str( Specifier spec )
forceinline Str to_str( Specifier spec )
{
return spec_to_str( spec );
}
forceinline Specifier to_type( StrC str )
forceinline Specifier to_type( Str str )
{
return strc_to_specifier( str );
return str_to_specifier( str );
}
forceinline bool is_trailing( Specifier specifier )

View File

@ -111,9 +111,9 @@ enum TokType : u32
Tok_NumTokens
};
inline StrC toktype_to_str( TokType type )
inline Str toktype_to_str( TokType type )
{
local_persist StrC lookup[] = {
local_persist Str lookup[] = {
{ sizeof( "__invalid__" ), "__invalid__" },
{ sizeof( "private" ), "private" },
{ sizeof( "protected" ), "protected" },
@ -192,7 +192,7 @@ inline StrC toktype_to_str( TokType type )
{ sizeof( "*" ), "*" },
{ sizeof( ";" ), ";" },
{ sizeof( "static_assert" ), "static_assert" },
{ sizeof( "__string__" ), "__string__" },
{ sizeof( "__strbuilder__" ), "__strbuilder__" },
{ sizeof( "typename" ), "typename" },
{ sizeof( "unsigned" ), "unsigned" },
{ sizeof( "signed" ), "signed" },
@ -215,12 +215,12 @@ inline StrC toktype_to_str( TokType type )
return lookup[type];
}
inline TokType strc_to_toktype( StrC str )
inline TokType str_to_toktype( Str str )
{
local_persist u32 keymap[Tok_NumTokens];
do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ )
{
StrC enum_str = toktype_to_str( (TokType)index );
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 );