reduction done on eoperator

This commit is contained in:
Edward R. Gonzalez 2024-12-03 13:51:29 -05:00
parent c6fba23173
commit 72d088c566
10 changed files with 222 additions and 229 deletions

View File

@ -202,7 +202,7 @@ char const* debug_str(Code self)
append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" ); append_fmt( result, "\n\tNext: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
break; break;
case Operator: case ECode::Operator:
case Operator_Member: case Operator_Member:
if ( self->Prev ) if ( self->Prev )
append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" ); append_fmt( result, "\n\tPrev: %S %S", type_str(self->Prev), self->Prev->Name ? self->Prev->Name : "Null" );
@ -482,7 +482,7 @@ void to_string( Code self, String* result )
to_string(cast(CodeNS, self), result ); to_string(cast(CodeNS, self), result );
break; break;
case Operator: case ECode::Operator:
case Operator_Member: case Operator_Member:
to_string_def(cast(CodeOperator, self), result ); to_string_def(cast(CodeOperator, self), result );
break; break;
@ -860,7 +860,7 @@ bool is_equal( Code self, Code other )
return true; return true;
} }
case Operator: case ECode::Operator:
case Operator_Member: case Operator_Member:
{ {
check_member_val( ModuleFlags ); check_member_val( ModuleFlags );

View File

@ -359,7 +359,7 @@ struct AST
union { union {
b32 IsFunction; // Used by typedef to not serialize the name field. b32 IsFunction; // Used by typedef to not serialize the name field.
b32 IsParamPack; // Used by typename to know if type should be considered a parameter pack. b32 IsParamPack; // Used by typename to know if type should be considered a parameter pack.
OperatorT Op; Operator Op;
AccessSpec ParentAccess; AccessSpec ParentAccess;
s32 NumEntries; s32 NumEntries;
s32 VarConstructorInit; // Used by variables to know that initialization is using a constructor expression instead of an assignment expression. s32 VarConstructorInit; // Used by variables to know that initialization is using a constructor expression instead of an assignment expression.

View File

@ -8,7 +8,7 @@
case Global_Body: \ case Global_Body: \
case Namespace: \ case Namespace: \
case Namespace_Body: \ case Namespace_Body: \
case Operator: \ case ECode::Operator: \
case Operator_Fwd: \ case Operator_Fwd: \
case Parameters: \ case Parameters: \
case Specifiers: \ case Specifiers: \
@ -30,7 +30,7 @@
case Global_Body: \ case Global_Body: \
case Namespace: \ case Namespace: \
case Namespace_Body: \ case Namespace_Body: \
case Operator: \ case ECode::Operator: \
case Operator_Fwd: \ case Operator_Fwd: \
case Operator_Member: \ case Operator_Member: \
case Operator_Member_Fwd: \ case Operator_Member_Fwd: \

View File

@ -605,7 +605,7 @@ struct AST_Operator
StringCached Name; StringCached Name;
CodeT Type; CodeT Type;
ModuleFlag ModuleFlags; ModuleFlag ModuleFlags;
OperatorT Op; Operator Op;
}; };
static_assert( sizeof(AST_Operator) == sizeof(AST), "ERROR: AST_Operator is not the same size as AST"); static_assert( sizeof(AST_Operator) == sizeof(AST), "ERROR: AST_Operator is not the same size as AST");

View File

@ -636,7 +636,7 @@ String to_string(CodeOperator self)
switch ( self->Type ) switch ( self->Type )
{ {
using namespace ECode; using namespace ECode;
case Operator: case ECode::Operator:
case Operator_Member: case Operator_Member:
to_string_def( self, & result ); to_string_def( self, & result );
break; break;

View File

@ -5,62 +5,62 @@
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
namespace EOperator typedef enum Operator_Def Operator;
{
enum Type : u32
{
Invalid,
Assign,
Assign_Add,
Assign_Subtract,
Assign_Multiply,
Assign_Divide,
Assign_Modulo,
Assign_BAnd,
Assign_BOr,
Assign_BXOr,
Assign_LShift,
Assign_RShift,
Increment,
Decrement,
Unary_Plus,
Unary_Minus,
UnaryNot,
Add,
Subtract,
Multiply,
Divide,
Modulo,
BNot,
BAnd,
BOr,
BXOr,
LShift,
RShift,
LAnd,
LOr,
LEqual,
LNot,
Lesser,
Greater,
LesserEqual,
GreaterEqual,
Subscript,
Indirection,
AddressOf,
MemberOfPointer,
PtrToMemOfPtr,
FunctionCall,
Comma,
New,
NewArray,
Delete,
DeleteArray,
NumOps
};
inline StrC to_str( Type op ) enum Operator_Def : u32
{ {
Op_Invalid,
Op_Assign,
Op_Assign_Add,
Op_Assign_Subtract,
Op_Assign_Multiply,
Op_Assign_Divide,
Op_Assign_Modulo,
Op_Assign_BAnd,
Op_Assign_BOr,
Op_Assign_BXOr,
Op_Assign_LShift,
Op_Assign_RShift,
Op_Increment,
Op_Decrement,
Op_Unary_Plus,
Op_Unary_Minus,
Op_UnaryNot,
Op_Add,
Op_Subtract,
Op_Multiply,
Op_Divide,
Op_Modulo,
Op_BNot,
Op_BAnd,
Op_BOr,
Op_BXOr,
Op_LShift,
Op_RShift,
Op_LAnd,
Op_LOr,
Op_LEqual,
Op_LNot,
Op_Lesser,
Op_Greater,
Op_LesserEqual,
Op_GreaterEqual,
Op_Subscript,
Op_Indirection,
Op_AddressOf,
Op_MemberOfPointer,
Op_PtrToMemOfPtr,
Op_FunctionCall,
Op_Comma,
Op_New,
Op_NewArray,
Op_Delete,
Op_DeleteArray,
NumOps
};
inline StrC to_str( Operator op )
{
local_persist StrC lookup[] { local_persist StrC lookup[] {
{ sizeof( "INVALID" ), "INVALID" }, { sizeof( "INVALID" ), "INVALID" },
{ sizeof( "=" ), "=" }, { sizeof( "=" ), "=" },
@ -111,8 +111,4 @@ namespace EOperator
{ sizeof( "delete[]" ), "delete[]" }, { sizeof( "delete[]" ), "delete[]" },
}; };
return lookup[op]; return lookup[op];
} }
} // namespace EOperator
using OperatorT = EOperator::Type;

View File

@ -106,7 +106,7 @@ struct Opts_def_operator {
CodeAttributes attributes; CodeAttributes attributes;
ModuleFlag mflags; ModuleFlag mflags;
}; };
CodeOperator def_operator( OperatorT op, StrC nspace, Opts_def_operator opts GEN_PARAM_DEFAULT ); CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator opts GEN_PARAM_DEFAULT );
struct Opts_def_operator_cast { struct Opts_def_operator_cast {
Code body; Code body;

View File

@ -12,11 +12,9 @@ enum class OpValidateResult : u32
Member Member
}; };
OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeType ret_type, CodeSpecifiers specifier ) OpValidateResult operator__validate( Operator op, CodeParam params_code, CodeType ret_type, CodeSpecifiers specifier )
{ {
using namespace EOperator; if ( op == Op_Invalid )
if ( op == EOperator::Invalid )
{ {
log_failure("gen::def_operator: op cannot be invalid"); log_failure("gen::def_operator: op cannot be invalid");
return OpValidateResult::Fail; return OpValidateResult::Fail;
@ -65,7 +63,7 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
switch ( op ) switch ( op )
{ {
# define specs( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__ # define specs( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__
case Assign: case Op_Assign:
check_params(); check_params();
if ( params_code->NumEntries > 1 ) if ( params_code->NumEntries > 1 )
@ -81,16 +79,16 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
is_member_symbol = true; is_member_symbol = true;
break; break;
case Assign_Add: case Op_Assign_Add:
case Assign_Subtract: case Op_Assign_Subtract:
case Assign_Multiply: case Op_Assign_Multiply:
case Assign_Divide: case Op_Assign_Divide:
case Assign_Modulo: case Op_Assign_Modulo:
case Assign_BAnd: case Op_Assign_BAnd:
case Assign_BOr: case Op_Assign_BOr:
case Assign_BXOr: case Op_Assign_BXOr:
case Assign_LShift: case Op_Assign_LShift:
case Assign_RShift: case Op_Assign_RShift:
check_params(); check_params();
if ( params_code->NumEntries == 1 ) if ( params_code->NumEntries == 1 )
@ -110,8 +108,8 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case Increment: case Op_Increment:
case Decrement: case Op_Decrement:
// If its not set, it just means its a prefix member op. // If its not set, it just means its a prefix member op.
if ( params_code ) if ( params_code )
{ {
@ -157,8 +155,8 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case Unary_Plus: case Op_Unary_Plus:
case Unary_Minus: case Op_Unary_Minus:
if ( ! params_code ) if ( ! params_code )
is_member_symbol = true; is_member_symbol = true;
@ -193,7 +191,7 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case BNot: case Op_BNot:
{ {
// Some compilers let you do this... // Some compilers let you do this...
#if 0 #if 0
@ -228,16 +226,16 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
break; break;
} }
case Add: case Op_Add:
case Subtract: case Op_Subtract:
case Multiply: case Op_Multiply:
case Divide: case Op_Divide:
case Modulo: case Op_Modulo:
case BAnd: case Op_BAnd:
case BOr: case Op_BOr:
case BXOr: case Op_BXOr:
case LShift: case Op_LShift:
case RShift: case Op_RShift:
check_params(); check_params();
switch ( params_code->NumEntries ) switch ( params_code->NumEntries )
@ -269,7 +267,7 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case UnaryNot: case Op_UnaryNot:
if ( ! params_code ) if ( ! params_code )
is_member_symbol = true; is_member_symbol = true;
@ -301,14 +299,14 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case LAnd: case Op_LAnd:
case LOr: case Op_LOr:
case LEqual: case Op_LEqual:
case LNot: case Op_LNot:
case Lesser: case Op_Lesser:
case Greater: case Op_Greater:
case LesserEqual: case Op_LesserEqual:
case GreaterEqual: case Op_GreaterEqual:
check_params(); check_params();
switch ( params_code->NumEntries ) switch ( params_code->NumEntries )
@ -329,9 +327,9 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case Indirection: case Op_Indirection:
case AddressOf: case Op_AddressOf:
case MemberOfPointer: case Op_MemberOfPointer:
if ( params_code && params_code->NumEntries > 1) if ( params_code && params_code->NumEntries > 1)
{ {
log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1" log_failure("gen::def_operator: operator%s recieved unexpected number of paramters recived %d instead of 0-1"
@ -346,7 +344,7 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case PtrToMemOfPtr: case Op_PtrToMemOfPtr:
if ( params_code ) if ( params_code )
{ {
log_failure("gen::def_operator: operator%s expects no paramters - %s", to_str(op), debug_str(params_code)); log_failure("gen::def_operator: operator%s expects no paramters - %s", to_str(op), debug_str(params_code));
@ -354,14 +352,14 @@ OpValidateResult operator__validate( OperatorT op, CodeParam params_code, CodeTy
} }
break; break;
case Subscript: case Op_Subscript:
case FunctionCall: case Op_FunctionCall:
case Comma: case Op_Comma:
check_params(); check_params();
break; break;
case New: case Op_New:
case Delete: case Op_Delete:
// This library doesn't support validating new and delete yet. // This library doesn't support validating new and delete yet.
break; break;
# undef specs # undef specs
@ -956,7 +954,7 @@ CodeNS def_namespace( StrC name, Code body, Opts_def_namespace p )
return result; return result;
} }
CodeOperator def_operator( OperatorT op, StrC nspace, Opts_def_operator p ) CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator p )
{ {
CodeParam params_code = p.params; CodeParam params_code = p.params;
CodeType ret_type = p.ret_type; CodeType ret_type = p.ret_type;

View File

@ -2135,7 +2135,6 @@ CodeOperator parse_operator_after_ret_type(
, CodeType ret_type , CodeType ret_type
) )
{ {
using namespace EOperator;
push_scope(); push_scope();
Token nspace = NullToken; Token nspace = NullToken;
@ -2171,19 +2170,19 @@ CodeOperator parse_operator_after_ret_type(
bool was_new_or_delete = false; bool was_new_or_delete = false;
OperatorT op = Invalid; Operator op = Op_Invalid;
switch ( currtok.Text[0] ) switch ( currtok.Text[0] )
{ {
case '+': case '+':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_Add; op = Op_Assign_Add;
else if ( currtok.Text[1] == '+' ) else if ( currtok.Text[1] == '+' )
op = Increment; op = Op_Increment;
else else
op = Add; op = Op_Add;
} }
break; break;
case '-': case '-':
@ -2191,25 +2190,25 @@ CodeOperator parse_operator_after_ret_type(
if ( currtok.Text[1] == '>' ) if ( currtok.Text[1] == '>' )
{ {
if ( currtok.Text[2] == '*' ) if ( currtok.Text[2] == '*' )
op = MemberOfPointer; op = Op_MemberOfPointer;
else else
op = MemberOfPointer; op = Op_MemberOfPointer;
break; break;
} }
else if ( currtok.Text[1] == '=' ) else if ( currtok.Text[1] == '=' )
op = Assign_Subtract; op = Op_Assign_Subtract;
else else
op = Subtract; op = Op_Subtract;
} }
break; break;
case '*': case '*':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_Multiply; op = Op_Assign_Multiply;
else else
{ {
@ -2218,154 +2217,154 @@ CodeOperator parse_operator_after_ret_type(
{ {
if ( finder.Type == Tok_Identifier) if ( finder.Type == Tok_Identifier)
{ {
op = Indirection; op = Op_Indirection;
break; break;
} }
} }
if ( op == Invalid) if ( op == Op_Invalid)
op = Multiply; op = Op_Multiply;
} }
} }
break; break;
case '/': case '/':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_Divide; op = Op_Assign_Divide;
else else
op = Divide; op = Op_Divide;
} }
break; break;
case '%': case '%':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_Modulo; op = Op_Assign_Modulo;
else else
op = Modulo; op = Op_Modulo;
} }
break; break;
case '&': case '&':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_BAnd; op = Op_Assign_BAnd;
else if ( currtok.Text[1] == '&' ) else if ( currtok.Text[1] == '&' )
op = LAnd; op = Op_LAnd;
else else
{ {
if ( op == Invalid ) if ( op == Op_Invalid )
op = BAnd; op = Op_BAnd;
} }
} }
break; break;
case '|': case '|':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_BOr; op = Op_Assign_BOr;
else if ( currtok.Text[1] == '|' ) else if ( currtok.Text[1] == '|' )
op = LOr; op = Op_LOr;
else else
op = BOr; op = Op_BOr;
} }
break; break;
case '^': case '^':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = Assign_BXOr; op = Op_Assign_BXOr;
else else
op = BXOr; op = Op_BXOr;
} }
break; break;
case '~': case '~':
{ {
op = BNot; op = Op_BNot;
} }
break; break;
case '!': case '!':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = LNot; op = Op_LNot;
else else
op = UnaryNot; op = Op_UnaryNot;
} }
break; break;
case '=': case '=':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = LEqual; op = Op_LEqual;
else else
op = Assign; op = Op_Assign;
} }
break; break;
case '<': case '<':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = LEqual; op = Op_LEqual;
else if ( currtok.Text[1] == '<' ) else if ( currtok.Text[1] == '<' )
{ {
if ( currtok.Text[2] == '=' ) if ( currtok.Text[2] == '=' )
op = Assign_LShift; op = Op_Assign_LShift;
else else
op = LShift; op = Op_LShift;
} }
else else
op = Lesser; op = Op_Lesser;
} }
break; break;
case '>': case '>':
{ {
if ( currtok.Text[1] == '=' ) if ( currtok.Text[1] == '=' )
op = GreaterEqual; op = Op_GreaterEqual;
else if ( currtok.Text[1] == '>' ) else if ( currtok.Text[1] == '>' )
{ {
if ( currtok.Text[2] == '=' ) if ( currtok.Text[2] == '=' )
op = Assign_RShift; op = Op_Assign_RShift;
else else
op = RShift; op = Op_RShift;
} }
else else
op = Greater; op = Op_Greater;
} }
break; break;
case '(': case '(':
{ {
if ( currtok.Text[1] == ')' ) if ( currtok.Text[1] == ')' )
op = FunctionCall; op = Op_FunctionCall;
else else
op = Invalid; op = Op_Invalid;
} }
break; break;
case '[': case '[':
{ {
if ( currtok.Text[1] == ']' ) if ( currtok.Text[1] == ']' )
op = Subscript; op = Op_Subscript;
else else
op = Invalid; op = Op_Invalid;
} }
break; break;
default: default:
{ {
StrC str_new = to_str(OperatorT::New); StrC str_new = to_str(Op_New);
StrC str_delete = to_str(OperatorT::Delete); StrC str_delete = to_str(Op_Delete);
if ( str_compare( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0) if ( str_compare( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0)
{ {
op = OperatorT::New; op = Op_New;
eat( Tok_Identifier ); eat( Tok_Identifier );
was_new_or_delete = true; was_new_or_delete = true;
@ -2378,18 +2377,18 @@ CodeOperator parse_operator_after_ret_type(
if ( currtok.Type == Tok_Operator && str_compare(currtok.Text, "[]", 2) == 0) if ( currtok.Type == Tok_Operator && str_compare(currtok.Text, "[]", 2) == 0)
{ {
eat(Tok_Operator); eat(Tok_Operator);
op = OperatorT::NewArray; op = Op_NewArray;
} }
else if ( currtok.Type == Tok_BraceSquare_Open && next.Type == Tok_BraceSquare_Close) else if ( currtok.Type == Tok_BraceSquare_Open && next.Type == Tok_BraceSquare_Close)
{ {
eat(Tok_BraceSquare_Open); eat(Tok_BraceSquare_Open);
eat(Tok_BraceSquare_Close); eat(Tok_BraceSquare_Close);
op = OperatorT::NewArray; op = Op_NewArray;
} }
} }
else if ( str_compare( currtok.Text, str_delete.Ptr, max(str_delete.Len - 1, currtok.Length )) == 0) else if ( str_compare( currtok.Text, str_delete.Ptr, max(str_delete.Len - 1, currtok.Length )) == 0)
{ {
op = OperatorT::Delete; op = Op_Delete;
eat(Tok_Identifier); eat(Tok_Identifier);
was_new_or_delete = true; was_new_or_delete = true;
@ -2402,18 +2401,18 @@ CodeOperator parse_operator_after_ret_type(
if ( currtok.Type == Tok_Operator && str_compare(currtok.Text, "[]", 2) == 0) if ( currtok.Type == Tok_Operator && str_compare(currtok.Text, "[]", 2) == 0)
{ {
eat(Tok_Operator); eat(Tok_Operator);
op = OperatorT::DeleteArray; op = Op_DeleteArray;
} }
else if ( currtok.Type == Tok_BraceSquare_Open && next.Type == Tok_BraceSquare_Close) else if ( currtok.Type == Tok_BraceSquare_Open && next.Type == Tok_BraceSquare_Close)
{ {
eat(Tok_BraceSquare_Open); eat(Tok_BraceSquare_Open);
eat(Tok_BraceSquare_Close); eat(Tok_BraceSquare_Close);
op = OperatorT::DeleteArray; op = Op_DeleteArray;
} }
} }
else else
{ {
if ( op == Invalid ) if ( op == Op_Invalid )
{ {
log_failure( "Invalid operator '%s'\n%s", prevtok.Text, to_string(Context) ); log_failure( "Invalid operator '%s'\n%s", prevtok.Text, to_string(Context) );
pop(& Context); pop(& Context);
@ -2423,7 +2422,7 @@ CodeOperator parse_operator_after_ret_type(
} }
} }
if ( op == Invalid ) if ( op == Op_Invalid )
{ {
log_failure( "Invalid operator '%s'\n%s", currtok.Text, to_string(Context) ); log_failure( "Invalid operator '%s'\n%s", currtok.Text, to_string(Context) );
pop(& Context); pop(& Context);
@ -2438,8 +2437,8 @@ CodeOperator parse_operator_after_ret_type(
CodeParam params = parse_params(); CodeParam params = parse_params();
// <ExportFlag> <Attributes> <Specifiers> <ReturnType> <Qualifier::...> operator <Op> ( <Parameters> ) // <ExportFlag> <Attributes> <Specifiers> <ReturnType> <Qualifier::...> operator <Op> ( <Parameters> )
if ( params.ast == nullptr && op == EOperator::Multiply ) if ( params.ast == nullptr && op == Op_Multiply )
op = MemberOfPointer; op = Op_MemberOfPointer;
while ( left && is_specifier(currtok) ) while ( left && is_specifier(currtok) )
{ {

View File

@ -76,12 +76,12 @@ CodeBody gen_eoperator( char const* path )
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 = str_strs [idx].string;
append_fmt( & enum_entries, "%s,\n", enum_str ); append_fmt( & enum_entries, "Op_%s,\n", enum_str );
append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_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( CodeEnum enum_code = parse_enum(token_fmt("entries", (StrC)enum_entries, stringize(
enum Type : u32 enum Operator_Def : u32
{ {
<entries> <entries>
NumOps NumOps
@ -92,7 +92,7 @@ CodeBody gen_eoperator( char const* path )
#undef local_persist #undef local_persist
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(
inline inline
StrC to_str( Type op ) StrC to_str( Operator op )
{ {
local_persist local_persist
StrC lookup[] { StrC lookup[] {
@ -104,11 +104,11 @@ CodeBody gen_eoperator( char const* path )
))); )));
#pragma pop_macro("local_persist") #pragma pop_macro("local_persist")
CodeNS nspace = def_namespace( name(EOperator), def_namespace_body( args( enum_code, to_str ) ) ); //CodeNS nspace = def_namespace( name(EOperator), def_namespace_body( args( enum_code, to_str ) ) );
//CodeUsing operator_t = def_using( name(OperatorT), def_type( name(EOperator::Type) ) );
CodeTypedef operator_t = parse_typedef(code( typedef enum Operator_Def Operator; ));
CodeUsing operator_t = def_using( name(OperatorT), def_type( name(EOperator::Type) ) ); return def_global_body( args( operator_t, enum_code, to_str, fmt_newline ) );
return def_global_body( args( nspace, operator_t, fmt_newline ) );
} }
CodeBody gen_especifier( char const* path ) CodeBody gen_especifier( char const* path )