mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 15:54:45 -08:00
No longer using components/temp/ast_inlines (switched to helper function to avoid macro usage)
Increased the arg count support of num_args to 100.
This commit is contained in:
parent
00f6c45f15
commit
97750388ad
@ -13,7 +13,7 @@ CodeExtern parse_extern_link ( StrC exten_link_def);
|
|||||||
CodeFriend parse_friend ( StrC friend_def );
|
CodeFriend parse_friend ( StrC friend_def );
|
||||||
CodeFn parse_function ( StrC fn_def );
|
CodeFn parse_function ( StrC fn_def );
|
||||||
CodeBody parse_global_body ( StrC body_def );
|
CodeBody parse_global_body ( StrC body_def );
|
||||||
CodeNamespace parse_namespace ( StrC namespace_def );
|
CodeNS parse_namespace ( StrC namespace_def );
|
||||||
CodeOperator parse_operator ( StrC operator_def );
|
CodeOperator parse_operator ( StrC operator_def );
|
||||||
CodeOpCast parse_operator_cast( StrC operator_def );
|
CodeOpCast parse_operator_cast( StrC operator_def );
|
||||||
CodeStruct parse_struct ( StrC struct_def );
|
CodeStruct parse_struct ( StrC struct_def );
|
||||||
|
@ -195,7 +195,7 @@ The following CodeTypes are used which the user may optionally use strong typing
|
|||||||
* CodeFriend
|
* CodeFriend
|
||||||
* CodeFn
|
* CodeFn
|
||||||
* CodeModule
|
* CodeModule
|
||||||
* CodeNamespace
|
* CodeNS
|
||||||
* CodeOperator
|
* CodeOperator
|
||||||
* CodeOpCast
|
* CodeOpCast
|
||||||
* CodeParam : Has support for `for-range` iterating across parameters.
|
* CodeParam : Has support for `for-range` iterating across parameters.
|
||||||
|
@ -906,7 +906,31 @@ bool AST::validate_body()
|
|||||||
CheckEntries( GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES );
|
||||||
break;
|
break;
|
||||||
case Global_Body:
|
case Global_Body:
|
||||||
CheckEntries( GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES );
|
for (Code entry : cast<CodeBody>())
|
||||||
|
{
|
||||||
|
switch (entry->Type)
|
||||||
|
{
|
||||||
|
case Access_Public:
|
||||||
|
case Access_Protected:
|
||||||
|
case Access_Private:
|
||||||
|
case PlatformAttributes:
|
||||||
|
case Class_Body:
|
||||||
|
case Enum_Body:
|
||||||
|
case Execution:
|
||||||
|
case Friend:
|
||||||
|
case Function_Body:
|
||||||
|
case Global_Body:
|
||||||
|
case Namespace_Body:
|
||||||
|
case Operator_Member:
|
||||||
|
case Operator_Member_Fwd:
|
||||||
|
case Parameters:
|
||||||
|
case Specifiers:
|
||||||
|
case Struct_Body:
|
||||||
|
case Typename:
|
||||||
|
log_failure("AST::validate_body: Invalid entry in body %s", entry.debug_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Namespace_Body:
|
case Namespace_Body:
|
||||||
CheckEntries( GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES );
|
CheckEntries( GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES );
|
||||||
|
@ -11,7 +11,7 @@ struct AST_Include;
|
|||||||
struct AST_Friend;
|
struct AST_Friend;
|
||||||
struct AST_Fn;
|
struct AST_Fn;
|
||||||
struct AST_Module;
|
struct AST_Module;
|
||||||
struct AST_Namespace;
|
struct AST_NS;
|
||||||
struct AST_Operator;
|
struct AST_Operator;
|
||||||
struct AST_OpCast;
|
struct AST_OpCast;
|
||||||
struct AST_Param;
|
struct AST_Param;
|
||||||
@ -40,7 +40,7 @@ struct CodeInclude;
|
|||||||
struct CodeFriend;
|
struct CodeFriend;
|
||||||
struct CodeFn;
|
struct CodeFn;
|
||||||
struct CodeModule;
|
struct CodeModule;
|
||||||
struct CodeNamespace;
|
struct CodeNS;
|
||||||
struct CodeOperator;
|
struct CodeOperator;
|
||||||
struct CodeOpCast;
|
struct CodeOpCast;
|
||||||
struct CodeParam;
|
struct CodeParam;
|
||||||
@ -117,7 +117,7 @@ struct Code
|
|||||||
operator CodeFriend() const;
|
operator CodeFriend() const;
|
||||||
operator CodeFn() const;
|
operator CodeFn() const;
|
||||||
operator CodeModule() const;
|
operator CodeModule() const;
|
||||||
operator CodeNamespace() const;
|
operator CodeNS() const;
|
||||||
operator CodeOperator() const;
|
operator CodeOperator() const;
|
||||||
operator CodeOpCast() const;
|
operator CodeOpCast() const;
|
||||||
operator CodeParam() const;
|
operator CodeParam() const;
|
||||||
@ -180,7 +180,7 @@ struct AST
|
|||||||
operator CodeFriend();
|
operator CodeFriend();
|
||||||
operator CodeFn();
|
operator CodeFn();
|
||||||
operator CodeModule();
|
operator CodeModule();
|
||||||
operator CodeNamespace();
|
operator CodeNS();
|
||||||
operator CodeOperator();
|
operator CodeOperator();
|
||||||
operator CodeOpCast();
|
operator CodeOpCast();
|
||||||
operator CodeParam();
|
operator CodeParam();
|
||||||
@ -558,7 +558,7 @@ Define_CodeType( Include );
|
|||||||
Define_CodeType( Friend );
|
Define_CodeType( Friend );
|
||||||
Define_CodeType( Fn );
|
Define_CodeType( Fn );
|
||||||
Define_CodeType( Module );
|
Define_CodeType( Module );
|
||||||
Define_CodeType( Namespace );
|
Define_CodeType( NS );
|
||||||
Define_CodeType( Operator );
|
Define_CodeType( Operator );
|
||||||
Define_CodeType( OpCast );
|
Define_CodeType( OpCast );
|
||||||
Define_CodeType( Pragma );
|
Define_CodeType( Pragma );
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
case Execution: \
|
case Execution: \
|
||||||
case Friend: \
|
case Friend: \
|
||||||
case Function_Body: \
|
case Function_Body: \
|
||||||
case Global_Body: \
|
|
||||||
case Namespace_Body: \
|
case Namespace_Body: \
|
||||||
case Operator_Member: \
|
case Operator_Member: \
|
||||||
case Operator_Member_Fwd: \
|
case Operator_Member_Fwd: \
|
||||||
|
@ -216,7 +216,7 @@ struct AST_Module
|
|||||||
};
|
};
|
||||||
static_assert( sizeof(AST_Module) == sizeof(AST), "ERROR: AST_Module is not the same size as AST");
|
static_assert( sizeof(AST_Module) == sizeof(AST), "ERROR: AST_Module is not the same size as AST");
|
||||||
|
|
||||||
struct AST_Namespace
|
struct AST_NS
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
|
char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
|
||||||
@ -233,7 +233,7 @@ struct AST_Namespace
|
|||||||
ModuleFlag ModuleFlags;
|
ModuleFlag ModuleFlags;
|
||||||
char _PAD_UNUSED_[ sizeof(u32) ];
|
char _PAD_UNUSED_[ sizeof(u32) ];
|
||||||
};
|
};
|
||||||
static_assert( sizeof(AST_Namespace) == sizeof(AST), "ERROR: AST_Namespace is not the same size as AST");
|
static_assert( sizeof(AST_NS) == sizeof(AST), "ERROR: AST_NS is not the same size as AST");
|
||||||
|
|
||||||
struct AST_Operator
|
struct AST_Operator
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ CodeFn def_function( StrC name
|
|||||||
|
|
||||||
CodeInclude def_include ( StrC content );
|
CodeInclude def_include ( StrC content );
|
||||||
CodeModule def_module ( StrC name, ModuleFlag mflags = ModuleFlag::None );
|
CodeModule def_module ( StrC name, ModuleFlag mflags = ModuleFlag::None );
|
||||||
CodeNamespace def_namespace( StrC name, Code body, ModuleFlag mflags = ModuleFlag::None );
|
CodeNS def_namespace( StrC name, Code body, ModuleFlag mflags = ModuleFlag::None );
|
||||||
|
|
||||||
CodeOperator def_operator( OperatorT op, StrC nspace
|
CodeOperator def_operator( OperatorT op, StrC nspace
|
||||||
, CodeParam params = NoCode, CodeType ret_type = NoCode, Code body = NoCode
|
, CodeParam params = NoCode, CodeType ret_type = NoCode, Code body = NoCode
|
||||||
@ -143,7 +143,7 @@ CodeExtern parse_extern_link ( StrC exten_link_def);
|
|||||||
CodeFriend parse_friend ( StrC friend_def );
|
CodeFriend parse_friend ( StrC friend_def );
|
||||||
CodeFn parse_function ( StrC fn_def );
|
CodeFn parse_function ( StrC fn_def );
|
||||||
CodeBody parse_global_body ( StrC body_def );
|
CodeBody parse_global_body ( StrC body_def );
|
||||||
CodeNamespace parse_namespace ( StrC namespace_def );
|
CodeNS parse_namespace ( StrC namespace_def );
|
||||||
CodeOperator parse_operator ( StrC operator_def );
|
CodeOperator parse_operator ( StrC operator_def );
|
||||||
CodeOpCast parse_operator_cast( StrC operator_def );
|
CodeOpCast parse_operator_cast( StrC operator_def );
|
||||||
CodeStruct parse_struct ( StrC struct_def );
|
CodeStruct parse_struct ( StrC struct_def );
|
||||||
|
@ -1120,7 +1120,7 @@ internal CodeBody parse_extern_link_body();
|
|||||||
internal CodeExtern parse_exten_link ();
|
internal CodeExtern parse_exten_link ();
|
||||||
internal CodeFriend parse_friend ();
|
internal CodeFriend parse_friend ();
|
||||||
internal CodeFn parse_function ();
|
internal CodeFn parse_function ();
|
||||||
internal CodeNamespace parse_namespace ();
|
internal CodeNS parse_namespace ();
|
||||||
internal CodeOpCast parse_operator_cast ();
|
internal CodeOpCast parse_operator_cast ();
|
||||||
internal CodeStruct parse_struct ( bool inplace_def = false );
|
internal CodeStruct parse_struct ( bool inplace_def = false );
|
||||||
internal CodeVar parse_variable ();
|
internal CodeVar parse_variable ();
|
||||||
@ -3071,7 +3071,10 @@ CodeBody parse_global_nspace( CodeT which )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( found_operator_cast )
|
if ( found_operator_cast )
|
||||||
|
{
|
||||||
member = parse_operator_cast();
|
member = parse_operator_cast();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
member = parse_operator_function_or_variable( expects_function, attributes, specifiers );
|
member = parse_operator_function_or_variable( expects_function, attributes, specifiers );
|
||||||
}
|
}
|
||||||
@ -3566,7 +3569,7 @@ CodeBody parse_global_body( StrC def )
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal
|
internal
|
||||||
CodeNamespace parse_namespace()
|
CodeNS parse_namespace()
|
||||||
{
|
{
|
||||||
using namespace Parser;
|
using namespace Parser;
|
||||||
push_scope();
|
push_scope();
|
||||||
@ -3583,8 +3586,8 @@ CodeNamespace parse_namespace()
|
|||||||
return CodeInvalid;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeNamespace
|
CodeNS
|
||||||
result = (CodeNamespace) make_code();
|
result = (CodeNS) make_code();
|
||||||
result->Type = ECode::Namespace;
|
result->Type = ECode::Namespace;
|
||||||
result->Name = get_cached_string( name );
|
result->Name = get_cached_string( name );
|
||||||
|
|
||||||
@ -3594,7 +3597,7 @@ CodeNamespace parse_namespace()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeNamespace parse_namespace( StrC def )
|
CodeNS parse_namespace( StrC def )
|
||||||
{
|
{
|
||||||
check_parse_args( def );
|
check_parse_args( def );
|
||||||
using namespace Parser;
|
using namespace Parser;
|
||||||
|
@ -763,7 +763,7 @@ CodeModule def_module( StrC name, ModuleFlag mflags )
|
|||||||
return (CodeModule) result;
|
return (CodeModule) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeNamespace def_namespace( StrC name, Code body, ModuleFlag mflags )
|
CodeNS def_namespace( StrC name, Code body, ModuleFlag mflags )
|
||||||
{
|
{
|
||||||
using namespace ECode;
|
using namespace ECode;
|
||||||
|
|
||||||
@ -776,8 +776,8 @@ CodeNamespace def_namespace( StrC name, Code body, ModuleFlag mflags )
|
|||||||
return CodeInvalid;
|
return CodeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeNamespace
|
CodeNS
|
||||||
result = (CodeNamespace) make_code();
|
result = (CodeNS) make_code();
|
||||||
result->Type = Namespace;
|
result->Type = Namespace;
|
||||||
result->Name = get_cached_string( name );
|
result->Name = get_cached_string( name );
|
||||||
result->ModuleFlags = mflags;
|
result->ModuleFlags = mflags;
|
||||||
@ -1732,6 +1732,10 @@ CodeBody def_global_body( s32 num, ... )
|
|||||||
|
|
||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
|
case Global_Body:
|
||||||
|
result.append( entry.cast<CodeBody>() ) ;
|
||||||
|
continue;
|
||||||
|
|
||||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||||
return (*Code::Invalid.ast);
|
return (*Code::Invalid.ast);
|
||||||
@ -1769,6 +1773,10 @@ CodeBody def_global_body( s32 num, Code* codes )
|
|||||||
|
|
||||||
switch (entry->Type)
|
switch (entry->Type)
|
||||||
{
|
{
|
||||||
|
case Global_Body:
|
||||||
|
result.append( entry.cast<CodeBody>() ) ;
|
||||||
|
continue;
|
||||||
|
|
||||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||||
return CodeInvalid;
|
return CodeInvalid;
|
||||||
|
@ -91,7 +91,7 @@ Define_CodeImpl( CodeInclude );
|
|||||||
Define_CodeImpl( CodeFriend );
|
Define_CodeImpl( CodeFriend );
|
||||||
Define_CodeImpl( CodeFn );
|
Define_CodeImpl( CodeFn );
|
||||||
Define_CodeImpl( CodeModule );
|
Define_CodeImpl( CodeModule );
|
||||||
Define_CodeImpl( CodeNamespace );
|
Define_CodeImpl( CodeNS );
|
||||||
Define_CodeImpl( CodeOperator );
|
Define_CodeImpl( CodeOperator );
|
||||||
Define_CodeImpl( CodeOpCast );
|
Define_CodeImpl( CodeOpCast );
|
||||||
Define_CodeImpl( CodeParam );
|
Define_CodeImpl( CodeParam );
|
||||||
@ -125,7 +125,7 @@ Define_AST_Cast( Include );
|
|||||||
Define_AST_Cast( Friend );
|
Define_AST_Cast( Friend );
|
||||||
Define_AST_Cast( Fn );
|
Define_AST_Cast( Fn );
|
||||||
Define_AST_Cast( Module );
|
Define_AST_Cast( Module );
|
||||||
Define_AST_Cast( Namespace );
|
Define_AST_Cast( NS );
|
||||||
Define_AST_Cast( Operator );
|
Define_AST_Cast( Operator );
|
||||||
Define_AST_Cast( OpCast );
|
Define_AST_Cast( OpCast );
|
||||||
Define_AST_Cast( Param );
|
Define_AST_Cast( Param );
|
||||||
@ -158,7 +158,7 @@ Define_CodeCast( Include );
|
|||||||
Define_CodeCast( Friend );
|
Define_CodeCast( Friend );
|
||||||
Define_CodeCast( Fn );
|
Define_CodeCast( Fn );
|
||||||
Define_CodeCast( Module );
|
Define_CodeCast( Module );
|
||||||
Define_CodeCast( Namespace );
|
Define_CodeCast( NS );
|
||||||
Define_CodeCast( Operator );
|
Define_CodeCast( Operator );
|
||||||
Define_CodeCast( OpCast );
|
Define_CodeCast( OpCast );
|
||||||
Define_CodeCast( Param );
|
Define_CodeCast( Param );
|
||||||
|
@ -23,44 +23,65 @@
|
|||||||
// Num Arguments (Varadics)
|
// Num Arguments (Varadics)
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
// Supports 0-50 arguments
|
// Supports 0-50 arguments
|
||||||
#define num_args_impl( _0, \
|
#define num_args_impl( _0, \
|
||||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||||
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
||||||
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
||||||
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
||||||
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
||||||
N, ... \
|
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
|
||||||
|
_61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
|
||||||
|
_71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
|
||||||
|
_81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
|
||||||
|
_91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
|
||||||
|
N, ... \
|
||||||
) N
|
) N
|
||||||
|
|
||||||
// ## deletes preceding comma if _VA_ARGS__ is empty (GCC, Clang)
|
// ## deletes preceding comma if _VA_ARGS__ is empty (GCC, Clang)
|
||||||
#define num_args(...) \
|
#define num_args(...) \
|
||||||
num_args_impl(_, ## __VA_ARGS__, \
|
num_args_impl(_, ## __VA_ARGS__, \
|
||||||
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
|
||||||
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
|
||||||
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
|
||||||
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
|
||||||
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, \
|
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
|
||||||
0 \
|
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||||
|
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||||
|
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
||||||
|
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
||||||
|
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, \
|
||||||
|
0 \
|
||||||
)
|
)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Supports 1-50 arguments
|
// Supports 1-50 arguments
|
||||||
#define num_args_impl( \
|
#define num_args_impl( \
|
||||||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
|
||||||
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
_11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \
|
||||||
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
_21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \
|
||||||
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
_31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \
|
||||||
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
_41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \
|
||||||
N, ... \
|
_51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \
|
||||||
|
_61, _62, _63, _64, _65, _66, _67, _68, _69, _70, \
|
||||||
|
_71, _72, _73, _74, _75, _76, _77, _78, _79, _80, \
|
||||||
|
_81, _82, _83, _84, _85, _86, _87, _88, _89, _90, \
|
||||||
|
_91, _92, _93, _94, _95, _96, _97, _98, _99, _100, \
|
||||||
|
N, ... \
|
||||||
) N
|
) N
|
||||||
|
|
||||||
#define num_args(...) \
|
#define num_args(...) \
|
||||||
num_args_impl( __VA_ARGS__, \
|
num_args_impl( __VA_ARGS__, \
|
||||||
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
100, 99, 98, 97, 96, 95, 94, 93, 92, 91, \
|
||||||
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
90, 89, 88, 87, 86, 85, 84, 83, 82, 81, \
|
||||||
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
80, 79, 78, 77, 76, 75, 74, 73, 72, 71, \
|
||||||
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
70, 69, 68, 67, 66, 65, 64, 63, 62, 61, \
|
||||||
10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
|
60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
|
||||||
|
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||||
|
50, 49, 48, 47, 46, 45, 44, 43, 42, 41, \
|
||||||
|
40, 39, 38, 37, 36, 35, 34, 33, 32, 31, \
|
||||||
|
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, \
|
||||||
|
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
|
||||||
|
10, 9, 8, 7, 6, 5, 4, 3, 2, 1 \
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -104,12 +104,12 @@ int gen_main()
|
|||||||
Code ast_types = scan_file( "components/ast_types.hpp" );
|
Code ast_types = scan_file( "components/ast_types.hpp" );
|
||||||
Code interface = scan_file( "components/interface.hpp" );
|
Code interface = scan_file( "components/interface.hpp" );
|
||||||
Code inlines = scan_file( "components/inlines.hpp" );
|
Code inlines = scan_file( "components/inlines.hpp" );
|
||||||
Code ast_inlines = scan_file( "components/temp/ast_inlines.hpp" );
|
|
||||||
Code header_end = scan_file( "components/header_end.hpp" );
|
Code header_end = scan_file( "components/header_end.hpp" );
|
||||||
|
|
||||||
CodeBody ecode = gen_ecode ( "enums/ECode.csv" );
|
CodeBody ecode = gen_ecode ( "enums/ECode.csv" );
|
||||||
CodeBody eoperator = gen_eoperator ( "enums/EOperator.csv" );
|
CodeBody eoperator = gen_eoperator ( "enums/EOperator.csv" );
|
||||||
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
|
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
|
||||||
|
CodeBody ast_inlines = gen_ast_inlines();
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
header = Builder::open( "gen/gen.hpp" );
|
header = Builder::open( "gen/gen.hpp" );
|
||||||
@ -155,8 +155,8 @@ int gen_main()
|
|||||||
Code parsing = scan_file( "components/interface.parsing.cpp" );
|
Code parsing = scan_file( "components/interface.parsing.cpp" );
|
||||||
Code untyped = scan_file( "components/untyped.cpp" );
|
Code untyped = scan_file( "components/untyped.cpp" );
|
||||||
|
|
||||||
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
||||||
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
||||||
|
|
||||||
Builder
|
Builder
|
||||||
src = Builder::open( "gen/gen.cpp" );
|
src = Builder::open( "gen/gen.cpp" );
|
||||||
|
@ -53,7 +53,7 @@ CodeBody gen_ecode( char const* path )
|
|||||||
)));
|
)));
|
||||||
#pragma pop_macro( "local_persist" )
|
#pragma pop_macro( "local_persist" )
|
||||||
|
|
||||||
CodeNamespace nspace = def_namespace( name(ECode), def_namespace_body( args( enum_code, to_str ) ) );
|
CodeNS nspace = def_namespace( name(ECode), def_namespace_body( args( enum_code, to_str ) ) );
|
||||||
CodeUsing code_t = def_using( name(CodeT), def_type( name(ECode::Type) ) );
|
CodeUsing code_t = def_using( name(CodeT), def_type( name(ECode::Type) ) );
|
||||||
|
|
||||||
return def_global_body( args( nspace, code_t ) );
|
return def_global_body( args( nspace, code_t ) );
|
||||||
@ -107,7 +107,7 @@ CodeBody gen_eoperator( char const* path )
|
|||||||
)));
|
)));
|
||||||
#pragma pop_macro( "local_persist" )
|
#pragma pop_macro( "local_persist" )
|
||||||
|
|
||||||
CodeNamespace 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) ) );
|
CodeUsing operator_t = def_using( name(OperatorT), def_type( name(EOperator::Type) ) );
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ CodeBody gen_especifier( char const* path )
|
|||||||
#pragma pop_macro( "do_once_start" )
|
#pragma pop_macro( "do_once_start" )
|
||||||
#pragma pop_macro( "do_once_end" )
|
#pragma pop_macro( "do_once_end" )
|
||||||
|
|
||||||
CodeNamespace 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) ) );
|
CodeUsing specifier_t = def_using( name(SpecifierT), def_type( name(ESpecifier::Type) ) );
|
||||||
|
|
||||||
@ -324,13 +324,272 @@ CodeBody gen_etoktype( char const* etok_path, char const* attr_path )
|
|||||||
#pragma pop_macro( "do_once_start" )
|
#pragma pop_macro( "do_once_start" )
|
||||||
#pragma pop_macro( "do_once_end" )
|
#pragma pop_macro( "do_once_end" )
|
||||||
|
|
||||||
CodeNamespace nspace = def_namespace( name(ETokType), def_namespace_body( args( attribute_entires_def, enum_code, to_str, to_type ) ) );
|
CodeNS nspace = def_namespace( name(ETokType), def_namespace_body( args( attribute_entires_def, enum_code, to_str, to_type ) ) );
|
||||||
CodeUsing td_toktype = def_using( name(TokType), def_type( name(ETokType::Type) ) );
|
CodeUsing td_toktype = def_using( name(TokType), def_type( name(ETokType::Type) ) );
|
||||||
|
|
||||||
return def_global_body( args( nspace, td_toktype ) );
|
return def_global_body( args( nspace, td_toktype ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeBody gen_data_structures( char const* data_path, char const* ast_path )
|
CodeBody gen_ast_inlines()
|
||||||
{
|
{
|
||||||
return CodeInvalid;
|
#pragma push_macro("rcast")
|
||||||
|
#undef rcast
|
||||||
|
char const* code_impl_tmpl = stringize(
|
||||||
|
\n
|
||||||
|
char const* <typename>::debug_str()
|
||||||
|
{
|
||||||
|
if ( ast == nullptr )
|
||||||
|
return "Code::debug_str: AST is null!";
|
||||||
|
|
||||||
|
return rcast(AST*, ast)->debug_str();
|
||||||
|
}
|
||||||
|
Code <typename>::duplicate()
|
||||||
|
{
|
||||||
|
if ( ast == nullptr )
|
||||||
|
{
|
||||||
|
log_failure("Code::duplicate: Cannot duplicate code, AST is null!");
|
||||||
|
return Code::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { rcast(AST*, ast)->duplicate() };
|
||||||
|
}
|
||||||
|
bool <typename>::is_equal( Code other )
|
||||||
|
{
|
||||||
|
if ( ast == nullptr || other.ast == nullptr )
|
||||||
|
{
|
||||||
|
log_failure("Code::is_equal: Cannot compare code, AST is null!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rcast(AST*, ast)->is_equal( other.ast );
|
||||||
|
}
|
||||||
|
bool <typename>::is_valid()
|
||||||
|
{
|
||||||
|
return (AST*) ast != nullptr && rcast( AST*, ast)->Type != CodeT::Invalid;
|
||||||
|
}
|
||||||
|
void <typename>::set_global()
|
||||||
|
{
|
||||||
|
if ( ast == nullptr )
|
||||||
|
{
|
||||||
|
log_failure("Code::set_global: Cannot set code as global, AST is null!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rcast(AST*, ast)->Parent = Code::Global.ast;
|
||||||
|
}
|
||||||
|
String <typename>::to_string()
|
||||||
|
{
|
||||||
|
if ( ast == nullptr )
|
||||||
|
{
|
||||||
|
log_failure("Code::to_string: Cannot convert code to string, AST is null!");
|
||||||
|
return { nullptr };
|
||||||
|
}
|
||||||
|
|
||||||
|
return rcast(AST*, ast)->to_string();
|
||||||
|
}
|
||||||
|
<typename>& <typename>::operator =( Code other )
|
||||||
|
{
|
||||||
|
if ( other.ast && other->Parent )
|
||||||
|
{
|
||||||
|
ast = rcast( decltype(ast), other.ast->duplicate() );
|
||||||
|
rcast( AST*, ast)->Parent = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
ast = rcast( decltype(ast), other.ast );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
bool <typename>::operator ==( Code other )
|
||||||
|
{
|
||||||
|
return (AST*) ast == other.ast;
|
||||||
|
}
|
||||||
|
bool <typename>::operator !=( Code other )
|
||||||
|
{
|
||||||
|
return (AST*) ast != other.ast;
|
||||||
|
}
|
||||||
|
<typename>::operator bool()
|
||||||
|
{
|
||||||
|
return ast != nullptr;
|
||||||
|
}
|
||||||
|
\n
|
||||||
|
);
|
||||||
|
|
||||||
|
CodeBody impl_code = parse_global_body( token_fmt( "typename", StrC name(Code), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_body = parse_global_body( token_fmt( "typename", StrC name(CodeBody), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_attr = parse_global_body( token_fmt( "typename", StrC name(CodeAttributes), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_cmt = parse_global_body( token_fmt( "typename", StrC name(CodeComment), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_class = parse_global_body( token_fmt( "typename", StrC name(CodeClass), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_define = parse_global_body( token_fmt( "typename", StrC name(CodeDefine), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_enum = parse_global_body( token_fmt( "typename", StrC name(CodeEnum), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_exec = parse_global_body( token_fmt( "typename", StrC name(CodeExec), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_extern = parse_global_body( token_fmt( "typename", StrC name(CodeExtern), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_include = parse_global_body( token_fmt( "typename", StrC name(CodeInclude), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_friend = parse_global_body( token_fmt( "typename", StrC name(CodeFriend), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_fn = parse_global_body( token_fmt( "typename", StrC name(CodeFn), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_module = parse_global_body( token_fmt( "typename", StrC name(CodeModule), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_ns = parse_global_body( token_fmt( "typename", StrC name(CodeNS), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_op = parse_global_body( token_fmt( "typename", StrC name(CodeOperator), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_opcast = parse_global_body( token_fmt( "typename", StrC name(CodeOpCast), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_param = parse_global_body( token_fmt( "typename", StrC name(CodeParam), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_precond = parse_global_body( token_fmt( "typename", StrC name(CodePreprocessCond), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_specs = parse_global_body( token_fmt( "typename", StrC name(CodeSpecifiers), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_struct = parse_global_body( token_fmt( "typename", StrC name(CodeStruct), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_tmpl = parse_global_body( token_fmt( "typename", StrC name(CodeTemplate), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_type = parse_global_body( token_fmt( "typename", StrC name(CodeType), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_typedef = parse_global_body( token_fmt( "typename", StrC name(CodeTypedef), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_union = parse_global_body( token_fmt( "typename", StrC name(CodeUnion), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_using = parse_global_body( token_fmt( "typename", StrC name(CodeUsing), code_impl_tmpl ));
|
||||||
|
CodeBody impl_code_var = parse_global_body( token_fmt( "typename", StrC name(CodeVar), code_impl_tmpl ));
|
||||||
|
|
||||||
|
char const* ast_cast_tmpl = stringize(
|
||||||
|
AST::operator Code<typename>()
|
||||||
|
{
|
||||||
|
return { rcast( AST_<typename>*, this ) };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
CodeOpCast impl_astcast_body = parse_operator_cast( token_fmt( "typename", StrC name(Body), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_attribute = parse_operator_cast( token_fmt( "typename", StrC name(Attributes), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_cmt = parse_operator_cast( token_fmt( "typename", StrC name(Comment), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_class = parse_operator_cast( token_fmt( "typename", StrC name(Class), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_define = parse_operator_cast( token_fmt( "typename", StrC name(Define), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_enum = parse_operator_cast( token_fmt( "typename", StrC name(Enum), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_exec = parse_operator_cast( token_fmt( "typename", StrC name(Exec), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_extern = parse_operator_cast( token_fmt( "typename", StrC name(Extern), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_friend = parse_operator_cast( token_fmt( "typename", StrC name(Friend), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_fn = parse_operator_cast( token_fmt( "typename", StrC name(Fn), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_module = parse_operator_cast( token_fmt( "typename", StrC name(Module), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_ns = parse_operator_cast( token_fmt( "typename", StrC name(NS), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_op = parse_operator_cast( token_fmt( "typename", StrC name(Operator), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_opcast = parse_operator_cast( token_fmt( "typename", StrC name(OpCast), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_param = parse_operator_cast( token_fmt( "typename", StrC name(Param), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_precond = parse_operator_cast( token_fmt( "typename", StrC name(PreprocessCond), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_specs = parse_operator_cast( token_fmt( "typename", StrC name(Specifiers), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_struct = parse_operator_cast( token_fmt( "typename", StrC name(Struct), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_tmpl = parse_operator_cast( token_fmt( "typename", StrC name(Template), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_type = parse_operator_cast( token_fmt( "typename", StrC name(Type), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_typedef = parse_operator_cast( token_fmt( "typename", StrC name(Typedef), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_union = parse_operator_cast( token_fmt( "typename", StrC name(Union), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_using = parse_operator_cast( token_fmt( "typename", StrC name(Using), ast_cast_tmpl ));
|
||||||
|
CodeOpCast impl_astcast_var = parse_operator_cast( token_fmt( "typename", StrC name(Var), ast_cast_tmpl ));
|
||||||
|
|
||||||
|
char const* code_cast_tmpl = stringize(
|
||||||
|
Code::operator Code<type>() const
|
||||||
|
{
|
||||||
|
return { (AST_<type>*) ast };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
CodeOpCast impl_codecast_attr = parse_operator_cast( token_fmt( "type", StrC name(CodeAttributes), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_cmt = parse_operator_cast( token_fmt( "type", StrC name(CodeComment), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_class = parse_operator_cast( token_fmt( "type", StrC name(CodeClass), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_define = parse_operator_cast( token_fmt( "type", StrC name(CodeDefine), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_enum = parse_operator_cast( token_fmt( "type", StrC name(CodeEnum), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_exec = parse_operator_cast( token_fmt( "type", StrC name(CodeExec), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_extern = parse_operator_cast( token_fmt( "type", StrC name(CodeExtern), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_friend = parse_operator_cast( token_fmt( "type", StrC name(CodeFriend), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_fn = parse_operator_cast( token_fmt( "type", StrC name(CodeFn), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_module = parse_operator_cast( token_fmt( "type", StrC name(CodeModule), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_ns = parse_operator_cast( token_fmt( "type", StrC name(CodeNS), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_op = parse_operator_cast( token_fmt( "type", StrC name(CodeOperator), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_opCast = parse_operator_cast( token_fmt( "type", StrC name(CodeOpCast), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_param = parse_operator_cast( token_fmt( "type", StrC name(CodeParam), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_precond = parse_operator_cast( token_fmt( "type", StrC name(CodePreprocessCond), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_specs = parse_operator_cast( token_fmt( "type", StrC name(CodeSpecifiers), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_struct = parse_operator_cast( token_fmt( "type", StrC name(CodeStruct), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_template= parse_operator_cast( token_fmt( "type", StrC name(CodeTemplate), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_type = parse_operator_cast( token_fmt( "type", StrC name(CodeType), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_typedef = parse_operator_cast( token_fmt( "type", StrC name(CodeTypedef), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_union = parse_operator_cast( token_fmt( "type", StrC name(CodeUnion), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_using = parse_operator_cast( token_fmt( "type", StrC name(CodeUsing), code_cast_tmpl ) );
|
||||||
|
CodeOpCast impl_codecast_var = parse_operator_cast( token_fmt( "type", StrC name(CodeVar), code_cast_tmpl ) );
|
||||||
|
|
||||||
|
CodeBody result = def_global_body( args(
|
||||||
|
def_pragma( txt_StrC("region generated code inline implementation")),
|
||||||
|
fmt_newline,
|
||||||
|
impl_code,
|
||||||
|
impl_code_body,
|
||||||
|
impl_code_cmt,
|
||||||
|
impl_code_class,
|
||||||
|
impl_code_define,
|
||||||
|
impl_code_enum,
|
||||||
|
impl_code_exec,
|
||||||
|
impl_code_extern,
|
||||||
|
impl_code_friend,
|
||||||
|
impl_code_fn,
|
||||||
|
impl_code_module,
|
||||||
|
impl_code_ns,
|
||||||
|
impl_code_op,
|
||||||
|
impl_code_opcast,
|
||||||
|
impl_code_param,
|
||||||
|
impl_code_precond,
|
||||||
|
impl_code_specs,
|
||||||
|
impl_code_struct,
|
||||||
|
impl_code_tmpl,
|
||||||
|
impl_code_type,
|
||||||
|
impl_code_typedef,
|
||||||
|
impl_code_union,
|
||||||
|
impl_code_using,
|
||||||
|
impl_code_var,
|
||||||
|
fmt_newline,
|
||||||
|
def_pragma( txt_StrC("endregion generated code inline implementation")),
|
||||||
|
fmt_newline,
|
||||||
|
def_pragma( txt_StrC("region generated AST cast implementation")),
|
||||||
|
fmt_newline,
|
||||||
|
impl_astcast_body,
|
||||||
|
impl_astcast_cmt,
|
||||||
|
impl_astcast_class,
|
||||||
|
impl_astcast_define,
|
||||||
|
impl_astcast_enum,
|
||||||
|
impl_astcast_exec,
|
||||||
|
impl_astcast_extern,
|
||||||
|
impl_astcast_friend,
|
||||||
|
impl_astcast_fn,
|
||||||
|
impl_astcast_module,
|
||||||
|
impl_astcast_ns,
|
||||||
|
impl_astcast_op,
|
||||||
|
impl_astcast_opcast,
|
||||||
|
impl_astcast_param,
|
||||||
|
impl_astcast_precond,
|
||||||
|
impl_astcast_specs,
|
||||||
|
impl_astcast_struct,
|
||||||
|
impl_astcast_tmpl,
|
||||||
|
impl_astcast_type,
|
||||||
|
impl_astcast_typedef,
|
||||||
|
impl_astcast_union,
|
||||||
|
impl_astcast_using,
|
||||||
|
impl_astcast_var,
|
||||||
|
fmt_newline,
|
||||||
|
def_pragma( txt_StrC("endregion generated AST cast implementation")),
|
||||||
|
fmt_newline,
|
||||||
|
def_pragma( txt_StrC("region Code cast implementation")),
|
||||||
|
impl_codecast_attr,
|
||||||
|
impl_codecast_cmt,
|
||||||
|
impl_codecast_class,
|
||||||
|
impl_codecast_define,
|
||||||
|
impl_codecast_enum,
|
||||||
|
impl_codecast_exec,
|
||||||
|
impl_codecast_extern,
|
||||||
|
impl_codecast_friend,
|
||||||
|
impl_codecast_fn,
|
||||||
|
impl_codecast_module,
|
||||||
|
impl_codecast_ns,
|
||||||
|
impl_codecast_op,
|
||||||
|
impl_codecast_opCast,
|
||||||
|
impl_codecast_param,
|
||||||
|
impl_codecast_precond,
|
||||||
|
impl_codecast_specs,
|
||||||
|
impl_codecast_struct,
|
||||||
|
impl_codecast_template,
|
||||||
|
impl_codecast_type,
|
||||||
|
impl_codecast_typedef,
|
||||||
|
impl_codecast_union,
|
||||||
|
impl_codecast_using,
|
||||||
|
impl_codecast_var,
|
||||||
|
fmt_newline,
|
||||||
|
def_pragma( txt_StrC("endregion Code cast implementation")),
|
||||||
|
fmt_newline
|
||||||
|
));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
#pragma pop_macro("rcast")
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@
|
|||||||
</Expand>
|
</Expand>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
||||||
<Type Name="gen::AST_Namespace">
|
<Type Name="gen::AST_NS">
|
||||||
<DisplayString>{Name} Type: {Type}</DisplayString>
|
<DisplayString>{Name} Type: {Type}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
<Item Name="ModuleFlags">ModuleFlags</Item>
|
<Item Name="ModuleFlags">ModuleFlags</Item>
|
||||||
@ -498,7 +498,7 @@
|
|||||||
</Expand>
|
</Expand>
|
||||||
</Type>
|
</Type>
|
||||||
|
|
||||||
<Type Name="gen::CodeNamespace">
|
<Type Name="gen::CodeNS">
|
||||||
<DisplayString Condition="ast == nullptr">Null</DisplayString>
|
<DisplayString Condition="ast == nullptr">Null</DisplayString>
|
||||||
<DisplayString Condition="ast != nullptr">{ast->Name} {ast->Type}</DisplayString>
|
<DisplayString Condition="ast != nullptr">{ast->Name} {ast->Type}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
|
@ -108,17 +108,17 @@ int gen_main()
|
|||||||
header.print_fmt( roll_own_dependencies_guard_end );
|
header.print_fmt( roll_own_dependencies_guard_end );
|
||||||
}
|
}
|
||||||
|
|
||||||
Code types = scan_file( project_dir "components/types.hpp" );
|
Code types = scan_file( project_dir "components/types.hpp" );
|
||||||
Code ast = scan_file( project_dir "components/ast.hpp" );
|
Code ast = scan_file( project_dir "components/ast.hpp" );
|
||||||
Code ast_types = scan_file( project_dir "components/ast_types.hpp" );
|
Code ast_types = scan_file( project_dir "components/ast_types.hpp" );
|
||||||
Code interface = scan_file( project_dir "components/interface.hpp" );
|
Code interface = scan_file( project_dir "components/interface.hpp" );
|
||||||
Code inlines = scan_file( project_dir "components/inlines.hpp" );
|
Code inlines = scan_file( project_dir "components/inlines.hpp" );
|
||||||
Code ast_inlines = scan_file( project_dir "components/temp/ast_inlines.hpp" );
|
Code header_end = scan_file( project_dir "components/header_end.hpp" );
|
||||||
Code header_end = scan_file( project_dir "components/header_end.hpp" );
|
|
||||||
|
|
||||||
CodeBody ecode = gen_ecode ( project_dir "enums/ECode.csv" );
|
CodeBody ecode = gen_ecode ( project_dir "enums/ECode.csv" );
|
||||||
CodeBody eoperator = gen_eoperator ( project_dir "enums/EOperator.csv" );
|
CodeBody eoperator = gen_eoperator ( project_dir "enums/EOperator.csv" );
|
||||||
CodeBody especifier = gen_especifier( project_dir "enums/ESpecifier.csv" );
|
CodeBody especifier = gen_especifier( project_dir "enums/ESpecifier.csv" );
|
||||||
|
CodeBody ast_inlines = gen_ast_inlines();
|
||||||
|
|
||||||
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ int gen_main()
|
|||||||
Code untyped = scan_file( project_dir "components/untyped.cpp" );
|
Code untyped = scan_file( project_dir "components/untyped.cpp" );
|
||||||
|
|
||||||
CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" );
|
CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" );
|
||||||
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
|
||||||
|
|
||||||
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
header.print_fmt( "GEN_NS_BEGIN\n\n");
|
||||||
header.print( static_data );
|
header.print( static_data );
|
||||||
|
@ -132,7 +132,7 @@ u32 gen_sanity()
|
|||||||
|
|
||||||
// Namespace
|
// Namespace
|
||||||
{
|
{
|
||||||
CodeNamespace def = parse_namespace( code(
|
CodeNS def = parse_namespace( code(
|
||||||
namespace TestNamespace
|
namespace TestNamespace
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ u32 gen_sanity()
|
|||||||
using TestUsing = u8;
|
using TestUsing = u8;
|
||||||
));
|
));
|
||||||
|
|
||||||
CodeNamespace nspace = parse_namespace( code(
|
CodeNS nspace = parse_namespace( code(
|
||||||
namespace TestNamespace
|
namespace TestNamespace
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@ -139,7 +139,7 @@ u32 gen_sanity_upfront()
|
|||||||
|
|
||||||
// Namespace
|
// Namespace
|
||||||
{
|
{
|
||||||
CodeNamespace namespace_def;
|
CodeNS namespace_def;
|
||||||
{
|
{
|
||||||
CodeBody body = def_namespace_body( 1
|
CodeBody body = def_namespace_body( 1
|
||||||
, def_comment( txt_StrC("Empty namespace body") )
|
, def_comment( txt_StrC("Empty namespace body") )
|
||||||
|
Loading…
Reference in New Issue
Block a user