mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-21 23:34:44 -08:00
reduce ESpecifier to c-compatiable enum
This commit is contained in:
parent
d45908fb32
commit
c6fba23173
@ -273,7 +273,7 @@ char const* debug_str(Code self)
|
||||
s32 left = self->NumEntries;
|
||||
while ( left-- )
|
||||
{
|
||||
StrC spec = ESpecifier::to_str( self->ArrSpecs[idx] );
|
||||
StrC spec = to_str( self->ArrSpecs[idx] );
|
||||
append_fmt( result, "%.*s, ", spec.Len, spec.Ptr );
|
||||
idx++;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ struct AST
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
struct {
|
||||
SpecifierT ArrSpecs[AST_ArrSpecs_Cap]; // Specifiers
|
||||
Specifier ArrSpecs[AST_ArrSpecs_Cap]; // Specifiers
|
||||
Code NextSpecs; // Specifiers; If ArrSpecs is full, then NextSpecs is used.
|
||||
};
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
struct AST_Body
|
||||
{
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
Code Front;
|
||||
Code Back;
|
||||
parser::Token* Tok;
|
||||
@ -27,7 +27,7 @@ static_assert( sizeof(AST_Body) == sizeof(AST), "ERROR: AST_Body is not the same
|
||||
struct AST_Attributes
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -44,7 +44,7 @@ static_assert( sizeof(AST_Attributes) == sizeof(AST), "ERROR: AST_Attributes is
|
||||
struct AST_BaseClass
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
Code Prev;
|
||||
Code Next;
|
||||
@ -60,7 +60,7 @@ static_assert( sizeof(AST_BaseClass) == sizeof(AST), "ERROR: AST_BaseClass is no
|
||||
struct AST_Comment
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -76,7 +76,7 @@ static_assert( sizeof(AST_Comment) == sizeof(AST), "ERROR: AST_Comment is not th
|
||||
struct AST_Class
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt; // Only supported by forward declarations
|
||||
@ -102,7 +102,7 @@ static_assert( sizeof(AST_Class) == sizeof(AST), "ERROR: AST_Class is not the sa
|
||||
struct AST_Constructor
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt; // Only supported by forward declarations
|
||||
@ -127,7 +127,7 @@ static_assert( sizeof(AST_Constructor) == sizeof(AST), "ERROR: AST_Constructor i
|
||||
struct AST_Define
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -143,7 +143,7 @@ static_assert( sizeof(AST_Define) == sizeof(AST), "ERROR: AST_Define is not the
|
||||
struct AST_Destructor
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -167,7 +167,7 @@ static_assert( sizeof(AST_Destructor) == sizeof(AST), "ERROR: AST_Destructor is
|
||||
struct AST_Enum
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -193,7 +193,7 @@ static_assert( sizeof(AST_Enum) == sizeof(AST), "ERROR: AST_Enum is not the same
|
||||
struct AST_Exec
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -210,7 +210,7 @@ static_assert( sizeof(AST_Exec) == sizeof(AST), "ERROR: AST_Exec is not the same
|
||||
struct AST_Expr
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -225,7 +225,7 @@ static_assert( sizeof(AST_Expr) == sizeof(AST), "ERROR: AST_Expr is not the same
|
||||
struct AST_Expr_Assign
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -240,7 +240,7 @@ static_assert( sizeof(AST_Expr_Assign) == sizeof(AST), "ERROR: AST_Expr_Assign i
|
||||
struct AST_Expr_Alignof
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -255,7 +255,7 @@ static_assert( sizeof(AST_Expr_Alignof) == sizeof(AST), "ERROR: AST_Expr_Alignof
|
||||
struct AST_Expr_Binary
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -270,7 +270,7 @@ static_assert( sizeof(AST_Expr_Binary) == sizeof(AST), "ERROR: AST_Expr_Binary i
|
||||
struct AST_Expr_CStyleCast
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -285,7 +285,7 @@ static_assert( sizeof(AST_Expr_CStyleCast) == sizeof(AST), "ERROR: AST_Expr_CSty
|
||||
struct AST_Expr_FunctionalCast
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -300,7 +300,7 @@ static_assert( sizeof(AST_Expr_FunctionalCast) == sizeof(AST), "ERROR: AST_Expr_
|
||||
struct AST_Expr_CppCast
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -315,7 +315,7 @@ static_assert( sizeof(AST_Expr_CppCast) == sizeof(AST), "ERROR: AST_Expr_CppCast
|
||||
struct AST_Expr_ProcCall
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -330,7 +330,7 @@ static_assert( sizeof(AST_Expr_ProcCall) == sizeof(AST), "ERROR: AST_Expr_Identi
|
||||
struct AST_Expr_Decltype
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -345,7 +345,7 @@ static_assert( sizeof(AST_Expr_Decltype) == sizeof(AST), "ERROR: AST_Expr_Declty
|
||||
struct AST_Expr_Comma
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -360,7 +360,7 @@ static_assert( sizeof(AST_Expr_Comma) == sizeof(AST), "ERROR: AST_Expr_Comma is
|
||||
struct AST_Expr_AMS
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -375,7 +375,7 @@ static_assert( sizeof(AST_Expr_AMS) == sizeof(AST), "ERROR: AST_Expr_AMS is not
|
||||
struct AST_Expr_Sizeof
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -390,7 +390,7 @@ static_assert( sizeof(AST_Expr_Sizeof) == sizeof(AST), "ERROR: AST_Expr_Sizeof i
|
||||
struct AST_Expr_Subscript
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -405,7 +405,7 @@ static_assert( sizeof(AST_Expr_Subscript) == sizeof(AST), "ERROR: AST_Expr_Subsc
|
||||
struct AST_Expr_Ternary
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -420,7 +420,7 @@ static_assert( sizeof(AST_Expr_Ternary) == sizeof(AST), "ERROR: AST_Expr_Ternary
|
||||
struct AST_Expr_UnaryPrefix
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -435,7 +435,7 @@ static_assert( sizeof(AST_Expr_UnaryPrefix) == sizeof(AST), "ERROR: AST_Expr_Una
|
||||
struct AST_Expr_UnaryPostfix
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -450,7 +450,7 @@ static_assert( sizeof(AST_Expr_UnaryPostfix) == sizeof(AST), "ERROR: AST_Expr_Un
|
||||
struct AST_Expr_Element
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -466,7 +466,7 @@ static_assert( sizeof(AST_Expr_Element) == sizeof(AST), "ERROR: AST_Expr_Element
|
||||
struct AST_Extern
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
char _PAD_PROPERTIES_[ sizeof(AST*) * 5 ];
|
||||
@ -487,7 +487,7 @@ static_assert( sizeof(AST_Extern) == sizeof(AST), "ERROR: AST_Extern is not the
|
||||
struct AST_Include
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -503,7 +503,7 @@ static_assert( sizeof(AST_Include) == sizeof(AST), "ERROR: AST_Include is not th
|
||||
struct AST_Friend
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -525,7 +525,7 @@ static_assert( sizeof(AST_Friend) == sizeof(AST), "ERROR: AST_Friend is not the
|
||||
struct AST_Fn
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -550,7 +550,7 @@ static_assert( sizeof(AST_Fn) == sizeof(AST), "ERROR: AST_Fn is not the same siz
|
||||
|
||||
struct AST_Module
|
||||
{
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
@ -565,7 +565,7 @@ static_assert( sizeof(AST_Module) == sizeof(AST), "ERROR: AST_Module is not the
|
||||
struct AST_NS
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct {
|
||||
char _PAD_PROPERTIES_[ sizeof(AST*) * 5 ];
|
||||
CodeBody Body;
|
||||
@ -586,7 +586,7 @@ static_assert( sizeof(AST_NS) == sizeof(AST), "ERROR: AST_NS is not the same siz
|
||||
struct AST_Operator
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -612,7 +612,7 @@ static_assert( sizeof(AST_Operator) == sizeof(AST), "ERROR: AST_Operator is not
|
||||
struct AST_OpCast
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -637,7 +637,7 @@ static_assert( sizeof(AST_OpCast) == sizeof(AST), "ERROR: AST_OpCast is not the
|
||||
struct AST_Param
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
char _PAD_PROPERTIES_2_[ sizeof(AST*) * 3 ];
|
||||
@ -662,7 +662,7 @@ static_assert( sizeof(AST_Param) == sizeof(AST), "ERROR: AST_Param is not the sa
|
||||
struct AST_Pragma
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -678,7 +678,7 @@ static_assert( sizeof(AST_Pragma) == sizeof(AST), "ERROR: AST_Pragma is not the
|
||||
struct AST_PreprocessCond
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StringCached Content;
|
||||
};
|
||||
Code Prev;
|
||||
@ -693,7 +693,7 @@ static_assert( sizeof(AST_PreprocessCond) == sizeof(AST), "ERROR: AST_Preprocess
|
||||
|
||||
struct AST_Specifiers
|
||||
{
|
||||
SpecifierT ArrSpecs[ AST_ArrSpecs_Cap ];
|
||||
Specifier ArrSpecs[ AST_ArrSpecs_Cap ];
|
||||
CodeSpecifiers NextSpecs;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
@ -710,7 +710,7 @@ static_assert( sizeof(AST_Specifiers) == sizeof(AST), "ERROR: AST_Specifier is n
|
||||
struct AST_Stmt
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -725,7 +725,7 @@ static_assert( sizeof(AST_Stmt) == sizeof(AST), "ERROR: AST_Stmt is not the same
|
||||
struct AST_Stmt_Break
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -740,7 +740,7 @@ static_assert( sizeof(AST_Stmt_Break) == sizeof(AST), "ERROR: AST_Stmt_Break is
|
||||
struct AST_Stmt_Case
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -755,7 +755,7 @@ static_assert( sizeof(AST_Stmt_Case) == sizeof(AST), "ERROR: AST_Stmt_Case is no
|
||||
struct AST_Stmt_Continue
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -770,7 +770,7 @@ static_assert( sizeof(AST_Stmt_Continue) == sizeof(AST), "ERROR: AST_Stmt_Contin
|
||||
struct AST_Stmt_Decl
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -785,7 +785,7 @@ static_assert( sizeof(AST_Stmt_Decl) == sizeof(AST), "ERROR: AST_Stmt_Decl is no
|
||||
struct AST_Stmt_Do
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -800,7 +800,7 @@ static_assert( sizeof(AST_Stmt_Do) == sizeof(AST), "ERROR: AST_Stmt_Do is not th
|
||||
struct AST_Stmt_Expr
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -815,7 +815,7 @@ static_assert( sizeof(AST_Stmt_Expr) == sizeof(AST), "ERROR: AST_Stmt_Expr is no
|
||||
struct AST_Stmt_Else
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -830,7 +830,7 @@ static_assert( sizeof(AST_Stmt_Else) == sizeof(AST), "ERROR: AST_Stmt_Else is no
|
||||
struct AST_Stmt_If
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -845,7 +845,7 @@ static_assert( sizeof(AST_Stmt_If) == sizeof(AST), "ERROR: AST_Stmt_If is not th
|
||||
struct AST_Stmt_For
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -860,7 +860,7 @@ static_assert( sizeof(AST_Stmt_For) == sizeof(AST), "ERROR: AST_Stmt_For is not
|
||||
struct AST_Stmt_Goto
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -875,7 +875,7 @@ static_assert( sizeof(AST_Stmt_Goto) == sizeof(AST), "ERROR: AST_Stmt_Goto is no
|
||||
struct AST_Stmt_Label
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -890,7 +890,7 @@ static_assert( sizeof(AST_Stmt_Label) == sizeof(AST), "ERROR: AST_Stmt_Label is
|
||||
struct AST_Stmt_Switch
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -905,7 +905,7 @@ static_assert( sizeof(AST_Stmt_Switch) == sizeof(AST), "ERROR: AST_Stmt_Switch i
|
||||
struct AST_Stmt_While
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
};
|
||||
CodeExpr Prev;
|
||||
CodeExpr Next;
|
||||
@ -921,7 +921,7 @@ static_assert( sizeof(AST_Stmt_While) == sizeof(AST), "ERROR: AST_Stmt_While is
|
||||
struct AST_Struct
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -947,7 +947,7 @@ static_assert( sizeof(AST_Struct) == sizeof(AST), "ERROR: AST_Struct is not the
|
||||
struct AST_Template
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
char _PAD_PROPERTIES_[ sizeof(AST*) * 4 ];
|
||||
@ -972,7 +972,7 @@ static_assert( sizeof(AST_Template) == sizeof(AST), "ERROR: AST_Template is not
|
||||
struct AST_Type
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
char _PAD_INLINE_CMT_[ sizeof(AST*) ];
|
||||
@ -1000,7 +1000,7 @@ static_assert( sizeof(AST_Type) == sizeof(AST), "ERROR: AST_Type is not the same
|
||||
struct AST_Type
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
char _PAD_INLINE_CMT_[ sizeof(AST*) ];
|
||||
@ -1026,7 +1026,7 @@ static_assert( sizeof(AST_Type) == sizeof(AST), "ERROR: AST_Type is not the same
|
||||
struct AST_Typedef
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -1049,7 +1049,7 @@ static_assert( sizeof(AST_Typedef) == sizeof(AST), "ERROR: AST_Typedef is not th
|
||||
struct AST_Union
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
char _PAD_INLINE_CMT_[ sizeof(AST*) ];
|
||||
@ -1073,7 +1073,7 @@ static_assert( sizeof(AST_Union) == sizeof(AST), "ERROR: AST_Union is not the sa
|
||||
struct AST_Using
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
@ -1097,7 +1097,7 @@ static_assert( sizeof(AST_Using) == sizeof(AST), "ERROR: AST_Using is not the sa
|
||||
struct AST_Var
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
|
@ -256,7 +256,7 @@ void to_string_def(CodeDestructor self, String* result )
|
||||
}
|
||||
else if ( self->Specs )
|
||||
{
|
||||
if ( has(self->Specs, ESpecifier::Virtual ) )
|
||||
if ( has(self->Specs, Spec_Virtual ) )
|
||||
append_fmt( result, "virtual ~%S()", self->Parent->Name );
|
||||
else
|
||||
append_fmt( result, "~%S()", self->Parent->Name );
|
||||
@ -271,12 +271,12 @@ void to_string_fwd(CodeDestructor self, String* result )
|
||||
{
|
||||
if ( self->Specs )
|
||||
{
|
||||
if ( has(self->Specs, ESpecifier::Virtual ) )
|
||||
if ( has(self->Specs, Spec_Virtual ) )
|
||||
append_fmt( result, "virtual ~%S();\n", self->Parent->Name );
|
||||
else
|
||||
append_fmt( result, "~%S()", self->Parent->Name );
|
||||
|
||||
if ( has(self->Specs, ESpecifier::Pure ) )
|
||||
if ( has(self->Specs, Spec_Pure ) )
|
||||
append( result, " = 0;" );
|
||||
else if (self->Body)
|
||||
append_fmt( result, " = %S;", GEN_NS to_string(self->Body) );
|
||||
@ -492,11 +492,11 @@ void to_string_def(CodeFn self, String* result )
|
||||
bool prefix_specs = false;
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
if ( ! is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
|
||||
prefix_specs = true;
|
||||
@ -521,11 +521,11 @@ void to_string_def(CodeFn self, String* result )
|
||||
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) )
|
||||
if ( is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -545,11 +545,11 @@ void to_string_fwd(CodeFn self, String* result )
|
||||
b32 prefix_specs = false;
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) || ! (spec != ESpecifier::Pure) )
|
||||
if ( ! is_trailing( spec ) || ! (spec != Spec_Pure) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
|
||||
prefix_specs = true;
|
||||
@ -576,17 +576,17 @@ void to_string_fwd(CodeFn self, String* result )
|
||||
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) )
|
||||
if ( is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( self->Specs && has(self->Specs, ESpecifier::Pure ) >= 0 )
|
||||
if ( self->Specs && has(self->Specs, Spec_Pure ) >= 0 )
|
||||
append( result, " = 0;" );
|
||||
else if (self->Body)
|
||||
append_fmt( result, " = %S;", GEN_NS to_string(self->Body) );
|
||||
@ -661,11 +661,11 @@ void to_string_def(CodeOperator self, String* result )
|
||||
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
if ( ! is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -687,11 +687,11 @@ void to_string_def(CodeOperator self, String* result )
|
||||
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) )
|
||||
if ( is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -712,11 +712,11 @@ void to_string_fwd(CodeOperator self, String* result )
|
||||
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
if ( ! is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -737,11 +737,11 @@ void to_string_fwd(CodeOperator self, String* result )
|
||||
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) )
|
||||
if ( is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -773,11 +773,11 @@ void to_string_def(CodeOpCast self, String* result )
|
||||
{
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
if ( ! is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, "%*s ", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -787,11 +787,11 @@ void to_string_def(CodeOpCast self, String* result )
|
||||
else
|
||||
append_fmt( result, "operator %S()", to_string(self->ValueType) );
|
||||
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) )
|
||||
if ( is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -810,22 +810,22 @@ void to_string_fwd(CodeOpCast self, String* result )
|
||||
{
|
||||
if ( self->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
if ( ! is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, "%*s ", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
|
||||
append_fmt( result, "operator %S()", to_string(self->ValueType) );
|
||||
|
||||
for ( SpecifierT spec : self->Specs )
|
||||
for ( Specifier spec : self->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) )
|
||||
if ( is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
StrC spec_str = to_str( spec );
|
||||
append_fmt( result, " %*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
@ -973,7 +973,7 @@ void to_string( CodeSpecifiers self, String* result )
|
||||
s32 left = self->NumEntries;
|
||||
while ( left-- )
|
||||
{
|
||||
StrC spec = ESpecifier::to_str( self->ArrSpecs[idx] );
|
||||
StrC spec = to_str( self->ArrSpecs[idx] );
|
||||
append_fmt( result, "%.*s ", spec.Len, spec.Ptr );
|
||||
idx++;
|
||||
}
|
||||
|
@ -27,14 +27,14 @@ void to_string (CodeParam params, String* result );
|
||||
CodeParam begin(CodeParam params);
|
||||
CodeParam end (CodeParam params);
|
||||
|
||||
bool append (CodeSpecifiers specifiers, SpecifierT spec);
|
||||
s32 has (CodeSpecifiers specifiers, SpecifierT spec);
|
||||
s32 remove (CodeSpecifiers specifiers, SpecifierT to_remove );
|
||||
bool append (CodeSpecifiers specifiers, Specifier spec);
|
||||
s32 has (CodeSpecifiers specifiers, Specifier spec);
|
||||
s32 remove (CodeSpecifiers specifiers, Specifier to_remove );
|
||||
String to_string(CodeSpecifiers specifiers);
|
||||
void to_string(CodeSpecifiers specifiers, String* result);
|
||||
|
||||
SpecifierT* begin(CodeSpecifiers specifiers );
|
||||
SpecifierT* end (CodeSpecifiers specifiers);
|
||||
Specifier* begin(CodeSpecifiers specifiers );
|
||||
Specifier* end (CodeSpecifiers specifiers);
|
||||
|
||||
void add_interface(CodeStruct self, CodeType interface);
|
||||
String to_string (CodeStruct self);
|
||||
|
@ -5,94 +5,90 @@
|
||||
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
namespace ESpecifier
|
||||
typedef enum Specifier_Def Specifier;
|
||||
|
||||
enum Specifier_Def : u32
|
||||
{
|
||||
enum Type : u32
|
||||
{
|
||||
Invalid,
|
||||
Consteval,
|
||||
Constexpr,
|
||||
Constinit,
|
||||
Explicit,
|
||||
External_Linkage,
|
||||
ForceInline,
|
||||
Global,
|
||||
Inline,
|
||||
Internal_Linkage,
|
||||
Local_Persist,
|
||||
Mutable,
|
||||
NeverInline,
|
||||
Ptr,
|
||||
Ref,
|
||||
Register,
|
||||
RValue,
|
||||
Static,
|
||||
Thread_Local,
|
||||
Virtual,
|
||||
Const,
|
||||
Final,
|
||||
NoExceptions,
|
||||
Override,
|
||||
Pure,
|
||||
Volatile,
|
||||
NumSpecifiers
|
||||
Spec_Invalid,
|
||||
Spec_Consteval,
|
||||
Spec_Constexpr,
|
||||
Spec_Constinit,
|
||||
Spec_Explicit,
|
||||
Spec_External_Linkage,
|
||||
Spec_ForceInline,
|
||||
Spec_Global,
|
||||
Spec_Inline,
|
||||
Spec_Internal_Linkage,
|
||||
Spec_Local_Persist,
|
||||
Spec_Mutable,
|
||||
Spec_NeverInline,
|
||||
Spec_Ptr,
|
||||
Spec_Ref,
|
||||
Spec_Register,
|
||||
Spec_RValue,
|
||||
Spec_Static,
|
||||
Spec_Thread_Local,
|
||||
Spec_Virtual,
|
||||
Spec_Const,
|
||||
Spec_Final,
|
||||
Spec_NoExceptions,
|
||||
Spec_Override,
|
||||
Spec_Pure,
|
||||
Spec_Volatile,
|
||||
Spec_NumSpecifiers
|
||||
};
|
||||
|
||||
inline bool is_trailing( Specifier specifier )
|
||||
{
|
||||
return specifier > Spec_Virtual;
|
||||
}
|
||||
|
||||
inline StrC to_str( Specifier type )
|
||||
{
|
||||
local_persist StrC lookup[] {
|
||||
{ sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "consteval" ), "consteval" },
|
||||
{ sizeof( "constexpr" ), "constexpr" },
|
||||
{ sizeof( "constinit" ), "constinit" },
|
||||
{ sizeof( "explicit" ), "explicit" },
|
||||
{ sizeof( "extern" ), "extern" },
|
||||
{ sizeof( "forceinline" ), "forceinline" },
|
||||
{ sizeof( "global" ), "global" },
|
||||
{ sizeof( "inline" ), "inline" },
|
||||
{ sizeof( "internal" ), "internal" },
|
||||
{ sizeof( "local_persist" ), "local_persist" },
|
||||
{ sizeof( "mutable" ), "mutable" },
|
||||
{ sizeof( "neverinline" ), "neverinline" },
|
||||
{ sizeof( "*" ), "*" },
|
||||
{ sizeof( "&" ), "&" },
|
||||
{ sizeof( "register" ), "register" },
|
||||
{ sizeof( "&&" ), "&&" },
|
||||
{ sizeof( "static" ), "static" },
|
||||
{ sizeof( "thread_local" ), "thread_local" },
|
||||
{ sizeof( "virtual" ), "virtual" },
|
||||
{ sizeof( "const" ), "const" },
|
||||
{ sizeof( "final" ), "final" },
|
||||
{ sizeof( "noexcept" ), "noexcept" },
|
||||
{ sizeof( "override" ), "override" },
|
||||
{ sizeof( "= 0" ), "= 0" },
|
||||
{ sizeof( "volatile" ), "volatile" },
|
||||
};
|
||||
return lookup[type];
|
||||
}
|
||||
|
||||
inline bool is_trailing( Type specifier )
|
||||
inline Specifier to_specifier( StrC str )
|
||||
{
|
||||
local_persist u32 keymap[Spec_NumSpecifiers];
|
||||
do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
return specifier > Virtual;
|
||||
StrC enum_str = to_str( (Specifier)index );
|
||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
||||
}
|
||||
|
||||
inline StrC to_str( Type type )
|
||||
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
local_persist StrC lookup[] {
|
||||
{ sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "consteval" ), "consteval" },
|
||||
{ sizeof( "constexpr" ), "constexpr" },
|
||||
{ sizeof( "constinit" ), "constinit" },
|
||||
{ sizeof( "explicit" ), "explicit" },
|
||||
{ sizeof( "extern" ), "extern" },
|
||||
{ sizeof( "forceinline" ), "forceinline" },
|
||||
{ sizeof( "global" ), "global" },
|
||||
{ sizeof( "inline" ), "inline" },
|
||||
{ sizeof( "internal" ), "internal" },
|
||||
{ sizeof( "local_persist" ), "local_persist" },
|
||||
{ sizeof( "mutable" ), "mutable" },
|
||||
{ sizeof( "neverinline" ), "neverinline" },
|
||||
{ sizeof( "*" ), "*" },
|
||||
{ sizeof( "&" ), "&" },
|
||||
{ sizeof( "register" ), "register" },
|
||||
{ sizeof( "&&" ), "&&" },
|
||||
{ sizeof( "static" ), "static" },
|
||||
{ sizeof( "thread_local" ), "thread_local" },
|
||||
{ sizeof( "virtual" ), "virtual" },
|
||||
{ sizeof( "const" ), "const" },
|
||||
{ sizeof( "final" ), "final" },
|
||||
{ sizeof( "noexcept" ), "noexcept" },
|
||||
{ sizeof( "override" ), "override" },
|
||||
{ sizeof( "= 0" ), "= 0" },
|
||||
{ sizeof( "volatile" ), "volatile" },
|
||||
};
|
||||
return lookup[type];
|
||||
if ( keymap[index] == hash )
|
||||
return (Specifier)index;
|
||||
}
|
||||
|
||||
inline Type to_type( StrC str )
|
||||
{
|
||||
local_persist u32 keymap[NumSpecifiers];
|
||||
do_once_start for ( u32 index = 0; index < NumSpecifiers; index++ )
|
||||
{
|
||||
StrC enum_str = to_str( (Type)index );
|
||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
||||
}
|
||||
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
||||
for ( u32 index = 0; index < NumSpecifiers; index++ )
|
||||
{
|
||||
if ( keymap[index] == hash )
|
||||
return (Type)index;
|
||||
}
|
||||
return Invalid;
|
||||
}
|
||||
|
||||
} // namespace ESpecifier
|
||||
|
||||
using SpecifierT = ESpecifier::Type;
|
||||
return Spec_Invalid;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
GEN_NS_PARSER_BEGIN
|
||||
#define GEN_DEFINE_ATTRIBUTE_TOKENS Entry( Tok_Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Tok_Attribute_API_Import, "GEN_API_Import_Code" )
|
||||
|
||||
typedef TokType_Def TokType;
|
||||
typedef enum TokType_Def TokType;
|
||||
|
||||
enum TokType_Def : u32
|
||||
{
|
||||
@ -216,7 +216,7 @@ inline StrC to_str( TokType type )
|
||||
return lookup[type];
|
||||
}
|
||||
|
||||
inline TokType to_type( StrC str )
|
||||
inline TokType to_toktype( StrC str )
|
||||
{
|
||||
local_persist u32 keymap[Tok_NumTokens];
|
||||
do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ )
|
||||
|
@ -232,7 +232,7 @@ CodeParam end(CodeParam params)
|
||||
|
||||
#pragma region CodeSpecifiers
|
||||
inline
|
||||
bool append(CodeSpecifiers self, SpecifierT spec )
|
||||
bool append(CodeSpecifiers self, Specifier spec )
|
||||
{
|
||||
if ( self.ast == nullptr )
|
||||
{
|
||||
@ -250,7 +250,7 @@ bool append(CodeSpecifiers self, SpecifierT spec )
|
||||
return true;
|
||||
}
|
||||
inline
|
||||
s32 has(CodeSpecifiers self, SpecifierT spec)
|
||||
s32 has(CodeSpecifiers self, Specifier spec)
|
||||
{
|
||||
GEN_ASSERT(self.ast != nullptr);
|
||||
for ( s32 idx = 0; idx < self->NumEntries; idx++ ) {
|
||||
@ -260,7 +260,7 @@ s32 has(CodeSpecifiers self, SpecifierT spec)
|
||||
return -1;
|
||||
}
|
||||
inline
|
||||
s32 remove( CodeSpecifiers self, SpecifierT to_remove )
|
||||
s32 remove( CodeSpecifiers self, Specifier to_remove )
|
||||
{
|
||||
AST_Specifiers* ast = self.ast;
|
||||
if ( ast == nullptr )
|
||||
@ -280,7 +280,7 @@ s32 remove( CodeSpecifiers self, SpecifierT to_remove )
|
||||
s32 next = 0;
|
||||
for(; next < self->NumEntries; ++ curr, ++ next)
|
||||
{
|
||||
SpecifierT spec = self->ArrSpecs[next];
|
||||
Specifier spec = self->ArrSpecs[next];
|
||||
if (spec == to_remove)
|
||||
{
|
||||
result = next;
|
||||
@ -301,7 +301,7 @@ s32 remove( CodeSpecifiers self, SpecifierT to_remove )
|
||||
return result;
|
||||
}
|
||||
inline
|
||||
SpecifierT* begin(CodeSpecifiers self)
|
||||
Specifier* begin(CodeSpecifiers self)
|
||||
{
|
||||
if ( self.ast )
|
||||
return & self->ArrSpecs[0];
|
||||
@ -309,7 +309,7 @@ SpecifierT* begin(CodeSpecifiers self)
|
||||
return nullptr;
|
||||
}
|
||||
inline
|
||||
SpecifierT* end(CodeSpecifiers self)
|
||||
Specifier* end(CodeSpecifiers self)
|
||||
{
|
||||
return self->ArrSpecs + self->NumEntries;
|
||||
}
|
||||
|
@ -192,32 +192,32 @@ void define_constants()
|
||||
# undef internal
|
||||
# undef local_persist
|
||||
# undef neverinline
|
||||
def_constant_spec( const, ESpecifier::Const );
|
||||
def_constant_spec( consteval, ESpecifier::Consteval );
|
||||
def_constant_spec( constexpr, ESpecifier::Constexpr );
|
||||
def_constant_spec( constinit, ESpecifier::Constinit );
|
||||
def_constant_spec( extern_linkage, ESpecifier::External_Linkage );
|
||||
def_constant_spec( final, ESpecifier::Final );
|
||||
def_constant_spec( forceinline, ESpecifier::ForceInline );
|
||||
def_constant_spec( global, ESpecifier::Global );
|
||||
def_constant_spec( inline, ESpecifier::Inline );
|
||||
def_constant_spec( internal_linkage, ESpecifier::Internal_Linkage );
|
||||
def_constant_spec( local_persist, ESpecifier::Local_Persist );
|
||||
def_constant_spec( mutable, ESpecifier::Mutable );
|
||||
def_constant_spec( neverinline, ESpecifier::NeverInline );
|
||||
def_constant_spec( noexcept, ESpecifier::NoExceptions );
|
||||
def_constant_spec( override, ESpecifier::Override );
|
||||
def_constant_spec( ptr, ESpecifier::Ptr );
|
||||
def_constant_spec( pure, ESpecifier::Pure )
|
||||
def_constant_spec( ref, ESpecifier::Ref );
|
||||
def_constant_spec( register, ESpecifier::Register );
|
||||
def_constant_spec( rvalue, ESpecifier::RValue );
|
||||
def_constant_spec( static_member, ESpecifier::Static );
|
||||
def_constant_spec( thread_local, ESpecifier::Thread_Local );
|
||||
def_constant_spec( virtual, ESpecifier::Virtual );
|
||||
def_constant_spec( volatile, ESpecifier::Volatile)
|
||||
def_constant_spec( const, Spec_Const );
|
||||
def_constant_spec( consteval, Spec_Consteval );
|
||||
def_constant_spec( constexpr, Spec_Constexpr );
|
||||
def_constant_spec( constinit, Spec_Constinit );
|
||||
def_constant_spec( extern_linkage, Spec_External_Linkage );
|
||||
def_constant_spec( final, Spec_Final );
|
||||
def_constant_spec( forceinline, Spec_ForceInline );
|
||||
def_constant_spec( global, Spec_Global );
|
||||
def_constant_spec( inline, Spec_Inline );
|
||||
def_constant_spec( internal_linkage, Spec_Internal_Linkage );
|
||||
def_constant_spec( local_persist, Spec_Local_Persist );
|
||||
def_constant_spec( mutable, Spec_Mutable );
|
||||
def_constant_spec( neverinline, Spec_NeverInline );
|
||||
def_constant_spec( noexcept, Spec_NoExceptions );
|
||||
def_constant_spec( override, Spec_Override );
|
||||
def_constant_spec( ptr, Spec_Ptr );
|
||||
def_constant_spec( pure, Spec_Pure )
|
||||
def_constant_spec( ref, Spec_Ref );
|
||||
def_constant_spec( register, Spec_Register );
|
||||
def_constant_spec( rvalue, Spec_RValue );
|
||||
def_constant_spec( static_member, Spec_Static );
|
||||
def_constant_spec( thread_local, Spec_Thread_Local );
|
||||
def_constant_spec( virtual, Spec_Virtual );
|
||||
def_constant_spec( volatile, Spec_Volatile)
|
||||
|
||||
spec_local_persist = def_specifiers( 1, ESpecifier::Local_Persist );
|
||||
spec_local_persist = def_specifiers( 1, Spec_Local_Persist );
|
||||
set_global(spec_local_persist);
|
||||
|
||||
# pragma pop_macro("forceinline")
|
||||
|
@ -120,7 +120,7 @@ CodePragma def_pragma( StrC directive );
|
||||
|
||||
CodePreprocessCond def_preprocess_cond( EPreprocessCond type, StrC content );
|
||||
|
||||
CodeSpecifiers def_specifier( SpecifierT specifier );
|
||||
CodeSpecifiers def_specifier( Specifier specifier );
|
||||
|
||||
CodeStruct def_struct( StrC name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
|
||||
@ -186,7 +186,7 @@ CodeBody def_namespace_body ( s32 num, Code* codes );
|
||||
CodeParam def_params ( s32 num, ... );
|
||||
CodeParam def_params ( s32 num, CodeParam* params );
|
||||
CodeSpecifiers def_specifiers ( s32 num, ... );
|
||||
CodeSpecifiers def_specifiers ( s32 num, SpecifierT* specs );
|
||||
CodeSpecifiers def_specifiers ( s32 num, Specifier* specs );
|
||||
CodeBody def_struct_body ( s32 num, ... );
|
||||
CodeBody def_struct_body ( s32 num, Code* codes );
|
||||
CodeBody def_union_body ( s32 num, ... );
|
||||
|
@ -36,30 +36,30 @@ CodeConstructor parse_constructor( StrC def )
|
||||
// TODO(Ed): Constructors can have prefix attributes
|
||||
|
||||
CodeSpecifiers specifiers;
|
||||
SpecifierT specs_found[ 16 ] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[ 16 ] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
b32 ignore_spec = false;
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::Explicit:
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::NeverInline :
|
||||
case Spec_Constexpr :
|
||||
case Spec_Explicit:
|
||||
case Spec_Inline :
|
||||
case Spec_ForceInline :
|
||||
case Spec_NeverInline :
|
||||
break;
|
||||
|
||||
case ESpecifier::Const :
|
||||
case Spec_Const :
|
||||
ignore_spec = true;
|
||||
break;
|
||||
|
||||
default :
|
||||
log_failure( "Invalid specifier %s for variable\n%s", ESpecifier::to_str( spec ), to_string(Context) );
|
||||
log_failure( "Invalid specifier %s for variable\n%s", to_str( spec ), to_string(Context) );
|
||||
pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ CodePreprocessCond def_preprocess_cond( EPreprocessCond type, StrC expr )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeSpecifiers def_specifier( SpecifierT spec )
|
||||
CodeSpecifiers def_specifier( Specifier spec )
|
||||
{
|
||||
CodeSpecifiers
|
||||
result = (CodeSpecifiers) make_code();
|
||||
@ -2149,7 +2149,7 @@ CodeSpecifiers def_specifiers( s32 num, ... )
|
||||
va_start(va, num);
|
||||
do
|
||||
{
|
||||
SpecifierT type = (SpecifierT)va_arg(va, int);
|
||||
Specifier type = (Specifier)va_arg(va, int);
|
||||
|
||||
append(result, type );
|
||||
}
|
||||
@ -2159,7 +2159,7 @@ CodeSpecifiers def_specifiers( s32 num, ... )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeSpecifiers def_specifiers( s32 num, SpecifierT* specs )
|
||||
CodeSpecifiers def_specifiers( s32 num, Specifier* specs )
|
||||
{
|
||||
if ( num <= 0 )
|
||||
{
|
||||
|
@ -233,7 +233,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
|
||||
ctx->token.Length++;
|
||||
}
|
||||
|
||||
ctx->token.Type = to_type( to_str(ctx->token) );
|
||||
ctx->token.Type = to_toktype( to_str(ctx->token) );
|
||||
|
||||
bool is_preprocessor = ctx->token.Type >= Tok_Preprocess_Define && ctx->token.Type <= Tok_Preprocess_Pragma;
|
||||
if ( ! is_preprocessor )
|
||||
@ -458,7 +458,7 @@ void lex_found_token( LexContext* ctx )
|
||||
return;
|
||||
}
|
||||
|
||||
TokType type = to_type( to_str(ctx->token) );
|
||||
TokType type = to_toktype( to_str(ctx->token) );
|
||||
|
||||
if (type <= Tok_Access_Public && type >= Tok_Access_Private )
|
||||
{
|
||||
|
@ -989,39 +989,39 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
||||
case Tok_Spec_Volatile:
|
||||
case Tok_Spec_Virtual:
|
||||
{
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[16] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
b32 ignore_spec = false;
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Constexpr:
|
||||
case ESpecifier::Constinit:
|
||||
case ESpecifier::Explicit:
|
||||
case ESpecifier::Inline:
|
||||
case ESpecifier::ForceInline:
|
||||
case ESpecifier::Mutable:
|
||||
case ESpecifier::NeverInline:
|
||||
case ESpecifier::Static:
|
||||
case ESpecifier::Volatile:
|
||||
case ESpecifier::Virtual:
|
||||
case Spec_Constexpr:
|
||||
case Spec_Constinit:
|
||||
case Spec_Explicit:
|
||||
case Spec_Inline:
|
||||
case Spec_ForceInline:
|
||||
case Spec_Mutable:
|
||||
case Spec_NeverInline:
|
||||
case Spec_Static:
|
||||
case Spec_Volatile:
|
||||
case Spec_Virtual:
|
||||
break;
|
||||
|
||||
case ESpecifier::Consteval:
|
||||
case Spec_Consteval:
|
||||
expects_function = true;
|
||||
break;
|
||||
|
||||
case ESpecifier::Const :
|
||||
case Spec_Const :
|
||||
ignore_spec = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "Invalid specifier %s for variable\n%s", ESpecifier::to_str(spec), to_string(Context) );
|
||||
log_failure( "Invalid specifier %s for variable\n%s", to_str(spec), to_string(Context) );
|
||||
pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -1182,13 +1182,13 @@ Code parse_complicated_definition( TokType which )
|
||||
}
|
||||
|
||||
Token tok = tokens.Arr[ idx - 1 ];
|
||||
if ( is_specifier(tok) && is_trailing( ESpecifier::to_type( to_str(tok))) )
|
||||
if ( is_specifier(tok) && is_trailing( to_specifier( to_str(tok))) )
|
||||
{
|
||||
// <which> <type_identifier>(...) <specifier> ...;
|
||||
|
||||
s32 spec_idx = idx - 1;
|
||||
Token spec = tokens.Arr[spec_idx];
|
||||
while ( is_specifier(spec) && is_trailing( ESpecifier::to_type( to_str(spec))) )
|
||||
while ( is_specifier(spec) && is_trailing( to_specifier( to_str(spec))) )
|
||||
{
|
||||
-- spec_idx;
|
||||
spec = tokens.Arr[spec_idx];
|
||||
@ -1442,12 +1442,12 @@ CodeFn parse_function_after_name(
|
||||
{
|
||||
if ( specifiers.ast == nullptr )
|
||||
{
|
||||
specifiers = def_specifier( ESpecifier::to_type( to_str(currtok)) );
|
||||
specifiers = def_specifier( to_specifier( to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
continue;
|
||||
}
|
||||
|
||||
append(specifiers, ESpecifier::to_type( to_str(currtok)) );
|
||||
append(specifiers, to_specifier( to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
}
|
||||
// <Attributes> <Specifiers> <ReturnType> <Name> ( <Paraemters> ) <Specifiers>
|
||||
@ -1467,7 +1467,7 @@ CodeFn parse_function_after_name(
|
||||
else if ( check(Tok_Operator) && currtok.Text[0] == '=' )
|
||||
{
|
||||
eat(Tok_Operator);
|
||||
append(specifiers, ESpecifier::Pure );
|
||||
append(specifiers, Spec_Pure );
|
||||
|
||||
eat( Tok_Number);
|
||||
Token stmt_end = currtok;
|
||||
@ -1768,40 +1768,40 @@ CodeBody parse_global_nspace( CodeT which )
|
||||
case Tok_Spec_NeverInline:
|
||||
case Tok_Spec_Static:
|
||||
{
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[16] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
bool ignore_spec = false;
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Constexpr:
|
||||
case ESpecifier::Constinit:
|
||||
case ESpecifier::ForceInline:
|
||||
case ESpecifier::Global:
|
||||
case ESpecifier::External_Linkage:
|
||||
case ESpecifier::Internal_Linkage:
|
||||
case ESpecifier::Inline:
|
||||
case ESpecifier::Mutable:
|
||||
case ESpecifier::NeverInline:
|
||||
case ESpecifier::Static:
|
||||
case ESpecifier::Volatile:
|
||||
case Spec_Constexpr:
|
||||
case Spec_Constinit:
|
||||
case Spec_ForceInline:
|
||||
case Spec_Global:
|
||||
case Spec_External_Linkage:
|
||||
case Spec_Internal_Linkage:
|
||||
case Spec_Inline:
|
||||
case Spec_Mutable:
|
||||
case Spec_NeverInline:
|
||||
case Spec_Static:
|
||||
case Spec_Volatile:
|
||||
break;
|
||||
|
||||
case ESpecifier::Consteval:
|
||||
case Spec_Consteval:
|
||||
expects_function = true;
|
||||
break;
|
||||
|
||||
case ESpecifier::Const:
|
||||
case Spec_Const:
|
||||
ignore_spec = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
StrC spec_str = ESpecifier::to_str(spec);
|
||||
StrC spec_str = to_str(spec);
|
||||
|
||||
log_failure( "Invalid specifier %.*s for variable\n%s", spec_str.Len, spec_str, to_string(Context) );
|
||||
pop(& Context);
|
||||
@ -2445,12 +2445,12 @@ CodeOperator parse_operator_after_ret_type(
|
||||
{
|
||||
if ( specifiers.ast == nullptr )
|
||||
{
|
||||
specifiers = def_specifier( ESpecifier::to_type( to_str(currtok)) );
|
||||
specifiers = def_specifier( to_specifier( to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
continue;
|
||||
}
|
||||
|
||||
append(specifiers, ESpecifier::to_type( to_str(currtok)) );
|
||||
append(specifiers, to_specifier( to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
}
|
||||
// <ExportFlag> <Attributes> <Specifiers> <ReturnType> <Qualifier::...> operator <Op> ( <Parameters> ) <Specifiers>
|
||||
@ -3284,12 +3284,12 @@ CodeVar parse_variable_declaration_list()
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Const:
|
||||
if ( specifiers->NumEntries && specifiers->ArrSpecs[ specifiers->NumEntries - 1 ] != ESpecifier::Ptr )
|
||||
case Spec_Const:
|
||||
if ( specifiers->NumEntries && specifiers->ArrSpecs[ specifiers->NumEntries - 1 ] != Spec_Ptr )
|
||||
{
|
||||
log_failure( "Error, const specifier must come after pointer specifier for variable declaration proceeding comma\n"
|
||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%s"
|
||||
@ -3299,9 +3299,9 @@ CodeVar parse_variable_declaration_list()
|
||||
}
|
||||
break;
|
||||
|
||||
case ESpecifier::Ptr:
|
||||
case ESpecifier::Ref:
|
||||
case ESpecifier::RValue:
|
||||
case Spec_Ptr:
|
||||
case Spec_Ref:
|
||||
case Spec_RValue:
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -3457,9 +3457,9 @@ CodeDestructor parse_destructor( CodeSpecifiers specifiers )
|
||||
if ( check( Tok_Spec_Virtual ) )
|
||||
{
|
||||
if ( specifiers )
|
||||
append(specifiers, ESpecifier::Virtual );
|
||||
append(specifiers, Spec_Virtual );
|
||||
else
|
||||
specifiers = def_specifier( ESpecifier::Virtual );
|
||||
specifiers = def_specifier( Spec_Virtual );
|
||||
eat( Tok_Spec_Virtual );
|
||||
}
|
||||
// <Virtual Specifier>
|
||||
@ -3500,7 +3500,7 @@ CodeDestructor parse_destructor( CodeSpecifiers specifiers )
|
||||
eat( Tok_Number );
|
||||
// <Virtual Specifier> ~<Name>() = 0
|
||||
|
||||
append(specifiers, ESpecifier::Pure );
|
||||
append(specifiers, Spec_Pure );
|
||||
}
|
||||
else if ( left && str_compare( upcoming.Text, "default", sizeof("default") - 1 ) == 0)
|
||||
{
|
||||
@ -3562,7 +3562,7 @@ CodeEnum parse_enum( bool inplace_def )
|
||||
using namespace ECode;
|
||||
push_scope();
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[16] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
CodeAttributes attributes = { nullptr };
|
||||
@ -3939,7 +3939,7 @@ CodeFn parse_function()
|
||||
{
|
||||
push_scope();
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[16] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
CodeAttributes attributes = { nullptr };
|
||||
@ -3958,27 +3958,27 @@ CodeFn parse_function()
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Const:
|
||||
case ESpecifier::Consteval:
|
||||
case ESpecifier::Constexpr:
|
||||
case ESpecifier::External_Linkage:
|
||||
case ESpecifier::ForceInline:
|
||||
case ESpecifier::Inline:
|
||||
case ESpecifier::NeverInline:
|
||||
case ESpecifier::Static:
|
||||
case Spec_Const:
|
||||
case Spec_Consteval:
|
||||
case Spec_Constexpr:
|
||||
case Spec_External_Linkage:
|
||||
case Spec_ForceInline:
|
||||
case Spec_Inline:
|
||||
case Spec_NeverInline:
|
||||
case Spec_Static:
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "Invalid specifier %s for functon\n%s", ESpecifier::to_str(spec), to_string(Context) );
|
||||
log_failure( "Invalid specifier %s for functon\n%s", to_str(spec), to_string(Context) );
|
||||
pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( spec == ESpecifier::Const )
|
||||
if ( spec == Spec_Const )
|
||||
continue;
|
||||
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
@ -4056,7 +4056,7 @@ CodeOperator parse_operator()
|
||||
CodeSpecifiers specifiers = { nullptr };
|
||||
ModuleFlag mflags = ModuleFlag_None;
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[16] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
if ( check(Tok_Module_Export) )
|
||||
@ -4071,25 +4071,25 @@ CodeOperator parse_operator()
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Const:
|
||||
case ESpecifier::Constexpr:
|
||||
case ESpecifier::ForceInline:
|
||||
case ESpecifier::Inline:
|
||||
case ESpecifier::NeverInline:
|
||||
case ESpecifier::Static:
|
||||
case Spec_Const:
|
||||
case Spec_Constexpr:
|
||||
case Spec_ForceInline:
|
||||
case Spec_Inline:
|
||||
case Spec_NeverInline:
|
||||
case Spec_Static:
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "Invalid specifier " "%s" " for operator\n%s", ESpecifier::to_str(spec), to_string(Context) );
|
||||
log_failure( "Invalid specifier " "%s" " for operator\n%s", to_str(spec), to_string(Context) );
|
||||
pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( spec == ESpecifier::Const )
|
||||
if ( spec == Spec_Const )
|
||||
continue;
|
||||
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
@ -4154,10 +4154,10 @@ CodeOpCast parse_operator_cast( CodeSpecifiers specifiers )
|
||||
if ( check(Tok_Spec_Const))
|
||||
{
|
||||
if ( specifiers.ast == nullptr )
|
||||
specifiers = def_specifier( ESpecifier::Const );
|
||||
specifiers = def_specifier( Spec_Const );
|
||||
|
||||
else
|
||||
append(specifiers, ESpecifier::Const );
|
||||
append(specifiers, Spec_Const );
|
||||
|
||||
eat( Tok_Spec_Const );
|
||||
}
|
||||
@ -4302,7 +4302,7 @@ CodeTemplate parse_template()
|
||||
|
||||
bool expects_function = false;
|
||||
|
||||
SpecifierT specs_found[ 16 ] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[ 16 ] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
attributes = parse_attributes();
|
||||
@ -4312,36 +4312,36 @@ CodeTemplate parse_template()
|
||||
{
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Const :
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::Constinit :
|
||||
case ESpecifier::External_Linkage :
|
||||
case ESpecifier::Global :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::Local_Persist :
|
||||
case ESpecifier::Mutable :
|
||||
case ESpecifier::Static :
|
||||
case ESpecifier::Thread_Local :
|
||||
case ESpecifier::Volatile :
|
||||
case Spec_Const :
|
||||
case Spec_Constexpr :
|
||||
case Spec_Constinit :
|
||||
case Spec_External_Linkage :
|
||||
case Spec_Global :
|
||||
case Spec_Inline :
|
||||
case Spec_ForceInline :
|
||||
case Spec_Local_Persist :
|
||||
case Spec_Mutable :
|
||||
case Spec_Static :
|
||||
case Spec_Thread_Local :
|
||||
case Spec_Volatile :
|
||||
break;
|
||||
|
||||
case ESpecifier::Consteval :
|
||||
case Spec_Consteval :
|
||||
expects_function = true;
|
||||
break;
|
||||
|
||||
default :
|
||||
log_failure( "Invalid specifier %s for variable or function\n%s", ESpecifier::to_str( spec ), to_string(Context) );
|
||||
log_failure( "Invalid specifier %s for variable or function\n%s", to_str( spec ), to_string(Context) );
|
||||
pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
// Ignore const it will be handled by the type
|
||||
if ( spec == ESpecifier::Const )
|
||||
if ( spec == Spec_Const )
|
||||
break;
|
||||
|
||||
specs_found[ NumSpecifiers ] = spec;
|
||||
@ -4442,7 +4442,7 @@ CodeType parse_type( bool from_template, bool* typedef_is_function )
|
||||
|
||||
Token context_tok = prevtok;
|
||||
|
||||
SpecifierT specs_found[ 16 ] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[ 16 ] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
Token name = { nullptr, 0, Tok_Invalid };
|
||||
@ -4454,9 +4454,9 @@ CodeType parse_type( bool from_template, bool* typedef_is_function )
|
||||
// Prefix specifiers
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
if ( spec != ESpecifier::Const )
|
||||
if ( spec != Spec_Const )
|
||||
{
|
||||
log_failure( "Error, invalid specifier used in type definition: %s\n%s", currtok.Text, to_string(Context) );
|
||||
pop(& Context);
|
||||
@ -4580,9 +4580,9 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
// Suffix specifiers for typename.
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
if ( spec != ESpecifier::Const && spec != ESpecifier::Ptr && spec != ESpecifier::Ref && spec != ESpecifier::RValue )
|
||||
if ( spec != Spec_Const && spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
||||
{
|
||||
log_failure( "Error, invalid specifier used in type definition: %s\n%s", currtok.Text, to_string(Context) );
|
||||
pop(& Context);
|
||||
@ -4677,7 +4677,7 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
|
||||
#else
|
||||
if ( NumSpecifiers )
|
||||
return_type->Specs = def_specifiers( NumSpecifiers, ( SpecifierT* )specs_found );
|
||||
return_type->Specs = def_specifiers( NumSpecifiers, ( Specifier* )specs_found );
|
||||
|
||||
// Reset specifiers, the function itself will have its own suffix specifiers possibly.
|
||||
NumSpecifiers = 0;
|
||||
@ -4713,9 +4713,9 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
// Binding specifiers
|
||||
while ( left && currtok.is_specifier() )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( currtok );
|
||||
Specifier spec = to_type( currtok );
|
||||
|
||||
if ( spec != ESpecifier::Ptr && spec != ESpecifier::Ref && spec != ESpecifier::RValue )
|
||||
if ( spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
||||
{
|
||||
log_failure( "Error, invalid specifier used in type definition: %s\n%s", currtok.Text, to_string(Context) );
|
||||
pop(& Context);
|
||||
@ -4780,12 +4780,12 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
// Look for suffix specifiers for the function
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
if ( spec != ESpecifier::Const
|
||||
if ( spec != Spec_Const
|
||||
// TODO : Add support for NoExcept, l-value, volatile, l-value, etc
|
||||
// && spec != ESpecifier::NoExcept
|
||||
&& spec != ESpecifier::RValue )
|
||||
// && spec != Spec_NoExcept
|
||||
&& spec != Spec_RValue )
|
||||
{
|
||||
log_failure( "Error, invalid specifier used in type definition: %s\n%s", currtok.Text, to_string(Context) );
|
||||
pop(& Context);
|
||||
@ -4852,7 +4852,7 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
#else
|
||||
if ( NumSpecifiers )
|
||||
{
|
||||
Code specifiers = def_specifiers( NumSpecifiers, ( SpecifierT* )specs_found );
|
||||
Code specifiers = def_specifiers( NumSpecifiers, ( Specifier* )specs_found );
|
||||
result->Specs = specifiers;
|
||||
}
|
||||
#endif
|
||||
@ -5230,7 +5230,7 @@ CodeUsing parse_using()
|
||||
{
|
||||
push_scope();
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::Invalid };
|
||||
Specifier specs_found[16] { Spec_Invalid };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
Token name = { nullptr, 0, Tok_Invalid };
|
||||
@ -5330,7 +5330,7 @@ CodeVar parse_variable()
|
||||
{
|
||||
push_scope();
|
||||
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
Specifier specs_found[16] { Spec_NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
|
||||
ModuleFlag mflags = ModuleFlag_None;
|
||||
@ -5349,31 +5349,31 @@ CodeVar parse_variable()
|
||||
|
||||
while ( left && is_specifier(currtok) )
|
||||
{
|
||||
SpecifierT spec = ESpecifier::to_type( to_str(currtok) );
|
||||
Specifier spec = to_specifier( to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
case ESpecifier::Const:
|
||||
case ESpecifier::Constexpr:
|
||||
case ESpecifier::Constinit:
|
||||
case ESpecifier::External_Linkage:
|
||||
case ESpecifier::Global:
|
||||
case ESpecifier::Inline:
|
||||
case ESpecifier::Local_Persist:
|
||||
case ESpecifier::Mutable:
|
||||
case ESpecifier::Static:
|
||||
case ESpecifier::Thread_Local:
|
||||
case ESpecifier::Volatile:
|
||||
case Spec_Const:
|
||||
case Spec_Constexpr:
|
||||
case Spec_Constinit:
|
||||
case Spec_External_Linkage:
|
||||
case Spec_Global:
|
||||
case Spec_Inline:
|
||||
case Spec_Local_Persist:
|
||||
case Spec_Mutable:
|
||||
case Spec_Static:
|
||||
case Spec_Thread_Local:
|
||||
case Spec_Volatile:
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "Invalid specifier %s for variable\n%s", ESpecifier::to_str( spec ), to_string(Context) );
|
||||
log_failure( "Invalid specifier %s for variable\n%s", to_str( spec ), to_string(Context) );
|
||||
pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
// Ignore const specifiers, they're handled by the type
|
||||
if ( spec == ESpecifier::Const )
|
||||
if ( spec == Spec_Const )
|
||||
break;
|
||||
|
||||
specs_found[NumSpecifiers] = spec;
|
||||
|
@ -132,23 +132,23 @@ CodeBody gen_especifier( char const* path )
|
||||
char const* enum_str = enum_strs[idx].string;
|
||||
char const* entry_to_str = str_strs [idx].string;
|
||||
|
||||
append_fmt( & enum_entries, "%s,\n", enum_str );
|
||||
append_fmt( & enum_entries, "Spec_%s,\n", enum_str );
|
||||
append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);
|
||||
}
|
||||
|
||||
CodeEnum enum_code = parse_enum(token_fmt("entries", (StrC)enum_entries, stringize(
|
||||
enum Type : u32
|
||||
enum Specifier_Def : u32
|
||||
{
|
||||
<entries>
|
||||
NumSpecifiers
|
||||
Spec_NumSpecifiers
|
||||
};
|
||||
)));
|
||||
|
||||
CodeFn is_trailing = parse_function(token_fmt("specifier", (StrC)to_str_entries, stringize(
|
||||
inline
|
||||
bool is_trailing( Type specifier )
|
||||
bool is_trailing( Specifier specifier )
|
||||
{
|
||||
return specifier > Virtual;
|
||||
return specifier > Spec_Virtual;
|
||||
}
|
||||
)));
|
||||
|
||||
@ -164,7 +164,7 @@ CodeBody gen_especifier( char const* path )
|
||||
#undef neverinline
|
||||
CodeFn to_str = parse_function(token_fmt("entries", (StrC)to_str_entries, stringize(
|
||||
inline
|
||||
StrC to_str( Type type )
|
||||
StrC to_str( Specifier type )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[] {
|
||||
@ -177,14 +177,14 @@ CodeBody gen_especifier( char const* path )
|
||||
|
||||
CodeFn to_type = parse_function( token_fmt( "entries", (StrC)to_str_entries, stringize(
|
||||
inline
|
||||
Type to_type( StrC str )
|
||||
Specifier to_specifier( StrC str )
|
||||
{
|
||||
local_persist
|
||||
u32 keymap[ NumSpecifiers ];
|
||||
u32 keymap[ Spec_NumSpecifiers ];
|
||||
do_once_start
|
||||
for ( u32 index = 0; index < NumSpecifiers; index++ )
|
||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
StrC enum_str = to_str( (Type)index );
|
||||
StrC enum_str = to_str( (Specifier)index );
|
||||
|
||||
// We subtract 1 to remove the null terminator
|
||||
// This is because the tokens lexed are not null terminated.
|
||||
@ -194,13 +194,13 @@ CodeBody gen_especifier( char const* path )
|
||||
|
||||
u32 hash = crc32( str.Ptr, str.Len );
|
||||
|
||||
for ( u32 index = 0; index < NumSpecifiers; index++ )
|
||||
for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
if ( keymap[index] == hash )
|
||||
return (Type)index;
|
||||
return (Specifier)index;
|
||||
}
|
||||
|
||||
return Invalid;
|
||||
return Spec_Invalid;
|
||||
}
|
||||
)));
|
||||
#pragma pop_macro("local_persist")
|
||||
@ -209,11 +209,11 @@ CodeBody gen_especifier( char const* path )
|
||||
#pragma pop_macro("forceinline")
|
||||
#pragma pop_macro("neverinline")
|
||||
|
||||
CodeNS nspace = def_namespace( name(ESpecifier), def_namespace_body( args( enum_code, is_trailing, to_str, to_type ) ) );
|
||||
//CodeNS nspace = def_namespace( name(ESpecifier), def_namespace_body( args( enum_code, is_trailing, to_str, to_type ) ) );
|
||||
//CodeUsing specifier_t = def_using( name(SpecifierT), def_type( name(ESpecifier::Type) ) );
|
||||
CodeTypedef specifier_t = parse_typedef( code(typedef enum Specifier_Def Specifier; ));
|
||||
|
||||
CodeUsing specifier_t = def_using( name(SpecifierT), def_type( name(ESpecifier::Type) ) );
|
||||
|
||||
return def_global_body( args( nspace, specifier_t, fmt_newline ) );
|
||||
return def_global_body( args( specifier_t, enum_code, is_trailing, to_str, to_type, fmt_newline ) );
|
||||
}
|
||||
|
||||
CodeBody gen_etoktype( char const* etok_path, char const* attr_path )
|
||||
@ -305,7 +305,7 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path )
|
||||
|
||||
CodeFn to_type = parse_function( token_fmt( "entries", (StrC)to_str_entries, stringize(
|
||||
inline
|
||||
TokType to_type( StrC str )
|
||||
TokType to_toktype( StrC str )
|
||||
{
|
||||
local_persist
|
||||
u32 keymap[ Tok_NumTokens ];
|
||||
@ -336,7 +336,7 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path )
|
||||
#pragma pop_macro("do_once_end")
|
||||
|
||||
//CodeNS nspace = def_namespace( name(ETokType), def_namespace_body( args( attribute_entires_def, enum_code, to_str, to_type ) ) );
|
||||
CodeTypedef td_toktype = parse_typedef( code( typedef TokType_Def TokType; ));
|
||||
CodeTypedef td_toktype = parse_typedef( code( typedef enum TokType_Def TokType; ));
|
||||
|
||||
return def_global_body( args(
|
||||
attribute_entires_def,
|
||||
|
Loading…
Reference in New Issue
Block a user