Fixes from latest refactor of toktype enum.

This commit is contained in:
2023-07-27 17:12:58 -04:00
parent b00c1ae522
commit d977c82f37
16 changed files with 357 additions and 322 deletions

View File

@ -1,3 +1,4 @@
Invalid
Untyped
Comment
Access_Private

1 Untyped Invalid
1 Invalid
2 Untyped Untyped
3 Comment Comment
4 Access_Private Access_Private

View File

@ -1,3 +1,4 @@
Invalid, INVALID
Assign, "="
Assign_Add, "+="
Assign_Subtract, "-="

1 Assign Invalid = INVALID
1 Invalid INVALID
2 Assign Assign = =
3 Assign_Add Assign_Add += +=
4 Assign_Subtract Assign_Subtract -= -=

View File

@ -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__"

1 Access_Private Invalid private __invalid__
2 Access_Protected Access_Private protected private
3 Access_Public Access_Protected public protected
4 Access_MemberSymbol Access_Public . public
5 Access_StaticSymbol Access_MemberSymbol :: .
6 Ampersand Access_StaticSymbol & ::
7 Ampersand_DBL Ampersand && &
8 Assign_Classifer Ampersand_DBL : &&
9 Attribute_Open Assign_Classifer [[ :
10 Attribute_Close Attribute_Open ]] [[
11 BraceCurly_Open Attribute_Close { ]]
12 BraceCurly_Close BraceCurly_Open } {
13 BraceSquare_Open BraceCurly_Close [ }
14 BraceSquare_Close BraceSquare_Open ] [
15 Capture_Start BraceSquare_Close ( ]
16 Capture_End Capture_Start ) (
17 Comment Capture_End __comment__ )
18 Char Comment __char__ __comment__
19 Comma Char , __char__
20 Decl_Class Comma class ,
21 Decl_GNU_Attribute Decl_Class __attribute__ class
22 Decl_MSVC_Attribute Decl_GNU_Attribute __declspec __attribute__
23 Decl_Enum Decl_MSVC_Attribute enum __declspec
24 Decl_Extern_Linkage Decl_Enum extern enum
25 Decl_Friend Decl_Extern_Linkage friend extern
26 Decl_Module Decl_Friend module friend
27 Decl_Namespace Decl_Module namespace module
28 Decl_Operator Decl_Namespace operator namespace
29 Decl_Struct Decl_Operator struct operator
30 Decl_Template Decl_Struct template struct
31 Decl_Typedef Decl_Template typedef template
32 Decl_Using Decl_Typedef using typedef
33 Decl_Union Decl_Using union using
34 Identifier Decl_Union __identifier__ union
35 Module_Import Identifier import __identifier__
36 Module_Export Module_Import export import
37 Number Module_Export number export
38 Operator Number operator number
39 Preprocessor_Directive Operator # operator
40 Preprocessor_Include Preprocessor_Directive include #
41 Spec_Alignas Preprocessor_Include alignas include
42 Spec_Const Spec_Alignas const alignas
43 Spec_Consteval Spec_Const consteval const
44 Spec_Constexpr Spec_Consteval constexpr consteval
45 Spec_Constinit Spec_Constexpr constinit constexpr
46 Spec_Explicit Spec_Constinit explicit constinit
47 Spec_Extern Spec_Explicit extern explicit
48 Spec_Final Spec_Extern final extern
49 Spec_Global Spec_Final global final
50 Spec_Inline Spec_Global inline global
51 Spec_Internal_Linkage Spec_Inline internal inline
52 Spec_LocalPersist Spec_Internal_Linkage local_persist internal
53 Spec_Mutable Spec_LocalPersist mutable local_persist
54 Spec_Override Spec_Mutable override mutable
55 Spec_Static Spec_Override static override
56 Spec_ThreadLocal Spec_Static thread_local static
57 Spec_Volatile Spec_ThreadLocal volatile thread_local
58 Star Spec_Volatile * volatile
59 Statement_End Star ; *
60 String Statement_End __string__ ;
61 Type_Unsigned String unsigned __string__
62 Type_Signed Type_Unsigned signed unsigned
63 Type_Short Type_Signed short signed
64 Type_Long Type_Short long short
65 Type_char Type_Long char long
66 Type_int Type_char int char
67 Type_double Type_int double int
68 Varadic_Argument Type_double ... double
69 Attributes_Start Varadic_Argument __attrib_start__ ...
70 Attributes_Start __attrib_start__

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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 );