mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Fixes from latest refactor of toktype enum.
This commit is contained in:
parent
b00c1ae522
commit
d977c82f37
@ -1,3 +1,4 @@
|
|||||||
|
Invalid
|
||||||
Untyped
|
Untyped
|
||||||
Comment
|
Comment
|
||||||
Access_Private
|
Access_Private
|
||||||
|
|
@ -1,3 +1,4 @@
|
|||||||
|
Invalid, INVALID
|
||||||
Assign, "="
|
Assign, "="
|
||||||
Assign_Add, "+="
|
Assign_Add, "+="
|
||||||
Assign_Subtract, "-="
|
Assign_Subtract, "-="
|
||||||
|
|
@ -1,69 +1,70 @@
|
|||||||
Access_Private, "private"
|
Invalid, "__invalid__"
|
||||||
Access_Protected, "protected"
|
Access_Private, "private"
|
||||||
Access_Public, "public"
|
Access_Protected, "protected"
|
||||||
Access_MemberSymbol, "."
|
Access_Public, "public"
|
||||||
Access_StaticSymbol, "::"
|
Access_MemberSymbol, "."
|
||||||
Ampersand, "&"
|
Access_StaticSymbol, "::"
|
||||||
Ampersand_DBL, "&&"
|
Ampersand, "&"
|
||||||
Assign_Classifer, ":"
|
Ampersand_DBL, "&&"
|
||||||
Attribute_Open, "[["
|
Assign_Classifer, ":"
|
||||||
Attribute_Close, "]]"
|
Attribute_Open, "[["
|
||||||
BraceCurly_Open, "{"
|
Attribute_Close, "]]"
|
||||||
BraceCurly_Close, "}"
|
BraceCurly_Open, "{"
|
||||||
BraceSquare_Open, "["
|
BraceCurly_Close, "}"
|
||||||
BraceSquare_Close, "]"
|
BraceSquare_Open, "["
|
||||||
Capture_Start, "("
|
BraceSquare_Close, "]"
|
||||||
Capture_End, ")"
|
Capture_Start, "("
|
||||||
Comment, "__comment__"
|
Capture_End, ")"
|
||||||
Char, "__char__"
|
Comment, "__comment__"
|
||||||
Comma, ","
|
Char, "__char__"
|
||||||
Decl_Class, "class"
|
Comma, ","
|
||||||
Decl_GNU_Attribute, "__attribute__"
|
Decl_Class, "class"
|
||||||
Decl_MSVC_Attribute, "__declspec"
|
Decl_GNU_Attribute, "__attribute__"
|
||||||
Decl_Enum, "enum"
|
Decl_MSVC_Attribute, "__declspec"
|
||||||
Decl_Extern_Linkage, "extern"
|
Decl_Enum, "enum"
|
||||||
Decl_Friend, "friend"
|
Decl_Extern_Linkage, "extern"
|
||||||
Decl_Module, "module"
|
Decl_Friend, "friend"
|
||||||
Decl_Namespace, "namespace"
|
Decl_Module, "module"
|
||||||
Decl_Operator, "operator"
|
Decl_Namespace, "namespace"
|
||||||
Decl_Struct, "struct"
|
Decl_Operator, "operator"
|
||||||
Decl_Template, "template"
|
Decl_Struct, "struct"
|
||||||
Decl_Typedef, "typedef"
|
Decl_Template, "template"
|
||||||
Decl_Using, "using"
|
Decl_Typedef, "typedef"
|
||||||
Decl_Union, "union"
|
Decl_Using, "using"
|
||||||
Identifier, "__identifier__"
|
Decl_Union, "union"
|
||||||
Module_Import, "import"
|
Identifier, "__identifier__"
|
||||||
Module_Export, "export"
|
Module_Import, "import"
|
||||||
Number, "number"
|
Module_Export, "export"
|
||||||
Operator, "operator"
|
Number, "number"
|
||||||
Preprocessor_Directive, "#"
|
Operator, "operator"
|
||||||
Preprocessor_Include, "include"
|
Preprocessor_Directive, "#"
|
||||||
Spec_Alignas, "alignas"
|
Preprocessor_Include, "include"
|
||||||
Spec_Const, "const"
|
Spec_Alignas, "alignas"
|
||||||
Spec_Consteval, "consteval"
|
Spec_Const, "const"
|
||||||
Spec_Constexpr, "constexpr"
|
Spec_Consteval, "consteval"
|
||||||
Spec_Constinit, "constinit"
|
Spec_Constexpr, "constexpr"
|
||||||
Spec_Explicit, "explicit"
|
Spec_Constinit, "constinit"
|
||||||
Spec_Extern, "extern"
|
Spec_Explicit, "explicit"
|
||||||
Spec_Final, "final"
|
Spec_Extern, "extern"
|
||||||
Spec_Global, "global"
|
Spec_Final, "final"
|
||||||
Spec_Inline, "inline"
|
Spec_Global, "global"
|
||||||
Spec_Internal_Linkage, "internal"
|
Spec_Inline, "inline"
|
||||||
Spec_LocalPersist, "local_persist"
|
Spec_Internal_Linkage, "internal"
|
||||||
Spec_Mutable, "mutable"
|
Spec_LocalPersist, "local_persist"
|
||||||
Spec_Override, "override"
|
Spec_Mutable, "mutable"
|
||||||
Spec_Static, "static"
|
Spec_Override, "override"
|
||||||
Spec_ThreadLocal, "thread_local"
|
Spec_Static, "static"
|
||||||
Spec_Volatile, "volatile"
|
Spec_ThreadLocal, "thread_local"
|
||||||
Star, "*"
|
Spec_Volatile, "volatile"
|
||||||
Statement_End, ";"
|
Star, "*"
|
||||||
String, "__string__"
|
Statement_End, ";"
|
||||||
Type_Unsigned, "unsigned"
|
String, "__string__"
|
||||||
Type_Signed, "signed"
|
Type_Unsigned, "unsigned"
|
||||||
Type_Short, "short"
|
Type_Signed, "signed"
|
||||||
Type_Long, "long"
|
Type_Short, "short"
|
||||||
Type_char, "char"
|
Type_Long, "long"
|
||||||
Type_int, "int"
|
Type_char, "char"
|
||||||
Type_double, "double"
|
Type_int, "int"
|
||||||
Varadic_Argument, "..."
|
Type_double, "double"
|
||||||
Attributes_Start, "__attrib_start__"
|
Varadic_Argument, "..."
|
||||||
|
Attributes_Start, "__attrib_start__"
|
||||||
|
|
@ -3,6 +3,7 @@
|
|||||||
namespace ECode
|
namespace ECode
|
||||||
{
|
{
|
||||||
# define Define_Types \
|
# define Define_Types \
|
||||||
|
Entry( Invalid ) \
|
||||||
Entry( Untyped ) \
|
Entry( Untyped ) \
|
||||||
Entry( Comment ) \
|
Entry( Comment ) \
|
||||||
Entry( Access_Private ) \
|
Entry( Access_Private ) \
|
||||||
@ -56,8 +57,7 @@ namespace ECode
|
|||||||
Define_Types
|
Define_Types
|
||||||
# undef Entry
|
# undef Entry
|
||||||
|
|
||||||
Num_Types,
|
Num_Types
|
||||||
Invalid
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace EOperator
|
namespace EOperator
|
||||||
{
|
{
|
||||||
# define Define_Operators \
|
# define Define_Operators \
|
||||||
|
Entry( Invalid, INVALID ) \
|
||||||
Entry( Assign, = ) \
|
Entry( Assign, = ) \
|
||||||
Entry( Assign_Add, += ) \
|
Entry( Assign_Add, += ) \
|
||||||
Entry( Assign_Subtract, -= ) \
|
Entry( Assign_Subtract, -= ) \
|
||||||
@ -53,7 +54,6 @@ namespace EOperator
|
|||||||
Comma,
|
Comma,
|
||||||
|
|
||||||
Num_Ops,
|
Num_Ops,
|
||||||
Invalid
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -38,7 +38,7 @@ namespace ESpecifier
|
|||||||
Define_Specifiers
|
Define_Specifiers
|
||||||
# undef Entry
|
# undef Entry
|
||||||
|
|
||||||
Num_Specifiers,
|
NumSpecifiers,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -52,7 +52,7 @@ namespace ESpecifier
|
|||||||
StrC to_str( Type specifier )
|
StrC to_str( Type specifier )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
StrC lookup[ Num_Specifiers ] = {
|
StrC lookup[ NumSpecifiers ] = {
|
||||||
# pragma push_macro( "global" )
|
# pragma push_macro( "global" )
|
||||||
# pragma push_macro( "internal" )
|
# pragma push_macro( "internal" )
|
||||||
# pragma push_macro( "local_persist" )
|
# pragma push_macro( "local_persist" )
|
||||||
@ -76,9 +76,9 @@ namespace ESpecifier
|
|||||||
Type to_type( StrC str )
|
Type to_type( StrC str )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
u32 keymap[ Num_Specifiers ];
|
u32 keymap[ NumSpecifiers ];
|
||||||
do_once_start
|
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 );
|
StrC enum_str = to_str( (Type)index );
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ namespace ESpecifier
|
|||||||
|
|
||||||
u32 hash = crc32( str.Ptr, str.Len );
|
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 )
|
if ( keymap[index] == hash )
|
||||||
return (Type)index;
|
return (Type)index;
|
||||||
@ -101,4 +101,5 @@ namespace ESpecifier
|
|||||||
|
|
||||||
# undef Define_Specifiers
|
# undef Define_Specifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
using SpecifierT = ESpecifier::Type;
|
using SpecifierT = ESpecifier::Type;
|
||||||
|
@ -10,6 +10,7 @@ namespace Parser
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
# define Define_TokType \
|
# define Define_TokType \
|
||||||
|
Entry( Invalid, "INVALID" ) \
|
||||||
Entry( Access_Private, "private" ) \
|
Entry( Access_Private, "private" ) \
|
||||||
Entry( Access_Protected, "protected" ) \
|
Entry( Access_Protected, "protected" ) \
|
||||||
Entry( Access_Public, "public" ) \
|
Entry( Access_Public, "public" ) \
|
||||||
@ -80,102 +81,61 @@ namespace Parser
|
|||||||
Entry( Varadic_Argument, "..." ) \
|
Entry( Varadic_Argument, "..." ) \
|
||||||
Entry( Attributes_Start, "__attrib_start__" )
|
Entry( Attributes_Start, "__attrib_start__" )
|
||||||
|
|
||||||
enum class TokType : u32
|
namespace ETokType
|
||||||
{
|
{
|
||||||
# define Entry( Name_, Str_ ) Name_,
|
enum Type : u32
|
||||||
Define_TokType
|
|
||||||
GEN_Define_Attribute_Tokens
|
|
||||||
# undef Entry
|
|
||||||
Num,
|
|
||||||
Invalid
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Token
|
|
||||||
{
|
|
||||||
char const* Text;
|
|
||||||
sptr Length;
|
|
||||||
TokType Type;
|
|
||||||
bool IsAssign;
|
|
||||||
|
|
||||||
operator bool()
|
|
||||||
{
|
{
|
||||||
return Text && Length && Type != TokType::Invalid;
|
# define Entry( Name_, Str_ ) Name_,
|
||||||
}
|
|
||||||
|
|
||||||
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_TokType
|
Define_TokType
|
||||||
GEN_Define_Attribute_Tokens
|
GEN_Define_Attribute_Tokens
|
||||||
# undef Entry
|
# 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;
|
local_persist
|
||||||
char const* lookup_str = lookup[index].Ptr;
|
StrC lookup[(u32)NumTokens] =
|
||||||
|
{
|
||||||
|
# define Entry( Name_, Str_ ) { sizeof(Str_), Str_ },
|
||||||
|
Define_TokType
|
||||||
|
GEN_Define_Attribute_Tokens
|
||||||
|
# undef Entry
|
||||||
|
};
|
||||||
|
|
||||||
if ( lookup_len != length )
|
for ( u32 index = 0; index < (u32)NumTokens; index++ )
|
||||||
continue;
|
{
|
||||||
|
s32 lookup_len = lookup[index].Len - 1;
|
||||||
|
char const* lookup_str = lookup[index].Ptr;
|
||||||
|
|
||||||
if ( str_compare( word, lookup_str, lookup_len ) == 0 )
|
if ( lookup_len != str_tok.Len )
|
||||||
return scast(TokType, index);
|
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* to_str( Type type )
|
||||||
|
|
||||||
internal inline
|
|
||||||
char const* str_tok_type( TokType type )
|
|
||||||
{
|
|
||||||
local_persist
|
|
||||||
char const* lookup[(u32)TokType::Num] =
|
|
||||||
{
|
{
|
||||||
# define Entry( Name_, Str_ ) Str_,
|
local_persist
|
||||||
Define_TokType
|
char const* lookup[(u32)NumTokens] =
|
||||||
GEN_Define_Attribute_Tokens
|
{
|
||||||
# undef Entry
|
# 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
|
} // Parser
|
||||||
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
|
|
||||||
|
@ -4,6 +4,52 @@ These constructors are the most implementation intensive other than the editor o
|
|||||||
|
|
||||||
namespace Parser
|
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
|
struct TokArray
|
||||||
{
|
{
|
||||||
Array<Token> Arr;
|
Array<Token> Arr;
|
||||||
@ -14,16 +60,16 @@ namespace Parser
|
|||||||
if ( Arr.num() - Idx <= 0 )
|
if ( Arr.num() - Idx <= 0 )
|
||||||
{
|
{
|
||||||
log_failure( "gen::%s: No tokens left", context );
|
log_failure( "gen::%s: No tokens left", context );
|
||||||
return Code::Invalid;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Arr[Idx].Type != type )
|
if ( Arr[Idx].Type != type )
|
||||||
{
|
{
|
||||||
String token_str = String::make( GlobalAllocator, { Arr[Idx].Length, Arr[Idx].Text } );
|
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++;
|
Idx++;
|
||||||
@ -538,7 +584,7 @@ namespace Parser
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TokType type = get_tok_type( token.Text, token.Length );
|
TokType type = ETokType::to_type( token );
|
||||||
|
|
||||||
if ( type == TokType::Invalid)
|
if ( type == TokType::Invalid)
|
||||||
type = TokType::Identifier;
|
type = TokType::Identifier;
|
||||||
@ -649,7 +695,7 @@ Code parse_array_decl( Parser::TokArray& toks, char const* context )
|
|||||||
|
|
||||||
if ( currtok.Type != TokType::BraceSquare_Close )
|
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;
|
return Code::Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,7 +794,7 @@ Parser::Token parse_identifier( Parser::TokArray& toks, char const* context )
|
|||||||
|
|
||||||
if ( currtok.Type != TokType::Identifier )
|
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 };
|
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] != '>' )
|
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;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
eat( TokType::Operator );
|
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_Static:
|
||||||
case TokType::Spec_Volatile:
|
case TokType::Spec_Volatile:
|
||||||
{
|
{
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
while ( left && tok_is_specifier( currtok ) )
|
while ( left && tok_is_specifier( currtok ) )
|
||||||
{
|
{
|
||||||
@ -1499,14 +1545,14 @@ CodeBody parse_class_struct_body( Parser::TokType which, Parser::TokArray& toks,
|
|||||||
return CodeInvalid;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( num_specifiers )
|
if ( NumSpecifiers )
|
||||||
{
|
{
|
||||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! Fallthrough intentional
|
//! 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 )
|
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;
|
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_Internal_Linkage:
|
||||||
case TokType::Spec_Static:
|
case TokType::Spec_Static:
|
||||||
{
|
{
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
while ( left && tok_is_specifier( currtok ) )
|
while ( left && tok_is_specifier( currtok ) )
|
||||||
{
|
{
|
||||||
@ -1803,14 +1849,14 @@ CodeBody parse_global_nspace( CodeT which, Parser::TokArray& toks, char const* c
|
|||||||
return CodeInvalid;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( num_specifiers )
|
if ( NumSpecifiers )
|
||||||
{
|
{
|
||||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//! Fallthrough intentional
|
//! Fallthrough intentional
|
||||||
@ -1867,8 +1913,8 @@ CodeEnum parse_enum( Parser::TokArray& toks, char const* context )
|
|||||||
using namespace Parser;
|
using namespace Parser;
|
||||||
using namespace ECode;
|
using namespace ECode;
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
Token name = { nullptr, 0, TokType::Invalid };
|
Token name = { nullptr, 0, TokType::Invalid };
|
||||||
Code array_expr = { nullptr };
|
Code array_expr = { nullptr };
|
||||||
@ -2111,8 +2157,8 @@ CodeFn parse_functon( Parser::TokArray& toks, char const* context )
|
|||||||
{
|
{
|
||||||
using namespace Parser;
|
using namespace Parser;
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
CodeAttributes attributes = { nullptr };
|
CodeAttributes attributes = { nullptr };
|
||||||
CodeSpecifiers specifiers = { nullptr };
|
CodeSpecifiers specifiers = { nullptr };
|
||||||
@ -2148,14 +2194,14 @@ CodeFn parse_functon( Parser::TokArray& toks, char const* context )
|
|||||||
if ( spec == ESpecifier::Const )
|
if ( spec == ESpecifier::Const )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
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) );
|
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 };
|
CodeSpecifiers specifiers = { nullptr };
|
||||||
ModuleFlag mflags = ModuleFlag::None;
|
ModuleFlag mflags = ModuleFlag::None;
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
if ( check(TokType::Module_Export) )
|
if ( check(TokType::Module_Export) )
|
||||||
{
|
{
|
||||||
@ -2270,14 +2316,14 @@ CodeOperator parse_operator( Parser::TokArray& toks, char const* context )
|
|||||||
if ( spec == ESpecifier::Const )
|
if ( spec == ESpecifier::Const )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( num_specifiers )
|
if ( NumSpecifiers )
|
||||||
{
|
{
|
||||||
specifiers = def_specifiers( num_specifiers, specs_found );
|
specifiers = def_specifiers( NumSpecifiers, specs_found );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse Return Type
|
// Parse Return Type
|
||||||
@ -2443,8 +2489,8 @@ CodeTemplate parse_template( Parser::TokArray& toks, char const* context )
|
|||||||
|
|
||||||
bool expects_function = false;
|
bool expects_function = false;
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
attributes = parse_attributes( toks, stringize(parse_template) );
|
attributes = parse_attributes( toks, stringize(parse_template) );
|
||||||
|
|
||||||
@ -2480,14 +2526,14 @@ CodeTemplate parse_template( Parser::TokArray& toks, char const* context )
|
|||||||
if ( spec == ESpecifier::Const )
|
if ( spec == ESpecifier::Const )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
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) );
|
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;
|
Token context_tok = prevtok;
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
Token name = { nullptr, 0, TokType::Invalid };
|
Token name = { nullptr, 0, TokType::Invalid };
|
||||||
Token brute_sig = { currtok.Text, 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;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2618,8 +2664,8 @@ CodeType parse_type( Parser::TokArray& toks, char const* context )
|
|||||||
return CodeInvalid;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
eat( currtok.Type );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2677,9 +2723,9 @@ CodeType parse_type( Parser::TokArray& toks, char const* context )
|
|||||||
}
|
}
|
||||||
else
|
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;
|
result->Specs = specifiers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2859,7 +2905,7 @@ CodeUsing parse_using( Parser::TokArray& toks, char const* context )
|
|||||||
using namespace Parser;
|
using namespace Parser;
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Invalid };
|
SpecifierT specs_found[16] { ESpecifier::Invalid };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
Token name = { nullptr, 0, TokType::Invalid };
|
Token name = { nullptr, 0, TokType::Invalid };
|
||||||
Code array_expr = { nullptr };
|
Code array_expr = { nullptr };
|
||||||
@ -2946,8 +2992,8 @@ CodeVar parse_variable( Parser::TokArray& toks, char const* context )
|
|||||||
|
|
||||||
Token name = { nullptr, 0, TokType::Invalid };
|
Token name = { nullptr, 0, TokType::Invalid };
|
||||||
|
|
||||||
SpecifierT specs_found[16] { ESpecifier::Num_Specifiers };
|
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||||
s32 num_specifiers = 0;
|
s32 NumSpecifiers = 0;
|
||||||
|
|
||||||
ModuleFlag mflags = ModuleFlag::None;
|
ModuleFlag mflags = ModuleFlag::None;
|
||||||
CodeAttributes attributes = { nullptr };
|
CodeAttributes attributes = { nullptr };
|
||||||
@ -2989,14 +3035,14 @@ CodeVar parse_variable( Parser::TokArray& toks, char const* context )
|
|||||||
if ( spec == ESpecifier::Const )
|
if ( spec == ESpecifier::Const )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
specs_found[num_specifiers] = spec;
|
specs_found[NumSpecifiers] = spec;
|
||||||
num_specifiers++;
|
NumSpecifiers++;
|
||||||
eat( currtok.Type );
|
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 );
|
CodeType type = parse_type( toks, context );
|
||||||
|
@ -33,43 +33,43 @@ u32 crc32( void const* data, sw len )
|
|||||||
}
|
}
|
||||||
|
|
||||||
global u64 const _crc64_table[ 256 ] = {
|
global u64 const _crc64_table[ 256 ] = {
|
||||||
0x0000000000000000ull, 0x7ad870c830358979ull, 0xf5b0e190606b12f2ull, 0x8f689158505e9b8bull, 0xc038e5739841b68full, 0xbae095bba8743ff6ull, 0x358804e3f82aa47dull,
|
0x0000000000000000ull, 0x7ad870c830358979ull, 0xf5b0e190606b12f2ull, 0x8f689158505e9b8bull, 0xc038e5739841b68full, 0xbae095bba8743ff6ull, 0x358804e3f82aa47dull,
|
||||||
0x4f50742bc81f2d04ull, 0xab28ecb46814fe75ull, 0xd1f09c7c5821770cull, 0x5e980d24087fec87ull, 0x24407dec384a65feull, 0x6b1009c7f05548faull, 0x11c8790fc060c183ull,
|
0x4f50742bc81f2d04ull, 0xab28ecb46814fe75ull, 0xd1f09c7c5821770cull, 0x5e980d24087fec87ull, 0x24407dec384a65feull, 0x6b1009c7f05548faull, 0x11c8790fc060c183ull,
|
||||||
0x9ea0e857903e5a08ull, 0xe478989fa00bd371ull, 0x7d08ff3b88be6f81ull, 0x07d08ff3b88be6f8ull, 0x88b81eabe8d57d73ull, 0xf2606e63d8e0f40aull, 0xbd301a4810ffd90eull,
|
0x9ea0e857903e5a08ull, 0xe478989fa00bd371ull, 0x7d08ff3b88be6f81ull, 0x07d08ff3b88be6f8ull, 0x88b81eabe8d57d73ull, 0xf2606e63d8e0f40aull, 0xbd301a4810ffd90eull,
|
||||||
0xc7e86a8020ca5077ull, 0x4880fbd87094cbfcull, 0x32588b1040a14285ull, 0xd620138fe0aa91f4ull, 0xacf86347d09f188dull, 0x2390f21f80c18306ull, 0x594882d7b0f40a7full,
|
0xc7e86a8020ca5077ull, 0x4880fbd87094cbfcull, 0x32588b1040a14285ull, 0xd620138fe0aa91f4ull, 0xacf86347d09f188dull, 0x2390f21f80c18306ull, 0x594882d7b0f40a7full,
|
||||||
0x1618f6fc78eb277bull, 0x6cc0863448deae02ull, 0xe3a8176c18803589ull, 0x997067a428b5bcf0ull, 0xfa11fe77117cdf02ull, 0x80c98ebf2149567bull, 0x0fa11fe77117cdf0ull,
|
0x1618f6fc78eb277bull, 0x6cc0863448deae02ull, 0xe3a8176c18803589ull, 0x997067a428b5bcf0ull, 0xfa11fe77117cdf02ull, 0x80c98ebf2149567bull, 0x0fa11fe77117cdf0ull,
|
||||||
0x75796f2f41224489ull, 0x3a291b04893d698dull, 0x40f16bccb908e0f4ull, 0xcf99fa94e9567b7full, 0xb5418a5cd963f206ull, 0x513912c379682177ull, 0x2be1620b495da80eull,
|
0x75796f2f41224489ull, 0x3a291b04893d698dull, 0x40f16bccb908e0f4ull, 0xcf99fa94e9567b7full, 0xb5418a5cd963f206ull, 0x513912c379682177ull, 0x2be1620b495da80eull,
|
||||||
0xa489f35319033385ull, 0xde51839b2936bafcull, 0x9101f7b0e12997f8ull, 0xebd98778d11c1e81ull, 0x64b116208142850aull, 0x1e6966e8b1770c73ull, 0x8719014c99c2b083ull,
|
0xa489f35319033385ull, 0xde51839b2936bafcull, 0x9101f7b0e12997f8ull, 0xebd98778d11c1e81ull, 0x64b116208142850aull, 0x1e6966e8b1770c73ull, 0x8719014c99c2b083ull,
|
||||||
0xfdc17184a9f739faull, 0x72a9e0dcf9a9a271ull, 0x08719014c99c2b08ull, 0x4721e43f0183060cull, 0x3df994f731b68f75ull, 0xb29105af61e814feull, 0xc849756751dd9d87ull,
|
0xfdc17184a9f739faull, 0x72a9e0dcf9a9a271ull, 0x08719014c99c2b08ull, 0x4721e43f0183060cull, 0x3df994f731b68f75ull, 0xb29105af61e814feull, 0xc849756751dd9d87ull,
|
||||||
0x2c31edf8f1d64ef6ull, 0x56e99d30c1e3c78full, 0xd9810c6891bd5c04ull, 0xa3597ca0a188d57dull, 0xec09088b6997f879ull, 0x96d1784359a27100ull, 0x19b9e91b09fcea8bull,
|
0x2c31edf8f1d64ef6ull, 0x56e99d30c1e3c78full, 0xd9810c6891bd5c04ull, 0xa3597ca0a188d57dull, 0xec09088b6997f879ull, 0x96d1784359a27100ull, 0x19b9e91b09fcea8bull,
|
||||||
0x636199d339c963f2ull, 0xdf7adabd7a6e2d6full, 0xa5a2aa754a5ba416ull, 0x2aca3b2d1a053f9dull, 0x50124be52a30b6e4ull, 0x1f423fcee22f9be0ull, 0x659a4f06d21a1299ull,
|
0x636199d339c963f2ull, 0xdf7adabd7a6e2d6full, 0xa5a2aa754a5ba416ull, 0x2aca3b2d1a053f9dull, 0x50124be52a30b6e4ull, 0x1f423fcee22f9be0ull, 0x659a4f06d21a1299ull,
|
||||||
0xeaf2de5e82448912ull, 0x902aae96b271006bull, 0x74523609127ad31aull, 0x0e8a46c1224f5a63ull, 0x81e2d7997211c1e8ull, 0xfb3aa75142244891ull, 0xb46ad37a8a3b6595ull,
|
0xeaf2de5e82448912ull, 0x902aae96b271006bull, 0x74523609127ad31aull, 0x0e8a46c1224f5a63ull, 0x81e2d7997211c1e8ull, 0xfb3aa75142244891ull, 0xb46ad37a8a3b6595ull,
|
||||||
0xceb2a3b2ba0eececull, 0x41da32eaea507767ull, 0x3b024222da65fe1eull, 0xa2722586f2d042eeull, 0xd8aa554ec2e5cb97ull, 0x57c2c41692bb501cull, 0x2d1ab4dea28ed965ull,
|
0xceb2a3b2ba0eececull, 0x41da32eaea507767ull, 0x3b024222da65fe1eull, 0xa2722586f2d042eeull, 0xd8aa554ec2e5cb97ull, 0x57c2c41692bb501cull, 0x2d1ab4dea28ed965ull,
|
||||||
0x624ac0f56a91f461ull, 0x1892b03d5aa47d18ull, 0x97fa21650afae693ull, 0xed2251ad3acf6feaull, 0x095ac9329ac4bc9bull, 0x7382b9faaaf135e2ull, 0xfcea28a2faafae69ull,
|
0x624ac0f56a91f461ull, 0x1892b03d5aa47d18ull, 0x97fa21650afae693ull, 0xed2251ad3acf6feaull, 0x095ac9329ac4bc9bull, 0x7382b9faaaf135e2ull, 0xfcea28a2faafae69ull,
|
||||||
0x8632586aca9a2710ull, 0xc9622c4102850a14ull, 0xb3ba5c8932b0836dull, 0x3cd2cdd162ee18e6ull, 0x460abd1952db919full, 0x256b24ca6b12f26dull, 0x5fb354025b277b14ull,
|
0x8632586aca9a2710ull, 0xc9622c4102850a14ull, 0xb3ba5c8932b0836dull, 0x3cd2cdd162ee18e6ull, 0x460abd1952db919full, 0x256b24ca6b12f26dull, 0x5fb354025b277b14ull,
|
||||||
0xd0dbc55a0b79e09full, 0xaa03b5923b4c69e6ull, 0xe553c1b9f35344e2ull, 0x9f8bb171c366cd9bull, 0x10e3202993385610ull, 0x6a3b50e1a30ddf69ull, 0x8e43c87e03060c18ull,
|
0xd0dbc55a0b79e09full, 0xaa03b5923b4c69e6ull, 0xe553c1b9f35344e2ull, 0x9f8bb171c366cd9bull, 0x10e3202993385610ull, 0x6a3b50e1a30ddf69ull, 0x8e43c87e03060c18ull,
|
||||||
0xf49bb8b633338561ull, 0x7bf329ee636d1eeaull, 0x012b592653589793ull, 0x4e7b2d0d9b47ba97ull, 0x34a35dc5ab7233eeull, 0xbbcbcc9dfb2ca865ull, 0xc113bc55cb19211cull,
|
0xf49bb8b633338561ull, 0x7bf329ee636d1eeaull, 0x012b592653589793ull, 0x4e7b2d0d9b47ba97ull, 0x34a35dc5ab7233eeull, 0xbbcbcc9dfb2ca865ull, 0xc113bc55cb19211cull,
|
||||||
0x5863dbf1e3ac9decull, 0x22bbab39d3991495ull, 0xadd33a6183c78f1eull, 0xd70b4aa9b3f20667ull, 0x985b3e827bed2b63ull, 0xe2834e4a4bd8a21aull, 0x6debdf121b863991ull,
|
0x5863dbf1e3ac9decull, 0x22bbab39d3991495ull, 0xadd33a6183c78f1eull, 0xd70b4aa9b3f20667ull, 0x985b3e827bed2b63ull, 0xe2834e4a4bd8a21aull, 0x6debdf121b863991ull,
|
||||||
0x1733afda2bb3b0e8ull, 0xf34b37458bb86399ull, 0x8993478dbb8deae0ull, 0x06fbd6d5ebd3716bull, 0x7c23a61ddbe6f812ull, 0x3373d23613f9d516ull, 0x49aba2fe23cc5c6full,
|
0x1733afda2bb3b0e8ull, 0xf34b37458bb86399ull, 0x8993478dbb8deae0ull, 0x06fbd6d5ebd3716bull, 0x7c23a61ddbe6f812ull, 0x3373d23613f9d516ull, 0x49aba2fe23cc5c6full,
|
||||||
0xc6c333a67392c7e4ull, 0xbc1b436e43a74e9dull, 0x95ac9329ac4bc9b5ull, 0xef74e3e19c7e40ccull, 0x601c72b9cc20db47ull, 0x1ac40271fc15523eull, 0x5594765a340a7f3aull,
|
0xc6c333a67392c7e4ull, 0xbc1b436e43a74e9dull, 0x95ac9329ac4bc9b5ull, 0xef74e3e19c7e40ccull, 0x601c72b9cc20db47ull, 0x1ac40271fc15523eull, 0x5594765a340a7f3aull,
|
||||||
0x2f4c0692043ff643ull, 0xa02497ca54616dc8ull, 0xdafce7026454e4b1ull, 0x3e847f9dc45f37c0ull, 0x445c0f55f46abeb9ull, 0xcb349e0da4342532ull, 0xb1eceec59401ac4bull,
|
0x2f4c0692043ff643ull, 0xa02497ca54616dc8ull, 0xdafce7026454e4b1ull, 0x3e847f9dc45f37c0ull, 0x445c0f55f46abeb9ull, 0xcb349e0da4342532ull, 0xb1eceec59401ac4bull,
|
||||||
0xfebc9aee5c1e814full, 0x8464ea266c2b0836ull, 0x0b0c7b7e3c7593bdull, 0x71d40bb60c401ac4ull, 0xe8a46c1224f5a634ull, 0x927c1cda14c02f4dull, 0x1d148d82449eb4c6ull,
|
0xfebc9aee5c1e814full, 0x8464ea266c2b0836ull, 0x0b0c7b7e3c7593bdull, 0x71d40bb60c401ac4ull, 0xe8a46c1224f5a634ull, 0x927c1cda14c02f4dull, 0x1d148d82449eb4c6ull,
|
||||||
0x67ccfd4a74ab3dbfull, 0x289c8961bcb410bbull, 0x5244f9a98c8199c2ull, 0xdd2c68f1dcdf0249ull, 0xa7f41839ecea8b30ull, 0x438c80a64ce15841ull, 0x3954f06e7cd4d138ull,
|
0x67ccfd4a74ab3dbfull, 0x289c8961bcb410bbull, 0x5244f9a98c8199c2ull, 0xdd2c68f1dcdf0249ull, 0xa7f41839ecea8b30ull, 0x438c80a64ce15841ull, 0x3954f06e7cd4d138ull,
|
||||||
0xb63c61362c8a4ab3ull, 0xcce411fe1cbfc3caull, 0x83b465d5d4a0eeceull, 0xf96c151de49567b7ull, 0x76048445b4cbfc3cull, 0x0cdcf48d84fe7545ull, 0x6fbd6d5ebd3716b7ull,
|
0xb63c61362c8a4ab3ull, 0xcce411fe1cbfc3caull, 0x83b465d5d4a0eeceull, 0xf96c151de49567b7ull, 0x76048445b4cbfc3cull, 0x0cdcf48d84fe7545ull, 0x6fbd6d5ebd3716b7ull,
|
||||||
0x15651d968d029fceull, 0x9a0d8ccedd5c0445ull, 0xe0d5fc06ed698d3cull, 0xaf85882d2576a038ull, 0xd55df8e515432941ull, 0x5a3569bd451db2caull, 0x20ed197575283bb3ull,
|
0x15651d968d029fceull, 0x9a0d8ccedd5c0445ull, 0xe0d5fc06ed698d3cull, 0xaf85882d2576a038ull, 0xd55df8e515432941ull, 0x5a3569bd451db2caull, 0x20ed197575283bb3ull,
|
||||||
0xc49581ead523e8c2ull, 0xbe4df122e51661bbull, 0x3125607ab548fa30ull, 0x4bfd10b2857d7349ull, 0x04ad64994d625e4dull, 0x7e7514517d57d734ull, 0xf11d85092d094cbfull,
|
0xc49581ead523e8c2ull, 0xbe4df122e51661bbull, 0x3125607ab548fa30ull, 0x4bfd10b2857d7349ull, 0x04ad64994d625e4dull, 0x7e7514517d57d734ull, 0xf11d85092d094cbfull,
|
||||||
0x8bc5f5c11d3cc5c6ull, 0x12b5926535897936ull, 0x686de2ad05bcf04full, 0xe70573f555e26bc4ull, 0x9ddd033d65d7e2bdull, 0xd28d7716adc8cfb9ull, 0xa85507de9dfd46c0ull,
|
0x8bc5f5c11d3cc5c6ull, 0x12b5926535897936ull, 0x686de2ad05bcf04full, 0xe70573f555e26bc4ull, 0x9ddd033d65d7e2bdull, 0xd28d7716adc8cfb9ull, 0xa85507de9dfd46c0ull,
|
||||||
0x273d9686cda3dd4bull, 0x5de5e64efd965432ull, 0xb99d7ed15d9d8743ull, 0xc3450e196da80e3aull, 0x4c2d9f413df695b1ull, 0x36f5ef890dc31cc8ull, 0x79a59ba2c5dc31ccull,
|
0x273d9686cda3dd4bull, 0x5de5e64efd965432ull, 0xb99d7ed15d9d8743ull, 0xc3450e196da80e3aull, 0x4c2d9f413df695b1ull, 0x36f5ef890dc31cc8ull, 0x79a59ba2c5dc31ccull,
|
||||||
0x037deb6af5e9b8b5ull, 0x8c157a32a5b7233eull, 0xf6cd0afa9582aa47ull, 0x4ad64994d625e4daull, 0x300e395ce6106da3ull, 0xbf66a804b64ef628ull, 0xc5bed8cc867b7f51ull,
|
0x037deb6af5e9b8b5ull, 0x8c157a32a5b7233eull, 0xf6cd0afa9582aa47ull, 0x4ad64994d625e4daull, 0x300e395ce6106da3ull, 0xbf66a804b64ef628ull, 0xc5bed8cc867b7f51ull,
|
||||||
0x8aeeace74e645255ull, 0xf036dc2f7e51db2cull, 0x7f5e4d772e0f40a7ull, 0x05863dbf1e3ac9deull, 0xe1fea520be311aafull, 0x9b26d5e88e0493d6ull, 0x144e44b0de5a085dull,
|
0x8aeeace74e645255ull, 0xf036dc2f7e51db2cull, 0x7f5e4d772e0f40a7ull, 0x05863dbf1e3ac9deull, 0xe1fea520be311aafull, 0x9b26d5e88e0493d6ull, 0x144e44b0de5a085dull,
|
||||||
0x6e963478ee6f8124ull, 0x21c640532670ac20ull, 0x5b1e309b16452559ull, 0xd476a1c3461bbed2ull, 0xaeaed10b762e37abull, 0x37deb6af5e9b8b5bull, 0x4d06c6676eae0222ull,
|
0x6e963478ee6f8124ull, 0x21c640532670ac20ull, 0x5b1e309b16452559ull, 0xd476a1c3461bbed2ull, 0xaeaed10b762e37abull, 0x37deb6af5e9b8b5bull, 0x4d06c6676eae0222ull,
|
||||||
0xc26e573f3ef099a9ull, 0xb8b627f70ec510d0ull, 0xf7e653dcc6da3dd4ull, 0x8d3e2314f6efb4adull, 0x0256b24ca6b12f26ull, 0x788ec2849684a65full, 0x9cf65a1b368f752eull,
|
0xc26e573f3ef099a9ull, 0xb8b627f70ec510d0ull, 0xf7e653dcc6da3dd4ull, 0x8d3e2314f6efb4adull, 0x0256b24ca6b12f26ull, 0x788ec2849684a65full, 0x9cf65a1b368f752eull,
|
||||||
0xe62e2ad306bafc57ull, 0x6946bb8b56e467dcull, 0x139ecb4366d1eea5ull, 0x5ccebf68aecec3a1ull, 0x2616cfa09efb4ad8ull, 0xa97e5ef8cea5d153ull, 0xd3a62e30fe90582aull,
|
0xe62e2ad306bafc57ull, 0x6946bb8b56e467dcull, 0x139ecb4366d1eea5ull, 0x5ccebf68aecec3a1ull, 0x2616cfa09efb4ad8ull, 0xa97e5ef8cea5d153ull, 0xd3a62e30fe90582aull,
|
||||||
0xb0c7b7e3c7593bd8ull, 0xca1fc72bf76cb2a1ull, 0x45775673a732292aull, 0x3faf26bb9707a053ull, 0x70ff52905f188d57ull, 0x0a2722586f2d042eull, 0x854fb3003f739fa5ull,
|
0xb0c7b7e3c7593bd8ull, 0xca1fc72bf76cb2a1ull, 0x45775673a732292aull, 0x3faf26bb9707a053ull, 0x70ff52905f188d57ull, 0x0a2722586f2d042eull, 0x854fb3003f739fa5ull,
|
||||||
0xff97c3c80f4616dcull, 0x1bef5b57af4dc5adull, 0x61372b9f9f784cd4ull, 0xee5fbac7cf26d75full, 0x9487ca0fff135e26ull, 0xdbd7be24370c7322ull, 0xa10fceec0739fa5bull,
|
0xff97c3c80f4616dcull, 0x1bef5b57af4dc5adull, 0x61372b9f9f784cd4ull, 0xee5fbac7cf26d75full, 0x9487ca0fff135e26ull, 0xdbd7be24370c7322ull, 0xa10fceec0739fa5bull,
|
||||||
0x2e675fb4576761d0ull, 0x54bf2f7c6752e8a9ull, 0xcdcf48d84fe75459ull, 0xb71738107fd2dd20ull, 0x387fa9482f8c46abull, 0x42a7d9801fb9cfd2ull, 0x0df7adabd7a6e2d6ull,
|
0x2e675fb4576761d0ull, 0x54bf2f7c6752e8a9ull, 0xcdcf48d84fe75459ull, 0xb71738107fd2dd20ull, 0x387fa9482f8c46abull, 0x42a7d9801fb9cfd2ull, 0x0df7adabd7a6e2d6ull,
|
||||||
0x772fdd63e7936bafull, 0xf8474c3bb7cdf024ull, 0x829f3cf387f8795dull, 0x66e7a46c27f3aa2cull, 0x1c3fd4a417c62355ull, 0x935745fc4798b8deull, 0xe98f353477ad31a7ull,
|
0x772fdd63e7936bafull, 0xf8474c3bb7cdf024ull, 0x829f3cf387f8795dull, 0x66e7a46c27f3aa2cull, 0x1c3fd4a417c62355ull, 0x935745fc4798b8deull, 0xe98f353477ad31a7ull,
|
||||||
0xa6df411fbfb21ca3ull, 0xdc0731d78f8795daull, 0x536fa08fdfd90e51ull, 0x29b7d047efec8728ull,
|
0xa6df411fbfb21ca3ull, 0xdc0731d78f8795daull, 0x536fa08fdfd90e51ull, 0x29b7d047efec8728ull,
|
||||||
};
|
};
|
||||||
|
|
||||||
u64 crc64( void const* data, sw len )
|
u64 crc64( void const* data, sw len )
|
||||||
|
@ -363,10 +363,10 @@ GEN_IMPL_INLINE void zero_size( void* ptr, sw size )
|
|||||||
struct Arena
|
struct Arena
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
void* allocator_proc( void* allocator_data, AllocType type, sw size, sw alignment, void* old_memory, sw old_size, u64 flags );
|
void* allocator_proc( void* allocator_data, AllocType type, sw size, sw alignment, void* old_memory, sw old_size, u64 flags );
|
||||||
|
|
||||||
static
|
static
|
||||||
Arena init_from_memory( void* start, sw size )
|
Arena init_from_memory( void* start, sw size )
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
{
|
{
|
||||||
@ -379,7 +379,7 @@ struct Arena
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
Arena init_from_allocator( AllocatorInfo backing, sw size )
|
Arena init_from_allocator( AllocatorInfo backing, sw size )
|
||||||
{
|
{
|
||||||
Arena result =
|
Arena result =
|
||||||
{
|
{
|
||||||
@ -393,7 +393,7 @@ struct Arena
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
Arena init_sub( Arena& parent, sw size )
|
Arena init_sub( Arena& parent, sw size )
|
||||||
{
|
{
|
||||||
return init_from_allocator( parent.Backing, size );
|
return init_from_allocator( parent.Backing, size );
|
||||||
}
|
}
|
||||||
@ -448,16 +448,16 @@ struct Arena
|
|||||||
struct Pool
|
struct Pool
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
void* allocator_proc( void* allocator_data, AllocType type, sw size, sw alignment, void* old_memory, sw old_size, u64 flags );
|
void* allocator_proc( void* allocator_data, AllocType type, sw size, sw alignment, void* old_memory, sw old_size, u64 flags );
|
||||||
|
|
||||||
static
|
static
|
||||||
Pool init( AllocatorInfo backing, sw num_blocks, sw block_size )
|
Pool init( AllocatorInfo backing, sw num_blocks, sw block_size )
|
||||||
{
|
{
|
||||||
return init_align( backing, num_blocks, block_size, GEN_DEFAULT_MEMORY_ALIGNMENT );
|
return init_align( backing, num_blocks, block_size, GEN_DEFAULT_MEMORY_ALIGNMENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
Pool init_align( AllocatorInfo backing, sw num_blocks, sw block_size, sw block_align );
|
Pool init_align( AllocatorInfo backing, sw num_blocks, sw block_size, sw block_align );
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
@ -137,12 +137,12 @@ int gen_main()
|
|||||||
header.print( nspace_macro );
|
header.print( nspace_macro );
|
||||||
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||||
|
|
||||||
header.print_fmt("#pragma region Types");
|
header.print_fmt("#pragma region Types\n\n");
|
||||||
header.print( types );
|
header.print( types );
|
||||||
header.print( ecode );
|
header.print( ecode );
|
||||||
header.print( eoperator );
|
header.print( eoperator );
|
||||||
header.print( especifier );
|
header.print( especifier );
|
||||||
header.print_fmt("#pragma endregion Types");
|
header.print_fmt("#pragma endregion Types\n\n");
|
||||||
|
|
||||||
header.print( data_structs );
|
header.print( data_structs );
|
||||||
header.print( interface );
|
header.print( interface );
|
||||||
@ -167,7 +167,7 @@ int gen_main()
|
|||||||
Code parsing = scan_file( "components/gen.interface.parsing.cpp" );
|
Code parsing = scan_file( "components/gen.interface.parsing.cpp" );
|
||||||
Code untyped = scan_file( "components/gen.untyped.cpp" );
|
Code untyped = scan_file( "components/gen.untyped.cpp" );
|
||||||
|
|
||||||
CodeBody etoktype = gen_etoktype( "./components/ETokType.csv" );
|
CodeBody etoktype = gen_etoktype( "components/ETokType.csv", "components/AttributeTokens.csv" );
|
||||||
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
||||||
|
|
||||||
Code builder = scan_file( "filesystem/gen.builder.cpp" );
|
Code builder = scan_file( "filesystem/gen.builder.cpp" );
|
||||||
|
@ -157,7 +157,6 @@ CodeBody gen_especifier( char const* path )
|
|||||||
#undef local_persist
|
#undef local_persist
|
||||||
#undef do_once_start
|
#undef do_once_start
|
||||||
#undef do_once_end
|
#undef do_once_end
|
||||||
|
|
||||||
CodeFn to_str = parse_function(token_fmt("entries", (StrC)to_str_entries, stringize(
|
CodeFn to_str = parse_function(token_fmt("entries", (StrC)to_str_entries, stringize(
|
||||||
StrC to_str( Type type )
|
StrC to_str( Type type )
|
||||||
{
|
{
|
||||||
@ -197,7 +196,6 @@ CodeBody gen_especifier( char const* path )
|
|||||||
return Invalid;
|
return Invalid;
|
||||||
}
|
}
|
||||||
)));
|
)));
|
||||||
|
|
||||||
#pragma pop_macro( "local_persist" )
|
#pragma pop_macro( "local_persist" )
|
||||||
#pragma pop_macro( "do_once_start" )
|
#pragma pop_macro( "do_once_start" )
|
||||||
#pragma pop_macro( "do_once_end" )
|
#pragma pop_macro( "do_once_end" )
|
||||||
@ -209,36 +207,57 @@ CodeBody gen_especifier( char const* path )
|
|||||||
return def_global_body( args( nspace, specifier_t ) );
|
return def_global_body( args( nspace, specifier_t ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeBody gen_etoktype( char const* path )
|
CodeBody gen_etoktype( char const* etok_path, char const* attr_path )
|
||||||
{
|
{
|
||||||
char scratch_mem[kilobytes(4)];
|
char scratch_mem[kilobytes(64)];
|
||||||
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
Arena scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||||
|
|
||||||
file_read_contents( scratch, zero_terminate, path );
|
FileContents enum_content = file_read_contents( scratch, zero_terminate, etok_path );
|
||||||
|
|
||||||
CSV_Object csv_nodes;
|
CSV_Object csv_enum_nodes;
|
||||||
csv_parse( &csv_nodes, scratch_mem, GlobalAllocator, false );
|
csv_parse( &csv_enum_nodes, rcast(char*, enum_content.data), GlobalAllocator, false );
|
||||||
|
|
||||||
Array<ADT_Node> enum_strs = csv_nodes.nodes[0].nodes;
|
// memset( scratch_mem, 0, sizeof(scratch_mem) );
|
||||||
Array<ADT_Node> str_strs = csv_nodes.nodes[1].nodes;
|
// scratch = Arena::init_from_memory( scratch_mem, sizeof(scratch_mem) );
|
||||||
|
FileContents attrib_content = file_read_contents( scratch, zero_terminate, attr_path );
|
||||||
|
|
||||||
String enum_entries = String::make_reserve( GlobalAllocator, kilobytes(1) );
|
CSV_Object csv_attr_nodes;
|
||||||
String to_str_entries = String::make_reserve( GlobalAllocator, kilobytes(1) );
|
csv_parse( &csv_attr_nodes, rcast(char*, attrib_content.data), GlobalAllocator, false );
|
||||||
|
|
||||||
|
Array<ADT_Node> enum_strs = csv_enum_nodes.nodes[0].nodes;
|
||||||
|
Array<ADT_Node> enum_str_strs = csv_enum_nodes.nodes[1].nodes;
|
||||||
|
Array<ADT_Node> attribute_strs = csv_attr_nodes.nodes[0].nodes;
|
||||||
|
Array<ADT_Node> attribute_str_strs = csv_attr_nodes.nodes[1].nodes;
|
||||||
|
|
||||||
|
String enum_entries = String::make_reserve( GlobalAllocator, kilobytes(2) );
|
||||||
|
String to_str_entries = String::make_reserve( GlobalAllocator, kilobytes(4) );
|
||||||
|
String attribute_entries = String::make_reserve( GlobalAllocator, kilobytes(2) );
|
||||||
|
String to_str_attributes = String::make_reserve( GlobalAllocator, kilobytes(4) );
|
||||||
|
|
||||||
for (uw idx = 0; idx < enum_strs.num(); idx++)
|
for (uw idx = 0; idx < enum_strs.num(); idx++)
|
||||||
{
|
{
|
||||||
char const* enum_str = enum_strs[idx].string;
|
char const* enum_str = enum_strs[idx].string;
|
||||||
char const* entry_to_str = str_strs [idx].string;
|
char const* entry_to_str = enum_str_strs [idx].string;
|
||||||
|
|
||||||
enum_entries.append_fmt( "%s,\n", enum_str );
|
enum_entries.append_fmt( "%s,\n", enum_str );
|
||||||
to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeEnum enum_code = parse_enum(token_fmt("entries", (StrC)enum_entries, stringize(
|
for ( uw idx = 0; idx < attribute_strs.num(); idx++ )
|
||||||
|
{
|
||||||
|
char const* attribute_str = attribute_strs[idx].string;
|
||||||
|
char const* entry_to_str = attribute_str_strs [idx].string;
|
||||||
|
|
||||||
|
attribute_entries.append_fmt( "%s,\n", attribute_str );
|
||||||
|
to_str_attributes.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeEnum enum_code = parse_enum(token_fmt("entries", (StrC)enum_entries, "attribute_toks", (StrC)attribute_entries, stringize(
|
||||||
enum Type : u32
|
enum Type : u32
|
||||||
{
|
{
|
||||||
<entries>
|
<entries>
|
||||||
NumTokenTypes
|
<attribute_toks>
|
||||||
|
NumTokens
|
||||||
};
|
};
|
||||||
)));
|
)));
|
||||||
|
|
||||||
@ -248,14 +267,13 @@ CodeBody gen_etoktype( char const* path )
|
|||||||
#undef local_persist
|
#undef local_persist
|
||||||
#undef do_once_start
|
#undef do_once_start
|
||||||
#undef do_once_end
|
#undef do_once_end
|
||||||
|
CodeFn to_str = parse_function(token_fmt("entries", (StrC)to_str_entries, "attribute_toks", (StrC)to_str_attributes, stringize(
|
||||||
CodeFn to_str = parse_function(token_fmt("entries", (StrC)to_str_entries, stringize(
|
|
||||||
StrC to_str( Type type )
|
StrC to_str( Type type )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
StrC lookup[] {
|
StrC lookup[] {
|
||||||
<entries>
|
<entries>
|
||||||
NumTokens
|
<attribute_toks>
|
||||||
};
|
};
|
||||||
|
|
||||||
return lookup[ type ];
|
return lookup[ type ];
|
||||||
@ -289,49 +307,12 @@ CodeBody gen_etoktype( char const* path )
|
|||||||
return Invalid;
|
return Invalid;
|
||||||
}
|
}
|
||||||
)));
|
)));
|
||||||
|
|
||||||
#pragma pop_macro( "local_persist" )
|
#pragma pop_macro( "local_persist" )
|
||||||
#pragma pop_macro( "do_once_start" )
|
#pragma pop_macro( "do_once_start" )
|
||||||
#pragma pop_macro( "do_once_end" )
|
#pragma pop_macro( "do_once_end" )
|
||||||
|
|
||||||
CodeFn is_specifier = parse_function( token_fmt( "entries", (StrC)to_str_entries, stringize(
|
CodeNamespace nspace = def_namespace( name(ETokType), def_namespace_body( args( enum_code, to_str, to_type ) ) );
|
||||||
bool tok_is_specifier( Type type )
|
CodeUsing td_toktype = def_using( name(TokType), def_type( name(ETokType::Type) ) );
|
||||||
{
|
|
||||||
return (tok.Type <= TokType::Star && tok.Type >= TokType::Spec_Alignas)
|
|
||||||
|| tok.Type == TokType::Ampersand
|
|
||||||
|| tok.Type == TokType::Ampersand_DBL
|
|
||||||
;
|
|
||||||
}
|
|
||||||
)));
|
|
||||||
|
|
||||||
CodeFn is_access_specifier = parse_function( token_fmt( "entries", (StrC)to_str_entries, stringize(
|
|
||||||
bool tok_is_access_specifier( Type type )
|
|
||||||
{
|
|
||||||
return tok.Type >= TokType::Access_Private && tok.Type <= TokType::Access_Public;
|
|
||||||
}
|
|
||||||
)));
|
|
||||||
|
|
||||||
#pragma push_macro( "internal" )
|
|
||||||
#pragma push_macro( "scast" )
|
|
||||||
CodeFn to_access_specifier = parse_function( token_fmt( "entries", (StrC)to_str_entries, stringize(
|
|
||||||
internal inline
|
|
||||||
AccessSpec tok_to_access_specifier( Type type )
|
|
||||||
{
|
|
||||||
return scast(AccessSpec, tok.Type);
|
|
||||||
}
|
|
||||||
)));
|
|
||||||
#pragma pop_macro( "internal" )
|
|
||||||
#pragma pop_macro( "scast" )
|
|
||||||
|
|
||||||
CodeFn is_attribute = parse_function( token_fmt( "entries", (StrC)to_str_entries, stringize(
|
|
||||||
bool tok_is_attribute( const Token type )
|
|
||||||
{
|
|
||||||
return tok.Type >= TokType::Attr_Alignas && tok.Type <= TokType::Attr_Visibility;
|
|
||||||
}
|
|
||||||
)));
|
|
||||||
|
|
||||||
CodeNamespace nspace = def_namespace( name(ETokType), def_namespace_body( args( enum_code, to_str, to_type, is_specifier, is_access_specifier, to_access_specifier, is_attribute ) ) );
|
|
||||||
CodeUsing td_toktype = def_using( name(TokTypeT), def_type( name(ETokType::Type) ) );
|
|
||||||
|
|
||||||
return def_global_body( args( nspace, td_toktype ) );
|
return def_global_body( args( nspace, td_toktype ) );
|
||||||
}
|
}
|
||||||
|
@ -52,10 +52,12 @@ Push-location $path_gen
|
|||||||
& $gencpp
|
& $gencpp
|
||||||
|
|
||||||
# Format generated files
|
# Format generated files
|
||||||
|
$path_clang_format = Join-Path $path_scripts .clang-format
|
||||||
|
|
||||||
Write-Host `nBeginning format...
|
Write-Host `nBeginning format...
|
||||||
$formatParams = @(
|
$formatParams = @(
|
||||||
'-i' # In-place
|
'-i' # In-place
|
||||||
'-style=file' # Search for a .clang-format file in the parent directory of the source file.
|
"-style=file:$path_clang_format" # Search for a .clang-format file in the parent directory of the source file.
|
||||||
'-verbose'
|
'-verbose'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
16
scripts/msvc/build_msvc.ps1
Normal file
16
scripts/msvc/build_msvc.ps1
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
cls
|
||||||
|
|
||||||
|
if ( -not( Test-Path $path_build ) ) {
|
||||||
|
New-Item -ItemType Directory -Path $path_build | Out-Null
|
||||||
|
}
|
||||||
|
if ( -not( Test-Path $path_build_interm ) ) {
|
||||||
|
New-Item -ItemType Directory -Path $path_build_interm | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
$path_root = git rev-parse --show-toplevel
|
||||||
|
$path_build = Join-Path $path_root build
|
||||||
|
$path_gen = Join-Path $path_test gen
|
||||||
|
$path_gen_build = Join-Path $path_gen build
|
||||||
|
$path_scripts = Join-Path $path_root scripts
|
||||||
|
$path_test = Join-Path $path_root test
|
||||||
|
$path_test_build = Join-Path $path_test build
|
26
scripts/msvc/devshell.ps1
Normal file
26
scripts/msvc/devshell.ps1
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# This script is used to iniitate the MSVC DevShell
|
||||||
|
$vs_devshell = @()
|
||||||
|
@("enterprise", "professional", "community") | ForEach-Object {
|
||||||
|
$vs_devshell_2022 = "C:\Program Files\Microsoft Visual Studio\2022\" + $_ + "\Common7\Tools\Launch-VsDevShell.ps1"
|
||||||
|
$vs_devshell_2019 = "C:\Program Files (x86)\Microsoft Visual Studio\2019\" + $_ + "\Common7\Tools\Launch-VsDevShell.ps1"
|
||||||
|
|
||||||
|
$vs_devshell += @( $vs_devshell_2022, $vs_devshell_2019 )
|
||||||
|
}
|
||||||
|
|
||||||
|
$found = $false
|
||||||
|
foreach($path in $vs_devshell) {
|
||||||
|
if (Test-Path $path) {
|
||||||
|
write-host "Found $path"
|
||||||
|
|
||||||
|
Push-Location # Save the current path, loading the script will change it.
|
||||||
|
& $path
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
$found = $true
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $found) {
|
||||||
|
write-host "MSVC DevShell: No valid path found"
|
||||||
|
}
|
@ -126,12 +126,12 @@ int gen_main()
|
|||||||
|
|
||||||
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||||
|
|
||||||
header.print_fmt("#pragma region Types");
|
header.print_fmt("#pragma region Types\n\n");
|
||||||
header.print( types );
|
header.print( types );
|
||||||
header.print( ecode );
|
header.print( ecode );
|
||||||
header.print( eoperator );
|
header.print( eoperator );
|
||||||
header.print( especifier );
|
header.print( especifier );
|
||||||
header.print_fmt("#pragma endregion Types");
|
header.print_fmt("#pragma endregion Types\n\n");
|
||||||
|
|
||||||
header.print( data_structs );
|
header.print( data_structs );
|
||||||
header.print( interface );
|
header.print( interface );
|
||||||
@ -184,7 +184,7 @@ int gen_main()
|
|||||||
Code parsing = scan_file( project_dir "components/gen.interface.parsing.cpp" );
|
Code parsing = scan_file( project_dir "components/gen.interface.parsing.cpp" );
|
||||||
Code untyped = scan_file( project_dir "components/gen.untyped.cpp" );
|
Code untyped = scan_file( project_dir "components/gen.untyped.cpp" );
|
||||||
|
|
||||||
CodeBody etoktype = gen_etoktype( project_dir "components/ETokType.csv" );
|
CodeBody etoktype = gen_etoktype( project_dir "components/ETokType.csv", project_dir "components/AttributeTokens.csv" );
|
||||||
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
||||||
|
|
||||||
Code builder = scan_file( project_dir "filesystem/gen.builder.cpp" );
|
Code builder = scan_file( project_dir "filesystem/gen.builder.cpp" );
|
||||||
|
Loading…
Reference in New Issue
Block a user