mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 15:54:45 -08:00
Compare commits
No commits in common. "16b8a3a164c6b6d83a4ec700a8cf2c627b5e69ad" and "c38b077c37d7dd921705d76e653c7e60c871ab8c" have entirely different histories.
16b8a3a164
...
c38b077c37
@ -552,7 +552,7 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
SpecifierT ArrSpecs[ AST_ArrSpecs_Cap ];
|
||||
SpecifierT ArrSpecs[ AST::ArrSpecs_Cap ];
|
||||
CodeSpecifiers NextSpecs;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
|
@ -101,7 +101,7 @@ union {
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
struct {
|
||||
SpecifierT ArrSpecs[AST_ArrSpecs_Cap]; // Specifiers
|
||||
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
|
||||
AST* NextSpecs; // Specifiers
|
||||
};
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ int gen_main()
|
||||
case ECode::Using:
|
||||
{
|
||||
log_fmt("REPLACE THIS MANUALLY: %S\n", entry->Name);
|
||||
CodeUsing using_ver = cast(CodeUsing, entry);
|
||||
CodeUsing using_ver = entry.code_cast<CodeUsing>();
|
||||
CodeTypedef typedef_ver = def_typedef(using_ver->Name, using_ver->UnderlyingType);
|
||||
|
||||
memory.append(typedef_ver);
|
||||
@ -144,7 +144,7 @@ int gen_main()
|
||||
break;
|
||||
case ECode::Function_Fwd:
|
||||
{
|
||||
CodeFn fn = cast(CodeFn, entry);
|
||||
CodeFn fn = entry.code_cast<CodeFn>();
|
||||
if ( fn->Name.is_equal(txt("free")) )
|
||||
{
|
||||
fn->Name = get_cached_string(txt("gen_free_ptr"));
|
||||
@ -154,7 +154,7 @@ int gen_main()
|
||||
break;
|
||||
case ECode::Function:
|
||||
{
|
||||
CodeFn fn = cast(CodeFn, entry);
|
||||
CodeFn fn = entry.code_cast<CodeFn>();
|
||||
s32 constexpr_found = fn->Specs.remove( ESpecifier::Constexpr );
|
||||
if (constexpr_found > -1) {
|
||||
log_fmt("Found constexpr: %S\n", entry->to_string());
|
||||
@ -169,7 +169,7 @@ int gen_main()
|
||||
break;
|
||||
case ECode::Template:
|
||||
{
|
||||
CodeTemplate tmpl = cast(CodeTemplate, entry);
|
||||
CodeTemplate tmpl = entry.code_cast<CodeTemplate>();
|
||||
if ( tmpl->Declaration->Name.contains(txt("swap")))
|
||||
{
|
||||
CodeBody macro_swap = parse_global_body( txt(R"(
|
||||
|
@ -8,7 +8,7 @@ using SwapContentProc = CodeBody(void);
|
||||
b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& body )
|
||||
{
|
||||
b32 found = false;
|
||||
CodePreprocessCond cond = cast(CodePreprocessCond, entry_iter);
|
||||
CodePreprocessCond cond = entry_iter.code_cast<CodePreprocessCond>();
|
||||
if ( cond->Content.contains(cond_sig) )
|
||||
{
|
||||
log_fmt("Preprocess cond found: %S\n", cond->Content);
|
||||
@ -44,7 +44,7 @@ b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& bod
|
||||
bool swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_content, Code& entry_iter, CodeBody& body )
|
||||
{
|
||||
bool found = false;
|
||||
CodePragma possible_region = cast(CodePragma, entry_iter);
|
||||
CodePragma possible_region = entry_iter.code_cast<CodePragma>();
|
||||
|
||||
String region_sig = string_fmt_buf(GlobalAllocator, "region %s", region_name.Ptr);
|
||||
String endregion_sig = string_fmt_buf(GlobalAllocator, "endregion %s", region_name.Ptr);
|
||||
@ -58,7 +58,7 @@ bool swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_
|
||||
(entry_iter->Type) {
|
||||
case ECode::Preprocess_Pragma:
|
||||
{
|
||||
CodePragma possible_end_region = cast(CodePragma, entry_iter);
|
||||
CodePragma possible_end_region = entry_iter.code_cast<CodePragma>();
|
||||
if ( possible_end_region->Content.contains(endregion_sig) ) {
|
||||
// body.append(possible_end_region);
|
||||
continue_for = false;
|
||||
|
@ -1,8 +1,6 @@
|
||||
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||
#define GEN_EXPOSE_BACKEND
|
||||
#define GEN_SUPPORT_CPP_MEMBER_FEATURES 1
|
||||
#define GEN_SUPPORT_CPP_REFERENCES 0
|
||||
#include "gen.cpp"
|
||||
|
||||
#include "helpers/push_ignores.inline.hpp"
|
||||
|
@ -26,7 +26,7 @@ void Builder::pad_lines( s32 num )
|
||||
|
||||
void Builder::print( Code code )
|
||||
{
|
||||
String str = to_string(code);
|
||||
String str = code->to_string();
|
||||
// const ssize len = str.length();
|
||||
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
|
||||
append( & Buffer, str );
|
||||
|
@ -1,7 +1,7 @@
|
||||
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
||||
#define GEN_EXPOSE_BACKEND
|
||||
#define GEN_SUPPORT_CPP_MEMBER_FEATURES 0
|
||||
#define GEN_SUPPORT_CPP_MEMBER_FEATURES 1
|
||||
#define GEN_SUPPORT_CPP_REFERENCES 0
|
||||
#include "gen.cpp"
|
||||
|
||||
|
@ -14,7 +14,7 @@ char const* debug_str(AST* self)
|
||||
String* result = & result_stack;
|
||||
|
||||
if ( self->Parent )
|
||||
append_fmt( result, "\n\tParent : %S %S", type_str(self->Parent), self->Name ? self->Name : "" );
|
||||
append_fmt( result, "\n\tParent : %S %S", self->Parent->type_str(), self->Name ? self->Name : "" );
|
||||
else
|
||||
append_fmt( result, "\n\tParent : %S", "Null" );
|
||||
|
||||
@ -372,20 +372,19 @@ AST* duplicate(AST* self)
|
||||
return result;
|
||||
}
|
||||
|
||||
String to_string(AST* self)
|
||||
String AST::to_string()
|
||||
{
|
||||
String result = string_make( GlobalAllocator, "" );
|
||||
GEN_NS to_string( self, & result );
|
||||
to_string( result );
|
||||
return result;
|
||||
}
|
||||
|
||||
void to_string( AST* self, String* result )
|
||||
void AST::to_string( String& result )
|
||||
{
|
||||
GEN_ASSERT(self != nullptr);
|
||||
local_persist thread_local
|
||||
char SerializationLevel = 0;
|
||||
|
||||
switch ( self->Type )
|
||||
switch ( Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
|
||||
@ -393,191 +392,191 @@ void to_string( AST* self, String* result )
|
||||
#ifdef GEN_DONT_ALLOW_INVALID_CODE
|
||||
log_failure("Attempted to serialize invalid code! - %S", Parent ? Parent->debug_str() : Name );
|
||||
#else
|
||||
append_fmt( result, "Invalid Code!" );
|
||||
GEN_NS append_fmt( & result, "Invalid Code!" );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case NewLine:
|
||||
append( result,"\n");
|
||||
GEN_NS append( & result,"\n");
|
||||
break;
|
||||
|
||||
case Untyped:
|
||||
case Execution:
|
||||
case Comment:
|
||||
case PlatformAttributes:
|
||||
append( result, self->Content );
|
||||
GEN_NS append( & result, Content );
|
||||
break;
|
||||
|
||||
case Access_Private:
|
||||
case Access_Protected:
|
||||
case Access_Public:
|
||||
append( result, self->Name );
|
||||
GEN_NS append( & result, Name );
|
||||
break;
|
||||
|
||||
case Class:
|
||||
to_string_def(cast(CodeClass, {self}), result );
|
||||
code_cast<CodeClass>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Class_Fwd:
|
||||
to_string_fwd(cast(CodeClass, {self}), result );
|
||||
code_cast<CodeClass>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Constructor:
|
||||
cast(CodeConstructor, {self}).to_string_def( * result );
|
||||
code_cast<CodeConstructor>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Constructor_Fwd:
|
||||
cast(CodeConstructor, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeConstructor>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Destructor:
|
||||
cast(CodeDestructor, {self}).to_string_def( * result );
|
||||
code_cast<CodeDestructor>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Destructor_Fwd:
|
||||
cast(CodeDestructor, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeDestructor>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Enum:
|
||||
cast(CodeEnum, {self}).to_string_def( * result );
|
||||
code_cast<CodeEnum>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Enum_Fwd:
|
||||
cast(CodeEnum, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeEnum>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Enum_Class:
|
||||
cast(CodeEnum, {self}).to_string_class_def( * result );
|
||||
code_cast<CodeEnum>().to_string_class_def( result );
|
||||
break;
|
||||
|
||||
case Enum_Class_Fwd:
|
||||
cast(CodeEnum, {self}).to_string_class_fwd( * result );
|
||||
code_cast<CodeEnum>().to_string_class_fwd( result );
|
||||
break;
|
||||
|
||||
case Export_Body:
|
||||
to_string_export(cast(CodeBody, {self}), result );
|
||||
code_cast<CodeBody>().to_string_export( result );
|
||||
break;
|
||||
|
||||
case Extern_Linkage:
|
||||
cast(CodeExtern, {self}).to_string( * result );
|
||||
code_cast<CodeExtern>().to_string( result );
|
||||
break;
|
||||
|
||||
case Friend:
|
||||
cast(CodeFriend, {self}).to_string( * result );
|
||||
code_cast<CodeFriend>().to_string( result );
|
||||
break;
|
||||
|
||||
case Function:
|
||||
cast(CodeFn, {self}).to_string_def( * result );
|
||||
code_cast<CodeFn>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Function_Fwd:
|
||||
cast(CodeFn, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeFn>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Module:
|
||||
cast(CodeModule, {self}).to_string( * result );
|
||||
code_cast<CodeModule>().to_string( result );
|
||||
break;
|
||||
|
||||
case Namespace:
|
||||
cast(CodeNS, {self}).to_string( * result );
|
||||
code_cast<CodeNS>().to_string( result );
|
||||
break;
|
||||
|
||||
case Operator:
|
||||
case Operator_Member:
|
||||
cast(CodeOperator, {self}).to_string_def( * result );
|
||||
code_cast<CodeOperator>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Operator_Fwd:
|
||||
case Operator_Member_Fwd:
|
||||
cast(CodeOperator, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeOperator>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Operator_Cast:
|
||||
cast(CodeOpCast, {self}).to_string_def( * result );
|
||||
code_cast<CodeOpCast>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Operator_Cast_Fwd:
|
||||
cast(CodeOpCast, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeOpCast>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Parameters:
|
||||
cast(CodeParam, {self}).to_string( * result );
|
||||
code_cast<CodeParam>().to_string( result );
|
||||
break;
|
||||
|
||||
case Preprocess_Define:
|
||||
cast(CodeDefine, {self}).to_string( * result );
|
||||
code_cast<CodeDefine>().to_string( result );
|
||||
break;
|
||||
|
||||
case Preprocess_If:
|
||||
cast(CodePreprocessCond, {self}).to_string_if( * result );
|
||||
code_cast<CodePreprocessCond>().to_string_if( result );
|
||||
break;
|
||||
|
||||
case Preprocess_IfDef:
|
||||
cast(CodePreprocessCond, {self}).to_string_ifdef( * result );
|
||||
code_cast<CodePreprocessCond>().to_string_ifdef( result );
|
||||
break;
|
||||
|
||||
case Preprocess_IfNotDef:
|
||||
cast(CodePreprocessCond, {self}).to_string_ifndef( * result );
|
||||
code_cast<CodePreprocessCond>().to_string_ifndef( result );
|
||||
break;
|
||||
|
||||
case Preprocess_Include:
|
||||
cast(CodeInclude, {self}).to_string( * result );
|
||||
code_cast<CodeInclude>().to_string( result );
|
||||
break;
|
||||
|
||||
case Preprocess_ElIf:
|
||||
cast(CodePreprocessCond, {self}).to_string_elif( * result );
|
||||
code_cast<CodePreprocessCond>().to_string_elif( result );
|
||||
break;
|
||||
|
||||
case Preprocess_Else:
|
||||
cast(CodePreprocessCond, {self}).to_string_else( * result );
|
||||
code_cast<CodePreprocessCond>().to_string_else( result );
|
||||
break;
|
||||
|
||||
case Preprocess_EndIf:
|
||||
cast(CodePreprocessCond, {self}).to_string_endif( * result );
|
||||
code_cast<CodePreprocessCond>().to_string_endif( result );
|
||||
break;
|
||||
|
||||
case Preprocess_Pragma:
|
||||
cast(CodePragma, {self}).to_string( * result );
|
||||
code_cast<CodePragma>().to_string( result );
|
||||
break;
|
||||
|
||||
case Specifiers:
|
||||
cast(CodeSpecifiers, {self}).to_string( * result );
|
||||
code_cast<CodeSpecifiers>().to_string( result );
|
||||
break;
|
||||
|
||||
case Struct:
|
||||
cast(CodeStruct, {self}).to_string_def( * result );
|
||||
code_cast<CodeStruct>().to_string_def( result );
|
||||
break;
|
||||
|
||||
case Struct_Fwd:
|
||||
cast(CodeStruct, {self}).to_string_fwd( * result );
|
||||
code_cast<CodeStruct>().to_string_fwd( result );
|
||||
break;
|
||||
|
||||
case Template:
|
||||
cast(CodeTemplate, {self}).to_string( * result );
|
||||
code_cast<CodeTemplate>().to_string( result );
|
||||
break;
|
||||
|
||||
case Typedef:
|
||||
cast(CodeTypedef, {self}).to_string( * result );
|
||||
code_cast<CodeTypedef>().to_string( result );
|
||||
break;
|
||||
|
||||
case Typename:
|
||||
cast(CodeType, {self}).to_string( * result );
|
||||
code_cast<CodeType>().to_string( result );
|
||||
break;
|
||||
|
||||
case Union:
|
||||
cast(CodeUnion, {self}).to_string( * result );
|
||||
code_cast<CodeUnion>().to_string( result );
|
||||
break;
|
||||
|
||||
case Using:
|
||||
cast(CodeUsing, {self}).to_string( * result );
|
||||
code_cast<CodeUsing>().to_string( result );
|
||||
break;
|
||||
|
||||
case Using_Namespace:
|
||||
cast(CodeUsing, {self}).to_string_ns( * result );
|
||||
code_cast<CodeUsing>().to_string_ns( result );
|
||||
break;
|
||||
|
||||
case Variable:
|
||||
cast(CodeVar, {self}).to_string( * result );
|
||||
code_cast<CodeVar>().to_string( result );
|
||||
break;
|
||||
|
||||
case Enum_Body:
|
||||
@ -588,7 +587,7 @@ void to_string( AST* self, String* result )
|
||||
case Namespace_Body:
|
||||
case Struct_Body:
|
||||
case Union_Body:
|
||||
to_string( cast(CodeBody, {self}), result );
|
||||
code_cast<CodeBody>().to_string( result );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -612,7 +611,7 @@ bool is_equal( AST* self, AST* other )
|
||||
{
|
||||
log_fmt("AST::is_equal: Type check failure with other\nAST: %S\nOther: %S"
|
||||
, debug_str(self)
|
||||
,debug_str(other)
|
||||
, other->debug_str()
|
||||
);
|
||||
|
||||
return false;
|
||||
@ -629,7 +628,7 @@ bool is_equal( AST* self, AST* other )
|
||||
"AST : %S\n" \
|
||||
"Other: %S\n" \
|
||||
, debug_str(self) \
|
||||
,debug_str(other) \
|
||||
, other->debug_str() \
|
||||
); \
|
||||
\
|
||||
return false; \
|
||||
@ -642,7 +641,7 @@ bool is_equal( AST* self, AST* other )
|
||||
"AST : %S\n" \
|
||||
"Other: %S\n" \
|
||||
, debug_str(self) \
|
||||
,debug_str(other) \
|
||||
, other->debug_str() \
|
||||
); \
|
||||
\
|
||||
return false; \
|
||||
@ -655,7 +654,7 @@ bool is_equal( AST* self, AST* other )
|
||||
"AST : %S\n" \
|
||||
"Other: %S\n" \
|
||||
, debug_str(self) \
|
||||
,debug_str(other) \
|
||||
, other->debug_str() \
|
||||
); \
|
||||
\
|
||||
log_fmt("Content cannot be trusted to be unique with this check " \
|
||||
@ -677,14 +676,14 @@ bool is_equal( AST* self, AST* other )
|
||||
"Other: %s\n" \
|
||||
"For ast member: %s\n" \
|
||||
, debug_str(self) \
|
||||
, debug_str(other) \
|
||||
, debug_str(self->ast) \
|
||||
, other->debug_str() \
|
||||
, self->ast->debug_str() \
|
||||
); \
|
||||
\
|
||||
return false; \
|
||||
} \
|
||||
\
|
||||
if ( ! is_equal(self->ast, other->ast ) ) \
|
||||
if ( ! self->ast->is_equal( other->ast ) ) \
|
||||
{ \
|
||||
log_fmt( "\nAST::is_equal: Failed for " #ast"\n" \
|
||||
"AST : %S\n" \
|
||||
@ -692,9 +691,9 @@ bool is_equal( AST* self, AST* other )
|
||||
"For ast member: %S\n" \
|
||||
"other's ast member: %S\n" \
|
||||
, debug_str(self) \
|
||||
, debug_str(other) \
|
||||
, debug_str(self->ast) \
|
||||
, debug_str(other->ast) \
|
||||
, other->debug_str() \
|
||||
, self->ast->debug_str() \
|
||||
, other->ast->debug_str() \
|
||||
); \
|
||||
\
|
||||
return false; \
|
||||
@ -922,7 +921,7 @@ bool is_equal( AST* self, AST* other )
|
||||
"AST : %S\n"
|
||||
"Other: %S\n"
|
||||
"For ast member: %S\n"
|
||||
, debug_str(curr)
|
||||
, curr->debug_str()
|
||||
);
|
||||
|
||||
return false;
|
||||
@ -936,14 +935,14 @@ bool is_equal( AST* self, AST* other )
|
||||
"For ast member: %S\n"
|
||||
"other's ast member: %S\n"
|
||||
, debug_str(self)
|
||||
, debug_str(other)
|
||||
, debug_str(curr)
|
||||
, debug_str(curr_other)
|
||||
, other->debug_str()
|
||||
, curr->debug_str()
|
||||
, curr_other->debug_str()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( curr->ValueType && ! is_equal(curr->ValueType, curr_other->ValueType) )
|
||||
if ( curr->ValueType && ! curr->ValueType->is_equal(curr_other->ValueType) )
|
||||
{
|
||||
log_fmt( "\nAST::is_equal: Failed for parameter value type check\n"
|
||||
"AST : %S\n"
|
||||
@ -951,14 +950,14 @@ bool is_equal( AST* self, AST* other )
|
||||
"For ast member: %S\n"
|
||||
"other's ast member: %S\n"
|
||||
, debug_str(self)
|
||||
, debug_str(other)
|
||||
, debug_str(curr)
|
||||
, debug_str(curr_other)
|
||||
, other->debug_str()
|
||||
, curr->debug_str()
|
||||
, curr_other->debug_str()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( curr->Value && ! is_equal(curr->Value, curr_other->Value) )
|
||||
if ( curr->Value && ! curr->Value->is_equal(curr_other->Value) )
|
||||
{
|
||||
log_fmt( "\nAST::is_equal: Failed for parameter value check\n"
|
||||
"AST : %S\n"
|
||||
@ -966,9 +965,9 @@ bool is_equal( AST* self, AST* other )
|
||||
"For ast member: %S\n"
|
||||
"other's ast member: %S\n"
|
||||
, debug_str(self)
|
||||
, debug_str(other)
|
||||
, debug_str(curr)
|
||||
, debug_str(curr_other)
|
||||
, other->debug_str()
|
||||
, curr->debug_str()
|
||||
, curr_other->debug_str()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -1114,13 +1113,13 @@ bool is_equal( AST* self, AST* other )
|
||||
"AST : %S\n"
|
||||
"Other: %S\n"
|
||||
"For ast member: %S\n"
|
||||
, debug_str(curr)
|
||||
, curr->debug_str()
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! is_equal( curr, curr_other ) )
|
||||
if ( ! curr->is_equal( curr_other ) )
|
||||
{
|
||||
log_fmt( "\nAST::is_equal: Failed for body\n"
|
||||
"AST : %S\n"
|
||||
@ -1128,9 +1127,9 @@ bool is_equal( AST* self, AST* other )
|
||||
"For ast member: %S\n"
|
||||
"other's ast member: %S\n"
|
||||
, debug_str(self)
|
||||
, debug_str(other)
|
||||
, debug_str(curr)
|
||||
, debug_str(curr_other)
|
||||
, other->debug_str()
|
||||
, curr->debug_str()
|
||||
, curr_other->debug_str()
|
||||
);
|
||||
|
||||
return false;
|
||||
@ -1153,36 +1152,36 @@ bool is_equal( AST* self, AST* other )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool validate_body(AST* self)
|
||||
bool AST::validate_body()
|
||||
{
|
||||
using namespace ECode;
|
||||
|
||||
#define CheckEntries( Unallowed_Types ) \
|
||||
do \
|
||||
{ \
|
||||
for ( Code entry : cast(CodeBody, {self}) ) \
|
||||
for ( Code entry : code_cast<CodeBody>() ) \
|
||||
{ \
|
||||
switch ( entry->Type ) \
|
||||
{ \
|
||||
Unallowed_Types \
|
||||
log_failure( "AST::validate_body: Invalid entry in body %s", GEN_NS debug_str(entry) ); \
|
||||
log_failure( "AST::validate_body: Invalid entry in body %s", entry.debug_str() ); \
|
||||
return false; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while (0);
|
||||
|
||||
switch ( self->Type )
|
||||
switch ( Type )
|
||||
{
|
||||
case Class_Body:
|
||||
CheckEntries( GEN_AST_BODY_CLASS_UNALLOWED_TYPES );
|
||||
break;
|
||||
case Enum_Body:
|
||||
for ( Code entry : cast(CodeBody, {self}) )
|
||||
for ( Code entry : code_cast<CodeBody>() )
|
||||
{
|
||||
if ( entry->Type != Untyped )
|
||||
{
|
||||
log_failure( "AST::validate_body: Invalid entry in enum body (needs to be untyped or comment) %s", GEN_NS debug_str(entry) );
|
||||
log_failure( "AST::validate_body: Invalid entry in enum body (needs to be untyped or comment) %s", entry.debug_str() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1197,7 +1196,7 @@ bool validate_body(AST* self)
|
||||
CheckEntries( GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES );
|
||||
break;
|
||||
case Global_Body:
|
||||
for (Code entry : cast(CodeBody, {self}))
|
||||
for (Code entry : code_cast<CodeBody>())
|
||||
{
|
||||
switch (entry->Type)
|
||||
{
|
||||
@ -1218,7 +1217,7 @@ bool validate_body(AST* self)
|
||||
case Specifiers:
|
||||
case Struct_Body:
|
||||
case Typename:
|
||||
log_failure("AST::validate_body: Invalid entry in body %s", GEN_NS debug_str(entry));
|
||||
log_failure("AST::validate_body: Invalid entry in body %s", entry.debug_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1230,18 +1229,18 @@ bool validate_body(AST* self)
|
||||
CheckEntries( GEN_AST_BODY_STRUCT_UNALLOWED_TYPES );
|
||||
break;
|
||||
case Union_Body:
|
||||
for ( Code entry : cast(CodeBody, {self->Body}) )
|
||||
for ( Code entry : Body->code_cast<CodeBody>() )
|
||||
{
|
||||
if ( entry->Type != Untyped )
|
||||
{
|
||||
log_failure( "AST::validate_body: Invalid entry in union body (needs to be untyped or comment) %s", GEN_NS debug_str(entry) );
|
||||
log_failure( "AST::validate_body: Invalid entry in union body (needs to be untyped or comment) %s", entry.debug_str() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "AST::validate_body: Invalid this AST does not have a body %s", debug_str(self) );
|
||||
log_failure( "AST::validate_body: Invalid this AST does not have a body %s", debug_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -73,92 +73,82 @@ struct AST_Union;
|
||||
struct AST_Using;
|
||||
struct AST_Var;
|
||||
|
||||
#if GEN_COMPILER_C
|
||||
#define Define_Code(Type) typedef AST_##Type* Code##Type
|
||||
#else
|
||||
#define Define_Code(Type) struct Code##Type
|
||||
#endif
|
||||
|
||||
#if GEN_COMPILER_C
|
||||
typedef AST* code;
|
||||
#else
|
||||
struct Code;
|
||||
#endif
|
||||
Define_Code(Body);
|
||||
struct CodeBody;
|
||||
// These are to offer ease of use and optionally strong type safety for the AST.
|
||||
Define_Code(Attributes);
|
||||
struct CodeAttributes;
|
||||
// struct CodeBaseClass;
|
||||
Define_Code(Comment);
|
||||
Define_Code(Class);
|
||||
Define_Code(Constructor);
|
||||
Define_Code(Define);
|
||||
Define_Code(Destructor);
|
||||
Define_Code(Enum);
|
||||
Define_Code(Exec);
|
||||
Define_Code(Extern);
|
||||
Define_Code(Include);
|
||||
Define_Code(Friend);
|
||||
Define_Code(Fn);
|
||||
Define_Code(Module);
|
||||
Define_Code(NS);
|
||||
Define_Code(Operator);
|
||||
Define_Code(OpCast);
|
||||
Define_Code(Param);
|
||||
Define_Code(PreprocessCond);
|
||||
Define_Code(Pragma);
|
||||
Define_Code(Specifiers);
|
||||
struct CodeComment;
|
||||
struct CodeClass;
|
||||
struct CodeConstructor;
|
||||
struct CodeDefine;
|
||||
struct CodeDestructor;
|
||||
struct CodeEnum;
|
||||
struct CodeExec;
|
||||
struct CodeExtern;
|
||||
struct CodeInclude;
|
||||
struct CodeFriend;
|
||||
struct CodeFn;
|
||||
struct CodeModule;
|
||||
struct CodeNS;
|
||||
struct CodeOperator;
|
||||
struct CodeOpCast;
|
||||
struct CodeParam;
|
||||
struct CodePreprocessCond;
|
||||
struct CodePragma;
|
||||
struct CodeSpecifiers;
|
||||
|
||||
#if GEN_EXECUTION_EXPRESSION_SUPPORT
|
||||
Define_Code(Expr);
|
||||
Define_Code(Expr_Assign);
|
||||
Define_Code(Expr_Alignof);
|
||||
Define_Code(Expr_Binary);
|
||||
Define_Code(Expr_CStyleCast);
|
||||
Define_Code(Expr_FunctionalCast);
|
||||
Define_Code(Expr_CppCast);
|
||||
Define_Code(Expr_Element);
|
||||
Define_Code(Expr_ProcCall);
|
||||
Define_Code(Expr_Decltype);
|
||||
Define_Code(Expr_Comma);
|
||||
Define_Code(Expr_AMS); // Access Member Symbol
|
||||
Define_Code(Expr_Sizeof);
|
||||
Define_Code(Expr_Subscript);
|
||||
Define_Code(Expr_Ternary);
|
||||
Define_Code(Expr_UnaryPrefix);
|
||||
Define_Code(Expr_UnaryPostfix);
|
||||
struct CodeExpr;
|
||||
struct CodeExpr_Assign;
|
||||
struct CodeExpr_Alignof;
|
||||
struct CodeExpr_Binary;
|
||||
struct CodeExpr_CStyleCast;
|
||||
struct CodeExpr_FunctionalCast;
|
||||
struct CodeExpr_CppCast;
|
||||
struct CodeExpr_Element;
|
||||
struct CodeExpr_ProcCall;
|
||||
struct CodeExpr_Decltype;
|
||||
struct CodeExpr_Comma;
|
||||
struct CodeExpr_AMS; // Access Member Symbol
|
||||
struct CodeExpr_Sizeof;
|
||||
struct CodeExpr_Subscript;
|
||||
struct CodeExpr_Ternary;
|
||||
struct CodeExpr_UnaryPrefix;
|
||||
struct CodeExpr_UnaryPostfix;
|
||||
|
||||
Define_Code(Stmt);
|
||||
Define_Code(Stmt_Break);
|
||||
Define_Code(Stmt_Case);
|
||||
Define_Code(Stmt_Continue);
|
||||
Define_Code(Stmt_Decl);
|
||||
Define_Code(Stmt_Do);
|
||||
Define_Code(Stmt_Expr);
|
||||
Define_Code(Stmt_Else);
|
||||
Define_Code(Stmt_If);
|
||||
Define_Code(Stmt_For);
|
||||
Define_Code(Stmt_Goto);
|
||||
Define_Code(Stmt_Label);
|
||||
Define_Code(Stmt_Switch);
|
||||
Define_Code(Stmt_While);
|
||||
struct CodeStmt;
|
||||
struct CodeStmt_Break;
|
||||
struct CodeStmt_Case;
|
||||
struct CodeStmt_Continue;
|
||||
struct CodeStmt_Decl;
|
||||
struct CodeStmt_Do;
|
||||
struct CodeStmt_Expr;
|
||||
struct CodeStmt_Else;
|
||||
struct CodeStmt_If;
|
||||
struct CodeStmt_For;
|
||||
struct CodeStmt_Goto;
|
||||
struct CodeStmt_Label;
|
||||
struct CodeStmt_Switch;
|
||||
struct CodeStmt_While;
|
||||
#endif
|
||||
|
||||
Define_Code(Struct);
|
||||
Define_Code(Template);
|
||||
Define_Code(Type);
|
||||
Define_Code(Typedef);
|
||||
Define_Code(Union);
|
||||
Define_Code(Using);
|
||||
Define_Code(Var);
|
||||
#undef Define_Code
|
||||
struct CodeStruct;
|
||||
struct CodeTemplate;
|
||||
struct CodeType;
|
||||
struct CodeTypedef;
|
||||
struct CodeUnion;
|
||||
struct CodeUsing;
|
||||
struct CodeVar;
|
||||
|
||||
namespace parser
|
||||
{
|
||||
struct Token;
|
||||
}
|
||||
|
||||
#if ! GEN_COMPILER_C
|
||||
template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast( Type*, & self ); }
|
||||
template< class Type> forceinline Type tmpl_cast( Code* self ) { return * rcast( Type*, self ); }
|
||||
#if ! GEN_COMPILER_C && 0
|
||||
template< class Type> forceinline Type tmpl_cast( Code& self ) { return * rcast( Type*, & self ); }
|
||||
#endif
|
||||
|
||||
char const* debug_str (Code code);
|
||||
@ -169,7 +159,6 @@ bool is_valid (Code code);
|
||||
void set_global(Code code);
|
||||
String to_string (Code code);
|
||||
|
||||
#if ! GEN_COMPILER_C
|
||||
/*
|
||||
AST* wrapper
|
||||
- Not constantly have to append the '*' as this is written often..
|
||||
@ -179,29 +168,32 @@ struct Code
|
||||
{
|
||||
AST* ast;
|
||||
|
||||
# define Using_Code( Typename ) \
|
||||
char const* debug_str() { return GEN_NS debug_str(* this); } \
|
||||
Code duplicate() { return GEN_NS duplicate(* this); } \
|
||||
# define Using_Code( Typename ) \
|
||||
char const* debug_str() { return GEN_NS debug_str(* this); } \
|
||||
Code duplicate() { return GEN_NS duplicate(* this); } \
|
||||
bool is_equal( Code other ) { return GEN_NS is_equal(* this, other); } \
|
||||
bool is_body() { return GEN_NS is_body(* this); } \
|
||||
bool is_valid() { return GEN_NS is_valid(* this); } \
|
||||
void set_global() { return GEN_NS set_global(* this); }
|
||||
|
||||
# define Using_CodeOps( Typename ) \
|
||||
Typename& operator = ( AST* other ); \
|
||||
Typename& operator = ( Code other ); \
|
||||
bool is_body() { return GEN_NS is_body(* this); } \
|
||||
bool is_valid() { return GEN_NS is_valid(* this); } \
|
||||
void set_global() { return GEN_NS set_global(* this); } \
|
||||
String to_string(); \
|
||||
Typename& operator = ( AST* other ); \
|
||||
Typename& operator = ( Code other ); \
|
||||
bool operator ==( Code other ) { return (AST*)ast == other.ast; } \
|
||||
bool operator !=( Code other ) { return (AST*)ast != other.ast; } \
|
||||
operator bool();
|
||||
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||
Using_Code( Code );
|
||||
String to_string() { return GEN_NS to_string(* this); }
|
||||
#endif
|
||||
|
||||
Using_CodeOps( Code );
|
||||
template< class Type >
|
||||
forceinline Type code_cast()
|
||||
{
|
||||
return * rcast( Type*, this );
|
||||
}
|
||||
|
||||
AST* operator ->() { return ast; }
|
||||
AST* operator ->()
|
||||
{
|
||||
return ast;
|
||||
}
|
||||
Code& operator ++();
|
||||
|
||||
// TODO(Ed) : Remove this overload.
|
||||
@ -250,7 +242,6 @@ struct Code
|
||||
operator CodeVar() const;
|
||||
#undef operator
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma region Statics
|
||||
// Used to identify ASTs that should always be duplicated. (Global constant ASTs)
|
||||
@ -270,17 +261,15 @@ static_assert( sizeof(Code) == sizeof(Code_POD), "ERROR: Code is not POD" );
|
||||
// Desired width of the AST data structure.
|
||||
constexpr int const AST_POD_Size = 128;
|
||||
|
||||
void append ( AST* self, AST* other );
|
||||
char const* debug_str ( AST* self );
|
||||
AST* duplicate ( AST* self );
|
||||
Code* entry ( AST* self, u32 idx );
|
||||
bool has_entries ( AST* self );
|
||||
bool is_body ( AST* self );
|
||||
bool is_equal ( AST* self, AST* other );
|
||||
String to_string ( AST* self );
|
||||
void to_string ( AST* self, String* result );
|
||||
char const* type_str ( AST* self );
|
||||
bool validate_body( AST* self );
|
||||
void append ( AST* self, AST* other );
|
||||
char const* debug_str ( AST* self );
|
||||
AST* duplicate ( AST* self );
|
||||
Code* entry ( AST* self, u32 idx );
|
||||
bool has_entries( AST* self );
|
||||
bool is_body ( AST* self );
|
||||
bool is_equal ( AST* self, AST* other );
|
||||
String to_string ( AST* self );
|
||||
char const* type_str ( AST* self );
|
||||
|
||||
#if GEN_CPP_SUPPORT_REFERENCES
|
||||
void append ( AST& self, AST& other ) { return append(& self, & other); }
|
||||
@ -291,20 +280,6 @@ String to_string( AST& self ) { return to_string( & self ); }
|
||||
char const* type_str ( AST& self ) { return type_str( & self ); }
|
||||
#endif
|
||||
|
||||
constexpr static
|
||||
int AST_ArrSpecs_Cap =
|
||||
(
|
||||
AST_POD_Size
|
||||
- sizeof(AST*) * 3
|
||||
- sizeof(parser::Token*)
|
||||
- sizeof(AST*)
|
||||
- sizeof(StringCached)
|
||||
- sizeof(CodeT)
|
||||
- sizeof(ModuleFlag)
|
||||
- sizeof(int)
|
||||
)
|
||||
/ sizeof(int) - 1; // -1 for 4 extra bytes
|
||||
|
||||
/*
|
||||
Simple AST POD with functionality to seralize into C++ syntax.
|
||||
*/
|
||||
@ -312,19 +287,26 @@ struct AST
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||
# pragma region Member Functions
|
||||
void append ( AST* other ) { GEN_NS append(this, other); }
|
||||
char const* debug_str () { return GEN_NS debug_str(this); }
|
||||
AST* duplicate () { return GEN_NS duplicate(this); }
|
||||
Code* entry ( u32 idx ) { return GEN_NS entry(this, idx); }
|
||||
bool has_entries() { return GEN_NS has_entries(this); }
|
||||
void append ( AST* other ) { GEN_NS append(this, other); }
|
||||
char const* debug_str () { return GEN_NS debug_str(this); }
|
||||
AST* duplicate () { return GEN_NS duplicate(this); }
|
||||
Code* entry ( u32 idx ) { return GEN_NS entry(this, idx); }
|
||||
bool has_entries();
|
||||
bool is_equal ( AST* other ) { return GEN_NS is_equal(this, other); }
|
||||
bool is_body() { return GEN_NS is_body(this); }
|
||||
char const* type_str() { return GEN_NS type_str(this); }
|
||||
bool validate_body() { return GEN_NS validate_body(this); }
|
||||
bool validate_body();
|
||||
|
||||
String to_string() { return GEN_NS to_string(this); }
|
||||
void to_string( String& result ) { return GEN_NS to_string(this, & result); }
|
||||
String to_string(); //{ return GEN_NS to_string(this); }
|
||||
|
||||
template< class Type >
|
||||
forceinline Type code_cast()
|
||||
{
|
||||
return * this;
|
||||
}
|
||||
|
||||
neverinline
|
||||
void to_string( String& result );
|
||||
# pragma endregion Member Functions
|
||||
#endif
|
||||
|
||||
@ -359,6 +341,20 @@ struct AST
|
||||
operator CodeUsing();
|
||||
operator CodeVar();
|
||||
|
||||
constexpr static
|
||||
int ArrSpecs_Cap =
|
||||
(
|
||||
AST_POD_Size
|
||||
- sizeof(AST*) * 3
|
||||
- sizeof(parser::Token*)
|
||||
- sizeof(AST*)
|
||||
- sizeof(StringCached)
|
||||
- sizeof(CodeT)
|
||||
- sizeof(ModuleFlag)
|
||||
- sizeof(int)
|
||||
)
|
||||
/ sizeof(int) - 1; // -1 for 4 extra bytes
|
||||
|
||||
union {
|
||||
struct
|
||||
{
|
||||
@ -391,7 +387,7 @@ struct AST
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
struct {
|
||||
SpecifierT ArrSpecs[AST_ArrSpecs_Cap]; // Specifiers
|
||||
SpecifierT ArrSpecs[ArrSpecs_Cap]; // Specifiers
|
||||
AST* NextSpecs; // Specifiers; If ArrSpecs is full, then NextSpecs is used.
|
||||
};
|
||||
};
|
||||
@ -455,7 +451,7 @@ struct AST_POD
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
struct {
|
||||
SpecifierT ArrSpecs[AST_ArrSpecs_Cap]; // Specifiers
|
||||
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
|
||||
AST* NextSpecs; // Specifiers; If ArrSpecs is full, then NextSpecs is used.
|
||||
};
|
||||
};
|
||||
@ -484,6 +480,10 @@ struct AST_POD
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// TODO(Ed): Convert
|
||||
String to_string ( AST* self ) { return self->to_string(); }
|
||||
|
||||
// Its intended for the AST to have equivalent size to its POD.
|
||||
// All extra functionality within the AST namespace should just be syntatic sugar.
|
||||
static_assert( sizeof(AST) == sizeof(AST_POD), "ERROR: AST IS NOT POD" );
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
struct AST_Body
|
||||
{
|
||||
char _PAD_[ sizeof(SpecifierT) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
char _PAD_[ sizeof(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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 ];
|
||||
SpecifierT 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * 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(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
|
||||
struct
|
||||
{
|
||||
CodeComment InlineCmt;
|
||||
|
@ -3,14 +3,14 @@
|
||||
#include "ast.cpp"
|
||||
#endif
|
||||
|
||||
String to_string(Code self)
|
||||
String Code::to_string()
|
||||
{
|
||||
if ( self.ast == nullptr )
|
||||
if ( ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::to_string: Cannot convert code to string, AST is null!" );
|
||||
return { nullptr };
|
||||
}
|
||||
return to_string( self.ast );
|
||||
return rcast( AST*, ast )->to_string();
|
||||
}
|
||||
|
||||
String CodeAttributes::to_string()
|
||||
@ -18,16 +18,15 @@ String CodeAttributes::to_string()
|
||||
return GEN_NS duplicate( ast->Content, GlobalAllocator );
|
||||
}
|
||||
|
||||
String to_string(CodeBody body)
|
||||
String CodeBody::to_string()
|
||||
{
|
||||
GEN_ASSERT(body.ast != nullptr);
|
||||
String result = string_make( GlobalAllocator, "" );
|
||||
switch ( body.ast->Type )
|
||||
switch ( ast->Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
case Untyped:
|
||||
case Execution:
|
||||
append( & result, rcast(AST*, body.ast)->Content );
|
||||
GEN_NS append( & result, raw()->Content );
|
||||
break;
|
||||
|
||||
case Enum_Body:
|
||||
@ -38,44 +37,40 @@ String to_string(CodeBody body)
|
||||
case Namespace_Body:
|
||||
case Struct_Body:
|
||||
case Union_Body:
|
||||
to_string( body, & result );
|
||||
to_string( result );
|
||||
break;
|
||||
|
||||
case Export_Body:
|
||||
to_string_export( body, & result );
|
||||
to_string_export( result );
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void to_string( CodeBody body, String* result )
|
||||
void CodeBody::to_string( String& result )
|
||||
{
|
||||
GEN_ASSERT(body.ast != nullptr);
|
||||
GEN_ASSERT(result != nullptr);
|
||||
Code curr = body.ast->Front;
|
||||
s32 left = body.ast->NumEntries;
|
||||
Code curr = ast->Front;
|
||||
s32 left = ast->NumEntries;
|
||||
while ( left -- )
|
||||
{
|
||||
append_fmt( result, "%S", GEN_NS to_string(curr) );
|
||||
append_fmt( & result, "%S", curr.to_string() );
|
||||
++curr;
|
||||
}
|
||||
}
|
||||
|
||||
void to_string_export( CodeBody body, String* result )
|
||||
void CodeBody::to_string_export( String& result )
|
||||
{
|
||||
GEN_ASSERT(body.ast != nullptr);
|
||||
GEN_ASSERT(result != nullptr);
|
||||
append_fmt( result, "export\n{\n" );
|
||||
append_fmt( & result, "export\n{\n" );
|
||||
|
||||
Code curr = body;
|
||||
s32 left = body.ast->NumEntries;
|
||||
Code curr = *this;
|
||||
s32 left = ast->NumEntries;
|
||||
while ( left-- )
|
||||
{
|
||||
append_fmt( result, "%S", to_string(curr) );
|
||||
append_fmt( & result, "%S", curr.to_string() );
|
||||
++curr;
|
||||
}
|
||||
|
||||
append_fmt( result, "};\n" );
|
||||
append_fmt( & result, "};\n" );
|
||||
}
|
||||
|
||||
String CodeComment::to_string()
|
||||
@ -115,12 +110,12 @@ void CodeConstructor::to_string_def( String& result )
|
||||
append( & result, "()" );
|
||||
|
||||
if ( ast->InitializerList )
|
||||
append_fmt( & result, " : %S", GEN_NS to_string(ast->InitializerList) );
|
||||
append_fmt( & result, " : %S", ast->InitializerList.to_string() );
|
||||
|
||||
if ( ast->InlineCmt )
|
||||
append_fmt( & result, " // %S", ast->InlineCmt->Content );
|
||||
|
||||
append_fmt( & result, "\n{\n%S\n}\n", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "\n{\n%S\n}\n", ast->Body.to_string() );
|
||||
}
|
||||
|
||||
void CodeConstructor::to_string_fwd( String& result )
|
||||
@ -139,7 +134,7 @@ void CodeConstructor::to_string_fwd( String& result )
|
||||
append_fmt( & result, "()");
|
||||
|
||||
if (ast->Body)
|
||||
append_fmt( & result, " = %S", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, " = %S", ast->Body.to_string() );
|
||||
|
||||
if ( ast->InlineCmt )
|
||||
append_fmt( & result, "; // %S\n", ast->InlineCmt->Content );
|
||||
@ -147,89 +142,83 @@ void CodeConstructor::to_string_fwd( String& result )
|
||||
append( & result, ";\n" );
|
||||
}
|
||||
|
||||
String to_string( CodeClass self )
|
||||
String CodeClass::to_string()
|
||||
{
|
||||
String result = string_make( GlobalAllocator, "" );
|
||||
switch ( self->Type )
|
||||
switch ( ast->Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
case Class:
|
||||
to_string_def(self, & result );
|
||||
to_string_def( result );
|
||||
break;
|
||||
case Class_Fwd:
|
||||
to_string_fwd(self, & result );
|
||||
to_string_fwd( result );
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void to_string_def( CodeClass self, String* result )
|
||||
void CodeClass::to_string_def( String& result )
|
||||
{
|
||||
GEN_ASSERT(self.ast != nullptr);
|
||||
AST_Class* ast = self.ast;
|
||||
|
||||
if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export ))
|
||||
append( result, "export " );
|
||||
append( & result, "export " );
|
||||
|
||||
append( result, "class " );
|
||||
append( & result, "class " );
|
||||
|
||||
if ( ast->Attributes )
|
||||
{
|
||||
append_fmt( result, "%S ", ast->Attributes.to_string() );
|
||||
append_fmt( & result, "%S ", ast->Attributes.to_string() );
|
||||
}
|
||||
|
||||
if ( ast->ParentType )
|
||||
{
|
||||
char const* access_level = to_str( ast->ParentAccess );
|
||||
|
||||
append_fmt( result, "%S : %s %S", ast->Name, access_level, ast->ParentType.to_string() );
|
||||
append_fmt( & result, "%S : %s %S", ast->Name, access_level, ast->ParentType.to_string() );
|
||||
|
||||
CodeType interface = cast(CodeType, ast->ParentType->Next);
|
||||
CodeType interface = ast->ParentType->Next->code_cast< CodeType >();
|
||||
if ( interface )
|
||||
append( result, "\n" );
|
||||
append( & result, "\n" );
|
||||
|
||||
while ( interface )
|
||||
{
|
||||
append_fmt( result, ", %S", interface.to_string() );
|
||||
interface = interface->Next ? cast(CodeType, interface->Next) : CodeType { nullptr };
|
||||
append_fmt( & result, ", %S", interface.to_string() );
|
||||
interface = interface->Next ? interface->Next->code_cast< CodeType >() : CodeType { nullptr };
|
||||
}
|
||||
}
|
||||
else if ( ast->Name )
|
||||
{
|
||||
append( result, ast->Name );
|
||||
append( & result, ast->Name );
|
||||
}
|
||||
|
||||
if ( ast->InlineCmt )
|
||||
{
|
||||
append_fmt( result, " // %S", ast->InlineCmt->Content );
|
||||
append_fmt( & result, " // %S", ast->InlineCmt->Content );
|
||||
}
|
||||
|
||||
append_fmt( result, "\n{\n%S\n}", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "\n{\n%S\n}", ast->Body.to_string() );
|
||||
|
||||
if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) )
|
||||
append( result, ";\n");
|
||||
append( & result, ";\n");
|
||||
}
|
||||
|
||||
void to_string_fwd( CodeClass self, String* result )
|
||||
void CodeClass::to_string_fwd( String& result )
|
||||
{
|
||||
GEN_ASSERT(self.ast != nullptr);
|
||||
AST_Class* ast = self.ast;
|
||||
|
||||
if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export ))
|
||||
append( result, "export " );
|
||||
append( & result, "export " );
|
||||
|
||||
if ( ast->Attributes )
|
||||
append_fmt( result, "class %S %S", ast->Attributes.to_string(), ast->Name );
|
||||
append_fmt( & result, "class %S %S", ast->Attributes.to_string(), ast->Name );
|
||||
|
||||
else append_fmt( result, "class %S", ast->Name );
|
||||
else append_fmt( & result, "class %S", ast->Name );
|
||||
|
||||
// Check if it can have an end-statement
|
||||
if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) )
|
||||
{
|
||||
if ( ast->InlineCmt )
|
||||
append_fmt( result, "; // %S\n", ast->InlineCmt->Content );
|
||||
append_fmt( & result, "; // %S\n", ast->InlineCmt->Content );
|
||||
else
|
||||
append( result,";\n");
|
||||
append( & result,";\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +264,7 @@ void CodeDestructor::to_string_def( String& result )
|
||||
else
|
||||
append_fmt( & result, "~%S()", ast->Parent->Name );
|
||||
|
||||
append_fmt( & result, "\n{\n%S\n}\n", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "\n{\n%S\n}\n", ast->Body.to_string() );
|
||||
}
|
||||
|
||||
void CodeDestructor::to_string_fwd( String& result )
|
||||
@ -290,7 +279,7 @@ void CodeDestructor::to_string_fwd( String& result )
|
||||
if ( ast->Specs.has( ESpecifier::Pure ) )
|
||||
append( & result, " = 0;" );
|
||||
else if (ast->Body)
|
||||
append_fmt( & result, " = %S;", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, " = %S;", ast->Body.to_string() );
|
||||
}
|
||||
else
|
||||
append_fmt( & result, "~%S();", ast->Parent->Name );
|
||||
@ -339,18 +328,18 @@ void CodeEnum::to_string_def( String& result )
|
||||
append_fmt( & result, "%S : %S\n{\n%S\n}"
|
||||
, ast->Name
|
||||
, ast->UnderlyingType.to_string()
|
||||
, GEN_NS to_string(ast->Body)
|
||||
, ast->Body.to_string()
|
||||
);
|
||||
else if ( ast->UnderlyingTypeMacro )
|
||||
append_fmt( & result, "%S : %S\n{\n%S\n}"
|
||||
, ast->Name
|
||||
, GEN_NS to_string(ast->UnderlyingTypeMacro)
|
||||
, GEN_NS to_string(ast->Body)
|
||||
, ast->UnderlyingTypeMacro.to_string()
|
||||
, ast->Body.to_string()
|
||||
);
|
||||
|
||||
else append_fmt( & result, "%S\n{\n%S\n}", ast->Name, GEN_NS to_string(ast->Body) );
|
||||
else append_fmt( & result, "%S\n{\n%S\n}", ast->Name, ast->Body.to_string() );
|
||||
}
|
||||
else append_fmt( & result, "enum %S\n{\n%S\n}", ast->Name, GEN_NS to_string(ast->Body) );
|
||||
else append_fmt( & result, "enum %S\n{\n%S\n}", ast->Name, ast->Body.to_string() );
|
||||
|
||||
if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) )
|
||||
append( & result, ";\n");
|
||||
@ -394,16 +383,16 @@ void CodeEnum::to_string_class_def( String& result )
|
||||
|
||||
if ( ast->UnderlyingType )
|
||||
{
|
||||
append_fmt( & result, "%S : %S\n{\n%S\n}", ast->Name, ast->UnderlyingType.to_string(), GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "%S : %S\n{\n%S\n}", ast->Name, ast->UnderlyingType.to_string(), ast->Body.to_string() );
|
||||
}
|
||||
else
|
||||
{
|
||||
append_fmt( & result, "%S\n{\n%S\n}", ast->Name, GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "%S\n{\n%S\n}", ast->Name, ast->Body.to_string() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
append_fmt( & result, "enum class %S\n{\n%S\n}", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "enum class %S\n{\n%S\n}", ast->Body.to_string() );
|
||||
}
|
||||
|
||||
if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) )
|
||||
@ -439,7 +428,7 @@ String CodeExec::to_string()
|
||||
void CodeExtern::to_string( String& result )
|
||||
{
|
||||
if ( ast->Body )
|
||||
append_fmt( & result, "extern \"%S\"\n{\n%S\n}\n", ast->Name, GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "extern \"%S\"\n{\n%S\n}\n", ast->Name, ast->Body.to_string() );
|
||||
else
|
||||
append_fmt( & result, "extern \"%S\"\n{}\n", ast->Name );
|
||||
}
|
||||
@ -463,7 +452,7 @@ String CodeFriend::to_string()
|
||||
|
||||
void CodeFriend::to_string( String& result )
|
||||
{
|
||||
append_fmt( & result, "friend %S", GEN_NS to_string(ast->Declaration) );
|
||||
append_fmt( & result, "friend %S", ast->Declaration->to_string() );
|
||||
|
||||
if ( ast->Declaration->Type != ECode::Function && result[ length(result) - 1 ] != ';' )
|
||||
{
|
||||
@ -542,7 +531,7 @@ void CodeFn::to_string_def( String& result )
|
||||
}
|
||||
}
|
||||
|
||||
append_fmt( & result, "\n{\n%S\n}\n", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "\n{\n%S\n}\n", ast->Body.to_string() );
|
||||
}
|
||||
|
||||
void CodeFn::to_string_fwd( String& result )
|
||||
@ -600,7 +589,7 @@ void CodeFn::to_string_fwd( String& result )
|
||||
if ( ast->Specs && ast->Specs.has( ESpecifier::Pure ) >= 0 )
|
||||
append( & result, " = 0;" );
|
||||
else if (ast->Body)
|
||||
append_fmt( & result, " = %S;", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, " = %S;", ast->Body.to_string() );
|
||||
|
||||
if ( ast->InlineCmt )
|
||||
append_fmt( & result, "; %S", ast->InlineCmt->Content );
|
||||
@ -638,7 +627,7 @@ void CodeNS::to_string( String& result )
|
||||
if ( bitfield_is_equal( u32, ast->ModuleFlags, ModuleFlag_Export ))
|
||||
append( & result, "export " );
|
||||
|
||||
append_fmt( & result, "namespace %S\n{\n%S\n}\n", ast->Name , GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "namespace %S\n{\n%S\n}\n", ast->Name , ast->Body.to_string() );
|
||||
}
|
||||
|
||||
String CodeOperator::to_string()
|
||||
@ -709,7 +698,7 @@ void CodeOperator::to_string_def( String& result )
|
||||
}
|
||||
|
||||
append_fmt( & result, "\n{\n%S\n}\n"
|
||||
, GEN_NS to_string(ast->Body)
|
||||
, ast->Body.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
@ -807,14 +796,14 @@ void CodeOpCast::to_string_def( String& result )
|
||||
}
|
||||
}
|
||||
|
||||
append_fmt( & result, "\n{\n%S\n}\n", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "\n{\n%S\n}\n", ast->Body.to_string() );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ast->Name && length(ast->Name) )
|
||||
append_fmt( & result, "%Soperator %S()\n{\n%S\n}\n", ast->Name, ast->ValueType.to_string(), GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "%Soperator %S()\n{\n%S\n}\n", ast->Name, ast->ValueType.to_string(), ast->Body.to_string() );
|
||||
else
|
||||
append_fmt( & result, "operator %S()\n{\n%S\n}\n", ast->ValueType.to_string(), GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "operator %S()\n{\n%S\n}\n", ast->ValueType.to_string(), ast->Body.to_string() );
|
||||
}
|
||||
|
||||
void CodeOpCast::to_string_fwd( String& result )
|
||||
@ -883,11 +872,11 @@ void CodeParam::to_string( String& result )
|
||||
|
||||
if ( ast->PostNameMacro )
|
||||
{
|
||||
append_fmt( & result, " %S", GEN_NS to_string(ast->PostNameMacro) );
|
||||
append_fmt( & result, " %S", ast->PostNameMacro.to_string() );
|
||||
}
|
||||
|
||||
if ( ast->Value )
|
||||
append_fmt( & result, " = %S", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, " = %S", ast->Value.to_string() );
|
||||
|
||||
if ( ast->NumEntries - 1 > 0 )
|
||||
{
|
||||
@ -1021,14 +1010,14 @@ void CodeStruct::to_string_def( String& result )
|
||||
|
||||
append_fmt( & result, "%S : %s %S", ast->Name, access_level, ast->ParentType.to_string() );
|
||||
|
||||
CodeType interface = cast(CodeType, ast->ParentType->Next);
|
||||
CodeType interface = ast->ParentType->Next->code_cast< CodeType >();
|
||||
if ( interface )
|
||||
append( & result, "\n" );
|
||||
|
||||
while ( interface )
|
||||
{
|
||||
append_fmt( & result, ", %S", interface.to_string() );
|
||||
interface = interface->Next ? cast( CodeType, interface->Next) : CodeType { nullptr };
|
||||
interface = interface->Next ? interface->Next->code_cast< CodeType >() : CodeType { nullptr };
|
||||
}
|
||||
}
|
||||
else if ( ast->Name )
|
||||
@ -1041,7 +1030,7 @@ void CodeStruct::to_string_def( String& result )
|
||||
append_fmt( & result, " // %S", ast->InlineCmt->Content );
|
||||
}
|
||||
|
||||
append_fmt( & result, "\n{\n%S\n}", GEN_NS to_string(ast->Body) );
|
||||
append_fmt( & result, "\n{\n%S\n}", ast->Body.to_string() );
|
||||
|
||||
if ( ast->Parent.ast == nullptr || ( ast->Parent->Type != ECode::Typedef && ast->Parent->Type != ECode::Variable ) )
|
||||
append( & result, ";\n");
|
||||
@ -1079,9 +1068,9 @@ void CodeTemplate::to_string( String& result )
|
||||
append( & result, "export " );
|
||||
|
||||
if ( ast->Params )
|
||||
append_fmt( & result, "template< %S >\n%S", GEN_NS to_string(ast->Params), GEN_NS to_string(ast->Declaration) );
|
||||
append_fmt( & result, "template< %S >\n%S", ast->Params.to_string(), ast->Declaration.to_string() );
|
||||
else
|
||||
append_fmt( & result, "template<>\n%S", GEN_NS to_string(ast->Declaration) );
|
||||
append_fmt( & result, "template<>\n%S", ast->Declaration.to_string() );
|
||||
}
|
||||
|
||||
String CodeTypedef::to_string()
|
||||
@ -1100,18 +1089,18 @@ void CodeTypedef::to_string( String& result )
|
||||
|
||||
// Determines if the typedef is a function typename
|
||||
if ( ast->UnderlyingType->ReturnType )
|
||||
append( & result, GEN_NS to_string(ast->UnderlyingType) );
|
||||
append( & result, ast->UnderlyingType.to_string() );
|
||||
else
|
||||
append_fmt( & result, "%S %S", GEN_NS to_string(ast->UnderlyingType), ast->Name );
|
||||
append_fmt( & result, "%S %S", ast->UnderlyingType.to_string(), ast->Name );
|
||||
|
||||
if ( ast->UnderlyingType->Type == ECode::Typename && ast->UnderlyingType->ArrExpr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ];", GEN_NS to_string(ast->UnderlyingType->ArrExpr) );
|
||||
append_fmt( & result, "[ %S ];", ast->UnderlyingType->ArrExpr->to_string() );
|
||||
|
||||
AST* next_arr_expr = ast->UnderlyingType->ArrExpr->Next;
|
||||
while ( next_arr_expr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ];", GEN_NS to_string(next_arr_expr) );
|
||||
append_fmt( & result, "[ %S ];", next_arr_expr->to_string() );
|
||||
next_arr_expr = next_arr_expr->Next;
|
||||
}
|
||||
}
|
||||
@ -1200,14 +1189,14 @@ void CodeUnion::to_string( String& result )
|
||||
{
|
||||
append_fmt( & result, "%S\n{\n%S\n}"
|
||||
, ast->Name
|
||||
, GEN_NS to_string(ast->Body)
|
||||
, ast->Body.to_string()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Anonymous union
|
||||
append_fmt( & result, "\n{\n%S\n}"
|
||||
, GEN_NS to_string(ast->Body)
|
||||
, ast->Body.to_string()
|
||||
);
|
||||
}
|
||||
|
||||
@ -1245,12 +1234,12 @@ void CodeUsing::to_string( String& result )
|
||||
|
||||
if ( ast->UnderlyingType->ArrExpr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(ast->UnderlyingType->ArrExpr) );
|
||||
append_fmt( & result, "[ %S ]", ast->UnderlyingType->ArrExpr.to_string() );
|
||||
|
||||
AST* next_arr_expr = ast->UnderlyingType->ArrExpr->Next;
|
||||
while ( next_arr_expr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(next_arr_expr) );
|
||||
append_fmt( & result, "[ %S ]", next_arr_expr->to_string() );
|
||||
next_arr_expr = next_arr_expr->Next;
|
||||
}
|
||||
}
|
||||
@ -1294,12 +1283,12 @@ void CodeVar::to_string( String& result )
|
||||
|
||||
if ( ast->ValueType->ArrExpr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(ast->ValueType->ArrExpr) );
|
||||
append_fmt( & result, "[ %S ]", ast->ValueType->ArrExpr.to_string() );
|
||||
|
||||
AST* next_arr_expr = ast->ValueType->ArrExpr->Next;
|
||||
while ( next_arr_expr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(next_arr_expr) );
|
||||
append_fmt( & result, "[ %S ]", next_arr_expr->to_string() );
|
||||
next_arr_expr = next_arr_expr->Next;
|
||||
}
|
||||
}
|
||||
@ -1307,9 +1296,9 @@ void CodeVar::to_string( String& result )
|
||||
if ( ast->Value )
|
||||
{
|
||||
if ( ast->VarConstructorInit )
|
||||
append_fmt( & result, "( %S ", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, "( %S ", ast->Value.to_string() );
|
||||
else
|
||||
append_fmt( & result, " = %S", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, " = %S", ast->Value.to_string() );
|
||||
}
|
||||
|
||||
// Keep the chain going...
|
||||
@ -1337,25 +1326,25 @@ void CodeVar::to_string( String& result )
|
||||
|
||||
if ( ast->ValueType->ArrExpr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(ast->ValueType->ArrExpr) );
|
||||
append_fmt( & result, "[ %S ]", ast->ValueType->ArrExpr.to_string() );
|
||||
|
||||
AST* next_arr_expr = ast->ValueType->ArrExpr->Next;
|
||||
while ( next_arr_expr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(next_arr_expr) );
|
||||
append_fmt( & result, "[ %S ]", next_arr_expr->to_string() );
|
||||
next_arr_expr = next_arr_expr->Next;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ast->BitfieldSize )
|
||||
append_fmt( & result, " : %S", GEN_NS to_string(ast->BitfieldSize) );
|
||||
append_fmt( & result, " : %S", ast->BitfieldSize.to_string() );
|
||||
|
||||
if ( ast->Value )
|
||||
{
|
||||
if ( ast->VarConstructorInit )
|
||||
append_fmt( & result, "( %S ", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, "( %S ", ast->Value.to_string() );
|
||||
else
|
||||
append_fmt( & result, " = %S", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, " = %S", ast->Value.to_string() );
|
||||
}
|
||||
|
||||
if ( ast->NextVar )
|
||||
@ -1373,16 +1362,16 @@ void CodeVar::to_string( String& result )
|
||||
}
|
||||
|
||||
if ( ast->BitfieldSize )
|
||||
append_fmt( & result, "%S %S : %S", ast->ValueType.to_string(), ast->Name, GEN_NS to_string(ast->BitfieldSize) );
|
||||
append_fmt( & result, "%S %S : %S", ast->ValueType.to_string(), ast->Name, ast->BitfieldSize.to_string() );
|
||||
|
||||
else if ( ast->ValueType->ArrExpr )
|
||||
{
|
||||
append_fmt( & result, "%S %S[ %S ]", ast->ValueType.to_string(), ast->Name, GEN_NS to_string(ast->ValueType->ArrExpr) );
|
||||
append_fmt( & result, "%S %S[ %S ]", ast->ValueType.to_string(), ast->Name, ast->ValueType->ArrExpr.to_string() );
|
||||
|
||||
AST* next_arr_expr = ast->ValueType->ArrExpr->Next;
|
||||
while ( next_arr_expr )
|
||||
{
|
||||
append_fmt( & result, "[ %S ]", GEN_NS to_string(next_arr_expr) );
|
||||
append_fmt( & result, "[ %S ]", next_arr_expr->to_string() );
|
||||
next_arr_expr = next_arr_expr->Next;
|
||||
}
|
||||
}
|
||||
@ -1393,9 +1382,9 @@ void CodeVar::to_string( String& result )
|
||||
if ( ast->Value )
|
||||
{
|
||||
if ( ast->VarConstructorInit )
|
||||
append_fmt( & result, "( %S ", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, "( %S ", ast->Value.to_string() );
|
||||
else
|
||||
append_fmt( & result, " = %S", GEN_NS to_string(ast->Value) );
|
||||
append_fmt( & result, " = %S", ast->Value.to_string() );
|
||||
}
|
||||
|
||||
if ( ast->NextVar )
|
||||
|
@ -3,45 +3,44 @@
|
||||
#include "ast.hpp"
|
||||
#endif
|
||||
|
||||
void append ( CodeBody body, Code other );
|
||||
void append ( CodeBody body, CodeBody other );
|
||||
String to_string ( CodeBody body );
|
||||
void to_string ( CodeBody body, String* result );
|
||||
void to_string_export ( CodeBody body, String* result );
|
||||
|
||||
void add_interface( CodeClass self, CodeType interface );
|
||||
String to_string ( CodeClass self );
|
||||
void to_string_def( CodeClass self, String* result );
|
||||
void to_string_fwd( CodeClass self, String* result );
|
||||
|
||||
#pragma region Code Types
|
||||
// These structs are not used at all by the C vairant.
|
||||
#if ! GEN_COMPILER_C
|
||||
// stati_assert( GEN_COMPILER_C, "This should not be compiled with the C-library" );
|
||||
|
||||
struct CodeBody
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES
|
||||
Using_Code( CodeBody );
|
||||
|
||||
void append( Code other ) { return GEN_NS append( *this, other ); }
|
||||
void append( CodeBody body ) { return GEN_NS append(*this, body); }
|
||||
bool has_entries() { return GEN_NS has_entries(rcast( AST*, ast )); }
|
||||
void append( Code other )
|
||||
{
|
||||
GEN_ASSERT(other.ast != nullptr);
|
||||
|
||||
String to_string() { return GEN_NS to_string(* this); }
|
||||
void to_string( String& result ) { return GEN_NS to_string(* this, & result ); }
|
||||
void to_string_export( String& result ) { return GEN_NS to_string_export(* this, & result); }
|
||||
#endif
|
||||
if (other.is_body()) {
|
||||
append( cast(CodeBody, & other) );
|
||||
}
|
||||
|
||||
GEN_NS append( raw(), other.ast );
|
||||
}
|
||||
void append( CodeBody body )
|
||||
{
|
||||
for ( Code entry : body ) {
|
||||
append( entry );
|
||||
}
|
||||
}
|
||||
bool has_entries() { return GEN_NS has_entries(rcast( AST*, ast )); }
|
||||
AST* raw() { return rcast( AST*, ast ); }
|
||||
|
||||
void to_string( String& result );
|
||||
void to_string_export( String& result );
|
||||
|
||||
Using_CodeOps( CodeBody );
|
||||
operator Code() { return * rcast( Code*, this ); }
|
||||
AST_Body* operator->() { return ast; }
|
||||
|
||||
operator Code() { return * rcast( Code*, this ); }
|
||||
|
||||
#pragma region Iterator
|
||||
Code begin()
|
||||
{
|
||||
if ( ast )
|
||||
return { rcast( AST*, ast)->Front };
|
||||
|
||||
return { nullptr };
|
||||
}
|
||||
Code end()
|
||||
@ -55,18 +54,21 @@ struct CodeBody
|
||||
|
||||
struct CodeClass
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 0
|
||||
Using_Code( CodeClass );
|
||||
|
||||
void add_interface( CodeType interface );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps( CodeClass );
|
||||
operator Code() { return * rcast( Code*, this ); }
|
||||
AST* raw()
|
||||
{
|
||||
return rcast( AST*, ast );
|
||||
}
|
||||
operator Code()
|
||||
{
|
||||
return * rcast( Code*, this );
|
||||
}
|
||||
AST_Class* operator->()
|
||||
{
|
||||
if ( ast == nullptr )
|
||||
@ -81,17 +83,13 @@ struct CodeClass
|
||||
|
||||
struct CodeParam
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeParam );
|
||||
|
||||
void append( CodeParam other );
|
||||
CodeParam get( s32 idx );
|
||||
bool has_entries();
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void append( CodeParam other );
|
||||
|
||||
Using_CodeOps( CodeParam );
|
||||
CodeParam get( s32 idx );
|
||||
bool has_entries();
|
||||
void to_string( String& result );
|
||||
AST* raw()
|
||||
{
|
||||
return rcast( AST*, ast );
|
||||
@ -134,7 +132,6 @@ struct CodeParam
|
||||
|
||||
struct CodeSpecifiers
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeSpecifiers );
|
||||
|
||||
bool append( SpecifierT spec )
|
||||
@ -145,9 +142,9 @@ struct CodeSpecifiers
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( raw()->NumEntries == AST_ArrSpecs_Cap )
|
||||
if ( raw()->NumEntries == AST::ArrSpecs_Cap )
|
||||
{
|
||||
log_failure("CodeSpecifiers: Attempted to append over %d specifiers to a specifiers AST!", AST_ArrSpecs_Cap );
|
||||
log_failure("CodeSpecifiers: Attempted to append over %d specifiers to a specifiers AST!", AST::ArrSpecs_Cap );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -173,9 +170,9 @@ struct CodeSpecifiers
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( raw()->NumEntries == AST_ArrSpecs_Cap )
|
||||
if ( raw()->NumEntries == AST::ArrSpecs_Cap )
|
||||
{
|
||||
log_failure("CodeSpecifiers: Attempted to append over %d specifiers to a specifiers AST!", AST_ArrSpecs_Cap );
|
||||
log_failure("CodeSpecifiers: Attempted to append over %d specifiers to a specifiers AST!", AST::ArrSpecs_Cap );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -205,11 +202,7 @@ struct CodeSpecifiers
|
||||
}
|
||||
return result;
|
||||
}
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
|
||||
Using_CodeOps(CodeSpecifiers);
|
||||
void to_string( String& result );
|
||||
AST* raw()
|
||||
{
|
||||
return rcast( AST*, ast );
|
||||
@ -246,17 +239,13 @@ struct CodeSpecifiers
|
||||
|
||||
struct CodeStruct
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeStruct );
|
||||
|
||||
void add_interface( CodeType interface );
|
||||
|
||||
String to_string();
|
||||
void to_string_fwd( String& result );
|
||||
void to_string_def( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps( CodeStruct );
|
||||
AST* raw()
|
||||
{
|
||||
return rcast( AST*, ast );
|
||||
@ -277,47 +266,27 @@ struct CodeStruct
|
||||
AST_Struct* ast;
|
||||
};
|
||||
|
||||
struct CodeAttributes
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code(CodeAttributes);
|
||||
String to_string();
|
||||
#endif
|
||||
|
||||
Using_CodeOps(CodeAttributes);
|
||||
AST *raw();
|
||||
operator Code();
|
||||
AST_Attributes *operator->();
|
||||
AST_Attributes *ast;
|
||||
};
|
||||
#define Define_CodeType( Typename ) \
|
||||
struct Code##Typename \
|
||||
{ \
|
||||
Using_Code( Code ## Typename ); \
|
||||
AST* raw(); \
|
||||
operator Code(); \
|
||||
AST_##Typename* operator->(); \
|
||||
AST_##Typename* ast; \
|
||||
}
|
||||
|
||||
Define_CodeType( Attributes );
|
||||
// Define_CodeType( BaseClass );
|
||||
|
||||
struct CodeComment
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code(CodeComment);
|
||||
String to_string();
|
||||
#endif
|
||||
|
||||
Using_CodeOps(CodeComment);
|
||||
AST *raw();
|
||||
operator Code();
|
||||
AST_Comment *operator->();
|
||||
AST_Comment *ast;
|
||||
};
|
||||
Define_CodeType( Comment );
|
||||
|
||||
struct CodeConstructor
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeConstructor );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps(CodeConstructor);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Constructor* operator->();
|
||||
@ -326,14 +295,10 @@ struct CodeConstructor
|
||||
|
||||
struct CodeDefine
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeDefine );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeDefine);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Define* operator->();
|
||||
@ -342,15 +307,11 @@ struct CodeDefine
|
||||
|
||||
struct CodeDestructor
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeDestructor );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps(CodeDestructor);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Destructor* operator->();
|
||||
@ -359,36 +320,20 @@ struct CodeDestructor
|
||||
|
||||
struct CodeEnum
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeEnum );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
void to_string_class_def( String& result );
|
||||
void to_string_class_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
void to_string_class_def( String& result );
|
||||
void to_string_class_fwd( String& result );
|
||||
|
||||
Using_CodeOps(CodeEnum);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Enum* operator->();
|
||||
AST_Enum* ast;
|
||||
};
|
||||
|
||||
struct CodeExec
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code(CodeExec);
|
||||
String to_string();
|
||||
#endif
|
||||
|
||||
Using_CodeOps(CodeExec);
|
||||
AST *raw();
|
||||
operator Code();
|
||||
AST_Exec *operator->();
|
||||
AST_Exec *ast;
|
||||
};
|
||||
Define_CodeType( Exec );
|
||||
|
||||
#if GEN_EXECUTION_EXPRESSION_SUPPORT
|
||||
struct CodeExpr
|
||||
@ -598,13 +543,10 @@ struct CodeExpr_UnaryPostfix
|
||||
|
||||
struct CodeExtern
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeExtern );
|
||||
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
|
||||
Using_CodeOps(CodeExtern);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Extern* operator->();
|
||||
@ -613,14 +555,10 @@ struct CodeExtern
|
||||
|
||||
struct CodeInclude
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeInclude );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeInclude);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Include* operator->();
|
||||
@ -629,14 +567,10 @@ struct CodeInclude
|
||||
|
||||
struct CodeFriend
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeFriend );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeFriend);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Friend* operator->();
|
||||
@ -645,15 +579,11 @@ struct CodeFriend
|
||||
|
||||
struct CodeFn
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeFn );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps(CodeFn);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Fn* operator->();
|
||||
@ -662,14 +592,10 @@ struct CodeFn
|
||||
|
||||
struct CodeModule
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeModule );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeModule);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Module* operator->();
|
||||
@ -678,14 +604,10 @@ struct CodeModule
|
||||
|
||||
struct CodeNS
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeNS );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeNS);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_NS* operator->();
|
||||
@ -694,15 +616,11 @@ struct CodeNS
|
||||
|
||||
struct CodeOperator
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeOperator );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps(CodeOperator);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Operator* operator->();
|
||||
@ -711,15 +629,11 @@ struct CodeOperator
|
||||
|
||||
struct CodeOpCast
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeOpCast );
|
||||
|
||||
String to_string();
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
#endif
|
||||
void to_string_def( String& result );
|
||||
void to_string_fwd( String& result );
|
||||
|
||||
Using_CodeOps(CodeOpCast);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_OpCast* operator->();
|
||||
@ -728,14 +642,10 @@ struct CodeOpCast
|
||||
|
||||
struct CodePragma
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodePragma );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps( CodePragma );
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Pragma* operator->();
|
||||
@ -744,19 +654,15 @@ struct CodePragma
|
||||
|
||||
struct CodePreprocessCond
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodePreprocessCond );
|
||||
|
||||
String to_string();
|
||||
void to_string_if( String& result );
|
||||
void to_string_ifdef( String& result );
|
||||
void to_string_ifndef( String& result );
|
||||
void to_string_elif( String& result );
|
||||
void to_string_else( String& result );
|
||||
void to_string_endif( String& result );
|
||||
#endif
|
||||
void to_string_if( String& result );
|
||||
void to_string_ifdef( String& result );
|
||||
void to_string_ifndef( String& result );
|
||||
void to_string_elif( String& result );
|
||||
void to_string_else( String& result );
|
||||
void to_string_endif( String& result );
|
||||
|
||||
Using_CodeOps( CodePreprocessCond );
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_PreprocessCond* operator->();
|
||||
@ -768,8 +674,7 @@ struct CodeStmt
|
||||
{
|
||||
Using_Code( CodeStmt );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -781,8 +686,7 @@ struct CodeStmt_Break
|
||||
{
|
||||
Using_Code( CodeStmt_Break );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -794,8 +698,7 @@ struct CodeStmt_Case
|
||||
{
|
||||
Using_Code( CodeStmt_Case );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -807,8 +710,7 @@ struct CodeStmt_Continue
|
||||
{
|
||||
Using_Code( CodeStmt_Continue );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -820,8 +722,7 @@ struct CodeStmt_Decl
|
||||
{
|
||||
Using_Code( CodeStmt_Decl );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -833,8 +734,7 @@ struct CodeStmt_Do
|
||||
{
|
||||
Using_Code( CodeStmt_Do );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -846,8 +746,7 @@ struct CodeStmt_Expr
|
||||
{
|
||||
Using_Code( CodeStmt_Expr );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -859,8 +758,7 @@ struct CodeStmt_Else
|
||||
{
|
||||
Using_Code( CodeStmt_Else );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -872,8 +770,7 @@ struct CodeStmt_If
|
||||
{
|
||||
Using_Code( CodeStmt_If );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -885,8 +782,7 @@ struct CodeStmt_For
|
||||
{
|
||||
Using_Code( CodeStmt_For );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -898,8 +794,7 @@ struct CodeStmt_Goto
|
||||
{
|
||||
Using_Code( CodeStmt_Goto );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -911,8 +806,7 @@ struct CodeStmt_Label
|
||||
{
|
||||
Using_Code( CodeStmt_Label );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -924,8 +818,7 @@ struct CodeStmt_Switch
|
||||
{
|
||||
Using_Code( CodeStmt_Switch );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -937,8 +830,7 @@ struct CodeStmt_While
|
||||
{
|
||||
Using_Code( CodeStmt_While );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string( String& result );
|
||||
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -949,14 +841,10 @@ struct CodeStmt_While
|
||||
|
||||
struct CodeTemplate
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeTemplate );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps( CodeTemplate );
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Template* operator->();
|
||||
@ -965,14 +853,10 @@ struct CodeTemplate
|
||||
|
||||
struct CodeType
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeType );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps( CodeType );
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Type* operator->();
|
||||
@ -981,14 +865,10 @@ struct CodeType
|
||||
|
||||
struct CodeTypedef
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeTypedef );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps( CodeTypedef );
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Typedef* operator->();
|
||||
@ -997,14 +877,10 @@ struct CodeTypedef
|
||||
|
||||
struct CodeUnion
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeUnion );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeUnion);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Union* operator->();
|
||||
@ -1013,15 +889,11 @@ struct CodeUnion
|
||||
|
||||
struct CodeUsing
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeUsing );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
void to_string_ns( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
void to_string_ns( String& result );
|
||||
|
||||
Using_CodeOps(CodeUsing);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Using* operator->();
|
||||
@ -1030,14 +902,10 @@ struct CodeUsing
|
||||
|
||||
struct CodeVar
|
||||
{
|
||||
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
|
||||
Using_Code( CodeVar );
|
||||
|
||||
String to_string();
|
||||
void to_string( String& result );
|
||||
#endif
|
||||
void to_string( String& result );
|
||||
|
||||
Using_CodeOps(CodeVar);
|
||||
AST* raw();
|
||||
operator Code();
|
||||
AST_Var* operator->();
|
||||
@ -1046,11 +914,5 @@ struct CodeVar
|
||||
|
||||
#undef Define_CodeType
|
||||
#undef Using_Code
|
||||
#undef Using_CodeOps
|
||||
|
||||
#if GEN_SUPPORT_CPP_REFERENCES
|
||||
void to_string_export( CodeBody body, String& result ) { return to_string_export(body, & result); };
|
||||
#endif
|
||||
|
||||
#endif //if ! GEN_COMPILER_C
|
||||
#pragma endregion Code Types
|
||||
|
@ -11,7 +11,7 @@ inline Code& Code::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -27,7 +27,7 @@ inline CodeBody& CodeBody::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -43,7 +43,7 @@ inline CodeAttributes& CodeAttributes::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -79,7 +79,7 @@ inline CodeComment& CodeComment::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -115,7 +115,7 @@ inline CodeConstructor& CodeConstructor::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -151,7 +151,7 @@ inline CodeClass& CodeClass::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -167,7 +167,7 @@ inline CodeDefine& CodeDefine::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -203,7 +203,7 @@ inline CodeDestructor& CodeDestructor::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -239,7 +239,7 @@ inline CodeEnum& CodeEnum::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -275,7 +275,7 @@ inline CodeExec& CodeExec::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -311,7 +311,7 @@ inline CodeExtern& CodeExtern::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -347,7 +347,7 @@ inline CodeFriend& CodeFriend::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -383,7 +383,7 @@ inline CodeFn& CodeFn::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -419,7 +419,7 @@ inline CodeInclude& CodeInclude::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -455,7 +455,7 @@ inline CodeModule& CodeModule::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -491,7 +491,7 @@ inline CodeNS& CodeNS::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -527,7 +527,7 @@ inline CodeOperator& CodeOperator::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -563,7 +563,7 @@ inline CodeOpCast& CodeOpCast::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -599,7 +599,7 @@ inline CodeParam& CodeParam::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -615,7 +615,7 @@ inline CodePragma& CodePragma::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -651,7 +651,7 @@ inline CodePreprocessCond& CodePreprocessCond::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -687,7 +687,7 @@ inline CodeSpecifiers& CodeSpecifiers::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -703,7 +703,7 @@ inline CodeStruct& CodeStruct::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -719,7 +719,7 @@ inline CodeTemplate& CodeTemplate::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -755,7 +755,7 @@ inline CodeType& CodeType::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -791,7 +791,7 @@ inline CodeTypedef& CodeTypedef::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -827,7 +827,7 @@ inline CodeUnion& CodeUnion::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -863,7 +863,7 @@ inline CodeUsing& CodeUsing::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
@ -899,7 +899,7 @@ inline CodeVar& CodeVar::operator=( Code other )
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype( ast ), GEN_NS duplicate( other.ast ) );
|
||||
ast = rcast( decltype( ast ), other.ast->duplicate() );
|
||||
rcast( AST*, ast )->Parent = nullptr;
|
||||
}
|
||||
ast = rcast( decltype( ast ), other.ast );
|
||||
|
@ -163,35 +163,13 @@ Code& Code::operator ++()
|
||||
#pragma endregion Code
|
||||
|
||||
inline
|
||||
void append( CodeBody self, Code other )
|
||||
void CodeClass::add_interface( CodeType type )
|
||||
{
|
||||
GEN_ASSERT(other.ast != nullptr);
|
||||
|
||||
if (is_body(other)) {
|
||||
append( self, cast(CodeBody, other) );
|
||||
return;
|
||||
}
|
||||
|
||||
append( rcast(AST*, self.ast), other.ast );
|
||||
}
|
||||
|
||||
inline
|
||||
void append( CodeBody self, CodeBody body )
|
||||
{
|
||||
for ( Code entry : body ) {
|
||||
append( self, entry );
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
void add_interface( CodeClass self, CodeType type )
|
||||
{
|
||||
GEN_ASSERT(self.ast !=nullptr);
|
||||
CodeType possible_slot = self->ParentType;
|
||||
CodeType possible_slot = ast->ParentType;
|
||||
if ( possible_slot.ast )
|
||||
{
|
||||
// Were adding an interface to parent type, so we need to make sure the parent type is public.
|
||||
self->ParentAccess = AccessSpec_Public;
|
||||
ast->ParentAccess = AccessSpec_Public;
|
||||
// If your planning on adding a proper parent,
|
||||
// then you'll need to move this over to ParentType->next and update ParentAccess accordingly.
|
||||
}
|
||||
|
@ -79,69 +79,69 @@ void define_constants()
|
||||
scast(String, Code_Global->Content) = Code_Global->Name;
|
||||
|
||||
Code_Invalid = make_code();
|
||||
set_global(Code_Invalid);
|
||||
Code_Invalid.set_global();
|
||||
|
||||
t_empty = (CodeType) make_code();
|
||||
t_empty->Type = ECode::Typename;
|
||||
t_empty->Name = get_cached_string( txt("") );
|
||||
set_global(t_empty);
|
||||
t_empty.set_global();
|
||||
|
||||
access_private = make_code();
|
||||
access_private->Type = ECode::Access_Private;
|
||||
access_private->Name = get_cached_string( txt("private:\n") );
|
||||
set_global(access_private);
|
||||
access_private.set_global();
|
||||
|
||||
access_protected = make_code();
|
||||
access_protected->Type = ECode::Access_Protected;
|
||||
access_protected->Name = get_cached_string( txt("protected:\n") );
|
||||
set_global(access_protected);
|
||||
access_protected.set_global();
|
||||
|
||||
access_public = make_code();
|
||||
access_public->Type = ECode::Access_Public;
|
||||
access_public->Name = get_cached_string( txt("public:\n") );
|
||||
set_global(access_public);
|
||||
access_public.set_global();
|
||||
|
||||
attrib_api_export = def_attributes( code(GEN_API_Export_Code));
|
||||
set_global(attrib_api_export);
|
||||
attrib_api_export.set_global();
|
||||
|
||||
attrib_api_import = def_attributes( code(GEN_API_Import_Code));
|
||||
set_global(attrib_api_import);
|
||||
attrib_api_import.set_global();
|
||||
|
||||
module_global_fragment = make_code();
|
||||
module_global_fragment->Type = ECode::Untyped;
|
||||
module_global_fragment->Name = get_cached_string( txt("module;") );
|
||||
module_global_fragment->Content = module_global_fragment->Name;
|
||||
set_global(module_global_fragment);
|
||||
module_global_fragment.set_global();
|
||||
|
||||
module_private_fragment = make_code();
|
||||
module_private_fragment->Type = ECode::Untyped;
|
||||
module_private_fragment->Name = get_cached_string( txt("module : private;") );
|
||||
module_private_fragment->Content = module_private_fragment->Name;
|
||||
set_global(module_private_fragment);
|
||||
module_private_fragment.set_global();
|
||||
|
||||
fmt_newline = make_code();
|
||||
fmt_newline->Type = ECode::NewLine;
|
||||
set_global(fmt_newline);
|
||||
fmt_newline.set_global();
|
||||
|
||||
pragma_once = (CodePragma) make_code();
|
||||
pragma_once->Type = ECode::Preprocess_Pragma;
|
||||
pragma_once->Name = get_cached_string( txt("once") );
|
||||
pragma_once->Content = pragma_once->Name;
|
||||
set_global(pragma_once);
|
||||
pragma_once.set_global();
|
||||
|
||||
param_varadic = (CodeType) make_code();
|
||||
param_varadic->Type = ECode::Parameters;
|
||||
param_varadic->Name = get_cached_string( txt("...") );
|
||||
param_varadic->ValueType = t_empty;
|
||||
set_global(param_varadic);
|
||||
param_varadic.set_global();
|
||||
|
||||
preprocess_else = (CodePreprocessCond) make_code();
|
||||
preprocess_else->Type = ECode::Preprocess_Else;
|
||||
set_global(preprocess_else);
|
||||
preprocess_else.set_global();
|
||||
|
||||
preprocess_endif = (CodePreprocessCond) make_code();
|
||||
preprocess_endif->Type = ECode::Preprocess_EndIf;
|
||||
set_global(preprocess_endif);
|
||||
preprocess_endif.set_global();
|
||||
|
||||
# define def_constant_code_type( Type_ ) \
|
||||
t_##Type_ = def_type( name(Type_) ); \
|
||||
|
@ -527,7 +527,7 @@ CodeConstructor def_constructor( CodeParam params, Code initializer_list, Code b
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure("gen::def_constructor: body must be either of Function_Body or Untyped type - %s", debug_str(body));
|
||||
log_failure("gen::def_constructor: body must be either of Function_Body or Untyped type - %s", body.debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -579,7 +579,7 @@ CodeClass def_class( StrC name
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure("gen::def_class: body must be either of Class_Body or Untyped type - %s", debug_str(body));
|
||||
log_failure("gen::def_class: body must be either of Class_Body or Untyped type - %s", body.debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ CodeClass def_class( StrC name
|
||||
{
|
||||
for (s32 idx = 0; idx < num_interfaces; idx++ )
|
||||
{
|
||||
add_interface(result, interfaces[idx] );
|
||||
result.add_interface( interfaces[idx] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -665,7 +665,7 @@ CodeDestructor def_destructor( Code body, CodeSpecifiers specifiers )
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure("gen::def_destructor: body must be either of Function_Body or Untyped type - %s", debug_str(body));
|
||||
log_failure("gen::def_destructor: body must be either of Function_Body or Untyped type - %s", body.debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -715,7 +715,7 @@ CodeEnum def_enum( StrC name
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "gen::def_enum: body must be of Enum_Body or Untyped type %s", debug_str(body));
|
||||
log_failure( "gen::def_enum: body must be of Enum_Body or Untyped type %s", body.debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ CodeExtern def_extern_link( StrC name, Code body )
|
||||
|
||||
if ( body->Type != Extern_Linkage_Body && body->Type != Untyped )
|
||||
{
|
||||
log_failure("gen::def_extern_linkage: body is not of extern_linkage or untyped type %s", debug_str(body));
|
||||
log_failure("gen::def_extern_linkage: body is not of extern_linkage or untyped type %s", body->debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -804,7 +804,7 @@ CodeFriend def_friend( Code declaration )
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure("gen::def_friend: requires declartion to have class, function, operator, or struct - %s", debug_str(declaration));
|
||||
log_failure("gen::def_friend: requires declartion to have class, function, operator, or struct - %s", declaration->debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -866,7 +866,7 @@ CodeFn def_function( StrC name
|
||||
|
||||
default:
|
||||
{
|
||||
log_failure("gen::def_function: body must be either of Function_Body, Execution, or Untyped type. %s", debug_str(body));
|
||||
log_failure("gen::def_function: body must be either of Function_Body, Execution, or Untyped type. %s", body->debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
}
|
||||
@ -944,7 +944,7 @@ CodeNS def_namespace( StrC name, Code body, ModuleFlag mflags )
|
||||
|
||||
if ( body->Type != Namespace_Body && body->Type != Untyped )
|
||||
{
|
||||
log_failure("gen::def_namespace: body is not of namespace or untyped type %s", debug_str(body));
|
||||
log_failure("gen::def_namespace: body is not of namespace or untyped type %s", body.debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1008,7 +1008,7 @@ CodeOperator def_operator( OperatorT op, StrC nspace
|
||||
|
||||
default:
|
||||
{
|
||||
log_failure("gen::def_operator: body must be either of Function_Body, Execution, or Untyped type. %s", debug_str(body));
|
||||
log_failure("gen::def_operator: body must be either of Function_Body, Execution, or Untyped type. %s", body->debug_str());
|
||||
return InvalidCode;
|
||||
}
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ CodeOpCast def_operator_cast( CodeType type, Code body, CodeSpecifiers const_spe
|
||||
|
||||
if ( body->Type != Function_Body && body->Type != Execution )
|
||||
{
|
||||
log_failure( "gen::def_operator_cast: body is not of function body or execution type - %s", debug_str(body) );
|
||||
log_failure( "gen::def_operator_cast: body is not of function body or execution type - %s", body.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1086,13 +1086,13 @@ CodeParam def_param( CodeType type, StrC name, Code value )
|
||||
|
||||
if ( type->Type != Typename )
|
||||
{
|
||||
log_failure( "gen::def_param: type is not a typename - %s", debug_str(type) );
|
||||
log_failure( "gen::def_param: type is not a typename - %s", type.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( value && value->Type != Untyped )
|
||||
{
|
||||
log_failure( "gen::def_param: value is not untyped - %s", debug_str(value) );
|
||||
log_failure( "gen::def_param: value is not untyped - %s", value.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1189,13 +1189,13 @@ CodeStruct def_struct( StrC name
|
||||
|
||||
if ( parent && parent->Type != Typename )
|
||||
{
|
||||
log_failure( "gen::def_struct: parent was not a `Struct` type - %s", debug_str(parent) );
|
||||
log_failure( "gen::def_struct: parent was not a `Struct` type - %s", parent.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( body && body->Type != Struct_Body )
|
||||
{
|
||||
log_failure( "gen::def_struct: body was not a Struct_Body type - %s", debug_str(body) );
|
||||
log_failure( "gen::def_struct: body was not a Struct_Body type - %s", body.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1256,7 +1256,7 @@ CodeTemplate def_template( CodeParam params, Code declaration, ModuleFlag mflags
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "gen::def_template: declaration is not of class, function, struct, variable, or using type - %s", debug_str(declaration) );
|
||||
log_failure( "gen::def_template: declaration is not of class, function, struct, variable, or using type - %s", declaration.debug_str() );
|
||||
}
|
||||
|
||||
CodeTemplate
|
||||
@ -1275,19 +1275,19 @@ CodeType def_type( StrC name, Code arrayexpr, CodeSpecifiers specifiers, CodeAtt
|
||||
|
||||
if ( attributes && attributes->Type != ECode::PlatformAttributes )
|
||||
{
|
||||
log_failure( "gen::def_type: attributes is not of attributes type - %s", debug_str(attributes) );
|
||||
log_failure( "gen::def_type: attributes is not of attributes type - %s", attributes.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( specifiers && specifiers->Type != ECode::Specifiers )
|
||||
{
|
||||
log_failure( "gen::def_type: specifiers is not of specifiers type - %s", debug_str(specifiers) );
|
||||
log_failure( "gen::def_type: specifiers is not of specifiers type - %s", specifiers.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( arrayexpr && arrayexpr->Type != ECode::Untyped )
|
||||
{
|
||||
log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", debug_str(arrayexpr) );
|
||||
log_failure( "gen::def_type: arrayexpr is not of untyped type - %s", arrayexpr->debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1329,13 +1329,13 @@ CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, Module
|
||||
case Typename:
|
||||
break;
|
||||
default:
|
||||
log_failure( "gen::def_typedef: type was not a Class, Enum, Function Forward, Struct, Typename, or Union - %s", debug_str(type) );
|
||||
log_failure( "gen::def_typedef: type was not a Class, Enum, Function Forward, Struct, Typename, or Union - %s", type.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( attributes && attributes->Type != ECode::PlatformAttributes )
|
||||
{
|
||||
log_failure( "gen::def_typedef: attributes was not a PlatformAttributes - %s", debug_str(attributes) );
|
||||
log_failure( "gen::def_typedef: attributes was not a PlatformAttributes - %s", attributes.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1359,7 +1359,7 @@ CodeTypedef def_typedef( StrC name, Code type, CodeAttributes attributes, Module
|
||||
{
|
||||
if (type->Type != Untyped)
|
||||
{
|
||||
log_failure( "gen::def_typedef: name was empty and type was not untyped (indicating its a function typedef) - %s", debug_str(type) );
|
||||
log_failure( "gen::def_typedef: name was empty and type was not untyped (indicating its a function typedef) - %s", type.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1381,7 +1381,7 @@ CodeUnion def_union( StrC name, Code body, CodeAttributes attributes, ModuleFlag
|
||||
|
||||
if ( body->Type != ECode::Union_Body )
|
||||
{
|
||||
log_failure( "gen::def_union: body was not a Union_Body type - %s", debug_str(body) );
|
||||
log_failure( "gen::def_union: body was not a Union_Body type - %s", body.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1482,7 +1482,7 @@ CodeVar def_variable( CodeType type, StrC name, Code value
|
||||
|
||||
if ( value && value->Type != ECode::Untyped )
|
||||
{
|
||||
log_failure( "gen::def_variable: value was not a `Untyped` type - %s", debug_str(value) );
|
||||
log_failure( "gen::def_variable: value was not a `Untyped` type - %s", value.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
@ -1558,14 +1558,14 @@ CodeBody def_class_body( s32 num, ... )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_CLASS_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -1595,14 +1595,14 @@ CodeBody def_class_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_CLASS_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_class_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
|
||||
@ -1632,11 +1632,11 @@ CodeBody def_enum_body( s32 num, ... )
|
||||
|
||||
if ( entry->Type != Untyped && entry->Type != Comment )
|
||||
{
|
||||
log_failure("gen::def_enum_body: Entry type is not allowed - %s. Must be of untyped or comment type.", debug_str(entry) );
|
||||
log_failure("gen::def_enum_body: Entry type is not allowed - %s. Must be of untyped or comment type.", entry.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
append(result, entry );
|
||||
result.append( entry );
|
||||
}
|
||||
while ( num--, num > 0 );
|
||||
va_end(va);
|
||||
@ -1664,11 +1664,11 @@ CodeBody def_enum_body( s32 num, Code* codes )
|
||||
|
||||
if ( entry->Type != Untyped && entry->Type != Comment )
|
||||
{
|
||||
log_failure("gen::def_enum_body: Entry type is not allowed: %s", debug_str(entry) );
|
||||
log_failure("gen::def_enum_body: Entry type is not allowed: %s", entry.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
append(result, entry );
|
||||
result.append( entry );
|
||||
}
|
||||
while ( codes++, num--, num > 0 );
|
||||
|
||||
@ -1699,14 +1699,14 @@ CodeBody def_export_body( s32 num, ... )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -1736,14 +1736,14 @@ CodeBody def_export_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_EXPORT_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_export_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
|
||||
@ -1774,14 +1774,14 @@ CodeBody def_extern_link_body( s32 num, ... )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -1811,14 +1811,14 @@ CodeBody def_extern_link_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_EXTERN_LINKAGE_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_extern_linkage_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
|
||||
}
|
||||
while (num--, num > 0);
|
||||
@ -1851,14 +1851,14 @@ CodeBody def_function_body( s32 num, ... )
|
||||
{
|
||||
|
||||
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
|
||||
log_failure("gen::" stringize(def_function_body) ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" stringize(def_function_body) ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -1888,13 +1888,13 @@ CodeBody def_function_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_FUNCTION_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_function_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_function_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
|
||||
@ -1925,19 +1925,18 @@ CodeBody def_global_body( s32 num, ... )
|
||||
switch (entry->Type)
|
||||
{
|
||||
case Global_Body:
|
||||
// result.append( entry.code_cast<CodeBody>() ) ;
|
||||
append( result, cast(CodeBody, entry) );
|
||||
result.append( entry.code_cast<CodeBody>() ) ;
|
||||
continue;
|
||||
|
||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -1967,18 +1966,18 @@ CodeBody def_global_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
case Global_Body:
|
||||
append(result, cast(CodeBody, entry) );
|
||||
result.append( entry.code_cast<CodeBody>() ) ;
|
||||
continue;
|
||||
|
||||
GEN_AST_BODY_GLOBAL_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_global_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
|
||||
@ -2009,14 +2008,14 @@ CodeBody def_namespace_body( s32 num, ... )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -2046,13 +2045,13 @@ CodeBody def_namespace_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_NAMESPACE_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", debug_str(entry) );
|
||||
log_failure("gen::" "def_namespace_body" ": Entry type is not allowed: %s", entry.debug_str() );
|
||||
return InvalidCode;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
|
||||
@ -2141,7 +2140,7 @@ CodeSpecifiers def_specifiers( s32 num, ... )
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( num > AST_ArrSpecs_Cap )
|
||||
if ( num > AST::ArrSpecs_Cap )
|
||||
{
|
||||
log_failure("gen::def_specifiers: num of speciifers to define AST larger than AST specicifier capacity - %d", num);
|
||||
return InvalidCode;
|
||||
@ -2173,7 +2172,7 @@ CodeSpecifiers def_specifiers( s32 num, SpecifierT* specs )
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
if ( num > AST_ArrSpecs_Cap )
|
||||
if ( num > AST::ArrSpecs_Cap )
|
||||
{
|
||||
log_failure("gen::def_specifiers: num of speciifers to define AST larger than AST specicifier capacity - %d", num);
|
||||
return InvalidCode;
|
||||
@ -2218,14 +2217,14 @@ CodeBody def_struct_body( s32 num, ... )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", debug_str(entry));
|
||||
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", entry.debug_str());
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
va_end(va);
|
||||
@ -2255,14 +2254,14 @@ CodeBody def_struct_body( s32 num, Code* codes )
|
||||
switch (entry->Type)
|
||||
{
|
||||
GEN_AST_BODY_STRUCT_UNALLOWED_TYPES
|
||||
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", debug_str(entry) );
|
||||
log_failure("gen::" "def_struct_body" ": Entry type is not allowed: %s", entry.debug_str() );
|
||||
return InvalidCode;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
append(result, entry);
|
||||
result.append(entry);
|
||||
}
|
||||
while (num--, num > 0);
|
||||
|
||||
@ -2292,11 +2291,11 @@ CodeBody def_union_body( s32 num, ... )
|
||||
|
||||
if ( entry->Type != Untyped && entry->Type != Comment )
|
||||
{
|
||||
log_failure("gen::def_union_body: Entry type is not allowed - %s. Must be of untyped or comment type.", debug_str(entry) );
|
||||
log_failure("gen::def_union_body: Entry type is not allowed - %s. Must be of untyped or comment type.", entry.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
append(result, entry );
|
||||
result.append( entry );
|
||||
}
|
||||
while ( num--, num > 0 );
|
||||
va_end(va);
|
||||
@ -2324,11 +2323,11 @@ CodeBody def_union_body( s32 num, CodeUnion* codes )
|
||||
|
||||
if ( entry->Type != Untyped && entry->Type != Comment )
|
||||
{
|
||||
log_failure("gen::def_union_body: Entry type is not allowed: %s", debug_str(entry) );
|
||||
log_failure("gen::def_union_body: Entry type is not allowed: %s", entry.debug_str() );
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
append(result, entry );
|
||||
result.append( entry );
|
||||
}
|
||||
while ( codes++, num--, num > 0 );
|
||||
|
||||
|
@ -1115,7 +1115,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
append(result, member );
|
||||
result.append( member );
|
||||
}
|
||||
|
||||
eat( TokType::BraceCurly_Close );
|
||||
@ -1503,7 +1503,7 @@ CodeFn parse_function_after_name(
|
||||
|
||||
default:
|
||||
{
|
||||
log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", debug_str(body), Context.to_string());
|
||||
log_failure("Body must be either of Function_Body or Untyped type, %s\n%s", body.debug_str(), Context.to_string());
|
||||
Context.pop();
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -1568,7 +1568,7 @@ Code parse_function_body()
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
append( result, def_execution( { len, start.Text } ) );
|
||||
result.append( def_execution( { len, start.Text } ) );
|
||||
}
|
||||
|
||||
eat( TokType::BraceCurly_Close );
|
||||
@ -1878,7 +1878,7 @@ CodeBody parse_global_nspace( CodeT which )
|
||||
}
|
||||
|
||||
// log_fmt("Global Body Member: %s", member->debug_str());
|
||||
append(result, member );
|
||||
result.append( member );
|
||||
}
|
||||
|
||||
if ( which != Global_Body )
|
||||
@ -3743,7 +3743,7 @@ CodeEnum parse_enum( bool inplace_def )
|
||||
return InvalidCode;
|
||||
}
|
||||
|
||||
append(body, member );
|
||||
body.append( member );
|
||||
}
|
||||
|
||||
eat( TokType::BraceCurly_Close );
|
||||
@ -5067,7 +5067,7 @@ CodeTypedef parse_typedef()
|
||||
// Type needs to be aware of its parent so that it can be serialized properly.
|
||||
|
||||
if ( type->Type == Typename && array_expr && array_expr->Type != Invalid )
|
||||
cast(CodeType, type)->ArrExpr = array_expr;
|
||||
type.code_cast<CodeType>()->ArrExpr = array_expr;
|
||||
|
||||
if ( inline_cmt )
|
||||
result->InlineCmt = inline_cmt;
|
||||
@ -5187,7 +5187,7 @@ CodeUnion parse_union( bool inplace_def )
|
||||
}
|
||||
|
||||
if ( member )
|
||||
append(body, member );
|
||||
body.append( member );
|
||||
}
|
||||
// <ModuleFlags> union <Attributes> <Name> { <Body>
|
||||
|
||||
|
@ -201,7 +201,7 @@ bool append_at(Array<Type>* array, Type item, usize idx)
|
||||
header = get_header(* array);
|
||||
}
|
||||
|
||||
Type* target = &(*array)[slot];
|
||||
Type* target = array->Data + slot;
|
||||
|
||||
mem_move(target + 1, target, (header->Num - slot) * sizeof(Type));
|
||||
header->Num++;
|
||||
@ -278,8 +278,7 @@ void free(Array<Type>* array) {
|
||||
GEN_ASSERT(array != nullptr);
|
||||
ArrayHeader* header = get_header(* array);
|
||||
GEN_NS free(header->Allocator, header);
|
||||
Type** Data = (Type**)array;
|
||||
*Data = nullptr;
|
||||
array->Data = nullptr;
|
||||
}
|
||||
|
||||
template<class Type> forceinline
|
||||
@ -375,8 +374,7 @@ bool set_capacity(Array<Type>* array, usize new_capacity)
|
||||
|
||||
GEN_NS free(header->Allocator, header);
|
||||
|
||||
Type** Data = (Type**)array;
|
||||
* Data = rcast(Type*, new_header + 1);
|
||||
array->Data = rcast(Type*, new_header + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ CodeBody gen_ast_inlines()
|
||||
{
|
||||
if ( other.ast && other->Parent )
|
||||
{
|
||||
ast = rcast( decltype(ast), GEN_NS duplicate(other.ast) );
|
||||
ast = rcast( decltype(ast), other.ast->duplicate() );
|
||||
rcast( AST*, ast)->Parent = nullptr;
|
||||
}
|
||||
|
||||
@ -428,29 +428,29 @@ CodeBody gen_ast_inlines()
|
||||
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 ));
|
||||
|
||||
append(impl_code_attr, parse_global_body( token_fmt( "typename", StrC name(Attributes), codetype_impl_tmpl )));
|
||||
append(impl_code_cmt, parse_global_body( token_fmt( "typename", StrC name(Comment), codetype_impl_tmpl )));
|
||||
append(impl_code_constr, parse_global_body( token_fmt( "typename", StrC name(Constructor), codetype_impl_tmpl )));
|
||||
append(impl_code_define, parse_global_body( token_fmt( "typename", StrC name(Define), codetype_impl_tmpl )));
|
||||
append(impl_code_destruct, parse_global_body( token_fmt( "typename", StrC name(Destructor), codetype_impl_tmpl )));
|
||||
append(impl_code_enum, parse_global_body( token_fmt( "typename", StrC name(Enum), codetype_impl_tmpl )));
|
||||
append(impl_code_exec, parse_global_body( token_fmt( "typename", StrC name(Exec), codetype_impl_tmpl )));
|
||||
append(impl_code_extern, parse_global_body( token_fmt( "typename", StrC name(Extern), codetype_impl_tmpl )));
|
||||
append(impl_code_include, parse_global_body( token_fmt( "typename", StrC name(Include), codetype_impl_tmpl )));
|
||||
append(impl_code_friend, parse_global_body( token_fmt( "typename", StrC name(Friend), codetype_impl_tmpl )));
|
||||
append(impl_code_fn, parse_global_body( token_fmt( "typename", StrC name(Fn), codetype_impl_tmpl )));
|
||||
append(impl_code_module, parse_global_body( token_fmt( "typename", StrC name(Module), codetype_impl_tmpl )));
|
||||
append(impl_code_ns, parse_global_body( token_fmt( "typename", StrC name(NS), codetype_impl_tmpl )));
|
||||
append(impl_code_op, parse_global_body( token_fmt( "typename", StrC name(Operator), codetype_impl_tmpl )));
|
||||
append(impl_code_opcast, parse_global_body( token_fmt( "typename", StrC name(OpCast), codetype_impl_tmpl )));
|
||||
append(impl_code_pragma, parse_global_body( token_fmt( "typename", StrC name(Pragma), codetype_impl_tmpl )));
|
||||
append(impl_code_precond, parse_global_body( token_fmt( "typename", StrC name(PreprocessCond), codetype_impl_tmpl )));
|
||||
append(impl_code_tmpl, parse_global_body( token_fmt( "typename", StrC name(Template), codetype_impl_tmpl )));
|
||||
append(impl_code_type, parse_global_body( token_fmt( "typename", StrC name(Type), codetype_impl_tmpl )));
|
||||
append(impl_code_typedef, parse_global_body( token_fmt( "typename", StrC name(Typedef), codetype_impl_tmpl )));
|
||||
append(impl_code_union, parse_global_body( token_fmt( "typename", StrC name(Union), codetype_impl_tmpl )));
|
||||
append(impl_code_using, parse_global_body( token_fmt( "typename", StrC name(Using), codetype_impl_tmpl )));
|
||||
append(impl_code_var, parse_global_body( token_fmt( "typename", StrC name(Var), codetype_impl_tmpl )));
|
||||
impl_code_attr. append( parse_global_body( token_fmt( "typename", StrC name(Attributes), codetype_impl_tmpl )));
|
||||
impl_code_cmt. append( parse_global_body( token_fmt( "typename", StrC name(Comment), codetype_impl_tmpl )));
|
||||
impl_code_constr. append( parse_global_body( token_fmt( "typename", StrC name(Constructor), codetype_impl_tmpl )));
|
||||
impl_code_define. append( parse_global_body( token_fmt( "typename", StrC name(Define), codetype_impl_tmpl )));
|
||||
impl_code_destruct.append( parse_global_body( token_fmt( "typename", StrC name(Destructor), codetype_impl_tmpl )));
|
||||
impl_code_enum. append( parse_global_body( token_fmt( "typename", StrC name(Enum), codetype_impl_tmpl )));
|
||||
impl_code_exec. append( parse_global_body( token_fmt( "typename", StrC name(Exec), codetype_impl_tmpl )));
|
||||
impl_code_extern. append( parse_global_body( token_fmt( "typename", StrC name(Extern), codetype_impl_tmpl )));
|
||||
impl_code_include. append( parse_global_body( token_fmt( "typename", StrC name(Include), codetype_impl_tmpl )));
|
||||
impl_code_friend. append( parse_global_body( token_fmt( "typename", StrC name(Friend), codetype_impl_tmpl )));
|
||||
impl_code_fn. append( parse_global_body( token_fmt( "typename", StrC name(Fn), codetype_impl_tmpl )));
|
||||
impl_code_module. append( parse_global_body( token_fmt( "typename", StrC name(Module), codetype_impl_tmpl )));
|
||||
impl_code_ns. append( parse_global_body( token_fmt( "typename", StrC name(NS), codetype_impl_tmpl )));
|
||||
impl_code_op. append( parse_global_body( token_fmt( "typename", StrC name(Operator), codetype_impl_tmpl )));
|
||||
impl_code_opcast. append( parse_global_body( token_fmt( "typename", StrC name(OpCast), codetype_impl_tmpl )));
|
||||
impl_code_pragma . append( parse_global_body( token_fmt( "typename", StrC name(Pragma), codetype_impl_tmpl )));
|
||||
impl_code_precond. append( parse_global_body( token_fmt( "typename", StrC name(PreprocessCond), codetype_impl_tmpl )));
|
||||
impl_code_tmpl. append( parse_global_body( token_fmt( "typename", StrC name(Template), codetype_impl_tmpl )));
|
||||
impl_code_type. append( parse_global_body( token_fmt( "typename", StrC name(Type), codetype_impl_tmpl )));
|
||||
impl_code_typedef. append( parse_global_body( token_fmt( "typename", StrC name(Typedef), codetype_impl_tmpl )));
|
||||
impl_code_union. append( parse_global_body( token_fmt( "typename", StrC name(Union), codetype_impl_tmpl )));
|
||||
impl_code_using. append( parse_global_body( token_fmt( "typename", StrC name(Using), codetype_impl_tmpl )));
|
||||
impl_code_var. append( parse_global_body( token_fmt( "typename", StrC name(Var), codetype_impl_tmpl )));
|
||||
|
||||
char const* cast_tmpl = stringize(
|
||||
inline AST::operator Code<typename>()
|
||||
|
Loading…
Reference in New Issue
Block a user