mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-14 18:51:47 -07:00
Corrected enum serialization of ecodetypes, eoperator, especifier, and etoktype, some more naming refactors for strbuilder... formatting
This commit is contained in:
@ -75,67 +75,67 @@ enum CodeType : u32
|
||||
inline Str codetype_to_str( CodeType type )
|
||||
{
|
||||
local_persist Str lookup[61] = {
|
||||
{ "Invalid", sizeof( "Invalid" ) },
|
||||
{ "Untyped", sizeof( "Untyped" ) },
|
||||
{ "NewLine", sizeof( "NewLine" ) },
|
||||
{ "Comment", sizeof( "Comment" ) },
|
||||
{ "Access_Private", sizeof( "Access_Private" ) },
|
||||
{ "Access_Protected", sizeof( "Access_Protected" ) },
|
||||
{ "Access_Public", sizeof( "Access_Public" ) },
|
||||
{ "PlatformAttributes", sizeof( "PlatformAttributes" ) },
|
||||
{ "Class", sizeof( "Class" ) },
|
||||
{ "Class_Fwd", sizeof( "Class_Fwd" ) },
|
||||
{ "Class_Body", sizeof( "Class_Body" ) },
|
||||
{ "Constructor", sizeof( "Constructor" ) },
|
||||
{ "Constructor_Fwd", sizeof( "Constructor_Fwd" ) },
|
||||
{ "Destructor", sizeof( "Destructor" ) },
|
||||
{ "Destructor_Fwd", sizeof( "Destructor_Fwd" ) },
|
||||
{ "Enum", sizeof( "Enum" ) },
|
||||
{ "Enum_Fwd", sizeof( "Enum_Fwd" ) },
|
||||
{ "Enum_Body", sizeof( "Enum_Body" ) },
|
||||
{ "Enum_Class", sizeof( "Enum_Class" ) },
|
||||
{ "Enum_Class_Fwd", sizeof( "Enum_Class_Fwd" ) },
|
||||
{ "Execution", sizeof( "Execution" ) },
|
||||
{ "Export_Body", sizeof( "Export_Body" ) },
|
||||
{ "Extern_Linkage", sizeof( "Extern_Linkage" ) },
|
||||
{ "Extern_Linkage_Body", sizeof( "Extern_Linkage_Body" ) },
|
||||
{ "Friend", sizeof( "Friend" ) },
|
||||
{ "Function", sizeof( "Function" ) },
|
||||
{ "Function_Fwd", sizeof( "Function_Fwd" ) },
|
||||
{ "Function_Body", sizeof( "Function_Body" ) },
|
||||
{ "Global_Body", sizeof( "Global_Body" ) },
|
||||
{ "Module", sizeof( "Module" ) },
|
||||
{ "Namespace", sizeof( "Namespace" ) },
|
||||
{ "Namespace_Body", sizeof( "Namespace_Body" ) },
|
||||
{ "Operator", sizeof( "Operator" ) },
|
||||
{ "Operator_Fwd", sizeof( "Operator_Fwd" ) },
|
||||
{ "Operator_Member", sizeof( "Operator_Member" ) },
|
||||
{ "Operator_Member_Fwd", sizeof( "Operator_Member_Fwd" ) },
|
||||
{ "Operator_Cast", sizeof( "Operator_Cast" ) },
|
||||
{ "Operator_Cast_Fwd", sizeof( "Operator_Cast_Fwd" ) },
|
||||
{ "Parameters", sizeof( "Parameters" ) },
|
||||
{ "Preprocess_Define", sizeof( "Preprocess_Define" ) },
|
||||
{ "Preprocess_Include", sizeof( "Preprocess_Include" ) },
|
||||
{ "Preprocess_If", sizeof( "Preprocess_If" ) },
|
||||
{ "Preprocess_IfDef", sizeof( "Preprocess_IfDef" ) },
|
||||
{ "Preprocess_IfNotDef", sizeof( "Preprocess_IfNotDef" ) },
|
||||
{ "Preprocess_ElIf", sizeof( "Preprocess_ElIf" ) },
|
||||
{ "Preprocess_Else", sizeof( "Preprocess_Else" ) },
|
||||
{ "Preprocess_EndIf", sizeof( "Preprocess_EndIf" ) },
|
||||
{ "Preprocess_Pragma", sizeof( "Preprocess_Pragma" ) },
|
||||
{ "Specifiers", sizeof( "Specifiers" ) },
|
||||
{ "Struct", sizeof( "Struct" ) },
|
||||
{ "Struct_Fwd", sizeof( "Struct_Fwd" ) },
|
||||
{ "Struct_Body", sizeof( "Struct_Body" ) },
|
||||
{ "Template", sizeof( "Template" ) },
|
||||
{ "Typedef", sizeof( "Typedef" ) },
|
||||
{ "Typename", sizeof( "Typename" ) },
|
||||
{ "Union", sizeof( "Union" ) },
|
||||
{ "Union_Fwd", sizeof( "Union_Fwd" ) },
|
||||
{ "Union_Body", sizeof( "Union_Body" ) },
|
||||
{ "Using", sizeof( "Using" ) },
|
||||
{ "Using_Namespace", sizeof( "Using_Namespace" ) },
|
||||
{ "Variable", sizeof( "Variable" ) },
|
||||
{ "Invalid", sizeof( "Invalid" ) - 1 },
|
||||
{ "Untyped", sizeof( "Untyped" ) - 1 },
|
||||
{ "NewLine", sizeof( "NewLine" ) - 1 },
|
||||
{ "Comment", sizeof( "Comment" ) - 1 },
|
||||
{ "Access_Private", sizeof( "Access_Private" ) - 1 },
|
||||
{ "Access_Protected", sizeof( "Access_Protected" ) - 1 },
|
||||
{ "Access_Public", sizeof( "Access_Public" ) - 1 },
|
||||
{ "PlatformAttributes", sizeof( "PlatformAttributes" ) - 1 },
|
||||
{ "Class", sizeof( "Class" ) - 1 },
|
||||
{ "Class_Fwd", sizeof( "Class_Fwd" ) - 1 },
|
||||
{ "Class_Body", sizeof( "Class_Body" ) - 1 },
|
||||
{ "Constructor", sizeof( "Constructor" ) - 1 },
|
||||
{ "Constructor_Fwd", sizeof( "Constructor_Fwd" ) - 1 },
|
||||
{ "Destructor", sizeof( "Destructor" ) - 1 },
|
||||
{ "Destructor_Fwd", sizeof( "Destructor_Fwd" ) - 1 },
|
||||
{ "Enum", sizeof( "Enum" ) - 1 },
|
||||
{ "Enum_Fwd", sizeof( "Enum_Fwd" ) - 1 },
|
||||
{ "Enum_Body", sizeof( "Enum_Body" ) - 1 },
|
||||
{ "Enum_Class", sizeof( "Enum_Class" ) - 1 },
|
||||
{ "Enum_Class_Fwd", sizeof( "Enum_Class_Fwd" ) - 1 },
|
||||
{ "Execution", sizeof( "Execution" ) - 1 },
|
||||
{ "Export_Body", sizeof( "Export_Body" ) - 1 },
|
||||
{ "Extern_Linkage", sizeof( "Extern_Linkage" ) - 1 },
|
||||
{ "Extern_Linkage_Body", sizeof( "Extern_Linkage_Body" ) - 1 },
|
||||
{ "Friend", sizeof( "Friend" ) - 1 },
|
||||
{ "Function", sizeof( "Function" ) - 1 },
|
||||
{ "Function_Fwd", sizeof( "Function_Fwd" ) - 1 },
|
||||
{ "Function_Body", sizeof( "Function_Body" ) - 1 },
|
||||
{ "Global_Body", sizeof( "Global_Body" ) - 1 },
|
||||
{ "Module", sizeof( "Module" ) - 1 },
|
||||
{ "Namespace", sizeof( "Namespace" ) - 1 },
|
||||
{ "Namespace_Body", sizeof( "Namespace_Body" ) - 1 },
|
||||
{ "Operator", sizeof( "Operator" ) - 1 },
|
||||
{ "Operator_Fwd", sizeof( "Operator_Fwd" ) - 1 },
|
||||
{ "Operator_Member", sizeof( "Operator_Member" ) - 1 },
|
||||
{ "Operator_Member_Fwd", sizeof( "Operator_Member_Fwd" ) - 1 },
|
||||
{ "Operator_Cast", sizeof( "Operator_Cast" ) - 1 },
|
||||
{ "Operator_Cast_Fwd", sizeof( "Operator_Cast_Fwd" ) - 1 },
|
||||
{ "Parameters", sizeof( "Parameters" ) - 1 },
|
||||
{ "Preprocess_Define", sizeof( "Preprocess_Define" ) - 1 },
|
||||
{ "Preprocess_Include", sizeof( "Preprocess_Include" ) - 1 },
|
||||
{ "Preprocess_If", sizeof( "Preprocess_If" ) - 1 },
|
||||
{ "Preprocess_IfDef", sizeof( "Preprocess_IfDef" ) - 1 },
|
||||
{ "Preprocess_IfNotDef", sizeof( "Preprocess_IfNotDef" ) - 1 },
|
||||
{ "Preprocess_ElIf", sizeof( "Preprocess_ElIf" ) - 1 },
|
||||
{ "Preprocess_Else", sizeof( "Preprocess_Else" ) - 1 },
|
||||
{ "Preprocess_EndIf", sizeof( "Preprocess_EndIf" ) - 1 },
|
||||
{ "Preprocess_Pragma", sizeof( "Preprocess_Pragma" ) - 1 },
|
||||
{ "Specifiers", sizeof( "Specifiers" ) - 1 },
|
||||
{ "Struct", sizeof( "Struct" ) - 1 },
|
||||
{ "Struct_Fwd", sizeof( "Struct_Fwd" ) - 1 },
|
||||
{ "Struct_Body", sizeof( "Struct_Body" ) - 1 },
|
||||
{ "Template", sizeof( "Template" ) - 1 },
|
||||
{ "Typedef", sizeof( "Typedef" ) - 1 },
|
||||
{ "Typename", sizeof( "Typename" ) - 1 },
|
||||
{ "Union", sizeof( "Union" ) - 1 },
|
||||
{ "Union_Fwd", sizeof( "Union_Fwd" ) - 1 },
|
||||
{ "Union_Body", sizeof( "Union_Body" ) - 1 },
|
||||
{ "Using", sizeof( "Using" ) - 1 },
|
||||
{ "Using_Namespace", sizeof( "Using_Namespace" ) - 1 },
|
||||
{ "Variable", sizeof( "Variable" ) - 1 },
|
||||
};
|
||||
return lookup[type];
|
||||
}
|
||||
|
@ -61,53 +61,53 @@ enum Operator : u32
|
||||
inline Str operator_to_str( Operator op )
|
||||
{
|
||||
local_persist Str lookup[47] = {
|
||||
{ "INVALID", sizeof( "INVALID" ) },
|
||||
{ "=", sizeof( "=" ) },
|
||||
{ "+=", sizeof( "+=" ) },
|
||||
{ "-=", sizeof( "-=" ) },
|
||||
{ "*=", sizeof( "*=" ) },
|
||||
{ "/=", sizeof( "/=" ) },
|
||||
{ "%=", sizeof( "%=" ) },
|
||||
{ "&=", sizeof( "&=" ) },
|
||||
{ "|=", sizeof( "|=" ) },
|
||||
{ "^=", sizeof( "^=" ) },
|
||||
{ "<<=", sizeof( "<<=" ) },
|
||||
{ ">>=", sizeof( ">>=" ) },
|
||||
{ "++", sizeof( "++" ) },
|
||||
{ "--", sizeof( "--" ) },
|
||||
{ "+", sizeof( "+" ) },
|
||||
{ "-", sizeof( "-" ) },
|
||||
{ "!", sizeof( "!" ) },
|
||||
{ "+", sizeof( "+" ) },
|
||||
{ "-", sizeof( "-" ) },
|
||||
{ "*", sizeof( "*" ) },
|
||||
{ "/", sizeof( "/" ) },
|
||||
{ "%", sizeof( "%" ) },
|
||||
{ "~", sizeof( "~" ) },
|
||||
{ "&", sizeof( "&" ) },
|
||||
{ "|", sizeof( "|" ) },
|
||||
{ "^", sizeof( "^" ) },
|
||||
{ "<<", sizeof( "<<" ) },
|
||||
{ ">>", sizeof( ">>" ) },
|
||||
{ "&&", sizeof( "&&" ) },
|
||||
{ "||", sizeof( "||" ) },
|
||||
{ "==", sizeof( "==" ) },
|
||||
{ "!=", sizeof( "!=" ) },
|
||||
{ "<", sizeof( "<" ) },
|
||||
{ ">", sizeof( ">" ) },
|
||||
{ "<=", sizeof( "<=" ) },
|
||||
{ ">=", sizeof( ">=" ) },
|
||||
{ "[]", sizeof( "[]" ) },
|
||||
{ "*", sizeof( "*" ) },
|
||||
{ "&", sizeof( "&" ) },
|
||||
{ "->", sizeof( "->" ) },
|
||||
{ "->*", sizeof( "->*" ) },
|
||||
{ "()", sizeof( "()" ) },
|
||||
{ ",", sizeof( "," ) },
|
||||
{ "new", sizeof( "new" ) },
|
||||
{ "new[]", sizeof( "new[]" ) },
|
||||
{ "delete", sizeof( "delete" ) },
|
||||
{ "delete[]", sizeof( "delete[]" ) },
|
||||
{ "INVALID", sizeof( "INVALID" ) - 1 },
|
||||
{ "=", sizeof( "=" ) - 1 },
|
||||
{ "+=", sizeof( "+=" ) - 1 },
|
||||
{ "-=", sizeof( "-=" ) - 1 },
|
||||
{ "*=", sizeof( "*=" ) - 1 },
|
||||
{ "/=", sizeof( "/=" ) - 1 },
|
||||
{ "%=", sizeof( "%=" ) - 1 },
|
||||
{ "&=", sizeof( "&=" ) - 1 },
|
||||
{ "|=", sizeof( "|=" ) - 1 },
|
||||
{ "^=", sizeof( "^=" ) - 1 },
|
||||
{ "<<=", sizeof( "<<=" ) - 1 },
|
||||
{ ">>=", sizeof( ">>=" ) - 1 },
|
||||
{ "++", sizeof( "++" ) - 1 },
|
||||
{ "--", sizeof( "--" ) - 1 },
|
||||
{ "+", sizeof( "+" ) - 1 },
|
||||
{ "-", sizeof( "-" ) - 1 },
|
||||
{ "!", sizeof( "!" ) - 1 },
|
||||
{ "+", sizeof( "+" ) - 1 },
|
||||
{ "-", sizeof( "-" ) - 1 },
|
||||
{ "*", sizeof( "*" ) - 1 },
|
||||
{ "/", sizeof( "/" ) - 1 },
|
||||
{ "%", sizeof( "%" ) - 1 },
|
||||
{ "~", sizeof( "~" ) - 1 },
|
||||
{ "&", sizeof( "&" ) - 1 },
|
||||
{ "|", sizeof( "|" ) - 1 },
|
||||
{ "^", sizeof( "^" ) - 1 },
|
||||
{ "<<", sizeof( "<<" ) - 1 },
|
||||
{ ">>", sizeof( ">>" ) - 1 },
|
||||
{ "&&", sizeof( "&&" ) - 1 },
|
||||
{ "||", sizeof( "||" ) - 1 },
|
||||
{ "==", sizeof( "==" ) - 1 },
|
||||
{ "!=", sizeof( "!=" ) - 1 },
|
||||
{ "<", sizeof( "<" ) - 1 },
|
||||
{ ">", sizeof( ">" ) - 1 },
|
||||
{ "<=", sizeof( "<=" ) - 1 },
|
||||
{ ">=", sizeof( ">=" ) - 1 },
|
||||
{ "[]", sizeof( "[]" ) - 1 },
|
||||
{ "*", sizeof( "*" ) - 1 },
|
||||
{ "&", sizeof( "&" ) - 1 },
|
||||
{ "->", sizeof( "->" ) - 1 },
|
||||
{ "->*", sizeof( "->*" ) - 1 },
|
||||
{ "()", sizeof( "()" ) - 1 },
|
||||
{ ",", sizeof( "," ) - 1 },
|
||||
{ "new", sizeof( "new" ) - 1 },
|
||||
{ "new[]", sizeof( "new[]" ) - 1 },
|
||||
{ "delete", sizeof( "delete" ) - 1 },
|
||||
{ "delete[]", sizeof( "delete[]" ) - 1 },
|
||||
};
|
||||
return lookup[op];
|
||||
}
|
||||
|
@ -40,32 +40,32 @@ enum Specifier : u32
|
||||
inline Str spec_to_str( Specifier type )
|
||||
{
|
||||
local_persist Str lookup[26] = {
|
||||
{ "INVALID", sizeof( "INVALID" ) },
|
||||
{ "consteval", sizeof( "consteval" ) },
|
||||
{ "constexpr", sizeof( "constexpr" ) },
|
||||
{ "constinit", sizeof( "constinit" ) },
|
||||
{ "explicit", sizeof( "explicit" ) },
|
||||
{ "extern", sizeof( "extern" ) },
|
||||
{ "forceinline", sizeof( "forceinline" ) },
|
||||
{ "global", sizeof( "global" ) },
|
||||
{ "inline", sizeof( "inline" ) },
|
||||
{ "internal", sizeof( "internal" ) },
|
||||
{ "local_persist", sizeof( "local_persist" ) },
|
||||
{ "mutable", sizeof( "mutable" ) },
|
||||
{ "neverinline", sizeof( "neverinline" ) },
|
||||
{ "*", sizeof( "*" ) },
|
||||
{ "&", sizeof( "&" ) },
|
||||
{ "register", sizeof( "register" ) },
|
||||
{ "&&", sizeof( "&&" ) },
|
||||
{ "static", sizeof( "static" ) },
|
||||
{ "thread_local", sizeof( "thread_local" ) },
|
||||
{ "virtual", sizeof( "virtual" ) },
|
||||
{ "const", sizeof( "const" ) },
|
||||
{ "final", sizeof( "final" ) },
|
||||
{ "noexcept", sizeof( "noexcept" ) },
|
||||
{ "override", sizeof( "override" ) },
|
||||
{ "= 0", sizeof( "= 0" ) },
|
||||
{ "volatile", sizeof( "volatile" ) },
|
||||
{ "INVALID", sizeof( "INVALID" ) - 1 },
|
||||
{ "consteval", sizeof( "consteval" ) - 1 },
|
||||
{ "constexpr", sizeof( "constexpr" ) - 1 },
|
||||
{ "constinit", sizeof( "constinit" ) - 1 },
|
||||
{ "explicit", sizeof( "explicit" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "forceinline", sizeof( "forceinline" ) - 1 },
|
||||
{ "global", sizeof( "global" ) - 1 },
|
||||
{ "inline", sizeof( "inline" ) - 1 },
|
||||
{ "internal", sizeof( "internal" ) - 1 },
|
||||
{ "local_persist", sizeof( "local_persist" ) - 1 },
|
||||
{ "mutable", sizeof( "mutable" ) - 1 },
|
||||
{ "neverinline", sizeof( "neverinline" ) - 1 },
|
||||
{ "*", sizeof( "*" ) - 1 },
|
||||
{ "&", sizeof( "&" ) - 1 },
|
||||
{ "register", sizeof( "register" ) - 1 },
|
||||
{ "&&", sizeof( "&&" ) - 1 },
|
||||
{ "static", sizeof( "static" ) - 1 },
|
||||
{ "thread_local", sizeof( "thread_local" ) - 1 },
|
||||
{ "virtual", sizeof( "virtual" ) - 1 },
|
||||
{ "const", sizeof( "const" ) - 1 },
|
||||
{ "final", sizeof( "final" ) - 1 },
|
||||
{ "noexcept", sizeof( "noexcept" ) - 1 },
|
||||
{ "override", sizeof( "override" ) - 1 },
|
||||
{ "= 0", sizeof( "= 0" ) - 1 },
|
||||
{ "volatile", sizeof( "volatile" ) - 1 },
|
||||
};
|
||||
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++ )
|
||||
{
|
||||
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 );
|
||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
|
@ -114,103 +114,103 @@ enum TokType : u32
|
||||
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" ) },
|
||||
{ "__invalid__", sizeof( "__invalid__" ) - 1 },
|
||||
{ "private", sizeof( "private" ) - 1 },
|
||||
{ "protected", sizeof( "protected" ) - 1 },
|
||||
{ "public", sizeof( "public" ) - 1 },
|
||||
{ ".", sizeof( "." ) - 1 },
|
||||
{ "::", sizeof( "::" ) - 1 },
|
||||
{ "&", sizeof( "&" ) - 1 },
|
||||
{ "&&", sizeof( "&&" ) - 1 },
|
||||
{ ":", sizeof( ":" ) - 1 },
|
||||
{ "[[", sizeof( "[[" ) - 1 },
|
||||
{ "]]", sizeof( "]]" ) - 1 },
|
||||
{ "{", sizeof( "{" ) - 1 },
|
||||
{ "}", sizeof( "}" ) - 1 },
|
||||
{ "[", sizeof( "[" ) - 1 },
|
||||
{ "]", sizeof( "]" ) - 1 },
|
||||
{ "(", sizeof( "(" ) - 1 },
|
||||
{ ")", sizeof( ")" ) - 1 },
|
||||
{ "__comment__", sizeof( "__comment__" ) - 1 },
|
||||
{ "__comment_end__", sizeof( "__comment_end__" ) - 1 },
|
||||
{ "__comment_start__", sizeof( "__comment_start__" ) - 1 },
|
||||
{ "__character__", sizeof( "__character__" ) - 1 },
|
||||
{ ",", sizeof( "," ) - 1 },
|
||||
{ "class", sizeof( "class" ) - 1 },
|
||||
{ "__attribute__", sizeof( "__attribute__" ) - 1 },
|
||||
{ "__declspec", sizeof( "__declspec" ) - 1 },
|
||||
{ "enum", sizeof( "enum" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "friend", sizeof( "friend" ) - 1 },
|
||||
{ "module", sizeof( "module" ) - 1 },
|
||||
{ "namespace", sizeof( "namespace" ) - 1 },
|
||||
{ "operator", sizeof( "operator" ) - 1 },
|
||||
{ "struct", sizeof( "struct" ) - 1 },
|
||||
{ "template", sizeof( "template" ) - 1 },
|
||||
{ "typedef", sizeof( "typedef" ) - 1 },
|
||||
{ "using", sizeof( "using" ) - 1 },
|
||||
{ "union", sizeof( "union" ) - 1 },
|
||||
{ "__identifier__", sizeof( "__identifier__" ) - 1 },
|
||||
{ "import", sizeof( "import" ) - 1 },
|
||||
{ "export", sizeof( "export" ) - 1 },
|
||||
{ "__new_line__", sizeof( "__new_line__" ) - 1 },
|
||||
{ "__number__", sizeof( "__number__" ) - 1 },
|
||||
{ "__operator__", sizeof( "__operator__" ) - 1 },
|
||||
{ "#", sizeof( "#" ) - 1 },
|
||||
{ "define", sizeof( "define" ) - 1 },
|
||||
{ "if", sizeof( "if" ) - 1 },
|
||||
{ "ifdef", sizeof( "ifdef" ) - 1 },
|
||||
{ "ifndef", sizeof( "ifndef" ) - 1 },
|
||||
{ "elif", sizeof( "elif" ) - 1 },
|
||||
{ "else", sizeof( "else" ) - 1 },
|
||||
{ "endif", sizeof( "endif" ) - 1 },
|
||||
{ "include", sizeof( "include" ) - 1 },
|
||||
{ "pragma", sizeof( "pragma" ) - 1 },
|
||||
{ "__macro_content__", sizeof( "__macro_content__" ) - 1 },
|
||||
{ "__macro__", sizeof( "__macro__" ) - 1 },
|
||||
{ "__unsupported__", sizeof( "__unsupported__" ) - 1 },
|
||||
{ "alignas", sizeof( "alignas" ) - 1 },
|
||||
{ "const", sizeof( "const" ) - 1 },
|
||||
{ "consteval", sizeof( "consteval" ) - 1 },
|
||||
{ "constexpr", sizeof( "constexpr" ) - 1 },
|
||||
{ "constinit", sizeof( "constinit" ) - 1 },
|
||||
{ "explicit", sizeof( "explicit" ) - 1 },
|
||||
{ "extern", sizeof( "extern" ) - 1 },
|
||||
{ "final", sizeof( "final" ) - 1 },
|
||||
{ "forceinline", sizeof( "forceinline" ) - 1 },
|
||||
{ "global", sizeof( "global" ) - 1 },
|
||||
{ "inline", sizeof( "inline" ) - 1 },
|
||||
{ "internal", sizeof( "internal" ) - 1 },
|
||||
{ "local_persist", sizeof( "local_persist" ) - 1 },
|
||||
{ "mutable", sizeof( "mutable" ) - 1 },
|
||||
{ "neverinline", sizeof( "neverinline" ) - 1 },
|
||||
{ "override", sizeof( "override" ) - 1 },
|
||||
{ "static", sizeof( "static" ) - 1 },
|
||||
{ "thread_local", sizeof( "thread_local" ) - 1 },
|
||||
{ "volatile", sizeof( "volatile" ) - 1 },
|
||||
{ "virtual", sizeof( "virtual" ) - 1 },
|
||||
{ "*", sizeof( "*" ) - 1 },
|
||||
{ ";", sizeof( ";" ) - 1 },
|
||||
{ "static_assert", sizeof( "static_assert" ) - 1 },
|
||||
{ "__string__", sizeof( "__string__" ) - 1 },
|
||||
{ "typename", sizeof( "typename" ) - 1 },
|
||||
{ "unsigned", sizeof( "unsigned" ) - 1 },
|
||||
{ "signed", sizeof( "signed" ) - 1 },
|
||||
{ "short", sizeof( "short" ) - 1 },
|
||||
{ "long", sizeof( "long" ) - 1 },
|
||||
{ "bool", sizeof( "bool" ) - 1 },
|
||||
{ "char", sizeof( "char" ) - 1 },
|
||||
{ "int", sizeof( "int" ) - 1 },
|
||||
{ "double", sizeof( "double" ) - 1 },
|
||||
{ "__int8", sizeof( "__int8" ) - 1 },
|
||||
{ "__int16", sizeof( "__int16" ) - 1 },
|
||||
{ "__int32", sizeof( "__int32" ) - 1 },
|
||||
{ "__int64", sizeof( "__int64" ) - 1 },
|
||||
{ "_W64", sizeof( "_W64" ) - 1 },
|
||||
{ "...", sizeof( "..." ) - 1 },
|
||||
{ "__attrib_start__", sizeof( "__attrib_start__" ) - 1 },
|
||||
{ "GEN_API_Export_Code", sizeof( "GEN_API_Export_Code" ) - 1 },
|
||||
{ "GEN_API_Import_Code", sizeof( "GEN_API_Import_Code" ) - 1 },
|
||||
};
|
||||
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++ )
|
||||
{
|
||||
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 );
|
||||
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
|
Reference in New Issue
Block a user