Preparing for reductions on code_types.hpp

This commit is contained in:
Edward R. Gonzalez 2024-12-02 01:56:49 -05:00
parent c38b077c37
commit 2dcc968c39
3 changed files with 319 additions and 166 deletions

View File

@ -73,73 +73,84 @@ struct AST_Union;
struct AST_Using; struct AST_Using;
struct AST_Var; struct AST_Var;
struct Code; #if GEN_COMPILER_C
struct CodeBody; #define Define_Code(Type) typedef AST_##Type* Code##Type
// These are to offer ease of use and optionally strong type safety for the AST. #else
struct CodeAttributes; #define Define_Code(Type) struct Code##Type
// struct CodeBaseClass;
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
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;
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 #endif
struct CodeStruct; #if GEN_COMPILER_C
struct CodeTemplate; typedef AST* code;
struct CodeType; #else
struct CodeTypedef; struct Code;
struct CodeUnion; #endif
struct CodeUsing; Define_Code(Body);
struct CodeVar; // These are to offer ease of use and optionally strong type safety for the AST.
Define_Code(Attributes);
// 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);
#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);
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);
#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
namespace parser namespace parser
{ {
@ -159,6 +170,7 @@ bool is_valid (Code code);
void set_global(Code code); void set_global(Code code);
String to_string (Code code); String to_string (Code code);
#if ! GEN_COMPILER_C
/* /*
AST* wrapper AST* wrapper
- Not constantly have to append the '*' as this is written often.. - Not constantly have to append the '*' as this is written often..
@ -174,26 +186,26 @@ struct Code
bool is_equal( Code other ) { return GEN_NS is_equal(* this, other); } \ bool is_equal( Code other ) { return GEN_NS is_equal(* this, other); } \
bool is_body() { return GEN_NS is_body(* this); } \ bool is_body() { return GEN_NS is_body(* this); } \
bool is_valid() { return GEN_NS is_valid(* this); } \ bool is_valid() { return GEN_NS is_valid(* this); } \
void set_global() { return GEN_NS set_global(* this); } \ void set_global() { return GEN_NS set_global(* this); }
String to_string(); \
# define Using_CodeOps( Typename ) \
Typename& operator = ( AST* other ); \ Typename& operator = ( AST* other ); \
Typename& operator = ( Code other ); \ Typename& operator = ( Code other ); \
bool operator ==( Code other ) { return (AST*)ast == other.ast; } \ bool operator ==( Code other ) { return (AST*)ast == other.ast; } \
bool operator !=( Code other ) { return (AST*)ast != other.ast; } \ bool operator !=( Code other ) { return (AST*)ast != other.ast; } \
operator bool(); operator bool();
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( Code ); Using_Code( Code );
String to_string() { return GEN_NS to_string(* this); }
#endif
Using_CodeOps( Code );
template< class Type > template< class Type >
forceinline Type code_cast() forceinline Type code_cast() { return * rcast( Type*, this ); }
{
return * rcast( Type*, this );
}
AST* operator ->() AST* operator ->() { return ast; }
{
return ast;
}
Code& operator ++(); Code& operator ++();
// TODO(Ed) : Remove this overload. // TODO(Ed) : Remove this overload.
@ -242,6 +254,7 @@ struct Code
operator CodeVar() const; operator CodeVar() const;
#undef operator #undef operator
}; };
#endif
#pragma region Statics #pragma region Statics
// Used to identify ASTs that should always be duplicated. (Global constant ASTs) // Used to identify ASTs that should always be duplicated. (Global constant ASTs)

View File

@ -3,14 +3,14 @@
#include "ast.cpp" #include "ast.cpp"
#endif #endif
String Code::to_string() String to_string(Code self)
{ {
if ( ast == nullptr ) if ( self.ast == nullptr )
{ {
log_failure( "Code::to_string: Cannot convert code to string, AST is null!" ); log_failure( "Code::to_string: Cannot convert code to string, AST is null!" );
return { nullptr }; return { nullptr };
} }
return rcast( AST*, ast )->to_string(); return rcast( AST*, self.ast )->to_string();
} }
String CodeAttributes::to_string() String CodeAttributes::to_string()

View File

@ -4,9 +4,13 @@
#endif #endif
#pragma region Code Types #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 struct CodeBody
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeBody ); Using_Code( CodeBody );
void append( Code other ) void append( Code other )
@ -28,19 +32,20 @@ struct CodeBody
bool has_entries() { return GEN_NS has_entries(rcast( AST*, ast )); } bool has_entries() { return GEN_NS has_entries(rcast( AST*, ast )); }
AST* raw() { return rcast( AST*, ast ); } AST* raw() { return rcast( AST*, ast ); }
String to_string();
void to_string( String& result ); void to_string( String& result );
void to_string_export( String& result ); void to_string_export( String& result );
#endif
AST_Body* operator->() { return ast; } Using_CodeOps( CodeBody );
operator Code() { return * rcast( Code*, this ); } operator Code() { return * rcast( Code*, this ); }
AST_Body* operator->() { return ast; }
#pragma region Iterator #pragma region Iterator
Code begin() Code begin()
{ {
if ( ast ) if ( ast )
return { rcast( AST*, ast)->Front }; return { rcast( AST*, ast)->Front };
return { nullptr }; return { nullptr };
} }
Code end() Code end()
@ -54,21 +59,20 @@ struct CodeBody
struct CodeClass struct CodeClass
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeClass ); Using_Code( CodeClass );
void add_interface( CodeType interface ); void add_interface( CodeType interface );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
AST* raw() AST* raw() { return rcast( AST*, ast ); }
{ #endif
return rcast( AST*, ast );
} Using_CodeOps( CodeClass );
operator Code() operator Code() { return * rcast( Code*, this ); }
{
return * rcast( Code*, this );
}
AST_Class* operator->() AST_Class* operator->()
{ {
if ( ast == nullptr ) if ( ast == nullptr )
@ -83,13 +87,17 @@ struct CodeClass
struct CodeParam struct CodeParam
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeParam ); Using_Code( CodeParam );
void append( CodeParam other ); void append( CodeParam other );
CodeParam get( s32 idx ); CodeParam get( s32 idx );
bool has_entries(); bool has_entries();
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps( CodeParam );
AST* raw() AST* raw()
{ {
return rcast( AST*, ast ); return rcast( AST*, ast );
@ -132,6 +140,7 @@ struct CodeParam
struct CodeSpecifiers struct CodeSpecifiers
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeSpecifiers ); Using_Code( CodeSpecifiers );
bool append( SpecifierT spec ) bool append( SpecifierT spec )
@ -202,7 +211,11 @@ struct CodeSpecifiers
} }
return result; return result;
} }
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeSpecifiers);
AST* raw() AST* raw()
{ {
return rcast( AST*, ast ); return rcast( AST*, ast );
@ -239,13 +252,17 @@ struct CodeSpecifiers
struct CodeStruct struct CodeStruct
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeStruct ); Using_Code( CodeStruct );
void add_interface( CodeType interface ); void add_interface( CodeType interface );
void to_string_def( String& result ); String to_string();
void to_string_fwd( String& result ); void to_string_fwd( String& result );
void to_string_def( String& result );
#endif
Using_CodeOps( CodeStruct );
AST* raw() AST* raw()
{ {
return rcast( AST*, ast ); return rcast( AST*, ast );
@ -266,27 +283,47 @@ struct CodeStruct
AST_Struct* ast; AST_Struct* ast;
}; };
#define Define_CodeType( Typename ) \ struct CodeAttributes
struct Code##Typename \ {
{ \ #if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( Code ## Typename ); \ Using_Code(CodeAttributes);
AST* raw(); \ String to_string();
operator Code(); \ #endif
AST_##Typename* operator->(); \
AST_##Typename* ast; \ Using_CodeOps(CodeAttributes);
} AST *raw();
operator Code();
AST_Attributes *operator->();
AST_Attributes *ast;
};
Define_CodeType( Attributes );
// Define_CodeType( BaseClass ); // Define_CodeType( BaseClass );
Define_CodeType( Comment );
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;
};
struct CodeConstructor struct CodeConstructor
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeConstructor ); Using_Code( CodeConstructor );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
#endif
Using_CodeOps(CodeConstructor);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Constructor* operator->(); AST_Constructor* operator->();
@ -295,10 +332,14 @@ struct CodeConstructor
struct CodeDefine struct CodeDefine
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeDefine ); Using_Code( CodeDefine );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeDefine);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Define* operator->(); AST_Define* operator->();
@ -307,11 +348,15 @@ struct CodeDefine
struct CodeDestructor struct CodeDestructor
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeDestructor ); Using_Code( CodeDestructor );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
#endif
Using_CodeOps(CodeDestructor);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Destructor* operator->(); AST_Destructor* operator->();
@ -320,20 +365,36 @@ struct CodeDestructor
struct CodeEnum struct CodeEnum
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeEnum ); Using_Code( CodeEnum );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
void to_string_class_def( String& result ); void to_string_class_def( String& result );
void to_string_class_fwd( String& result ); void to_string_class_fwd( String& result );
#endif
Using_CodeOps(CodeEnum);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Enum* operator->(); AST_Enum* operator->();
AST_Enum* ast; AST_Enum* ast;
}; };
Define_CodeType( Exec ); 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;
};
#if GEN_EXECUTION_EXPRESSION_SUPPORT #if GEN_EXECUTION_EXPRESSION_SUPPORT
struct CodeExpr struct CodeExpr
@ -543,10 +604,13 @@ struct CodeExpr_UnaryPostfix
struct CodeExtern struct CodeExtern
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeExtern ); Using_Code( CodeExtern );
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeExtern);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Extern* operator->(); AST_Extern* operator->();
@ -555,10 +619,14 @@ struct CodeExtern
struct CodeInclude struct CodeInclude
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeInclude ); Using_Code( CodeInclude );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeInclude);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Include* operator->(); AST_Include* operator->();
@ -567,10 +635,14 @@ struct CodeInclude
struct CodeFriend struct CodeFriend
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeFriend ); Using_Code( CodeFriend );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeFriend);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Friend* operator->(); AST_Friend* operator->();
@ -579,11 +651,15 @@ struct CodeFriend
struct CodeFn struct CodeFn
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeFn ); Using_Code( CodeFn );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
#endif
Using_CodeOps(CodeFn);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Fn* operator->(); AST_Fn* operator->();
@ -592,10 +668,14 @@ struct CodeFn
struct CodeModule struct CodeModule
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeModule ); Using_Code( CodeModule );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeModule);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Module* operator->(); AST_Module* operator->();
@ -604,10 +684,14 @@ struct CodeModule
struct CodeNS struct CodeNS
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeNS ); Using_Code( CodeNS );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeNS);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_NS* operator->(); AST_NS* operator->();
@ -616,11 +700,15 @@ struct CodeNS
struct CodeOperator struct CodeOperator
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeOperator ); Using_Code( CodeOperator );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
#endif
Using_CodeOps(CodeOperator);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Operator* operator->(); AST_Operator* operator->();
@ -629,11 +717,15 @@ struct CodeOperator
struct CodeOpCast struct CodeOpCast
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeOpCast ); Using_Code( CodeOpCast );
String to_string();
void to_string_def( String& result ); void to_string_def( String& result );
void to_string_fwd( String& result ); void to_string_fwd( String& result );
#endif
Using_CodeOps(CodeOpCast);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_OpCast* operator->(); AST_OpCast* operator->();
@ -642,10 +734,14 @@ struct CodeOpCast
struct CodePragma struct CodePragma
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodePragma ); Using_Code( CodePragma );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps( CodePragma );
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Pragma* operator->(); AST_Pragma* operator->();
@ -654,15 +750,19 @@ struct CodePragma
struct CodePreprocessCond struct CodePreprocessCond
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodePreprocessCond ); Using_Code( CodePreprocessCond );
String to_string();
void to_string_if( String& result ); void to_string_if( String& result );
void to_string_ifdef( String& result ); void to_string_ifdef( String& result );
void to_string_ifndef( String& result ); void to_string_ifndef( String& result );
void to_string_elif( String& result ); void to_string_elif( String& result );
void to_string_else( String& result ); void to_string_else( String& result );
void to_string_endif( String& result ); void to_string_endif( String& result );
#endif
Using_CodeOps( CodePreprocessCond );
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_PreprocessCond* operator->(); AST_PreprocessCond* operator->();
@ -674,6 +774,7 @@ struct CodeStmt
{ {
Using_Code( CodeStmt ); Using_Code( CodeStmt );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -686,6 +787,7 @@ struct CodeStmt_Break
{ {
Using_Code( CodeStmt_Break ); Using_Code( CodeStmt_Break );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -698,6 +800,7 @@ struct CodeStmt_Case
{ {
Using_Code( CodeStmt_Case ); Using_Code( CodeStmt_Case );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -710,6 +813,7 @@ struct CodeStmt_Continue
{ {
Using_Code( CodeStmt_Continue ); Using_Code( CodeStmt_Continue );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -722,6 +826,7 @@ struct CodeStmt_Decl
{ {
Using_Code( CodeStmt_Decl ); Using_Code( CodeStmt_Decl );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -734,6 +839,7 @@ struct CodeStmt_Do
{ {
Using_Code( CodeStmt_Do ); Using_Code( CodeStmt_Do );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -746,6 +852,7 @@ struct CodeStmt_Expr
{ {
Using_Code( CodeStmt_Expr ); Using_Code( CodeStmt_Expr );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -758,6 +865,7 @@ struct CodeStmt_Else
{ {
Using_Code( CodeStmt_Else ); Using_Code( CodeStmt_Else );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -770,6 +878,7 @@ struct CodeStmt_If
{ {
Using_Code( CodeStmt_If ); Using_Code( CodeStmt_If );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -782,6 +891,7 @@ struct CodeStmt_For
{ {
Using_Code( CodeStmt_For ); Using_Code( CodeStmt_For );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -794,6 +904,7 @@ struct CodeStmt_Goto
{ {
Using_Code( CodeStmt_Goto ); Using_Code( CodeStmt_Goto );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -806,6 +917,7 @@ struct CodeStmt_Label
{ {
Using_Code( CodeStmt_Label ); Using_Code( CodeStmt_Label );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -818,6 +930,7 @@ struct CodeStmt_Switch
{ {
Using_Code( CodeStmt_Switch ); Using_Code( CodeStmt_Switch );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -830,6 +943,7 @@ struct CodeStmt_While
{ {
Using_Code( CodeStmt_While ); Using_Code( CodeStmt_While );
String to_string();
void to_string( String& result ); void to_string( String& result );
AST* raw(); AST* raw();
@ -841,10 +955,14 @@ struct CodeStmt_While
struct CodeTemplate struct CodeTemplate
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeTemplate ); Using_Code( CodeTemplate );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps( CodeTemplate );
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Template* operator->(); AST_Template* operator->();
@ -853,10 +971,14 @@ struct CodeTemplate
struct CodeType struct CodeType
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeType ); Using_Code( CodeType );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps( CodeType );
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Type* operator->(); AST_Type* operator->();
@ -865,10 +987,14 @@ struct CodeType
struct CodeTypedef struct CodeTypedef
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeTypedef ); Using_Code( CodeTypedef );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps( CodeTypedef );
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Typedef* operator->(); AST_Typedef* operator->();
@ -877,10 +1003,14 @@ struct CodeTypedef
struct CodeUnion struct CodeUnion
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeUnion ); Using_Code( CodeUnion );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeUnion);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Union* operator->(); AST_Union* operator->();
@ -889,11 +1019,15 @@ struct CodeUnion
struct CodeUsing struct CodeUsing
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeUsing ); Using_Code( CodeUsing );
String to_string();
void to_string( String& result ); void to_string( String& result );
void to_string_ns( String& result ); void to_string_ns( String& result );
#endif
Using_CodeOps(CodeUsing);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Using* operator->(); AST_Using* operator->();
@ -902,10 +1036,14 @@ struct CodeUsing
struct CodeVar struct CodeVar
{ {
#if GEN_SUPPORT_CPP_MEMBER_FEATURES || 1
Using_Code( CodeVar ); Using_Code( CodeVar );
String to_string();
void to_string( String& result ); void to_string( String& result );
#endif
Using_CodeOps(CodeVar);
AST* raw(); AST* raw();
operator Code(); operator Code();
AST_Var* operator->(); AST_Var* operator->();
@ -914,5 +1052,7 @@ struct CodeVar
#undef Define_CodeType #undef Define_CodeType
#undef Using_Code #undef Using_Code
#undef Using_CodeOps
#endif //if ! GEN_COMPILER_C
#pragma endregion Code Types #pragma endregion Code Types