mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 11:11:46 -07:00
Fixes from latest refactor of toktype enum.
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
Invalid
|
||||
Untyped
|
||||
Comment
|
||||
Access_Private
|
||||
|
|
@ -1,3 +1,4 @@
|
||||
Invalid, INVALID
|
||||
Assign, "="
|
||||
Assign_Add, "+="
|
||||
Assign_Subtract, "-="
|
||||
|
|
@ -1,69 +1,70 @@
|
||||
Access_Private, "private"
|
||||
Access_Protected, "protected"
|
||||
Access_Public, "public"
|
||||
Access_MemberSymbol, "."
|
||||
Access_StaticSymbol, "::"
|
||||
Ampersand, "&"
|
||||
Ampersand_DBL, "&&"
|
||||
Assign_Classifer, ":"
|
||||
Attribute_Open, "[["
|
||||
Attribute_Close, "]]"
|
||||
BraceCurly_Open, "{"
|
||||
BraceCurly_Close, "}"
|
||||
BraceSquare_Open, "["
|
||||
BraceSquare_Close, "]"
|
||||
Capture_Start, "("
|
||||
Capture_End, ")"
|
||||
Comment, "__comment__"
|
||||
Char, "__char__"
|
||||
Comma, ","
|
||||
Decl_Class, "class"
|
||||
Decl_GNU_Attribute, "__attribute__"
|
||||
Decl_MSVC_Attribute, "__declspec"
|
||||
Decl_Enum, "enum"
|
||||
Decl_Extern_Linkage, "extern"
|
||||
Decl_Friend, "friend"
|
||||
Decl_Module, "module"
|
||||
Decl_Namespace, "namespace"
|
||||
Decl_Operator, "operator"
|
||||
Decl_Struct, "struct"
|
||||
Decl_Template, "template"
|
||||
Decl_Typedef, "typedef"
|
||||
Decl_Using, "using"
|
||||
Decl_Union, "union"
|
||||
Identifier, "__identifier__"
|
||||
Module_Import, "import"
|
||||
Module_Export, "export"
|
||||
Number, "number"
|
||||
Operator, "operator"
|
||||
Preprocessor_Directive, "#"
|
||||
Preprocessor_Include, "include"
|
||||
Spec_Alignas, "alignas"
|
||||
Spec_Const, "const"
|
||||
Spec_Consteval, "consteval"
|
||||
Spec_Constexpr, "constexpr"
|
||||
Spec_Constinit, "constinit"
|
||||
Spec_Explicit, "explicit"
|
||||
Spec_Extern, "extern"
|
||||
Spec_Final, "final"
|
||||
Spec_Global, "global"
|
||||
Spec_Inline, "inline"
|
||||
Spec_Internal_Linkage, "internal"
|
||||
Spec_LocalPersist, "local_persist"
|
||||
Spec_Mutable, "mutable"
|
||||
Spec_Override, "override"
|
||||
Spec_Static, "static"
|
||||
Spec_ThreadLocal, "thread_local"
|
||||
Spec_Volatile, "volatile"
|
||||
Star, "*"
|
||||
Statement_End, ";"
|
||||
String, "__string__"
|
||||
Type_Unsigned, "unsigned"
|
||||
Type_Signed, "signed"
|
||||
Type_Short, "short"
|
||||
Type_Long, "long"
|
||||
Type_char, "char"
|
||||
Type_int, "int"
|
||||
Type_double, "double"
|
||||
Varadic_Argument, "..."
|
||||
Attributes_Start, "__attrib_start__"
|
||||
Invalid, "__invalid__"
|
||||
Access_Private, "private"
|
||||
Access_Protected, "protected"
|
||||
Access_Public, "public"
|
||||
Access_MemberSymbol, "."
|
||||
Access_StaticSymbol, "::"
|
||||
Ampersand, "&"
|
||||
Ampersand_DBL, "&&"
|
||||
Assign_Classifer, ":"
|
||||
Attribute_Open, "[["
|
||||
Attribute_Close, "]]"
|
||||
BraceCurly_Open, "{"
|
||||
BraceCurly_Close, "}"
|
||||
BraceSquare_Open, "["
|
||||
BraceSquare_Close, "]"
|
||||
Capture_Start, "("
|
||||
Capture_End, ")"
|
||||
Comment, "__comment__"
|
||||
Char, "__char__"
|
||||
Comma, ","
|
||||
Decl_Class, "class"
|
||||
Decl_GNU_Attribute, "__attribute__"
|
||||
Decl_MSVC_Attribute, "__declspec"
|
||||
Decl_Enum, "enum"
|
||||
Decl_Extern_Linkage, "extern"
|
||||
Decl_Friend, "friend"
|
||||
Decl_Module, "module"
|
||||
Decl_Namespace, "namespace"
|
||||
Decl_Operator, "operator"
|
||||
Decl_Struct, "struct"
|
||||
Decl_Template, "template"
|
||||
Decl_Typedef, "typedef"
|
||||
Decl_Using, "using"
|
||||
Decl_Union, "union"
|
||||
Identifier, "__identifier__"
|
||||
Module_Import, "import"
|
||||
Module_Export, "export"
|
||||
Number, "number"
|
||||
Operator, "operator"
|
||||
Preprocessor_Directive, "#"
|
||||
Preprocessor_Include, "include"
|
||||
Spec_Alignas, "alignas"
|
||||
Spec_Const, "const"
|
||||
Spec_Consteval, "consteval"
|
||||
Spec_Constexpr, "constexpr"
|
||||
Spec_Constinit, "constinit"
|
||||
Spec_Explicit, "explicit"
|
||||
Spec_Extern, "extern"
|
||||
Spec_Final, "final"
|
||||
Spec_Global, "global"
|
||||
Spec_Inline, "inline"
|
||||
Spec_Internal_Linkage, "internal"
|
||||
Spec_LocalPersist, "local_persist"
|
||||
Spec_Mutable, "mutable"
|
||||
Spec_Override, "override"
|
||||
Spec_Static, "static"
|
||||
Spec_ThreadLocal, "thread_local"
|
||||
Spec_Volatile, "volatile"
|
||||
Star, "*"
|
||||
Statement_End, ";"
|
||||
String, "__string__"
|
||||
Type_Unsigned, "unsigned"
|
||||
Type_Signed, "signed"
|
||||
Type_Short, "short"
|
||||
Type_Long, "long"
|
||||
Type_char, "char"
|
||||
Type_int, "int"
|
||||
Type_double, "double"
|
||||
Varadic_Argument, "..."
|
||||
Attributes_Start, "__attrib_start__"
|
||||
|
|
@ -3,6 +3,7 @@
|
||||
namespace ECode
|
||||
{
|
||||
# define Define_Types \
|
||||
Entry( Invalid ) \
|
||||
Entry( Untyped ) \
|
||||
Entry( Comment ) \
|
||||
Entry( Access_Private ) \
|
||||
@ -56,8 +57,7 @@ namespace ECode
|
||||
Define_Types
|
||||
# undef Entry
|
||||
|
||||
Num_Types,
|
||||
Invalid
|
||||
Num_Types
|
||||
};
|
||||
|
||||
inline
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace EOperator
|
||||
{
|
||||
# define Define_Operators \
|
||||
Entry( Invalid, INVALID ) \
|
||||
Entry( Assign, = ) \
|
||||
Entry( Assign_Add, += ) \
|
||||
Entry( Assign_Subtract, -= ) \
|
||||
@ -53,7 +54,6 @@ namespace EOperator
|
||||
Comma,
|
||||
|
||||
Num_Ops,
|
||||
Invalid
|
||||
};
|
||||
|
||||
inline
|
||||
|
@ -38,7 +38,7 @@ namespace ESpecifier
|
||||
Define_Specifiers
|
||||
# undef Entry
|
||||
|
||||
Num_Specifiers,
|
||||
NumSpecifiers,
|
||||
};
|
||||
|
||||
inline
|
||||
@ -52,7 +52,7 @@ namespace ESpecifier
|
||||
StrC to_str( Type specifier )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[ Num_Specifiers ] = {
|
||||
StrC lookup[ NumSpecifiers ] = {
|
||||
# pragma push_macro( "global" )
|
||||
# pragma push_macro( "internal" )
|
||||
# pragma push_macro( "local_persist" )
|
||||
@ -76,9 +76,9 @@ namespace ESpecifier
|
||||
Type to_type( StrC str )
|
||||
{
|
||||
local_persist
|
||||
u32 keymap[ Num_Specifiers ];
|
||||
u32 keymap[ NumSpecifiers ];
|
||||
do_once_start
|
||||
for ( u32 index = 0; index < Num_Specifiers; index++ )
|
||||
for ( u32 index = 0; index < NumSpecifiers; index++ )
|
||||
{
|
||||
StrC enum_str = to_str( (Type)index );
|
||||
|
||||
@ -90,7 +90,7 @@ namespace ESpecifier
|
||||
|
||||
u32 hash = crc32( str.Ptr, str.Len );
|
||||
|
||||
for ( u32 index = 0; index < Num_Specifiers; index++ )
|
||||
for ( u32 index = 0; index < NumSpecifiers; index++ )
|
||||
{
|
||||
if ( keymap[index] == hash )
|
||||
return (Type)index;
|
||||
@ -101,4 +101,5 @@ namespace ESpecifier
|
||||
|
||||
# undef Define_Specifiers
|
||||
}
|
||||
|
||||
using SpecifierT = ESpecifier::Type;
|
||||
|
@ -10,6 +10,7 @@ namespace Parser
|
||||
*/
|
||||
|
||||
# define Define_TokType \
|
||||
Entry( Invalid, "INVALID" ) \
|
||||
Entry( Access_Private, "private" ) \
|
||||
Entry( Access_Protected, "protected" ) \
|
||||
Entry( Access_Public, "public" ) \
|
||||
@ -80,102 +81,61 @@ namespace Parser
|
||||
Entry( Varadic_Argument, "..." ) \
|
||||
Entry( Attributes_Start, "__attrib_start__" )
|
||||
|
||||
enum class TokType : u32
|
||||
namespace ETokType
|
||||
{
|
||||
# define Entry( Name_, Str_ ) Name_,
|
||||
Define_TokType
|
||||
GEN_Define_Attribute_Tokens
|
||||
# undef Entry
|
||||
Num,
|
||||
Invalid
|
||||
};
|
||||
|
||||
struct Token
|
||||
{
|
||||
char const* Text;
|
||||
sptr Length;
|
||||
TokType Type;
|
||||
bool IsAssign;
|
||||
|
||||
operator bool()
|
||||
enum Type : u32
|
||||
{
|
||||
return Text && Length && Type != TokType::Invalid;
|
||||
}
|
||||
|
||||
operator StrC()
|
||||
{
|
||||
return { Length, Text };
|
||||
}
|
||||
};
|
||||
|
||||
internal inline
|
||||
TokType get_tok_type( char const* word, s32 length )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[(u32)TokType::Num] =
|
||||
{
|
||||
# define Entry( Name_, Str_ ) { sizeof(Str_), Str_ },
|
||||
# define Entry( Name_, Str_ ) Name_,
|
||||
Define_TokType
|
||||
GEN_Define_Attribute_Tokens
|
||||
# undef Entry
|
||||
NumTokens,
|
||||
};
|
||||
|
||||
for ( u32 index = 0; index < (u32)TokType::Num; index++ )
|
||||
internal inline
|
||||
Type to_type( StrC str_tok )
|
||||
{
|
||||
s32 lookup_len = lookup[index].Len - 1;
|
||||
char const* lookup_str = lookup[index].Ptr;
|
||||
local_persist
|
||||
StrC lookup[(u32)NumTokens] =
|
||||
{
|
||||
# define Entry( Name_, Str_ ) { sizeof(Str_), Str_ },
|
||||
Define_TokType
|
||||
GEN_Define_Attribute_Tokens
|
||||
# undef Entry
|
||||
};
|
||||
|
||||
if ( lookup_len != length )
|
||||
continue;
|
||||
for ( u32 index = 0; index < (u32)NumTokens; index++ )
|
||||
{
|
||||
s32 lookup_len = lookup[index].Len - 1;
|
||||
char const* lookup_str = lookup[index].Ptr;
|
||||
|
||||
if ( str_compare( word, lookup_str, lookup_len ) == 0 )
|
||||
return scast(TokType, index);
|
||||
if ( lookup_len != str_tok.Len )
|
||||
continue;
|
||||
|
||||
if ( str_compare( str_tok.Ptr, lookup_str, lookup_len ) == 0 )
|
||||
return scast(Type, index);
|
||||
}
|
||||
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
return TokType::Invalid;
|
||||
}
|
||||
|
||||
internal inline
|
||||
char const* str_tok_type( TokType type )
|
||||
{
|
||||
local_persist
|
||||
char const* lookup[(u32)TokType::Num] =
|
||||
internal inline
|
||||
char const* to_str( Type type )
|
||||
{
|
||||
# define Entry( Name_, Str_ ) Str_,
|
||||
Define_TokType
|
||||
GEN_Define_Attribute_Tokens
|
||||
# undef Entry
|
||||
};
|
||||
local_persist
|
||||
char const* lookup[(u32)NumTokens] =
|
||||
{
|
||||
# define Entry( Name_, Str_ ) Str_,
|
||||
Define_TokType
|
||||
GEN_Define_Attribute_Tokens
|
||||
# undef Entry
|
||||
};
|
||||
|
||||
return lookup[(u32)type];
|
||||
}
|
||||
return lookup[(u32)type];
|
||||
}
|
||||
# undef Define_TokType
|
||||
};
|
||||
|
||||
# undef Define_TokType
|
||||
using TokType = ETokType::Type;
|
||||
|
||||
internal inline
|
||||
bool tok_is_specifier( Token const& tok )
|
||||
{
|
||||
return (tok.Type <= TokType::Star && tok.Type >= TokType::Spec_Alignas)
|
||||
|| tok.Type == TokType::Ampersand
|
||||
|| tok.Type == TokType::Ampersand_DBL
|
||||
;
|
||||
}
|
||||
|
||||
internal inline
|
||||
bool tok_is_access_specifier( Token const& tok )
|
||||
{
|
||||
return tok.Type >= TokType::Access_Private && tok.Type <= TokType::Access_Public;
|
||||
}
|
||||
|
||||
internal inline
|
||||
AccessSpec tok_to_access_specifier( Token const& tok )
|
||||
{
|
||||
return scast(AccessSpec, tok.Type);
|
||||
}
|
||||
|
||||
internal inline
|
||||
bool tok_is_attribute( Token const& tok )
|
||||
{
|
||||
return tok.Type > TokType::Attributes_Start;
|
||||
}
|
||||
} // Parser
|
||||
} // Parser
|
||||
|
@ -4,6 +4,52 @@ These constructors are the most implementation intensive other than the editor o
|
||||
|
||||
namespace Parser
|
||||
{
|
||||
|
||||
struct Token
|
||||
{
|
||||
char const* Text;
|
||||
sptr Length;
|
||||
TokType Type;
|
||||
bool IsAssign;
|
||||
|
||||
operator bool()
|
||||
{
|
||||
return Text && Length && Type != TokType::Invalid;
|
||||
}
|
||||
|
||||
operator StrC()
|
||||
{
|
||||
return { Length, Text };
|
||||
}
|
||||
};
|
||||
|
||||
internal inline
|
||||
bool tok_is_specifier( Token const& tok )
|
||||
{
|
||||
return (tok.Type <= TokType::Star && tok.Type >= TokType::Spec_Alignas)
|
||||
|| tok.Type == TokType::Ampersand
|
||||
|| tok.Type == TokType::Ampersand_DBL
|
||||
;
|
||||
}
|
||||
|
||||
internal inline
|
||||
bool tok_is_access_specifier( Token const& tok )
|
||||
{
|
||||
return tok.Type >= TokType::Access_Private && tok.Type <= TokType::Access_Public;
|
||||
}
|
||||
|
||||
internal inline
|
||||
AccessSpec tok_to_access_specifier( Token const& tok )
|
||||
{
|
||||
return scast(AccessSpec, tok.Type);
|
||||
}
|
||||
|
||||
internal inline
|
||||
bool tok_is_attribute( Token const& tok )
|
||||
{
|
||||
return tok.Type > TokType::Attributes_Start;
|
||||
}
|
||||
|
||||
struct TokArray
|
||||
{
|
||||
Array<Token> Arr;
|
||||
@ -14,16 +60,16 @@ namespace Parser
|
||||
if ( Arr.num() - Idx <= 0 )
|
||||
{
|
||||
log_failure( "gen::%s: No tokens left", context );
|
||||
return Code::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( Arr[Idx].Type != type )
|
||||
{
|
||||
String token_str = String::make( GlobalAllocator, { Arr[Idx].Length, Arr[Idx].Text } );
|
||||
|
||||
log_failure( "gen::%s: expected %s, got %s", context, str_tok_type(type), str_tok_type(Arr[Idx].Type) );
|
||||
log_failure( "gen::%s: expected %s, got %s", context, ETokType::to_str(type), ETokType::to_str(Arr[Idx].Type) );
|
||||
|
||||
return Code::Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
Idx++;
|
||||
@ -538,7 +584,7 @@ namespace Parser
|
||||
continue;
|
||||
}
|
||||
|
||||
TokType type = get_tok_type( token.Text, token.Length );
|
||||
TokType type = ETokType::to_type( token );
|
||||
|
||||
if ( type == TokType::Invalid)
|
||||
type = TokType::Identifier;
|
||||
@ -649,7 +695,7 @@ Code parse_array_decl( Parser::TokArray& toks, char const* context )
|
||||
|
||||
if ( currtok.Type != TokType::BraceSquare_Close )
|
||||
{
|
||||
log_failure( "%s: Error, expected ] in type definition, not %s", stringize(parse_typedef), str_tok_type( currtok.Type ) );
|
||||
log_failure( "%s: Error, expected ] in type definition, not %s", stringize(parse_typedef), ETokType::to_str( currtok.Type ) );
|
||||
return Code::Invalid;
|
||||
}
|
||||
|
||||
@ -748,7 +794,7 @@ Parser::Token parse_identifier( Parser::TokArray& toks, char const* context )
|
||||
|
||||
if ( currtok.Type != TokType::Identifier )
|
||||
{
|
||||
log_failure( "%s: Error, expected identifier in type definition, not %s", context, str_tok_type( currtok.Type ) );
|
||||
log_failure( "%s: Error, expected identifier in type definition, not %s", context, ETokType::to_str( currtok.Type ) );
|
||||
return { nullptr, 0, TokType::Invalid };
|
||||
}
|
||||
|
||||
@ -909,7 +955,7 @@ CodeParam parse_params( Parser::TokArray& toks, char const* context, bool use_te
|
||||
{
|
||||
if ( ! check( TokType::Operator) || currtok.Text[0] != '>' )
|
||||
{
|
||||
log_failure("gen::parse_params: expected '<' after 'template' keyword. %s", str_tok_type( currtok.Type ));
|
||||
log_failure("gen::parse_params: expected '<' after 'template' keyword. %s", ETokType::to_str( currtok.Type ));
|
||||
return CodeInvalid;
|
||||
}
|
||||
eat( TokType::Operator );
|
||||
@ -1473,8 +1519,8 @@ CodeBody parse_class_struct_body( Parser::TokType which, Parser::TokArray& toks,
|
||||
case TokType::Spec_Static:
|
||||
case TokType::Spec_Volatile:
|
||||
{
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
while ( left && tok_is_specifier( currtok ) )
|
||||
{
|
||||
@ -1499,14 +1545,14 @@ CodeBody parse_class_struct_body( Parser::TokType which, Parser::TokArray& toks,
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
if ( num_specifiers )
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
||||
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||
}
|
||||
}
|
||||
//! Fallthrough intentional
|
||||
@ -1557,7 +1603,7 @@ Code parse_class_struct( Parser::TokType which, Parser::TokArray& toks, char con
|
||||
|
||||
if ( which != TokType::Decl_Class && which != TokType::Decl_Struct )
|
||||
{
|
||||
log_failure( "%s: Error, expected class or struct, not %s", context, str_tok_type( which ) );
|
||||
log_failure( "%s: Error, expected class or struct, not %s", context, ETokType::to_str( which ) );
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
@ -1777,8 +1823,8 @@ CodeBody parse_global_nspace( CodeT which, Parser::TokArray& toks, char const* c
|
||||
case TokType::Spec_Internal_Linkage:
|
||||
case TokType::Spec_Static:
|
||||
{
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
while ( left && tok_is_specifier( currtok ) )
|
||||
{
|
||||
@ -1803,14 +1849,14 @@ CodeBody parse_global_nspace( CodeT which, Parser::TokArray& toks, char const* c
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
if ( num_specifiers )
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
||||
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||
}
|
||||
}
|
||||
//! Fallthrough intentional
|
||||
@ -1867,8 +1913,8 @@ CodeEnum parse_enum( Parser::TokArray& toks, char const* context )
|
||||
using namespace Parser;
|
||||
using namespace ECode;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
Token name = { nullptr, 0, TokType::Invalid };
|
||||
Code array_expr = { nullptr };
|
||||
@ -2111,8 +2157,8 @@ CodeFn parse_functon( Parser::TokArray& toks, char const* context )
|
||||
{
|
||||
using namespace Parser;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
CodeAttributes attributes = { nullptr };
|
||||
CodeSpecifiers specifiers = { nullptr };
|
||||
@ -2148,14 +2194,14 @@ CodeFn parse_functon( Parser::TokArray& toks, char const* context )
|
||||
if ( spec == ESpecifier::Const )
|
||||
continue;
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
if ( num_specifiers )
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
||||
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||
}
|
||||
|
||||
CodeType ret_type = parse_type( toks, stringize(parse_function) );
|
||||
@ -2239,8 +2285,8 @@ CodeOperator parse_operator( Parser::TokArray& toks, char const* context )
|
||||
CodeSpecifiers specifiers = { nullptr };
|
||||
ModuleFlag mflags = ModuleFlag::None;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
if ( check(TokType::Module_Export) )
|
||||
{
|
||||
@ -2270,14 +2316,14 @@ CodeOperator parse_operator( Parser::TokArray& toks, char const* context )
|
||||
if ( spec == ESpecifier::Const )
|
||||
continue;
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
if ( num_specifiers )
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
||||
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||
}
|
||||
|
||||
// Parse Return Type
|
||||
@ -2443,8 +2489,8 @@ CodeTemplate parse_template( Parser::TokArray& toks, char const* context )
|
||||
|
||||
bool expects_function = false;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
attributes = parse_attributes( toks, stringize(parse_template) );
|
||||
|
||||
@ -2480,14 +2526,14 @@ CodeTemplate parse_template( Parser::TokArray& toks, char const* context )
|
||||
if ( spec == ESpecifier::Const )
|
||||
continue;
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
if ( num_specifiers )
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
||||
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||
}
|
||||
|
||||
definition = parse_operator_function_or_variable( expects_function, attributes, specifiers, toks, stringize(parse_template) );
|
||||
@ -2524,8 +2570,8 @@ CodeType parse_type( Parser::TokArray& toks, char const* context )
|
||||
|
||||
Token context_tok = prevtok;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
Token name = { nullptr, 0, TokType::Invalid };
|
||||
Token brute_sig = { currtok.Text, 0, TokType::Invalid };
|
||||
@ -2542,8 +2588,8 @@ CodeType parse_type( Parser::TokArray& toks, char const* context )
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
@ -2618,8 +2664,8 @@ CodeType parse_type( Parser::TokArray& toks, char const* context )
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
@ -2677,9 +2723,9 @@ CodeType parse_type( Parser::TokArray& toks, char const* context )
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_specifiers)
|
||||
if (NumSpecifiers)
|
||||
{
|
||||
Code specifiers = def_specifiers( num_specifiers, (SpecifierT*)specs_found );
|
||||
Code specifiers = def_specifiers( NumSpecifiers, (SpecifierT*)specs_found );
|
||||
result->Specs = specifiers;
|
||||
}
|
||||
}
|
||||
@ -2859,7 +2905,7 @@ CodeUsing parse_using( Parser::TokArray& toks, char const* context )
|
||||
using namespace Parser;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Invalid };
|
||||
s32 num_specifiers = 0;
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
Token name = { nullptr, 0, TokType::Invalid };
|
||||
Code array_expr = { nullptr };
|
||||
@ -2946,8 +2992,8 @@ CodeVar parse_variable( Parser::TokArray& toks, char const* context )
|
||||
|
||||
Token name = { nullptr, 0, TokType::Invalid };
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
||||
s32 num_specifiers = 0;
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
ModuleFlag mflags = ModuleFlag::None;
|
||||
CodeAttributes attributes = { nullptr };
|
||||
@ -2989,14 +3035,14 @@ CodeVar parse_variable( Parser::TokArray& toks, char const* context )
|
||||
if ( spec == ESpecifier::Const )
|
||||
continue;
|
||||
|
||||
specs_found[num_specifiers] = spec;
|
||||
num_specifiers++;
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
NumSpecifiers++;
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
if ( num_specifiers )
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
||||
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||
}
|
||||
|
||||
CodeType type = parse_type( toks, context );
|
||||
|
Reference in New Issue
Block a user