mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07: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:
@ -906,7 +906,31 @@ bool AST::validate_body()
|
||||
CheckEntries( GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES );
|
||||
break;
|
||||
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;
|
||||
case Namespace_Body:
|
||||
CheckEntries( GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES );
|
||||
|
@ -11,7 +11,7 @@ struct AST_Include;
|
||||
struct AST_Friend;
|
||||
struct AST_Fn;
|
||||
struct AST_Module;
|
||||
struct AST_Namespace;
|
||||
struct AST_NS;
|
||||
struct AST_Operator;
|
||||
struct AST_OpCast;
|
||||
struct AST_Param;
|
||||
@ -40,7 +40,7 @@ struct CodeInclude;
|
||||
struct CodeFriend;
|
||||
struct CodeFn;
|
||||
struct CodeModule;
|
||||
struct CodeNamespace;
|
||||
struct CodeNS;
|
||||
struct CodeOperator;
|
||||
struct CodeOpCast;
|
||||
struct CodeParam;
|
||||
@ -117,7 +117,7 @@ struct Code
|
||||
operator CodeFriend() const;
|
||||
operator CodeFn() const;
|
||||
operator CodeModule() const;
|
||||
operator CodeNamespace() const;
|
||||
operator CodeNS() const;
|
||||
operator CodeOperator() const;
|
||||
operator CodeOpCast() const;
|
||||
operator CodeParam() const;
|
||||
@ -180,7 +180,7 @@ struct AST
|
||||
operator CodeFriend();
|
||||
operator CodeFn();
|
||||
operator CodeModule();
|
||||
operator CodeNamespace();
|
||||
operator CodeNS();
|
||||
operator CodeOperator();
|
||||
operator CodeOpCast();
|
||||
operator CodeParam();
|
||||
@ -558,7 +558,7 @@ Define_CodeType( Include );
|
||||
Define_CodeType( Friend );
|
||||
Define_CodeType( Fn );
|
||||
Define_CodeType( Module );
|
||||
Define_CodeType( Namespace );
|
||||
Define_CodeType( NS );
|
||||
Define_CodeType( Operator );
|
||||
Define_CodeType( OpCast );
|
||||
Define_CodeType( Pragma );
|
||||
|
@ -49,7 +49,6 @@
|
||||
case Execution: \
|
||||
case Friend: \
|
||||
case Function_Body: \
|
||||
case Global_Body: \
|
||||
case Namespace_Body: \
|
||||
case Operator_Member: \
|
||||
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");
|
||||
|
||||
struct AST_Namespace
|
||||
struct AST_NS
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
|
||||
@ -233,7 +233,7 @@ struct AST_Namespace
|
||||
ModuleFlag ModuleFlags;
|
||||
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
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ CodeFn def_function( StrC name
|
||||
|
||||
CodeInclude def_include ( StrC content );
|
||||
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
|
||||
, 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 );
|
||||
CodeFn parse_function ( StrC fn_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 );
|
||||
CodeOpCast parse_operator_cast( StrC operator_def );
|
||||
CodeStruct parse_struct ( StrC struct_def );
|
||||
|
@ -1120,7 +1120,7 @@ internal CodeBody parse_extern_link_body();
|
||||
internal CodeExtern parse_exten_link ();
|
||||
internal CodeFriend parse_friend ();
|
||||
internal CodeFn parse_function ();
|
||||
internal CodeNamespace parse_namespace ();
|
||||
internal CodeNS parse_namespace ();
|
||||
internal CodeOpCast parse_operator_cast ();
|
||||
internal CodeStruct parse_struct ( bool inplace_def = false );
|
||||
internal CodeVar parse_variable ();
|
||||
@ -3071,7 +3071,10 @@ CodeBody parse_global_nspace( CodeT which )
|
||||
}
|
||||
|
||||
if ( found_operator_cast )
|
||||
{
|
||||
member = parse_operator_cast();
|
||||
break;
|
||||
}
|
||||
|
||||
member = parse_operator_function_or_variable( expects_function, attributes, specifiers );
|
||||
}
|
||||
@ -3566,7 +3569,7 @@ CodeBody parse_global_body( StrC def )
|
||||
}
|
||||
|
||||
internal
|
||||
CodeNamespace parse_namespace()
|
||||
CodeNS parse_namespace()
|
||||
{
|
||||
using namespace Parser;
|
||||
push_scope();
|
||||
@ -3583,8 +3586,8 @@ CodeNamespace parse_namespace()
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
CodeNamespace
|
||||
result = (CodeNamespace) make_code();
|
||||
CodeNS
|
||||
result = (CodeNS) make_code();
|
||||
result->Type = ECode::Namespace;
|
||||
result->Name = get_cached_string( name );
|
||||
|
||||
@ -3594,7 +3597,7 @@ CodeNamespace parse_namespace()
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeNamespace parse_namespace( StrC def )
|
||||
CodeNS parse_namespace( StrC def )
|
||||
{
|
||||
check_parse_args( def );
|
||||
using namespace Parser;
|
||||
|
@ -763,7 +763,7 @@ CodeModule def_module( StrC name, ModuleFlag mflags )
|
||||
return (CodeModule) result;
|
||||
}
|
||||
|
||||
CodeNamespace def_namespace( StrC name, Code body, ModuleFlag mflags )
|
||||
CodeNS def_namespace( StrC name, Code body, ModuleFlag mflags )
|
||||
{
|
||||
using namespace ECode;
|
||||
|
||||
@ -776,8 +776,8 @@ CodeNamespace def_namespace( StrC name, Code body, ModuleFlag mflags )
|
||||
return CodeInvalid;
|
||||
}
|
||||
|
||||
CodeNamespace
|
||||
result = (CodeNamespace) make_code();
|
||||
CodeNS
|
||||
result = (CodeNS) make_code();
|
||||
result->Type = Namespace;
|
||||
result->Name = get_cached_string( name );
|
||||
result->ModuleFlags = mflags;
|
||||
@ -1732,6 +1732,10 @@ CodeBody def_global_body( s32 num, ... )
|
||||
|
||||
switch (entry->Type)
|
||||
{
|
||||
case Global_Body:
|
||||
result.append( entry.cast<CodeBody>() ) ;
|
||||
continue;
|
||||
|
||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return (*Code::Invalid.ast);
|
||||
@ -1769,6 +1773,10 @@ CodeBody def_global_body( s32 num, Code* codes )
|
||||
|
||||
switch (entry->Type)
|
||||
{
|
||||
case Global_Body:
|
||||
result.append( entry.cast<CodeBody>() ) ;
|
||||
continue;
|
||||
|
||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return CodeInvalid;
|
||||
|
@ -91,7 +91,7 @@ Define_CodeImpl( CodeInclude );
|
||||
Define_CodeImpl( CodeFriend );
|
||||
Define_CodeImpl( CodeFn );
|
||||
Define_CodeImpl( CodeModule );
|
||||
Define_CodeImpl( CodeNamespace );
|
||||
Define_CodeImpl( CodeNS );
|
||||
Define_CodeImpl( CodeOperator );
|
||||
Define_CodeImpl( CodeOpCast );
|
||||
Define_CodeImpl( CodeParam );
|
||||
@ -125,7 +125,7 @@ Define_AST_Cast( Include );
|
||||
Define_AST_Cast( Friend );
|
||||
Define_AST_Cast( Fn );
|
||||
Define_AST_Cast( Module );
|
||||
Define_AST_Cast( Namespace );
|
||||
Define_AST_Cast( NS );
|
||||
Define_AST_Cast( Operator );
|
||||
Define_AST_Cast( OpCast );
|
||||
Define_AST_Cast( Param );
|
||||
@ -158,7 +158,7 @@ Define_CodeCast( Include );
|
||||
Define_CodeCast( Friend );
|
||||
Define_CodeCast( Fn );
|
||||
Define_CodeCast( Module );
|
||||
Define_CodeCast( Namespace );
|
||||
Define_CodeCast( NS );
|
||||
Define_CodeCast( Operator );
|
||||
Define_CodeCast( OpCast );
|
||||
Define_CodeCast( Param );
|
||||
|
Reference in New Issue
Block a user