mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07:00
working to towards https://github.com/Ed94/gencpp/issues/56
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -252,7 +252,7 @@ template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast(
|
||||
#pragma region Code C-Interface
|
||||
|
||||
void code_append (Code code, Code other );
|
||||
StrC code_debug_str (Code code);
|
||||
Str code_debug_str (Code code);
|
||||
Code code_duplicate (Code code);
|
||||
Code* code_entry (Code code, u32 idx );
|
||||
bool code_has_entries (Code code);
|
||||
@ -260,9 +260,9 @@ bool code_is_body (Code code);
|
||||
bool code_is_equal (Code code, Code other);
|
||||
bool code_is_valid (Code code);
|
||||
void code_set_global (Code code);
|
||||
String code_to_string (Code self );
|
||||
void code_to_string_ptr(Code self, String* result );
|
||||
StrC code_type_str (Code self );
|
||||
StrBuilder code_to_string (Code self );
|
||||
void code_to_strbuilder_ptr(Code self, StrBuilder* result );
|
||||
Str code_type_str (Code self );
|
||||
bool code_validate_body(Code self );
|
||||
|
||||
#pragma endregion Code C-Interface
|
||||
@ -278,7 +278,7 @@ struct Code
|
||||
AST* ast;
|
||||
|
||||
# define Using_Code( Typename ) \
|
||||
forceinline StrC debug_str() { return code_debug_str(* this); } \
|
||||
forceinline Str debug_str() { return code_debug_str(* this); } \
|
||||
forceinline Code duplicate() { return code_duplicate(* this); } \
|
||||
forceinline bool is_equal( Code other ) { return code_is_equal(* this, other); } \
|
||||
forceinline bool is_body() { return code_is_body(* this); } \
|
||||
@ -298,9 +298,9 @@ struct Code
|
||||
forceinline void append(Code other) { return code_append(* this, other); }
|
||||
forceinline Code* entry(u32 idx) { return code_entry(* this, idx); }
|
||||
forceinline bool has_entries() { return code_has_entries(* this); }
|
||||
forceinline String to_string() { return code_to_string(* this); }
|
||||
forceinline void to_string(String& result) { return code_to_string_ptr(* this, & result); }
|
||||
forceinline StrC type_str() { return code_type_str(* this); }
|
||||
forceinline StrBuilder to_string() { return code_to_string(* this); }
|
||||
forceinline void to_string(StrBuilder& result) { return code_to_strbuilder_ptr(* this, & result); }
|
||||
forceinline Str type_str() { return code_type_str(* this); }
|
||||
forceinline bool validate_body() { return code_validate_body(*this); }
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,24 +19,24 @@
|
||||
|
||||
void body_append ( CodeBody body, Code other );
|
||||
void body_append_body ( CodeBody body, CodeBody other );
|
||||
String body_to_string ( CodeBody body );
|
||||
void body_to_string_ref ( CodeBody body, String* result );
|
||||
void body_to_string_export( CodeBody body, String* result );
|
||||
StrBuilder body_to_string ( CodeBody body );
|
||||
void body_to_strbuilder_ref ( CodeBody body, StrBuilder* result );
|
||||
void body_to_strbuilder_export( CodeBody body, StrBuilder* result );
|
||||
|
||||
Code begin_CodeBody( CodeBody body);
|
||||
Code end_CodeBody ( CodeBody body );
|
||||
Code next_CodeBody ( CodeBody body, Code entry_iter );
|
||||
|
||||
void class_add_interface( CodeClass self, CodeTypename interface );
|
||||
String class_to_string ( CodeClass self );
|
||||
void class_to_string_def( CodeClass self, String* result );
|
||||
void class_to_string_fwd( CodeClass self, String* result );
|
||||
StrBuilder class_to_string ( CodeClass self );
|
||||
void class_to_strbuilder_def( CodeClass self, StrBuilder* result );
|
||||
void class_to_strbuilder_fwd( CodeClass self, StrBuilder* result );
|
||||
|
||||
void params_append (CodeParams params, CodeParams param );
|
||||
CodeParams params_get (CodeParams params, s32 idx);
|
||||
bool params_has_entries (CodeParams params );
|
||||
String params_to_string (CodeParams params );
|
||||
void params_to_string_ref(CodeParams params, String* result );
|
||||
StrBuilder params_to_string (CodeParams params );
|
||||
void params_to_strbuilder_ref(CodeParams params, StrBuilder* result );
|
||||
|
||||
CodeParams begin_CodeParams(CodeParams params);
|
||||
CodeParams end_CodeParams (CodeParams params);
|
||||
@ -45,100 +45,100 @@ CodeParams next_CodeParams (CodeParams params, CodeParams entry_iter);
|
||||
bool specifiers_append (CodeSpecifiers specifiers, Specifier spec);
|
||||
s32 specifiers_has (CodeSpecifiers specifiers, Specifier spec);
|
||||
s32 specifiers_remove (CodeSpecifiers specifiers, Specifier to_remove );
|
||||
String specifiers_to_string (CodeSpecifiers specifiers);
|
||||
void specifiers_to_string_ref(CodeSpecifiers specifiers, String* result);
|
||||
StrBuilder specifiers_to_string (CodeSpecifiers specifiers);
|
||||
void specifiers_to_strbuilder_ref(CodeSpecifiers specifiers, StrBuilder* result);
|
||||
|
||||
Specifier* begin_CodeSpecifiers(CodeSpecifiers specifiers);
|
||||
Specifier* end_CodeSpecifiers (CodeSpecifiers specifiers);
|
||||
Specifier* next_CodeSpecifiers (CodeSpecifiers specifiers, Specifier* spec_iter);
|
||||
|
||||
void struct_add_interface(CodeStruct self, CodeTypename interface);
|
||||
String struct_to_string (CodeStruct self);
|
||||
void struct_to_string_fwd(CodeStruct self, String* result);
|
||||
void struct_to_string_def(CodeStruct self, String* result);
|
||||
StrBuilder struct_to_string (CodeStruct self);
|
||||
void struct_to_strbuilder_fwd(CodeStruct self, StrBuilder* result);
|
||||
void struct_to_strbuilder_def(CodeStruct self, StrBuilder* result);
|
||||
|
||||
String attributes_to_string (CodeAttributes attributes);
|
||||
void attributes_to_string_ref(CodeAttributes attributes, String* result);
|
||||
StrBuilder attributes_to_string (CodeAttributes attributes);
|
||||
void attributes_to_strbuilder_ref(CodeAttributes attributes, StrBuilder* result);
|
||||
|
||||
String comment_to_string (CodeComment comment );
|
||||
void comment_to_string_ref(CodeComment comment, String* result );
|
||||
StrBuilder comment_to_string (CodeComment comment );
|
||||
void comment_to_strbuilder_ref(CodeComment comment, StrBuilder* result );
|
||||
|
||||
String constructor_to_string (CodeConstructor constructor);
|
||||
void constructor_to_string_def(CodeConstructor constructor, String* result );
|
||||
void constructor_to_string_fwd(CodeConstructor constructor, String* result );
|
||||
StrBuilder constructor_to_string (CodeConstructor constructor);
|
||||
void constructor_to_strbuilder_def(CodeConstructor constructor, StrBuilder* result );
|
||||
void constructor_to_strbuilder_fwd(CodeConstructor constructor, StrBuilder* result );
|
||||
|
||||
String define_to_string (CodeDefine self);
|
||||
void define_to_string_ref(CodeDefine self, String* result);
|
||||
StrBuilder define_to_string (CodeDefine self);
|
||||
void define_to_strbuilder_ref(CodeDefine self, StrBuilder* result);
|
||||
|
||||
String destructor_to_string (CodeDestructor destructor);
|
||||
void destructor_to_string_def(CodeDestructor destructor, String* result );
|
||||
void destructor_to_string_fwd(CodeDestructor destructor, String* result );
|
||||
StrBuilder destructor_to_string (CodeDestructor destructor);
|
||||
void destructor_to_strbuilder_def(CodeDestructor destructor, StrBuilder* result );
|
||||
void destructor_to_strbuilder_fwd(CodeDestructor destructor, StrBuilder* result );
|
||||
|
||||
String enum_to_string (CodeEnum self);
|
||||
void enum_to_string_def (CodeEnum self, String* result );
|
||||
void enum_to_string_fwd (CodeEnum self, String* result );
|
||||
void enum_to_string_class_def(CodeEnum self, String* result );
|
||||
void enum_to_string_class_fwd(CodeEnum self, String* result );
|
||||
StrBuilder enum_to_string (CodeEnum self);
|
||||
void enum_to_strbuilder_def (CodeEnum self, StrBuilder* result );
|
||||
void enum_to_strbuilder_fwd (CodeEnum self, StrBuilder* result );
|
||||
void enum_to_strbuilder_class_def(CodeEnum self, StrBuilder* result );
|
||||
void enum_to_strbuilder_class_fwd(CodeEnum self, StrBuilder* result );
|
||||
|
||||
String exec_to_string (CodeExec exec);
|
||||
void exec_to_string_ref(CodeExec exec, String* result);
|
||||
StrBuilder exec_to_string (CodeExec exec);
|
||||
void exec_to_strbuilder_ref(CodeExec exec, StrBuilder* result);
|
||||
|
||||
void extern_to_string(CodeExtern self, String* result);
|
||||
void extern_to_string(CodeExtern self, StrBuilder* result);
|
||||
|
||||
String include_to_string (CodeInclude self);
|
||||
void include_to_string_ref(CodeInclude self, String* result);
|
||||
StrBuilder include_to_string (CodeInclude self);
|
||||
void include_to_strbuilder_ref(CodeInclude self, StrBuilder* result);
|
||||
|
||||
String friend_to_string (CodeFriend self);
|
||||
void friend_to_string_ref(CodeFriend self, String* result);
|
||||
StrBuilder friend_to_string (CodeFriend self);
|
||||
void friend_to_strbuilder_ref(CodeFriend self, StrBuilder* result);
|
||||
|
||||
String fn_to_string (CodeFn self);
|
||||
void fn_to_string_def(CodeFn self, String* result);
|
||||
void fn_to_string_fwd(CodeFn self, String* result);
|
||||
StrBuilder fn_to_string (CodeFn self);
|
||||
void fn_to_strbuilder_def(CodeFn self, StrBuilder* result);
|
||||
void fn_to_strbuilder_fwd(CodeFn self, StrBuilder* result);
|
||||
|
||||
String module_to_string (CodeModule self);
|
||||
void module_to_string_ref(CodeModule self, String* result);
|
||||
StrBuilder module_to_string (CodeModule self);
|
||||
void module_to_strbuilder_ref(CodeModule self, StrBuilder* result);
|
||||
|
||||
String namespace_to_string (CodeNS self);
|
||||
void namespace_to_string_ref(CodeNS self, String* result);
|
||||
StrBuilder namespace_to_string (CodeNS self);
|
||||
void namespace_to_strbuilder_ref(CodeNS self, StrBuilder* result);
|
||||
|
||||
String code_op_to_string (CodeOperator self);
|
||||
void code_op_to_string_fwd(CodeOperator self, String* result );
|
||||
void code_op_to_string_def(CodeOperator self, String* result );
|
||||
StrBuilder code_op_to_string (CodeOperator self);
|
||||
void code_op_to_strbuilder_fwd(CodeOperator self, StrBuilder* result );
|
||||
void code_op_to_strbuilder_def(CodeOperator self, StrBuilder* result );
|
||||
|
||||
String opcast_to_string (CodeOpCast op_cast );
|
||||
void opcast_to_string_def(CodeOpCast op_cast, String* result );
|
||||
void opcast_to_string_fwd(CodeOpCast op_cast, String* result );
|
||||
StrBuilder opcast_to_string (CodeOpCast op_cast );
|
||||
void opcast_to_strbuilder_def(CodeOpCast op_cast, StrBuilder* result );
|
||||
void opcast_to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder* result );
|
||||
|
||||
String pragma_to_string (CodePragma self);
|
||||
void pragma_to_string_ref(CodePragma self, String* result);
|
||||
StrBuilder pragma_to_string (CodePragma self);
|
||||
void pragma_to_strbuilder_ref(CodePragma self, StrBuilder* result);
|
||||
|
||||
String preprocess_to_string (CodePreprocessCond cond);
|
||||
void preprocess_to_string_if (CodePreprocessCond cond, String* result );
|
||||
void preprocess_to_string_ifdef (CodePreprocessCond cond, String* result );
|
||||
void preprocess_to_string_ifndef(CodePreprocessCond cond, String* result );
|
||||
void preprocess_to_string_elif (CodePreprocessCond cond, String* result );
|
||||
void preprocess_to_string_else (CodePreprocessCond cond, String* result );
|
||||
void preprocess_to_string_endif (CodePreprocessCond cond, String* result );
|
||||
StrBuilder preprocess_to_string (CodePreprocessCond cond);
|
||||
void preprocess_to_strbuilder_if (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_elif (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_else (CodePreprocessCond cond, StrBuilder* result );
|
||||
void preprocess_to_strbuilder_endif (CodePreprocessCond cond, StrBuilder* result );
|
||||
|
||||
String template_to_string (CodeTemplate self);
|
||||
void template_to_string_ref(CodeTemplate self, String* result);
|
||||
StrBuilder template_to_string (CodeTemplate self);
|
||||
void template_to_strbuilder_ref(CodeTemplate self, StrBuilder* result);
|
||||
|
||||
String typename_to_string (CodeTypename self);
|
||||
void typename_to_string_ref(CodeTypename self, String* result);
|
||||
StrBuilder typename_to_string (CodeTypename self);
|
||||
void typename_to_strbuilder_ref(CodeTypename self, StrBuilder* result);
|
||||
|
||||
String typedef_to_string (CodeTypedef self);
|
||||
void typedef_to_string_ref(CodeTypedef self, String* result );
|
||||
StrBuilder typedef_to_string (CodeTypedef self);
|
||||
void typedef_to_strbuilder_ref(CodeTypedef self, StrBuilder* result );
|
||||
|
||||
String union_to_string (CodeUnion self);
|
||||
void union_to_string_def(CodeUnion self, String* result);
|
||||
void union_to_string_fwd(CodeUnion self, String* result);
|
||||
StrBuilder union_to_string (CodeUnion self);
|
||||
void union_to_strbuilder_def(CodeUnion self, StrBuilder* result);
|
||||
void union_to_strbuilder_fwd(CodeUnion self, StrBuilder* result);
|
||||
|
||||
String using_to_string (CodeUsing op_cast );
|
||||
void using_to_string_ref(CodeUsing op_cast, String* result );
|
||||
void using_to_string_ns (CodeUsing op_cast, String* result );
|
||||
StrBuilder using_to_string (CodeUsing op_cast );
|
||||
void using_to_strbuilder_ref(CodeUsing op_cast, StrBuilder* result );
|
||||
void using_to_strbuilder_ns (CodeUsing op_cast, StrBuilder* result );
|
||||
|
||||
String var_to_string (CodeVar self);
|
||||
void var_to_string_ref(CodeVar self, String* result);
|
||||
StrBuilder var_to_string (CodeVar self);
|
||||
void var_to_strbuilder_ref(CodeVar self, StrBuilder* result);
|
||||
|
||||
#pragma endregion Code Type C-Interface
|
||||
|
||||
@ -157,9 +157,9 @@ struct CodeBody
|
||||
forceinline void append( Code other ) { return body_append( *this, other ); }
|
||||
forceinline void append( CodeBody body ) { return body_append(*this, body); }
|
||||
forceinline bool has_entries() { return code_has_entries(* this); }
|
||||
forceinline String to_string() { return body_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return body_to_string_ref(* this, & result ); }
|
||||
forceinline void to_string_export( String& result ) { return body_to_string_export(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return body_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return body_to_strbuilder_ref(* this, & result ); }
|
||||
forceinline void to_strbuilder_export( StrBuilder& result ) { return body_to_strbuilder_export(* this, & result); }
|
||||
|
||||
forceinline Code begin() { return begin_CodeBody(* this); }
|
||||
forceinline Code end() { return end_CodeBody(* this); }
|
||||
@ -175,9 +175,9 @@ struct CodeClass
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeClass );
|
||||
forceinline void add_interface( CodeType interface );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string_def( String& result );
|
||||
forceinline void to_string_fwd( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_strbuilder_def( StrBuilder& result );
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result );
|
||||
#endif
|
||||
Using_CodeOps( CodeClass );
|
||||
forceinline operator Code() { return * rcast( Code*, this ); }
|
||||
@ -195,8 +195,8 @@ struct CodeParams
|
||||
forceinline void append( CodeParams other );
|
||||
forceinline CodeParams get( s32 idx );
|
||||
forceinline bool has_entries();
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
|
||||
forceinline CodeParams begin() { return begin_CodeParams(* this); }
|
||||
forceinline CodeParams end() { return end_CodeParams(* this); }
|
||||
@ -219,8 +219,8 @@ struct CodeSpecifiers
|
||||
bool append( Specifier spec ) { return specifiers_append(* this, spec); }
|
||||
s32 has( Specifier spec ) { return specifiers_has(* this, spec); }
|
||||
s32 remove( Specifier to_remove ) { return specifiers_remove(* this, to_remove); }
|
||||
String to_string() { return specifiers_to_string(* this ); }
|
||||
void to_string( String& result ) { return specifiers_to_string_ref(* this, & result); }
|
||||
StrBuilder to_string() { return specifiers_to_string(* this ); }
|
||||
void to_string( StrBuilder& result ) { return specifiers_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeSpecifiers);
|
||||
forceinline operator Code() { return { (AST*) ast }; }
|
||||
@ -235,8 +235,8 @@ struct CodeAttributes
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code(CodeAttributes);
|
||||
forceinline String to_string() { return attributes_to_string(* this); }
|
||||
forceinline void to_string(String& result) { return attributes_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return attributes_to_string(* this); }
|
||||
forceinline void to_string(StrBuilder& result) { return attributes_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeAttributes);
|
||||
operator Code();
|
||||
@ -250,8 +250,8 @@ struct CodeComment
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code(CodeComment);
|
||||
forceinline String to_string() { return comment_to_string (* this); }
|
||||
forceinline void to_string(String& result) { return comment_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return comment_to_string (* this); }
|
||||
forceinline void to_string(StrBuilder& result) { return comment_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeComment);
|
||||
operator Code();
|
||||
@ -263,9 +263,9 @@ struct CodeConstructor
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeConstructor );
|
||||
forceinline String to_string() { return constructor_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return constructor_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return constructor_to_string_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return constructor_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return constructor_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return constructor_to_strbuilder_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeConstructor);
|
||||
operator Code();
|
||||
@ -277,8 +277,8 @@ struct CodeDefine
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeDefine );
|
||||
forceinline String to_string() { return define_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return define_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return define_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return define_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeDefine);
|
||||
operator Code();
|
||||
@ -290,9 +290,9 @@ struct CodeDestructor
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeDestructor );
|
||||
forceinline String to_string() { return destructor_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return destructor_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return destructor_to_string_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return destructor_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return destructor_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return destructor_to_strbuilder_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeDestructor);
|
||||
operator Code();
|
||||
@ -304,11 +304,11 @@ struct CodeEnum
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeEnum );
|
||||
forceinline String to_string() { return enum_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return enum_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return enum_to_string_fwd(* this, & result); }
|
||||
forceinline void to_string_class_def( String& result ) { return enum_to_string_class_def(* this, & result); }
|
||||
forceinline void to_string_class_fwd( String& result ) { return enum_to_string_class_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return enum_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return enum_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return enum_to_strbuilder_fwd(* this, & result); }
|
||||
forceinline void to_strbuilder_class_def( StrBuilder& result ) { return enum_to_strbuilder_class_def(* this, & result); }
|
||||
forceinline void to_strbuilder_class_fwd( StrBuilder& result ) { return enum_to_strbuilder_class_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeEnum);
|
||||
operator Code();
|
||||
@ -320,8 +320,8 @@ struct CodeExec
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code(CodeExec);
|
||||
forceinline String to_string() { return exec_to_string(* this); }
|
||||
forceinline void to_string(String& result) { return exec_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return exec_to_string(* this); }
|
||||
forceinline void to_string(StrBuilder& result) { return exec_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeExec);
|
||||
operator Code();
|
||||
@ -334,7 +334,7 @@ struct CodeExpr
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr* operator->();
|
||||
@ -345,7 +345,7 @@ struct CodeExpr_Assign
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Assign );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Assign* operator->();
|
||||
@ -356,7 +356,7 @@ struct CodeExpr_Alignof
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Alignof );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Alignof* operator->();
|
||||
@ -367,7 +367,7 @@ struct CodeExpr_Binary
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Binary );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Binary* operator->();
|
||||
@ -378,7 +378,7 @@ struct CodeExpr_CStyleCast
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_CStyleCast );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_CStyleCast* operator->();
|
||||
@ -389,7 +389,7 @@ struct CodeExpr_FunctionalCast
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_FunctionalCast );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_FunctionalCast* operator->();
|
||||
@ -400,7 +400,7 @@ struct CodeExpr_CppCast
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_CppCast );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_CppCast* operator->();
|
||||
@ -411,7 +411,7 @@ struct CodeExpr_Element
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Element );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Element* operator->();
|
||||
@ -422,7 +422,7 @@ struct CodeExpr_ProcCall
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_ProcCall );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_ProcCall* operator->();
|
||||
@ -433,7 +433,7 @@ struct CodeExpr_Decltype
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Decltype );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Decltype* operator->();
|
||||
@ -444,7 +444,7 @@ struct CodeExpr_Comma
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Comma );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Comma* operator->();
|
||||
@ -455,7 +455,7 @@ struct CodeExpr_AMS
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_AMS );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_AMS* operator->();
|
||||
@ -466,7 +466,7 @@ struct CodeExpr_Sizeof
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Sizeof );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Sizeof* operator->();
|
||||
@ -477,7 +477,7 @@ struct CodeExpr_Subscript
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Subscript );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Subscript* operator->();
|
||||
@ -488,7 +488,7 @@ struct CodeExpr_Ternary
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_Ternary );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_Ternary* operator->();
|
||||
@ -499,7 +499,7 @@ struct CodeExpr_UnaryPrefix
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_UnaryPrefix );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Expr_UnaryPrefix* operator->();
|
||||
@ -510,7 +510,7 @@ struct CodeExpr_UnaryPostfix
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExpr_UnaryPostfix );
|
||||
forceinline void to_string( String& result );
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
AST* raw();
|
||||
operator Code();
|
||||
@ -523,7 +523,7 @@ struct CodeExtern
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeExtern );
|
||||
forceinline void to_string( String& result ) { return extern_to_string(* this, & result); }
|
||||
forceinline void to_string( StrBuilder& result ) { return extern_to_string(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeExtern);
|
||||
operator Code();
|
||||
@ -535,8 +535,8 @@ struct CodeInclude
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeInclude );
|
||||
String to_string() { return include_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return include_to_string_ref(* this, & result); }
|
||||
StrBuilder to_string() { return include_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return include_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeInclude);
|
||||
operator Code();
|
||||
@ -548,8 +548,8 @@ struct CodeFriend
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeFriend );
|
||||
forceinline String to_string() { return friend_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return friend_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return friend_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return friend_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeFriend);
|
||||
operator Code();
|
||||
@ -561,9 +561,9 @@ struct CodeFn
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeFn );
|
||||
forceinline String to_string() { return fn_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return fn_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return fn_to_string_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return fn_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return fn_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return fn_to_strbuilder_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeFn);
|
||||
operator Code();
|
||||
@ -575,8 +575,8 @@ struct CodeModule
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeModule );
|
||||
forceinline String to_string() { return module_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return module_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return module_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return module_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeModule);
|
||||
operator Code();
|
||||
@ -588,8 +588,8 @@ struct CodeNS
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeNS );
|
||||
forceinline String to_string() { return namespace_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return namespace_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return namespace_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return namespace_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeNS);
|
||||
operator Code();
|
||||
@ -601,9 +601,9 @@ struct CodeOperator
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeOperator );
|
||||
forceinline String to_string() { return code_op_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return code_op_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return code_op_to_string_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return code_op_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return code_op_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return code_op_to_strbuilder_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeOperator);
|
||||
operator Code();
|
||||
@ -615,9 +615,9 @@ struct CodeOpCast
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeOpCast );
|
||||
forceinline String to_string() { return opcast_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return opcast_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return opcast_to_string_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return opcast_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return opcast_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return opcast_to_strbuilder_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeOpCast);
|
||||
operator Code();
|
||||
@ -629,8 +629,8 @@ struct CodePragma
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodePragma );
|
||||
forceinline String to_string() { return pragma_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return pragma_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return pragma_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return pragma_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps( CodePragma );
|
||||
operator Code();
|
||||
@ -642,13 +642,13 @@ struct CodePreprocessCond
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodePreprocessCond );
|
||||
forceinline String to_string() { return preprocess_to_string(* this); }
|
||||
forceinline void to_string_if( String& result ) { return preprocess_to_string_if(* this, & result); }
|
||||
forceinline void to_string_ifdef( String& result ) { return preprocess_to_string_ifdef(* this, & result); }
|
||||
forceinline void to_string_ifndef( String& result ) { return preprocess_to_string_ifndef(* this, & result); }
|
||||
forceinline void to_string_elif( String& result ) { return preprocess_to_string_elif(* this, & result); }
|
||||
forceinline void to_string_else( String& result ) { return preprocess_to_string_else(* this, & result); }
|
||||
forceinline void to_string_endif( String& result ) { return preprocess_to_string_endif(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return preprocess_to_string(* this); }
|
||||
forceinline void to_strbuilder_if( StrBuilder& result ) { return preprocess_to_strbuilder_if(* this, & result); }
|
||||
forceinline void to_strbuilder_ifdef( StrBuilder& result ) { return preprocess_to_strbuilder_ifdef(* this, & result); }
|
||||
forceinline void to_strbuilder_ifndef( StrBuilder& result ) { return preprocess_to_strbuilder_ifndef(* this, & result); }
|
||||
forceinline void to_strbuilder_elif( StrBuilder& result ) { return preprocess_to_strbuilder_elif(* this, & result); }
|
||||
forceinline void to_strbuilder_else( StrBuilder& result ) { return preprocess_to_strbuilder_else(* this, & result); }
|
||||
forceinline void to_strbuilder_endif( StrBuilder& result ) { return preprocess_to_strbuilder_endif(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps( CodePreprocessCond );
|
||||
operator Code();
|
||||
@ -661,8 +661,8 @@ struct CodeStmt
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt* operator->();
|
||||
@ -673,8 +673,8 @@ struct CodeStmt_Break
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Break );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Break* operator->();
|
||||
@ -685,8 +685,8 @@ struct CodeStmt_Case
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Case );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Case* operator->();
|
||||
@ -697,8 +697,8 @@ struct CodeStmt_Continue
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Continue );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Continue* operator->();
|
||||
@ -709,8 +709,8 @@ struct CodeStmt_Decl
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Decl );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Decl* operator->();
|
||||
@ -721,8 +721,8 @@ struct CodeStmt_Do
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Do );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Do* operator->();
|
||||
@ -733,8 +733,8 @@ struct CodeStmt_Expr
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Expr );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Expr* operator->();
|
||||
@ -745,8 +745,8 @@ struct CodeStmt_Else
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Else );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Else* operator->();
|
||||
@ -757,8 +757,8 @@ struct CodeStmt_If
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_If );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_If* operator->();
|
||||
@ -769,8 +769,8 @@ struct CodeStmt_For
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_For );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_For* operator->();
|
||||
@ -781,8 +781,8 @@ struct CodeStmt_Goto
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Goto );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Goto* operator->();
|
||||
@ -793,8 +793,8 @@ struct CodeStmt_Label
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Label );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Label* operator->();
|
||||
@ -805,8 +805,8 @@ struct CodeStmt_Switch
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_Switch );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_Switch* operator->();
|
||||
@ -817,8 +817,8 @@ struct CodeStmt_While
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStmt_While );
|
||||
forceinline String to_string();
|
||||
forceinline void to_string( String& result );
|
||||
forceinline StrBuilder to_string();
|
||||
forceinline void to_string( StrBuilder& result );
|
||||
#endif
|
||||
operator Code();
|
||||
AST_Stmt_While* operator->();
|
||||
@ -830,8 +830,8 @@ struct CodeTemplate
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeTemplate );
|
||||
forceinline String to_string() { return template_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return template_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return template_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return template_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps( CodeTemplate );
|
||||
operator Code();
|
||||
@ -843,8 +843,8 @@ struct CodeTypename
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeTypename );
|
||||
forceinline String to_string() { return typename_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return typename_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return typename_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return typename_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps( CodeTypename );
|
||||
operator Code();
|
||||
@ -856,8 +856,8 @@ struct CodeTypedef
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeTypedef );
|
||||
forceinline String to_string() { return typedef_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return typedef_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return typedef_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return typedef_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps( CodeTypedef );
|
||||
operator Code();
|
||||
@ -869,9 +869,9 @@ struct CodeUnion
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeUnion );
|
||||
forceinline String to_string() { return union_to_string(* this); }
|
||||
forceinline void to_string_def( String& result ) { return union_to_string_def(* this, & result); }
|
||||
forceinline void to_string_fwd( String& result ) { return union_to_string_fwd(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return union_to_string(* this); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return union_to_strbuilder_def(* this, & result); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return union_to_strbuilder_fwd(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeUnion);
|
||||
operator Code();
|
||||
@ -883,9 +883,9 @@ struct CodeUsing
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeUsing );
|
||||
forceinline String to_string() { return using_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return using_to_string_ref(* this, & result); }
|
||||
forceinline void to_string_ns( String& result ) { return using_to_string_ns(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return using_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return using_to_strbuilder_ref(* this, & result); }
|
||||
forceinline void to_strbuilder_ns( StrBuilder& result ) { return using_to_strbuilder_ns(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeUsing);
|
||||
operator Code();
|
||||
@ -897,8 +897,8 @@ struct CodeVar
|
||||
{
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeVar );
|
||||
forceinline String to_string() { return var_to_string(* this); }
|
||||
forceinline void to_string( String& result ) { return var_to_string_ref(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return var_to_string(* this); }
|
||||
forceinline void to_string( StrBuilder& result ) { return var_to_strbuilder_ref(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps(CodeVar);
|
||||
operator Code();
|
||||
@ -911,9 +911,9 @@ struct CodeStruct
|
||||
#if ! GEN_C_LIKE_CPP
|
||||
Using_Code( CodeStruct );
|
||||
forceinline void add_interface( CodeTypename interface ) { return struct_add_interface(* this, interface); }
|
||||
forceinline String to_string() { return struct_to_string(* this); }
|
||||
forceinline void to_string_fwd( String& result ) { return struct_to_string_fwd(* this, & result); }
|
||||
forceinline void to_string_def( String& result ) { return struct_to_string_def(* this, & result); }
|
||||
forceinline StrBuilder to_string() { return struct_to_string(* this); }
|
||||
forceinline void to_strbuilder_fwd( StrBuilder& result ) { return struct_to_strbuilder_fwd(* this, & result); }
|
||||
forceinline void to_strbuilder_def( StrBuilder& result ) { return struct_to_strbuilder_def(* this, & result); }
|
||||
#endif
|
||||
Using_CodeOps( CodeStruct );
|
||||
forceinline operator Code() { return * rcast( Code*, this ); }
|
||||
@ -1002,24 +1002,24 @@ GEN_OPTIMIZE_MAPPINGS_BEGIN
|
||||
|
||||
forceinline void append ( CodeBody body, Code other ) { return body_append(body, other); }
|
||||
forceinline void append ( CodeBody body, CodeBody other ) { return body_append_body(body, other); }
|
||||
forceinline String to_string ( CodeBody body ) { return body_to_string(body); }
|
||||
forceinline void to_string ( CodeBody body, String& result ) { return body_to_string_ref(body, & result); }
|
||||
forceinline void to_string_export( CodeBody body, String& result ) { return body_to_string_export(body, & result); }
|
||||
forceinline StrBuilder to_string ( CodeBody body ) { return body_to_string(body); }
|
||||
forceinline void to_string ( CodeBody body, StrBuilder& result ) { return body_to_strbuilder_ref(body, & result); }
|
||||
forceinline void to_strbuilder_export( CodeBody body, StrBuilder& result ) { return body_to_strbuilder_export(body, & result); }
|
||||
|
||||
forceinline Code begin( CodeBody body) { return begin_CodeBody(body); }
|
||||
forceinline Code end ( CodeBody body ) { return end_CodeBody(body); }
|
||||
forceinline Code next ( CodeBody body, Code entry_iter ) { return next_CodeBody(body, entry_iter); }
|
||||
|
||||
forceinline void add_interface( CodeClass self, CodeTypename interface ) { return class_add_interface(self, interface); }
|
||||
forceinline String to_string ( CodeClass self ) { return class_to_string(self); }
|
||||
forceinline void to_string_def( CodeClass self, String& result ) { return class_to_string_def(self, & result); }
|
||||
forceinline void to_string_fwd( CodeClass self, String& result ) { return class_to_string_fwd(self, & result); }
|
||||
forceinline StrBuilder to_string ( CodeClass self ) { return class_to_string(self); }
|
||||
forceinline void to_strbuilder_def( CodeClass self, StrBuilder& result ) { return class_to_strbuilder_def(self, & result); }
|
||||
forceinline void to_strbuilder_fwd( CodeClass self, StrBuilder& result ) { return class_to_strbuilder_fwd(self, & result); }
|
||||
|
||||
forceinline void append (CodeParams params, CodeParams param ) { return params_append(params, param); }
|
||||
forceinline CodeParams get (CodeParams params, s32 idx) { return params_get(params, idx); }
|
||||
forceinline bool has_entries(CodeParams params ) { return params_has_entries(params); }
|
||||
forceinline String to_string (CodeParams params ) { return params_to_string(params); }
|
||||
forceinline void to_string (CodeParams params, String& result ) { return params_to_string_ref(params, & result); }
|
||||
forceinline StrBuilder to_string (CodeParams params ) { return params_to_string(params); }
|
||||
forceinline void to_string (CodeParams params, StrBuilder& result ) { return params_to_strbuilder_ref(params, & result); }
|
||||
|
||||
forceinline CodeParams begin(CodeParams params) { return begin_CodeParams(params); }
|
||||
forceinline CodeParams end (CodeParams params) { return end_CodeParams(params); }
|
||||
@ -1028,100 +1028,100 @@ forceinline CodeParams next (CodeParams params, CodeParams entry_iter) { return
|
||||
forceinline bool append (CodeSpecifiers specifiers, Specifier spec) { return specifiers_append(specifiers, spec); }
|
||||
forceinline s32 has (CodeSpecifiers specifiers, Specifier spec) { return specifiers_has(specifiers, spec); }
|
||||
forceinline s32 remove (CodeSpecifiers specifiers, Specifier to_remove ) { return specifiers_remove(specifiers, to_remove); }
|
||||
forceinline String to_string(CodeSpecifiers specifiers) { return specifiers_to_string(specifiers); }
|
||||
forceinline void to_string(CodeSpecifiers specifiers, String& result) { return specifiers_to_string_ref(specifiers, & result); }
|
||||
forceinline StrBuilder to_string(CodeSpecifiers specifiers) { return specifiers_to_string(specifiers); }
|
||||
forceinline void to_string(CodeSpecifiers specifiers, StrBuilder& result) { return specifiers_to_strbuilder_ref(specifiers, & result); }
|
||||
|
||||
forceinline Specifier* begin(CodeSpecifiers specifiers) { return begin_CodeSpecifiers(specifiers); }
|
||||
forceinline Specifier* end (CodeSpecifiers specifiers) { return end_CodeSpecifiers(specifiers); }
|
||||
forceinline Specifier* next (CodeSpecifiers specifiers, Specifier& spec_iter) { return next_CodeSpecifiers(specifiers, & spec_iter); }
|
||||
|
||||
forceinline void add_interface(CodeStruct self, CodeTypename interface) { return struct_add_interface(self, interface); }
|
||||
forceinline String to_string (CodeStruct self) { return struct_to_string(self); }
|
||||
forceinline void to_string_fwd(CodeStruct self, String& result) { return struct_to_string_fwd(self, & result); }
|
||||
forceinline void to_string_def(CodeStruct self, String& result) { return struct_to_string_def(self, & result); }
|
||||
forceinline StrBuilder to_string (CodeStruct self) { return struct_to_string(self); }
|
||||
forceinline void to_strbuilder_fwd(CodeStruct self, StrBuilder& result) { return struct_to_strbuilder_fwd(self, & result); }
|
||||
forceinline void to_strbuilder_def(CodeStruct self, StrBuilder& result) { return struct_to_strbuilder_def(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeAttributes attributes) { return attributes_to_string(attributes); }
|
||||
forceinline void to_string(CodeAttributes attributes, String& result) { return attributes_to_string_ref(attributes, & result); }
|
||||
forceinline StrBuilder to_string(CodeAttributes attributes) { return attributes_to_string(attributes); }
|
||||
forceinline void to_string(CodeAttributes attributes, StrBuilder& result) { return attributes_to_strbuilder_ref(attributes, & result); }
|
||||
|
||||
forceinline String to_string(CodeComment comment ) { return comment_to_string(comment); }
|
||||
forceinline void to_string(CodeComment comment, String& result ) { return comment_to_string_ref(comment, & result); }
|
||||
forceinline StrBuilder to_string(CodeComment comment ) { return comment_to_string(comment); }
|
||||
forceinline void to_string(CodeComment comment, StrBuilder& result ) { return comment_to_strbuilder_ref(comment, & result); }
|
||||
|
||||
forceinline String to_string (CodeConstructor constructor) { return constructor_to_string(constructor); }
|
||||
forceinline void to_string_def(CodeConstructor constructor, String& result ) { return constructor_to_string_def(constructor, & result); }
|
||||
forceinline void to_string_fwd(CodeConstructor constructor, String& result ) { return constructor_to_string_fwd(constructor, & result); }
|
||||
forceinline StrBuilder to_string (CodeConstructor constructor) { return constructor_to_string(constructor); }
|
||||
forceinline void to_strbuilder_def(CodeConstructor constructor, StrBuilder& result ) { return constructor_to_strbuilder_def(constructor, & result); }
|
||||
forceinline void to_strbuilder_fwd(CodeConstructor constructor, StrBuilder& result ) { return constructor_to_strbuilder_fwd(constructor, & result); }
|
||||
|
||||
forceinline String to_string(CodeDefine self) { return define_to_string(self); }
|
||||
forceinline void to_string(CodeDefine self, String& result) { return define_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeDefine self) { return define_to_string(self); }
|
||||
forceinline void to_string(CodeDefine self, StrBuilder& result) { return define_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string (CodeDestructor destructor) { return destructor_to_string(destructor); }
|
||||
forceinline void to_string_def(CodeDestructor destructor, String& result ) { return destructor_to_string_def(destructor, & result); }
|
||||
forceinline void to_string_fwd(CodeDestructor destructor, String& result ) { return destructor_to_string_fwd(destructor, & result); }
|
||||
forceinline StrBuilder to_string (CodeDestructor destructor) { return destructor_to_string(destructor); }
|
||||
forceinline void to_strbuilder_def(CodeDestructor destructor, StrBuilder& result ) { return destructor_to_strbuilder_def(destructor, & result); }
|
||||
forceinline void to_strbuilder_fwd(CodeDestructor destructor, StrBuilder& result ) { return destructor_to_strbuilder_fwd(destructor, & result); }
|
||||
|
||||
forceinline String to_string (CodeEnum self) { return enum_to_string(self); }
|
||||
forceinline void to_string_def (CodeEnum self, String& result ) { return enum_to_string_def(self, & result); }
|
||||
forceinline void to_string_fwd (CodeEnum self, String& result ) { return enum_to_string_fwd(self, & result); }
|
||||
forceinline void to_string_class_def(CodeEnum self, String& result ) { return enum_to_string_class_def(self, & result); }
|
||||
forceinline void to_string_class_fwd(CodeEnum self, String& result ) { return enum_to_string_class_fwd(self, & result); }
|
||||
forceinline StrBuilder to_string (CodeEnum self) { return enum_to_string(self); }
|
||||
forceinline void to_strbuilder_def (CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_def(self, & result); }
|
||||
forceinline void to_strbuilder_fwd (CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_fwd(self, & result); }
|
||||
forceinline void to_strbuilder_class_def(CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_class_def(self, & result); }
|
||||
forceinline void to_strbuilder_class_fwd(CodeEnum self, StrBuilder& result ) { return enum_to_strbuilder_class_fwd(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeExec exec) { return exec_to_string(exec); }
|
||||
forceinline void to_string(CodeExec exec, String& result) { return exec_to_string_ref(exec, & result); }
|
||||
forceinline StrBuilder to_string(CodeExec exec) { return exec_to_string(exec); }
|
||||
forceinline void to_string(CodeExec exec, StrBuilder& result) { return exec_to_strbuilder_ref(exec, & result); }
|
||||
|
||||
forceinline void to_string(CodeExtern self, String& result) { return extern_to_string(self, & result); }
|
||||
forceinline void to_string(CodeExtern self, StrBuilder& result) { return extern_to_string(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeInclude self) { return include_to_string(self); }
|
||||
forceinline void to_string(CodeInclude self, String& result) { return include_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeInclude self) { return include_to_string(self); }
|
||||
forceinline void to_string(CodeInclude self, StrBuilder& result) { return include_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeFriend self) { return friend_to_string(self); }
|
||||
forceinline void to_string(CodeFriend self, String& result) { return friend_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeFriend self) { return friend_to_string(self); }
|
||||
forceinline void to_string(CodeFriend self, StrBuilder& result) { return friend_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string (CodeFn self) { return fn_to_string(self); }
|
||||
forceinline void to_string_def(CodeFn self, String& result) { return fn_to_string_def(self, & result); }
|
||||
forceinline void to_string_fwd(CodeFn self, String& result) { return fn_to_string_fwd(self, & result); }
|
||||
forceinline StrBuilder to_string (CodeFn self) { return fn_to_string(self); }
|
||||
forceinline void to_strbuilder_def(CodeFn self, StrBuilder& result) { return fn_to_strbuilder_def(self, & result); }
|
||||
forceinline void to_strbuilder_fwd(CodeFn self, StrBuilder& result) { return fn_to_strbuilder_fwd(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeModule self) { return module_to_string(self); }
|
||||
forceinline void to_string(CodeModule self, String& result) { return module_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeModule self) { return module_to_string(self); }
|
||||
forceinline void to_string(CodeModule self, StrBuilder& result) { return module_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeNS self) { return namespace_to_string(self); }
|
||||
forceinline void to_string(CodeNS self, String& result) { return namespace_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeNS self) { return namespace_to_string(self); }
|
||||
forceinline void to_string(CodeNS self, StrBuilder& result) { return namespace_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string (CodeOperator self) { return code_op_to_string(self); }
|
||||
forceinline void to_string_fwd(CodeOperator self, String& result ) { return code_op_to_string_fwd(self, & result); }
|
||||
forceinline void to_string_def(CodeOperator self, String& result ) { return code_op_to_string_def(self, & result); }
|
||||
forceinline StrBuilder to_string (CodeOperator self) { return code_op_to_string(self); }
|
||||
forceinline void to_strbuilder_fwd(CodeOperator self, StrBuilder& result ) { return code_op_to_strbuilder_fwd(self, & result); }
|
||||
forceinline void to_strbuilder_def(CodeOperator self, StrBuilder& result ) { return code_op_to_strbuilder_def(self, & result); }
|
||||
|
||||
forceinline String to_string (CodeOpCast op_cast ) { return opcast_to_string(op_cast); }
|
||||
forceinline void to_string_def(CodeOpCast op_cast, String& result ) { return opcast_to_string_def(op_cast, & result); }
|
||||
forceinline void to_string_fwd(CodeOpCast op_cast, String& result ) { return opcast_to_string_fwd(op_cast, & result); }
|
||||
forceinline StrBuilder to_string (CodeOpCast op_cast ) { return opcast_to_string(op_cast); }
|
||||
forceinline void to_strbuilder_def(CodeOpCast op_cast, StrBuilder& result ) { return opcast_to_strbuilder_def(op_cast, & result); }
|
||||
forceinline void to_strbuilder_fwd(CodeOpCast op_cast, StrBuilder& result ) { return opcast_to_strbuilder_fwd(op_cast, & result); }
|
||||
|
||||
forceinline String to_string(CodePragma self) { return pragma_to_string(self); }
|
||||
forceinline void to_string(CodePragma self, String& result) { return pragma_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodePragma self) { return pragma_to_string(self); }
|
||||
forceinline void to_string(CodePragma self, StrBuilder& result) { return pragma_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string (CodePreprocessCond cond) { return preprocess_to_string(cond); }
|
||||
forceinline void to_string_if (CodePreprocessCond cond, String& result ) { return preprocess_to_string_if(cond, & result); }
|
||||
forceinline void to_string_ifdef (CodePreprocessCond cond, String& result ) { return preprocess_to_string_ifdef(cond, & result); }
|
||||
forceinline void to_string_ifndef(CodePreprocessCond cond, String& result ) { return preprocess_to_string_ifndef(cond, & result); }
|
||||
forceinline void to_string_elif (CodePreprocessCond cond, String& result ) { return preprocess_to_string_elif(cond, & result); }
|
||||
forceinline void to_string_else (CodePreprocessCond cond, String& result ) { return preprocess_to_string_else(cond, & result); }
|
||||
forceinline void to_string_endif (CodePreprocessCond cond, String& result ) { return preprocess_to_string_endif(cond, & result); }
|
||||
forceinline StrBuilder to_string (CodePreprocessCond cond) { return preprocess_to_string(cond); }
|
||||
forceinline void to_strbuilder_if (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_if(cond, & result); }
|
||||
forceinline void to_strbuilder_ifdef (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_ifdef(cond, & result); }
|
||||
forceinline void to_strbuilder_ifndef(CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_ifndef(cond, & result); }
|
||||
forceinline void to_strbuilder_elif (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_elif(cond, & result); }
|
||||
forceinline void to_strbuilder_else (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_else(cond, & result); }
|
||||
forceinline void to_strbuilder_endif (CodePreprocessCond cond, StrBuilder& result ) { return preprocess_to_strbuilder_endif(cond, & result); }
|
||||
|
||||
forceinline String to_string(CodeTemplate self) { return template_to_string(self); }
|
||||
forceinline void to_string(CodeTemplate self, String& result) { return template_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeTemplate self) { return template_to_string(self); }
|
||||
forceinline void to_string(CodeTemplate self, StrBuilder& result) { return template_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeTypename self) { return typename_to_string(self); }
|
||||
forceinline void to_string(CodeTypename self, String& result) { return typename_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeTypename self) { return typename_to_string(self); }
|
||||
forceinline void to_string(CodeTypename self, StrBuilder& result) { return typename_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string(CodeTypedef self) { return typedef_to_string(self); }
|
||||
forceinline void to_string(CodeTypedef self, String& result ) { return typedef_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeTypedef self) { return typedef_to_string(self); }
|
||||
forceinline void to_string(CodeTypedef self, StrBuilder& result ) { return typedef_to_strbuilder_ref(self, & result); }
|
||||
|
||||
forceinline String to_string (CodeUnion self) { return union_to_string(self); }
|
||||
forceinline void to_string_def(CodeUnion self, String& result) { return union_to_string_def(self, & result); }
|
||||
forceinline void to_string_fwd(CodeUnion self, String& result) { return union_to_string_fwd(self, & result); }
|
||||
forceinline StrBuilder to_string (CodeUnion self) { return union_to_string(self); }
|
||||
forceinline void to_strbuilder_def(CodeUnion self, StrBuilder& result) { return union_to_strbuilder_def(self, & result); }
|
||||
forceinline void to_strbuilder_fwd(CodeUnion self, StrBuilder& result) { return union_to_strbuilder_fwd(self, & result); }
|
||||
|
||||
forceinline String to_string (CodeUsing op_cast ) { return using_to_string(op_cast); }
|
||||
forceinline void to_string (CodeUsing op_cast, String& result ) { return using_to_string_ref(op_cast, & result); }
|
||||
forceinline void to_string_ns(CodeUsing op_cast, String& result ) { return using_to_string_ns(op_cast, & result); }
|
||||
forceinline StrBuilder to_string (CodeUsing op_cast ) { return using_to_string(op_cast); }
|
||||
forceinline void to_string (CodeUsing op_cast, StrBuilder& result ) { return using_to_strbuilder_ref(op_cast, & result); }
|
||||
forceinline void to_strbuilder_ns(CodeUsing op_cast, StrBuilder& result ) { return using_to_strbuilder_ns(op_cast, & result); }
|
||||
|
||||
forceinline String to_string(CodeVar self) { return var_to_string(self); }
|
||||
forceinline void to_string(CodeVar self, String& result) { return var_to_string_ref(self, & result); }
|
||||
forceinline StrBuilder to_string(CodeVar self) { return var_to_string(self); }
|
||||
forceinline void to_string(CodeVar self, StrBuilder& result) { return var_to_strbuilder_ref(self, & result); }
|
||||
|
||||
GEN_OPITMIZE_MAPPINGS_END
|
||||
#endif //if GEN_C_LIKE_CPP
|
||||
|
@ -72,9 +72,9 @@ enum CodeType : u32
|
||||
CT_UnderlyingType = GEN_U32_MAX
|
||||
};
|
||||
|
||||
inline StrC codetype_to_str( CodeType type )
|
||||
inline Str codetype_to_str( CodeType type )
|
||||
{
|
||||
local_persist StrC lookup[61] = {
|
||||
local_persist Str lookup[61] = {
|
||||
{ sizeof( "Invalid" ), "Invalid" },
|
||||
{ sizeof( "Untyped" ), "Untyped" },
|
||||
{ sizeof( "NewLine" ), "NewLine" },
|
||||
@ -140,9 +140,9 @@ inline StrC codetype_to_str( CodeType type )
|
||||
return lookup[type];
|
||||
}
|
||||
|
||||
inline StrC codetype_to_keyword_str( CodeType type )
|
||||
inline Str codetype_to_keyword_str( CodeType type )
|
||||
{
|
||||
local_persist StrC lookup[61] = {
|
||||
local_persist Str lookup[61] = {
|
||||
{ sizeof( "__NA__" ) - 1, "__NA__" },
|
||||
{ sizeof( "__NA__" ) - 1, "__NA__" },
|
||||
{ sizeof( "__NA__" ) - 1, "__NA__" },
|
||||
@ -208,12 +208,12 @@ inline StrC codetype_to_keyword_str( CodeType type )
|
||||
return lookup[type];
|
||||
}
|
||||
|
||||
forceinline StrC to_str( CodeType type )
|
||||
forceinline Str to_str( CodeType type )
|
||||
{
|
||||
return codetype_to_str( type );
|
||||
}
|
||||
|
||||
forceinline StrC to_keyword_str( CodeType type )
|
||||
forceinline Str to_keyword_str( CodeType type )
|
||||
{
|
||||
return codetype_to_keyword_str( type );
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ enum Operator : u32
|
||||
Op_UnderlyingType = 0xffffffffu
|
||||
};
|
||||
|
||||
inline StrC operator_to_str( Operator op )
|
||||
inline Str operator_to_str( Operator op )
|
||||
{
|
||||
local_persist StrC lookup[47] = {
|
||||
local_persist Str lookup[47] = {
|
||||
{ sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "=" ), "=" },
|
||||
{ sizeof( "+=" ), "+=" },
|
||||
@ -112,7 +112,7 @@ inline StrC operator_to_str( Operator op )
|
||||
return lookup[op];
|
||||
}
|
||||
|
||||
forceinline StrC to_str( Operator op )
|
||||
forceinline Str to_str( Operator op )
|
||||
{
|
||||
return operator_to_str( op );
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ enum Specifier : u32
|
||||
Spec_UnderlyingType = 0xffffffffu
|
||||
};
|
||||
|
||||
inline StrC spec_to_str( Specifier type )
|
||||
inline Str spec_to_str( Specifier type )
|
||||
{
|
||||
local_persist StrC lookup[26] = {
|
||||
local_persist Str lookup[26] = {
|
||||
{ sizeof( "INVALID" ), "INVALID" },
|
||||
{ sizeof( "consteval" ), "consteval" },
|
||||
{ sizeof( "constexpr" ), "constexpr" },
|
||||
@ -75,12 +75,12 @@ inline bool spec_is_trailing( Specifier specifier )
|
||||
return specifier > Spec_Virtual;
|
||||
}
|
||||
|
||||
inline Specifier strc_to_specifier( StrC str )
|
||||
inline Specifier str_to_specifier( Str str )
|
||||
{
|
||||
local_persist u32 keymap[Spec_NumSpecifiers];
|
||||
do_once_start for ( u32 index = 0; index < Spec_NumSpecifiers; index++ )
|
||||
{
|
||||
StrC enum_str = spec_to_str( (Specifier)index );
|
||||
Str enum_str = spec_to_str( (Specifier)index );
|
||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
||||
}
|
||||
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
||||
@ -92,14 +92,14 @@ inline Specifier strc_to_specifier( StrC str )
|
||||
return Spec_Invalid;
|
||||
}
|
||||
|
||||
forceinline StrC to_str( Specifier spec )
|
||||
forceinline Str to_str( Specifier spec )
|
||||
{
|
||||
return spec_to_str( spec );
|
||||
}
|
||||
|
||||
forceinline Specifier to_type( StrC str )
|
||||
forceinline Specifier to_type( Str str )
|
||||
{
|
||||
return strc_to_specifier( str );
|
||||
return str_to_specifier( str );
|
||||
}
|
||||
|
||||
forceinline bool is_trailing( Specifier specifier )
|
||||
|
@ -111,9 +111,9 @@ enum TokType : u32
|
||||
Tok_NumTokens
|
||||
};
|
||||
|
||||
inline StrC toktype_to_str( TokType type )
|
||||
inline Str toktype_to_str( TokType type )
|
||||
{
|
||||
local_persist StrC lookup[] = {
|
||||
local_persist Str lookup[] = {
|
||||
{ sizeof( "__invalid__" ), "__invalid__" },
|
||||
{ sizeof( "private" ), "private" },
|
||||
{ sizeof( "protected" ), "protected" },
|
||||
@ -192,7 +192,7 @@ inline StrC toktype_to_str( TokType type )
|
||||
{ sizeof( "*" ), "*" },
|
||||
{ sizeof( ";" ), ";" },
|
||||
{ sizeof( "static_assert" ), "static_assert" },
|
||||
{ sizeof( "__string__" ), "__string__" },
|
||||
{ sizeof( "__strbuilder__" ), "__strbuilder__" },
|
||||
{ sizeof( "typename" ), "typename" },
|
||||
{ sizeof( "unsigned" ), "unsigned" },
|
||||
{ sizeof( "signed" ), "signed" },
|
||||
@ -215,12 +215,12 @@ inline StrC toktype_to_str( TokType type )
|
||||
return lookup[type];
|
||||
}
|
||||
|
||||
inline TokType strc_to_toktype( StrC str )
|
||||
inline TokType str_to_toktype( Str str )
|
||||
{
|
||||
local_persist u32 keymap[Tok_NumTokens];
|
||||
do_once_start for ( u32 index = 0; index < Tok_NumTokens; index++ )
|
||||
{
|
||||
StrC enum_str = toktype_to_str( (TokType)index );
|
||||
Str enum_str = toktype_to_str( (TokType)index );
|
||||
keymap[index] = crc32( enum_str.Ptr, enum_str.Len - 1 );
|
||||
}
|
||||
do_once_end u32 hash = crc32( str.Ptr, str.Len );
|
||||
|
@ -53,7 +53,7 @@ constexpr s32 MaxUntypedStrLength = GEN_MAX_UNTYPED_STR_LENGTH;
|
||||
constexpr s32 LexAllocator_Size = GEN_LEX_ALLOCATOR_SIZE;
|
||||
constexpr s32 Builder_StrBufferReserve = GEN_BUILDER_STR_BUFFER_RESERVE;
|
||||
|
||||
extern StrC enum_underlying_sig;
|
||||
extern Str enum_underlying_sig;
|
||||
|
||||
extern Code access_public;
|
||||
extern Code access_protected;
|
||||
|
@ -101,7 +101,7 @@ Code& Code::operator ++()
|
||||
}
|
||||
#endif
|
||||
forceinline
|
||||
StrC code_type_str(Code self)
|
||||
Str code_type_str(Code self)
|
||||
{
|
||||
GEN_ASSERT(self != nullptr);
|
||||
return codetype_to_str( self->Type );
|
||||
@ -397,7 +397,7 @@ CodeBody def_body( CodeType type )
|
||||
}
|
||||
|
||||
inline
|
||||
StrC token_fmt_impl( ssize num, ... )
|
||||
Str token_fmt_impl( ssize num, ... )
|
||||
{
|
||||
local_persist thread_local
|
||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||
@ -408,7 +408,7 @@ StrC token_fmt_impl( ssize num, ... )
|
||||
ssize result = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num, va);
|
||||
va_end(va);
|
||||
|
||||
StrC str = { result, buf };
|
||||
Str str = { result, buf };
|
||||
return str;
|
||||
}
|
||||
#pragma endregion Interface
|
||||
|
@ -101,11 +101,11 @@ void define_constants()
|
||||
access_public->Name = get_cached_string( txt("public:\n") );
|
||||
code_set_global(access_public);
|
||||
|
||||
StrC api_export_str = code(GEN_API_Export_Code);
|
||||
Str api_export_str = code(GEN_API_Export_Code);
|
||||
attrib_api_export = def_attributes( api_export_str );
|
||||
code_set_global(cast(Code, attrib_api_export));
|
||||
|
||||
StrC api_import_str = code(GEN_API_Import_Code);
|
||||
Str api_import_str = code(GEN_API_Import_Code);
|
||||
attrib_api_import = def_attributes( api_import_str );
|
||||
code_set_global(cast(Code, attrib_api_import));
|
||||
|
||||
@ -145,33 +145,33 @@ void define_constants()
|
||||
preprocess_endif->Type = CT_Preprocess_EndIf;
|
||||
code_set_global((Code)preprocess_endif);
|
||||
|
||||
StrC auto_str = txt("auto"); t_auto = def_type( auto_str ); code_set_global( t_auto );
|
||||
StrC void_str = txt("void"); t_void = def_type( void_str ); code_set_global( t_void );
|
||||
StrC int_str = txt("int"); t_int = def_type( int_str ); code_set_global( t_int );
|
||||
StrC bool_str = txt("bool"); t_bool = def_type( bool_str ); code_set_global( t_bool );
|
||||
StrC char_str = txt("char"); t_char = def_type( char_str ); code_set_global( t_char );
|
||||
StrC wchar_str = txt("wchar_t"); t_wchar_t = def_type( wchar_str ); code_set_global( t_wchar_t );
|
||||
StrC class_str = txt("class"); t_class = def_type( class_str ); code_set_global( t_class );
|
||||
StrC typename_str = txt("typename"); t_typename = def_type( typename_str ); code_set_global( t_typename );
|
||||
Str auto_str = txt("auto"); t_auto = def_type( auto_str ); code_set_global( t_auto );
|
||||
Str void_str = txt("void"); t_void = def_type( void_str ); code_set_global( t_void );
|
||||
Str int_str = txt("int"); t_int = def_type( int_str ); code_set_global( t_int );
|
||||
Str bool_str = txt("bool"); t_bool = def_type( bool_str ); code_set_global( t_bool );
|
||||
Str char_str = txt("char"); t_char = def_type( char_str ); code_set_global( t_char );
|
||||
Str wchar_str = txt("wchar_t"); t_wchar_t = def_type( wchar_str ); code_set_global( t_wchar_t );
|
||||
Str class_str = txt("class"); t_class = def_type( class_str ); code_set_global( t_class );
|
||||
Str typename_str = txt("typename"); t_typename = def_type( typename_str ); code_set_global( t_typename );
|
||||
|
||||
#ifdef GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||
t_b32 = def_type( name(b32) ); code_set_global( t_b32 );
|
||||
|
||||
StrC s8_str = txt("s8"); t_s8 = def_type( s8_str ); code_set_global( t_s8 );
|
||||
StrC s16_str = txt("s16"); t_s16 = def_type( s16_str ); code_set_global( t_s16 );
|
||||
StrC s32_str = txt("s32"); t_s32 = def_type( s32_str ); code_set_global( t_s32 );
|
||||
StrC s64_str = txt("s64"); t_s64 = def_type( s64_str ); code_set_global( t_s64 );
|
||||
Str s8_str = txt("s8"); t_s8 = def_type( s8_str ); code_set_global( t_s8 );
|
||||
Str s16_str = txt("s16"); t_s16 = def_type( s16_str ); code_set_global( t_s16 );
|
||||
Str s32_str = txt("s32"); t_s32 = def_type( s32_str ); code_set_global( t_s32 );
|
||||
Str s64_str = txt("s64"); t_s64 = def_type( s64_str ); code_set_global( t_s64 );
|
||||
|
||||
StrC u8_str = txt("u8"); t_u8 = def_type( u8_str ); code_set_global( t_u8 );
|
||||
StrC u16_str = txt("u16"); t_u16 = def_type( u16_str ); code_set_global( t_u16 );
|
||||
StrC u32_str = txt("u32"); t_u32 = def_type( u32_str ); code_set_global( t_u32 );
|
||||
StrC u64_str = txt("u64"); t_u64 = def_type( u64_str ); code_set_global( t_u64 );
|
||||
Str u8_str = txt("u8"); t_u8 = def_type( u8_str ); code_set_global( t_u8 );
|
||||
Str u16_str = txt("u16"); t_u16 = def_type( u16_str ); code_set_global( t_u16 );
|
||||
Str u32_str = txt("u32"); t_u32 = def_type( u32_str ); code_set_global( t_u32 );
|
||||
Str u64_str = txt("u64"); t_u64 = def_type( u64_str ); code_set_global( t_u64 );
|
||||
|
||||
StrC ssize_str = txt("ssize"); t_ssize = def_type( ssize_str ); code_set_global( t_ssize );
|
||||
StrC usize_str = txt("usize"); t_usize = def_type( usize_str ); code_set_global( t_usize );
|
||||
Str ssize_str = txt("ssize"); t_ssize = def_type( ssize_str ); code_set_global( t_ssize );
|
||||
Str usize_str = txt("usize"); t_usize = def_type( usize_str ); code_set_global( t_usize );
|
||||
|
||||
StrC f32_str = txt("f32"); t_f32 = def_type( f32_str ); code_set_global( t_f32 );
|
||||
StrC f64_str = txt("f64"); t_f64 = def_type( f64_str ); code_set_global( t_f64 );
|
||||
Str f32_str = txt("f32"); t_f32 = def_type( f32_str ); code_set_global( t_f32 );
|
||||
Str f64_str = txt("f64"); t_f64 = def_type( f64_str ); code_set_global( t_f64 );
|
||||
#endif
|
||||
|
||||
spec_const = def_specifier( Spec_Const); code_set_global( cast(Code, spec_const ));
|
||||
@ -273,12 +273,12 @@ void init()
|
||||
|
||||
LexArena = arena_init_from_allocator( Allocator_Lexer, LexAllocator_Size );
|
||||
|
||||
Arena string_arena = arena_init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
||||
Arena strbuilder_arena = arena_init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
||||
|
||||
if ( string_arena.PhysicalStart == nullptr )
|
||||
if ( strbuilder_arena.PhysicalStart == nullptr )
|
||||
GEN_FATAL( "gen::init: Failed to initialize the string arena" );
|
||||
|
||||
array_append( StringArenas, string_arena );
|
||||
array_append( StringArenas, strbuilder_arena );
|
||||
}
|
||||
|
||||
// Setup the hash tables
|
||||
@ -312,8 +312,8 @@ void deinit()
|
||||
left = array_num(StringArenas);
|
||||
do
|
||||
{
|
||||
Arena* string_arena = & StringArenas[index];
|
||||
arena_free(string_arena);
|
||||
Arena* strbuilder_arena = & StringArenas[index];
|
||||
arena_free(strbuilder_arena);
|
||||
index++;
|
||||
}
|
||||
while ( left--, left );
|
||||
@ -357,8 +357,8 @@ void reset()
|
||||
left = array_num(StringArenas);
|
||||
do
|
||||
{
|
||||
Arena* string_arena = & StringArenas[index];
|
||||
string_arena->TotalUsed = 0;;
|
||||
Arena* strbuilder_arena = & StringArenas[index];
|
||||
strbuilder_arena->TotalUsed = 0;;
|
||||
index++;
|
||||
}
|
||||
while ( left--, left );
|
||||
@ -368,18 +368,18 @@ void reset()
|
||||
define_constants();
|
||||
}
|
||||
|
||||
AllocatorInfo get_string_allocator( s32 str_length )
|
||||
AllocatorInfo get_strbuilder_allocator( s32 c_str_length )
|
||||
{
|
||||
Arena* last = array_back(StringArenas);
|
||||
|
||||
usize size_req = str_length + sizeof(StringHeader) + sizeof(char*);
|
||||
usize size_req = c_str_length + sizeof(StrBuilderHeader) + sizeof(char*);
|
||||
|
||||
if ( last->TotalUsed + scast(ssize, size_req) > last->TotalSize )
|
||||
{
|
||||
Arena new_arena = arena_init_from_allocator( Allocator_StringArena, SizePer_StringArena );
|
||||
|
||||
if ( ! array_append( StringArenas, new_arena ) )
|
||||
GEN_FATAL( "gen::get_string_allocator: Failed to allocate a new string arena" );
|
||||
GEN_FATAL( "gen::get_strbuilder_allocator: Failed to allocate a new string arena" );
|
||||
|
||||
last = array_back(StringArenas);
|
||||
}
|
||||
@ -388,7 +388,7 @@ AllocatorInfo get_string_allocator( s32 str_length )
|
||||
}
|
||||
|
||||
// Will either make or retrive a code string.
|
||||
StringCached get_cached_string( StrC str )
|
||||
StringCached get_cached_string( Str str )
|
||||
{
|
||||
s32 hash_length = str.Len > kilobytes(1) ? kilobytes(1) : str.Len;
|
||||
u64 key = crc32( str.Ptr, hash_length );
|
||||
@ -399,7 +399,7 @@ StringCached get_cached_string( StrC str )
|
||||
return * result;
|
||||
}
|
||||
|
||||
StrC result = string_to_strc( string_make_strc( get_string_allocator( str.Len ), str ));
|
||||
Str result = strbuilder_to_str( strbuilder_make_str( get_strbuilder_allocator( str.Len ), str ));
|
||||
hashtable_set(StringCache, key, result );
|
||||
|
||||
return result;
|
||||
@ -442,12 +442,12 @@ void set_allocator_lexer( AllocatorInfo allocator )
|
||||
Allocator_Lexer = allocator;
|
||||
}
|
||||
|
||||
void set_allocator_string_arena( AllocatorInfo allocator )
|
||||
void set_allocator_strbuilder_arena( AllocatorInfo allocator )
|
||||
{
|
||||
Allocator_StringArena = allocator;
|
||||
}
|
||||
|
||||
void set_allocator_string_table( AllocatorInfo allocator )
|
||||
void set_allocator_strbuilder_table( AllocatorInfo allocator )
|
||||
{
|
||||
Allocator_StringArena = allocator;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ void reset();
|
||||
|
||||
// Used internally to retrive or make string allocations.
|
||||
// Strings are stored in a series of string arenas of fixed size (SizePer_StringArena)
|
||||
StringCached get_cached_string( StrC str );
|
||||
StringCached get_cached_string( Str str );
|
||||
|
||||
/*
|
||||
This provides a fresh Code AST.
|
||||
@ -42,14 +42,14 @@ Code make_code();
|
||||
void set_allocator_data_arrays ( AllocatorInfo data_array_allocator );
|
||||
void set_allocator_code_pool ( AllocatorInfo pool_allocator );
|
||||
void set_allocator_lexer ( AllocatorInfo lex_allocator );
|
||||
void set_allocator_string_arena( AllocatorInfo string_allocator );
|
||||
void set_allocator_string_table( AllocatorInfo string_allocator );
|
||||
void set_allocator_strbuilder_arena( AllocatorInfo strbuilder_allocator );
|
||||
void set_allocator_strbuilder_table( AllocatorInfo strbuilder_allocator );
|
||||
void set_allocator_type_table ( AllocatorInfo type_reg_allocator );
|
||||
|
||||
#pragma region Upfront
|
||||
|
||||
CodeAttributes def_attributes( StrC content );
|
||||
CodeComment def_comment ( StrC content );
|
||||
CodeAttributes def_attributes( Str content );
|
||||
CodeComment def_comment ( Str content );
|
||||
|
||||
struct Opts_def_struct {
|
||||
CodeBody body;
|
||||
@ -60,7 +60,7 @@ struct Opts_def_struct {
|
||||
s32 num_interfaces;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeClass def_class( StrC name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
CodeClass def_class( Str name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_constructor {
|
||||
CodeParams params;
|
||||
@ -72,7 +72,7 @@ CodeConstructor def_constructor( Opts_def_constructor opts GEN_PARAM_DEFAULT );
|
||||
struct Opts_def_define {
|
||||
b32 dont_append_preprocess_defines;
|
||||
};
|
||||
CodeDefine def_define( StrC name, StrC content, Opts_def_define opts GEN_PARAM_DEFAULT );
|
||||
CodeDefine def_define( Str name, Str content, Opts_def_define opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_destructor {
|
||||
Code body;
|
||||
@ -88,10 +88,10 @@ struct Opts_def_enum {
|
||||
ModuleFlag mflags;
|
||||
Code type_macro;
|
||||
};
|
||||
CodeEnum def_enum( StrC name, Opts_def_enum opts GEN_PARAM_DEFAULT );
|
||||
CodeEnum def_enum( Str name, Opts_def_enum opts GEN_PARAM_DEFAULT );
|
||||
|
||||
CodeExec def_execution ( StrC content );
|
||||
CodeExtern def_extern_link( StrC name, CodeBody body );
|
||||
CodeExec def_execution ( Str content );
|
||||
CodeExtern def_extern_link( Str name, CodeBody body );
|
||||
CodeFriend def_friend ( Code symbol );
|
||||
|
||||
struct Opts_def_function {
|
||||
@ -102,14 +102,14 @@ struct Opts_def_function {
|
||||
CodeAttributes attrs;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeFn def_function( StrC name, Opts_def_function opts GEN_PARAM_DEFAULT );
|
||||
CodeFn def_function( Str name, Opts_def_function opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_include { b32 foreign; };
|
||||
struct Opts_def_module { ModuleFlag mflags; };
|
||||
struct Opts_def_namespace { ModuleFlag mflags; };
|
||||
CodeInclude def_include ( StrC content, Opts_def_include opts GEN_PARAM_DEFAULT );
|
||||
CodeModule def_module ( StrC name, Opts_def_module opts GEN_PARAM_DEFAULT );
|
||||
CodeNS def_namespace( StrC name, CodeBody body, Opts_def_namespace opts GEN_PARAM_DEFAULT );
|
||||
CodeInclude def_include ( Str content, Opts_def_include opts GEN_PARAM_DEFAULT );
|
||||
CodeModule def_module ( Str name, Opts_def_module opts GEN_PARAM_DEFAULT );
|
||||
CodeNS def_namespace( Str name, CodeBody body, Opts_def_namespace opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_operator {
|
||||
CodeParams params;
|
||||
@ -119,7 +119,7 @@ struct Opts_def_operator {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator opts GEN_PARAM_DEFAULT );
|
||||
CodeOperator def_operator( Operator op, Str nspace, Opts_def_operator opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_operator_cast {
|
||||
CodeBody body;
|
||||
@ -128,14 +128,14 @@ struct Opts_def_operator_cast {
|
||||
CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_param { Code value; };
|
||||
CodeParams def_param ( CodeTypename type, StrC name, Opts_def_param opts GEN_PARAM_DEFAULT );
|
||||
CodePragma def_pragma( StrC directive );
|
||||
CodeParams def_param ( CodeTypename type, Str name, Opts_def_param opts GEN_PARAM_DEFAULT );
|
||||
CodePragma def_pragma( Str directive );
|
||||
|
||||
CodePreprocessCond def_preprocess_cond( EPreprocessCond type, StrC content );
|
||||
CodePreprocessCond def_preprocess_cond( EPreprocessCond type, Str content );
|
||||
|
||||
CodeSpecifiers def_specifier( Specifier specifier );
|
||||
|
||||
CodeStruct def_struct( StrC name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
CodeStruct def_struct( Str name, Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_template { ModuleFlag mflags; };
|
||||
CodeTemplate def_template( CodeParams params, Code definition, Opts_def_template opts GEN_PARAM_DEFAULT );
|
||||
@ -146,27 +146,27 @@ struct Opts_def_type {
|
||||
CodeSpecifiers specifiers;
|
||||
CodeAttributes attributes;
|
||||
};
|
||||
CodeTypename def_type( StrC name, Opts_def_type opts GEN_PARAM_DEFAULT );
|
||||
CodeTypename def_type( Str name, Opts_def_type opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_typedef {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeTypedef def_typedef( StrC name, Code type, Opts_def_typedef opts GEN_PARAM_DEFAULT );
|
||||
CodeTypedef def_typedef( Str name, Code type, Opts_def_typedef opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_union {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeUnion def_union( StrC name, CodeBody body, Opts_def_union opts GEN_PARAM_DEFAULT );
|
||||
CodeUnion def_union( Str name, CodeBody body, Opts_def_union opts GEN_PARAM_DEFAULT );
|
||||
|
||||
struct Opts_def_using {
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeUsing def_using( StrC name, CodeTypename type, Opts_def_using opts GEN_PARAM_DEFAULT );
|
||||
CodeUsing def_using( Str name, CodeTypename type, Opts_def_using opts GEN_PARAM_DEFAULT );
|
||||
|
||||
CodeUsing def_using_namespace( StrC name );
|
||||
CodeUsing def_using_namespace( Str name );
|
||||
|
||||
struct Opts_def_variable
|
||||
{
|
||||
@ -175,7 +175,7 @@ struct Opts_def_variable
|
||||
CodeAttributes attributes;
|
||||
ModuleFlag mflags;
|
||||
};
|
||||
CodeVar def_variable( CodeTypename type, StrC name, Opts_def_variable opts GEN_PARAM_DEFAULT );
|
||||
CodeVar def_variable( CodeTypename type, Str name, Opts_def_variable opts GEN_PARAM_DEFAULT );
|
||||
|
||||
// Constructs an empty body. Use AST::validate_body() to check if the body is was has valid entries.
|
||||
CodeBody def_body( CodeType type );
|
||||
@ -220,13 +220,13 @@ struct StackNode
|
||||
|
||||
Token Start;
|
||||
Token Name; // The name of the AST node (if parsed)
|
||||
StrC FailedProc; // The name of the procedure that failed
|
||||
Str FailedProc; // The name of the procedure that failed
|
||||
};
|
||||
// Stack nodes are allocated the error's allocator
|
||||
|
||||
struct Error
|
||||
{
|
||||
String message;
|
||||
StrBuilder message;
|
||||
StackNode* context_stack;
|
||||
};
|
||||
GEN_NS_PARSER_END
|
||||
@ -243,28 +243,28 @@ struct ParseInfo
|
||||
// Errors are allocated to a dedicated general arena.
|
||||
};
|
||||
|
||||
CodeBody parse_file( StrC path );
|
||||
CodeBody parse_file( Str path );
|
||||
#endif
|
||||
|
||||
CodeClass parse_class ( StrC class_def );
|
||||
CodeConstructor parse_constructor ( StrC constructor_def );
|
||||
CodeDestructor parse_destructor ( StrC destructor_def );
|
||||
CodeEnum parse_enum ( StrC enum_def );
|
||||
CodeBody parse_export_body ( StrC export_def );
|
||||
CodeExtern parse_extern_link ( StrC exten_link_def );
|
||||
CodeFriend parse_friend ( StrC friend_def );
|
||||
CodeFn parse_function ( StrC fn_def );
|
||||
CodeBody parse_global_body ( StrC body_def );
|
||||
CodeNS parse_namespace ( StrC namespace_def );
|
||||
CodeOperator parse_operator ( StrC operator_def );
|
||||
CodeOpCast parse_operator_cast( StrC operator_def );
|
||||
CodeStruct parse_struct ( StrC struct_def );
|
||||
CodeTemplate parse_template ( StrC template_def );
|
||||
CodeTypename parse_type ( StrC type_def );
|
||||
CodeTypedef parse_typedef ( StrC typedef_def );
|
||||
CodeUnion parse_union ( StrC union_def );
|
||||
CodeUsing parse_using ( StrC using_def );
|
||||
CodeVar parse_variable ( StrC var_def );
|
||||
CodeClass parse_class ( Str class_def );
|
||||
CodeConstructor parse_constructor ( Str constructor_def );
|
||||
CodeDestructor parse_destructor ( Str destructor_def );
|
||||
CodeEnum parse_enum ( Str enum_def );
|
||||
CodeBody parse_export_body ( Str export_def );
|
||||
CodeExtern parse_extern_link ( Str exten_link_def );
|
||||
CodeFriend parse_friend ( Str friend_def );
|
||||
CodeFn parse_function ( Str fn_def );
|
||||
CodeBody parse_global_body ( Str body_def );
|
||||
CodeNS parse_namespace ( Str namespace_def );
|
||||
CodeOperator parse_operator ( Str operator_def );
|
||||
CodeOpCast parse_operator_cast( Str operator_def );
|
||||
CodeStruct parse_struct ( Str struct_def );
|
||||
CodeTemplate parse_template ( Str template_def );
|
||||
CodeTypename parse_type ( Str type_def );
|
||||
CodeTypedef parse_typedef ( Str typedef_def );
|
||||
CodeUnion parse_union ( Str union_def );
|
||||
CodeUsing parse_using ( Str using_def );
|
||||
CodeVar parse_variable ( Str var_def );
|
||||
|
||||
#pragma endregion Parsing
|
||||
|
||||
@ -272,9 +272,9 @@ CodeVar parse_variable ( StrC var_def );
|
||||
|
||||
ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va );
|
||||
//! Do not use directly. Use the token_fmt macro instead.
|
||||
StrC token_fmt_impl( ssize, ... );
|
||||
Str token_fmt_impl( ssize, ... );
|
||||
|
||||
Code untyped_str ( StrC content);
|
||||
Code untyped_str ( Str content);
|
||||
Code untyped_fmt ( char const* fmt, ... );
|
||||
Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... );
|
||||
|
||||
@ -317,21 +317,21 @@ Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... );
|
||||
|
||||
#ifndef token_fmt
|
||||
/*
|
||||
Takes a format string (char const*) and a list of tokens (StrC) and returns a StrC of the formatted string.
|
||||
Takes a format string (char const*) and a list of tokens (Str) and returns a Str of the formatted string.
|
||||
Tokens are provided in '<'identifier'>' format where '<' '>' are just angle brackets (you can change it in token_fmt_va)
|
||||
---------------------------------------------------------
|
||||
Example - A string with:
|
||||
typedef <type> <name> <name>;
|
||||
Will have a token_fmt arguments populated with:
|
||||
"type", strc_for_type,
|
||||
"name", strc_for_name,
|
||||
"type", str_for_type,
|
||||
"name", str_for_name,
|
||||
and:
|
||||
stringize( typedef <type> <name> <name>; )
|
||||
-----------------------------------------------------------
|
||||
So the full call for this example would be:
|
||||
token_fmt(
|
||||
"type", strc_for_type
|
||||
, "name", strc_for_name
|
||||
"type", str_for_type
|
||||
, "name", str_for_name
|
||||
, stringize(
|
||||
typedef <type> <name> <name>
|
||||
));
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
// Publically Exposed Interface
|
||||
|
||||
CodeClass parse_class( StrC def )
|
||||
CodeClass parse_class( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -24,7 +24,7 @@ CodeClass parse_class( StrC def )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeConstructor parse_constructor( StrC def )
|
||||
CodeConstructor parse_constructor( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -41,7 +41,7 @@ CodeConstructor parse_constructor( StrC def )
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
b32 ignore_spec = false;
|
||||
|
||||
@ -84,7 +84,7 @@ CodeConstructor parse_constructor( StrC def )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeDestructor parse_destructor( StrC def )
|
||||
CodeDestructor parse_destructor( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -101,7 +101,7 @@ CodeDestructor parse_destructor( StrC def )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeEnum parse_enum( StrC def )
|
||||
CodeEnum parse_enum( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -117,7 +117,7 @@ CodeEnum parse_enum( StrC def )
|
||||
return parser_parse_enum( parser_not_inplace_def);
|
||||
}
|
||||
|
||||
CodeBody parse_export_body( StrC def )
|
||||
CodeBody parse_export_body( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -130,7 +130,7 @@ CodeBody parse_export_body( StrC def )
|
||||
return parser_parse_export_body();
|
||||
}
|
||||
|
||||
CodeExtern parse_extern_link( StrC def )
|
||||
CodeExtern parse_extern_link( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -143,7 +143,7 @@ CodeExtern parse_extern_link( StrC def )
|
||||
return parser_parse_extern_link();
|
||||
}
|
||||
|
||||
CodeFriend parse_friend( StrC def )
|
||||
CodeFriend parse_friend( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -156,7 +156,7 @@ CodeFriend parse_friend( StrC def )
|
||||
return parser_parse_friend();
|
||||
}
|
||||
|
||||
CodeFn parse_function( StrC def )
|
||||
CodeFn parse_function( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -169,7 +169,7 @@ CodeFn parse_function( StrC def )
|
||||
return (CodeFn) parser_parse_function();
|
||||
}
|
||||
|
||||
CodeBody parse_global_body( StrC def )
|
||||
CodeBody parse_global_body( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -185,7 +185,7 @@ CodeBody parse_global_body( StrC def )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeNS parse_namespace( StrC def )
|
||||
CodeNS parse_namespace( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -198,7 +198,7 @@ CodeNS parse_namespace( StrC def )
|
||||
return parser_parse_namespace();
|
||||
}
|
||||
|
||||
CodeOperator parse_operator( StrC def )
|
||||
CodeOperator parse_operator( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -211,7 +211,7 @@ CodeOperator parse_operator( StrC def )
|
||||
return (CodeOperator) parser_parse_operator();
|
||||
}
|
||||
|
||||
CodeOpCast parse_operator_cast( StrC def )
|
||||
CodeOpCast parse_operator_cast( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -224,7 +224,7 @@ CodeOpCast parse_operator_cast( StrC def )
|
||||
return parser_parse_operator_cast(NullCode);
|
||||
}
|
||||
|
||||
CodeStruct parse_struct( StrC def )
|
||||
CodeStruct parse_struct( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -240,7 +240,7 @@ CodeStruct parse_struct( StrC def )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeTemplate parse_template( StrC def )
|
||||
CodeTemplate parse_template( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -253,7 +253,7 @@ CodeTemplate parse_template( StrC def )
|
||||
return parser_parse_template();
|
||||
}
|
||||
|
||||
CodeTypename parse_type( StrC def )
|
||||
CodeTypename parse_type( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -266,7 +266,7 @@ CodeTypename parse_type( StrC def )
|
||||
return parser_parse_type( parser_not_from_template, nullptr);
|
||||
}
|
||||
|
||||
CodeTypedef parse_typedef( StrC def )
|
||||
CodeTypedef parse_typedef( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -279,7 +279,7 @@ CodeTypedef parse_typedef( StrC def )
|
||||
return parser_parse_typedef();
|
||||
}
|
||||
|
||||
CodeUnion parse_union( StrC def )
|
||||
CodeUnion parse_union( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -292,7 +292,7 @@ CodeUnion parse_union( StrC def )
|
||||
return parser_parse_union( parser_not_inplace_def);
|
||||
}
|
||||
|
||||
CodeUsing parse_using( StrC def )
|
||||
CodeUsing parse_using( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
@ -305,7 +305,7 @@ CodeUsing parse_using( StrC def )
|
||||
return parser_parse_using();
|
||||
}
|
||||
|
||||
CodeVar parse_variable( StrC def )
|
||||
CodeVar parse_variable( Str def )
|
||||
{
|
||||
GEN_USING_NS_PARSER;
|
||||
check_parse_args( def );
|
||||
|
@ -15,16 +15,16 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
|
||||
local_persist
|
||||
StringTable tok_map;
|
||||
{
|
||||
tok_map = hashtable_init(StrC, fixed_arena_allocator_info(& tok_map_arena) );
|
||||
tok_map = hashtable_init(Str, fixed_arena_allocator_info(& tok_map_arena) );
|
||||
|
||||
s32 left = num_tokens - 1;
|
||||
|
||||
while ( left-- )
|
||||
{
|
||||
char const* token = va_arg( va, char const* );
|
||||
StrC value = va_arg( va, StrC );
|
||||
Str value = va_arg( va, Str );
|
||||
|
||||
u32 key = crc32( token, str_len(token) );
|
||||
u32 key = crc32( token, c_str_len(token) );
|
||||
hashtable_set( tok_map, key, value );
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
|
||||
char const* token = fmt + 1;
|
||||
|
||||
u32 key = crc32( token, tok_len );
|
||||
StrC* value = hashtable_get(tok_map, key );
|
||||
Str* value = hashtable_get(tok_map, key );
|
||||
|
||||
if ( value )
|
||||
{
|
||||
@ -99,7 +99,7 @@ ssize token_fmt_va( char* buf, usize buf_size, s32 num_tokens, va_list va )
|
||||
return result;
|
||||
}
|
||||
|
||||
Code untyped_str( StrC content )
|
||||
Code untyped_str( Str content )
|
||||
{
|
||||
if ( content.Len == 0 )
|
||||
{
|
||||
@ -135,11 +135,11 @@ Code untyped_fmt( char const* fmt, ...)
|
||||
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
ssize length = str_fmt_va(buf, GEN_PRINTF_MAXLEN, fmt, va);
|
||||
ssize length = c_str_fmt_va(buf, GEN_PRINTF_MAXLEN, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
StrC buf_str = { str_len_capped(fmt, MaxNameLength), fmt };
|
||||
StrC uncapped_str = { length, buf };
|
||||
Str buf_str = { c_str_len_capped(fmt, MaxNameLength), fmt };
|
||||
Str uncapped_str = { length, buf };
|
||||
|
||||
Code
|
||||
result = make_code();
|
||||
@ -172,7 +172,7 @@ Code untyped_token_fmt( s32 num_tokens, char const* fmt, ... )
|
||||
ssize length = token_fmt_va(buf, GEN_PRINTF_MAXLEN, num_tokens, va);
|
||||
va_end(va);
|
||||
|
||||
StrC buf_str = { length, buf };
|
||||
Str buf_str = { length, buf };
|
||||
|
||||
Code
|
||||
result = make_code();
|
||||
|
@ -373,7 +373,7 @@ OpValidateResult operator__validate( Operator op, CodeParams params_code, CodeTy
|
||||
}
|
||||
|
||||
forceinline
|
||||
bool name__check( char const* context, StrC name )
|
||||
bool name__check( char const* context, Str name )
|
||||
{
|
||||
if ( name.Len <= 0 ) {
|
||||
log_failure( "gen::%s: Invalid name length provided - %d", name.Len );
|
||||
@ -409,7 +409,7 @@ identify the issue without having to debug too much (at least they can debug tho
|
||||
The largest of the functions is related to operator overload definitions.
|
||||
The library validates a good protion of their form and thus the argument processing for is quite a bit.
|
||||
*/
|
||||
CodeAttributes def_attributes( StrC content )
|
||||
CodeAttributes def_attributes( Str content )
|
||||
{
|
||||
if ( content.Len <= 0 || content.Ptr == nullptr ) {
|
||||
log_failure( "gen::def_attributes: Invalid attributes provided" );
|
||||
@ -424,7 +424,7 @@ CodeAttributes def_attributes( StrC content )
|
||||
return (CodeAttributes) result;
|
||||
}
|
||||
|
||||
CodeComment def_comment( StrC content )
|
||||
CodeComment def_comment( Str content )
|
||||
{
|
||||
if ( content.Len <= 0 || content.Ptr == nullptr )
|
||||
{
|
||||
@ -435,7 +435,7 @@ CodeComment def_comment( StrC content )
|
||||
|
||||
static char line[ MaxCommentLineLength ];
|
||||
|
||||
String cmt_formatted = string_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
StrBuilder cmt_formatted = strbuilder_make_reserve( GlobalAllocator, kilobytes(1) );
|
||||
char const* end = content.Ptr + content.Len;
|
||||
char const* scanner = content.Ptr;
|
||||
s32 curr = 0;
|
||||
@ -450,18 +450,18 @@ CodeComment def_comment( StrC content )
|
||||
}
|
||||
length++;
|
||||
|
||||
str_copy( line, scanner, length );
|
||||
string_append_fmt(& cmt_formatted, "//%.*s", length, line );
|
||||
c_str_copy( line, scanner, length );
|
||||
strbuilder_append_fmt(& cmt_formatted, "//%.*s", length, line );
|
||||
mem_set( line, 0, MaxCommentLineLength );
|
||||
|
||||
scanner += length;
|
||||
}
|
||||
while ( scanner <= end );
|
||||
|
||||
if ( * string_back(cmt_formatted) != '\n' )
|
||||
string_append_strc( & cmt_formatted, txt("\n") );
|
||||
if ( * strbuilder_back(cmt_formatted) != '\n' )
|
||||
strbuilder_append_str( & cmt_formatted, txt("\n") );
|
||||
|
||||
StrC name = { string_length(cmt_formatted), cmt_formatted };
|
||||
Str name = { strbuilder_length(cmt_formatted), cmt_formatted };
|
||||
|
||||
Code
|
||||
result = make_code();
|
||||
@ -469,7 +469,7 @@ CodeComment def_comment( StrC content )
|
||||
result->Name = get_cached_string( name );
|
||||
result->Content = result->Name;
|
||||
|
||||
string_free(& cmt_formatted);
|
||||
strbuilder_free(& cmt_formatted);
|
||||
|
||||
return (CodeComment) result;
|
||||
}
|
||||
@ -511,7 +511,7 @@ CodeConstructor def_constructor( Opts_def_constructor p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeClass def_class( StrC name, Opts_def_struct p )
|
||||
CodeClass def_class( Str name, Opts_def_struct p )
|
||||
{
|
||||
if ( ! name_check( def_class, name ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -564,7 +564,7 @@ CodeClass def_class( StrC name, Opts_def_struct p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeDefine def_define( StrC name, StrC content, Opts_def_define p )
|
||||
CodeDefine def_define( Str name, Str content, Opts_def_define p )
|
||||
{
|
||||
if ( ! name_check( def_define, name ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -579,7 +579,7 @@ CodeDefine def_define( StrC name, StrC content, Opts_def_define p )
|
||||
if ( content.Len <= 0 || content.Ptr == nullptr )
|
||||
result->Content = get_cached_string( txt("") );
|
||||
else
|
||||
result->Content = get_cached_string( string_to_strc(string_fmt_buf(GlobalAllocator, "%SC\n", content)) );
|
||||
result->Content = get_cached_string( strbuilder_to_str(strbuilder_fmt_buf(GlobalAllocator, "%S\n", content)) );
|
||||
|
||||
b32 append_preprocess_defines = ! p.dont_append_preprocess_defines;
|
||||
if ( append_preprocess_defines ) {
|
||||
@ -589,7 +589,7 @@ CodeDefine def_define( StrC name, StrC content, Opts_def_define p )
|
||||
if ( result->Name.Ptr[lex_id_len] == '(' )
|
||||
break;
|
||||
}
|
||||
StrC lex_id = { lex_id_len, result->Name.Ptr };
|
||||
Str lex_id = { lex_id_len, result->Name.Ptr };
|
||||
array_append(PreprocessorDefines, lex_id );
|
||||
}
|
||||
return result;
|
||||
@ -629,7 +629,7 @@ CodeDestructor def_destructor( Opts_def_destructor p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeEnum def_enum( StrC name, Opts_def_enum p )
|
||||
CodeEnum def_enum( Str name, Opts_def_enum p )
|
||||
{
|
||||
if ( ! name_check( def_enum, name ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -690,7 +690,7 @@ CodeEnum def_enum( StrC name, Opts_def_enum p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeExec def_execution( StrC content )
|
||||
CodeExec def_execution( Str content )
|
||||
{
|
||||
if ( content.Len <= 0 || content.Ptr == nullptr ) {
|
||||
log_failure( "gen::def_execution: Invalid execution provided" );
|
||||
@ -704,7 +704,7 @@ CodeExec def_execution( StrC content )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeExtern def_extern_link( StrC name, CodeBody body )
|
||||
CodeExtern def_extern_link( Str name, CodeBody body )
|
||||
{
|
||||
if ( ! name_check(def_extern_link, name) || ! null_check(def_extern_link, body) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -752,7 +752,7 @@ CodeFriend def_friend( Code declaration )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeFn def_function( StrC name, Opts_def_function p )
|
||||
CodeFn def_function( Str name, Opts_def_function p )
|
||||
{
|
||||
if ( ! name_check( def_function, name )) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -812,26 +812,26 @@ CodeFn def_function( StrC name, Opts_def_function p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeInclude def_include( StrC path, Opts_def_include p )
|
||||
CodeInclude def_include( Str path, Opts_def_include p )
|
||||
{
|
||||
if ( path.Len <= 0 || path.Ptr == nullptr ) {
|
||||
log_failure( "gen::def_include: Invalid path provided - %d" );
|
||||
GEN_DEBUG_TRAP();
|
||||
return InvalidCode;
|
||||
}
|
||||
String content = p.foreign ?
|
||||
string_fmt_buf( GlobalAllocator, "<%.*s>", path.Len, path.Ptr )
|
||||
: string_fmt_buf( GlobalAllocator, "\"%.*s\"", path.Len, path.Ptr );
|
||||
StrBuilder content = p.foreign ?
|
||||
strbuilder_fmt_buf( GlobalAllocator, "<%.*s>", path.Len, path.Ptr )
|
||||
: strbuilder_fmt_buf( GlobalAllocator, "\"%.*s\"", path.Len, path.Ptr );
|
||||
|
||||
CodeInclude
|
||||
result = (CodeInclude) make_code();
|
||||
result->Type = CT_Preprocess_Include;
|
||||
result->Name = get_cached_string( string_to_strc(content) );
|
||||
result->Name = get_cached_string( strbuilder_to_str(content) );
|
||||
result->Content = result->Name;
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeModule def_module( StrC name, Opts_def_module p )
|
||||
CodeModule def_module( Str name, Opts_def_module p )
|
||||
{
|
||||
if ( ! name_check( def_module, name )) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -845,7 +845,7 @@ CodeModule def_module( StrC name, Opts_def_module p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeNS def_namespace( StrC name, CodeBody body, Opts_def_namespace p )
|
||||
CodeNS def_namespace( Str name, CodeBody body, Opts_def_namespace p )
|
||||
{
|
||||
if ( ! name_check( def_namespace, name )) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -869,7 +869,7 @@ CodeNS def_namespace( StrC name, CodeBody body, Opts_def_namespace p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator p )
|
||||
CodeOperator def_operator( Operator op, Str nspace, Opts_def_operator p )
|
||||
{
|
||||
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes ) {
|
||||
log_failure( "gen::def_operator: PlatformAttributes was provided but its not of attributes type: %s", code_debug_str(p.attributes) );
|
||||
@ -889,13 +889,13 @@ CodeOperator def_operator( Operator op, StrC nspace, Opts_def_operator p )
|
||||
|
||||
char const* name = nullptr;
|
||||
|
||||
StrC op_str = operator_to_str( op );
|
||||
Str op_str = operator_to_str( op );
|
||||
if ( nspace.Len > 0 )
|
||||
name = str_fmt_buf( "%.*soperator %.*s", nspace.Len, nspace.Ptr, op_str.Len, op_str.Ptr );
|
||||
name = c_str_fmt_buf( "%.*soperator %.*s", nspace.Len, nspace.Ptr, op_str.Len, op_str.Ptr );
|
||||
else
|
||||
name = str_fmt_buf( "operator %.*s", op_str.Len, op_str.Ptr );
|
||||
name = c_str_fmt_buf( "operator %.*s", op_str.Len, op_str.Ptr );
|
||||
|
||||
StrC name_resolved = { str_len(name), name };
|
||||
Str name_resolved = { c_str_len(name), name };
|
||||
|
||||
CodeOperator
|
||||
result = (CodeOperator) make_code();
|
||||
@ -969,7 +969,7 @@ CodeOpCast def_operator_cast( CodeTypename type, Opts_def_operator_cast p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeParams def_param( CodeTypename type, StrC name, Opts_def_param p )
|
||||
CodeParams def_param( CodeTypename type, Str name, Opts_def_param p )
|
||||
{
|
||||
if ( ! name_check( def_param, name ) || ! null_check( def_param, type ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -993,7 +993,7 @@ CodeParams def_param( CodeTypename type, StrC name, Opts_def_param p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodePragma def_pragma( StrC directive )
|
||||
CodePragma def_pragma( Str directive )
|
||||
{
|
||||
if ( directive.Len <= 0 || directive.Ptr == nullptr ) {
|
||||
log_failure( "gen::def_comment: Invalid comment provided:" );
|
||||
@ -1007,7 +1007,7 @@ CodePragma def_pragma( StrC directive )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodePreprocessCond def_preprocess_cond( EPreprocessCond type, StrC expr )
|
||||
CodePreprocessCond def_preprocess_cond( EPreprocessCond type, Str expr )
|
||||
{
|
||||
if ( expr.Len <= 0 || expr.Ptr == nullptr ) {
|
||||
log_failure( "gen::def_comment: Invalid comment provided:" );
|
||||
@ -1044,7 +1044,7 @@ CodeSpecifiers def_specifier( Specifier spec )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeStruct def_struct( StrC name, Opts_def_struct p )
|
||||
CodeStruct def_struct( Str name, Opts_def_struct p )
|
||||
{
|
||||
if ( p.attributes && p.attributes->Type != CT_PlatformAttributes ) {
|
||||
log_failure( "gen::def_struct: attributes was not a `PlatformAttributes` type - %s", code_debug_str(cast(Code, p.attributes)) );
|
||||
@ -1117,7 +1117,7 @@ CodeTemplate def_template( CodeParams params, Code declaration, Opts_def_templat
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeTypename def_type( StrC name, Opts_def_type p )
|
||||
CodeTypename def_type( Str name, Opts_def_type p )
|
||||
{
|
||||
if ( ! name_check( def_type, name )) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -1152,7 +1152,7 @@ CodeTypename def_type( StrC name, Opts_def_type p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeTypedef def_typedef( StrC name, Code type, Opts_def_typedef p )
|
||||
CodeTypedef def_typedef( Str name, Code type, Opts_def_typedef p )
|
||||
{
|
||||
if ( ! null_check( def_typedef, type ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -1215,7 +1215,7 @@ CodeTypedef def_typedef( StrC name, Code type, Opts_def_typedef p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeUnion def_union( StrC name, CodeBody body, Opts_def_union p )
|
||||
CodeUnion def_union( Str name, CodeBody body, Opts_def_union p )
|
||||
{
|
||||
if ( ! null_check( def_union, body ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -1242,7 +1242,7 @@ CodeUnion def_union( StrC name, CodeBody body, Opts_def_union p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeUsing def_using( StrC name, CodeTypename type, Opts_def_using p )
|
||||
CodeUsing def_using( Str name, CodeTypename type, Opts_def_using p )
|
||||
{
|
||||
if ( ! name_check( def_using, name ) || null_check( def_using, type ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -1270,7 +1270,7 @@ CodeUsing def_using( StrC name, CodeTypename type, Opts_def_using p )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeUsing def_using_namespace( StrC name )
|
||||
CodeUsing def_using_namespace( Str name )
|
||||
{
|
||||
if ( ! name_check( def_using_namespace, name ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
@ -1283,7 +1283,7 @@ CodeUsing def_using_namespace( StrC name )
|
||||
return result;
|
||||
}
|
||||
|
||||
CodeVar def_variable( CodeTypename type, StrC name, Opts_def_variable p )
|
||||
CodeVar def_variable( CodeTypename type, Str name, Opts_def_variable p )
|
||||
{
|
||||
if ( ! name_check( def_variable, name ) || null_check( def_variable, type ) ) {
|
||||
GEN_DEBUG_TRAP();
|
||||
|
@ -41,9 +41,9 @@ AccessSpec tok_to_access_specifier(Token tok)
|
||||
return scast(AccessSpec, tok.Type);
|
||||
}
|
||||
|
||||
StrC tok_to_str(Token tok)
|
||||
Str tok_to_str(Token tok)
|
||||
{
|
||||
StrC str = { tok.Length, tok.Text };
|
||||
Str str = { tok.Length, tok.Text };
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -92,13 +92,13 @@ bool tok_is_end_definition(Token tok)
|
||||
return bitfield_is_equal( u32, tok.Flags, TF_EndDefinition );
|
||||
}
|
||||
|
||||
String tok_to_string(Token tok)
|
||||
StrBuilder tok_to_string(Token tok)
|
||||
{
|
||||
String result = string_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
StrBuilder result = strbuilder_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
|
||||
StrC type_str = toktype_to_str( tok.Type );
|
||||
Str type_str = toktype_to_str( tok.Type );
|
||||
|
||||
string_append_fmt( & result, "Line: %d Column: %d, Type: %.*s Content: %.*s"
|
||||
strbuilder_append_fmt( & result, "Line: %d Column: %d, Type: %.*s Content: %.*s"
|
||||
, tok.Line, tok.Column
|
||||
, type_str.Len, type_str.Ptr
|
||||
, tok.Length, tok.Text
|
||||
@ -183,7 +183,7 @@ enum
|
||||
|
||||
struct LexContext
|
||||
{
|
||||
StrC content;
|
||||
Str content;
|
||||
s32 left;
|
||||
char const* scanner;
|
||||
s32 line;
|
||||
@ -247,7 +247,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
|
||||
ctx->token.Length++;
|
||||
}
|
||||
|
||||
ctx->token.Type = strc_to_toktype( tok_to_str(ctx->token) );
|
||||
ctx->token.Type = str_to_toktype( tok_to_str(ctx->token) );
|
||||
|
||||
bool is_preprocessor = ctx->token.Type >= Tok_Preprocess_Define && ctx->token.Type <= Tok_Preprocess_Pragma;
|
||||
if ( ! is_preprocessor )
|
||||
@ -365,7 +365,7 @@ s32 lex_preprocessor_directive( LexContext* ctx )
|
||||
|
||||
if ( (* ctx->scanner) != '"' && (* ctx->scanner) != '<' )
|
||||
{
|
||||
String directive_str = string_fmt_buf( GlobalAllocator, "%.*s", min( 80, ctx->left + preprocess_content.Length ), ctx->token.Text );
|
||||
StrBuilder directive_str = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 80, ctx->left + preprocess_content.Length ), ctx->token.Text );
|
||||
|
||||
log_failure( "gen::Parser::lex: Expected '\"' or '<' after #include, not '%c' (%d, %d)\n%s"
|
||||
, (* ctx->scanner)
|
||||
@ -432,8 +432,8 @@ s32 lex_preprocessor_directive( LexContext* ctx )
|
||||
}
|
||||
else
|
||||
{
|
||||
String directive_str = string_make_length( GlobalAllocator, ctx->token.Text, ctx->token.Length );
|
||||
String content_str = string_fmt_buf( GlobalAllocator, "%.*s", min( 400, ctx->left + preprocess_content.Length ), preprocess_content.Text );
|
||||
StrBuilder directive_str = strbuilder_make_length( GlobalAllocator, ctx->token.Text, ctx->token.Length );
|
||||
StrBuilder content_str = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 400, ctx->left + preprocess_content.Length ), preprocess_content.Text );
|
||||
|
||||
log_failure( "gen::Parser::lex: Invalid escape sequence '\\%c' (%d, %d)"
|
||||
" in preprocessor directive '%s' (%d, %d)\n%s"
|
||||
@ -473,7 +473,7 @@ void lex_found_token( LexContext* ctx )
|
||||
return;
|
||||
}
|
||||
|
||||
TokType type = strc_to_toktype( tok_to_str(ctx->token) );
|
||||
TokType type = str_to_toktype( tok_to_str(ctx->token) );
|
||||
|
||||
if (type <= Tok_Access_Public && type >= Tok_Access_Private )
|
||||
{
|
||||
@ -524,7 +524,7 @@ void lex_found_token( LexContext* ctx )
|
||||
else
|
||||
key = crc32( ctx->token.Text, ctx->token.Length );
|
||||
|
||||
StrC* define = hashtable_get(ctx->defines, key );
|
||||
Str* define = hashtable_get(ctx->defines, key );
|
||||
if ( define )
|
||||
{
|
||||
ctx->token.Type = Tok_Preprocess_Macro;
|
||||
@ -572,8 +572,8 @@ void lex_found_token( LexContext* ctx )
|
||||
}
|
||||
|
||||
neverinline
|
||||
// TokArray lex( Array<Token> tokens, StrC content )
|
||||
TokArray lex( StrC content )
|
||||
// TokArray lex( Array<Token> tokens, Str content )
|
||||
TokArray lex( Str content )
|
||||
{
|
||||
LexContext c; LexContext* ctx = & c;
|
||||
c.content = content;
|
||||
@ -620,7 +620,7 @@ TokArray lex( StrC content )
|
||||
#if 0
|
||||
if (Tokens.num())
|
||||
{
|
||||
log_fmt("\nLastTok: %S", Tokens.back().to_string());
|
||||
log_fmt("\nLastTok: %SB", Tokens.back().to_string());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -721,7 +721,7 @@ TokArray lex( StrC content )
|
||||
}
|
||||
else
|
||||
{
|
||||
String context_str = string_fmt_buf( GlobalAllocator, "%s", c.scanner, min( 100, c.left ) );
|
||||
StrBuilder context_str = strbuilder_fmt_buf( GlobalAllocator, "%s", c.scanner, min( 100, c.left ) );
|
||||
|
||||
log_failure( "gen::lex: invalid varadic argument, expected '...' got '..%c' (%d, %d)\n%s", (* ctx->scanner), c.line, c.column, context_str );
|
||||
}
|
||||
@ -1282,7 +1282,7 @@ TokArray lex( StrC content )
|
||||
);
|
||||
}
|
||||
|
||||
String context_str = string_fmt_buf( GlobalAllocator, "%.*s", min( 100, c.left ), c.scanner );
|
||||
StrBuilder context_str = strbuilder_fmt_buf( GlobalAllocator, "%.*s", min( 100, c.left ), c.scanner );
|
||||
log_failure( "Failed to lex token '%c' (%d, %d)\n%s", (* ctx->scanner), c.line, c.column, context_str );
|
||||
|
||||
// Skip to next whitespace since we can't know if anything else is valid until then.
|
||||
|
@ -18,7 +18,7 @@ struct StackNode
|
||||
|
||||
Token Start;
|
||||
Token Name; // The name of the AST node (if parsed)
|
||||
StrC ProcName; // The name of the procedure
|
||||
Str ProcName; // The name of the procedure
|
||||
};
|
||||
|
||||
struct ParseContext
|
||||
@ -45,9 +45,9 @@ void parser_pop(ParseContext* ctx)
|
||||
ctx->Scope = ctx->Scope->Prev;
|
||||
}
|
||||
|
||||
String parser_to_string(ParseContext ctx)
|
||||
StrBuilder parser_to_string(ParseContext ctx)
|
||||
{
|
||||
String result = string_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
StrBuilder result = strbuilder_make_reserve( GlobalAllocator, kilobytes(4) );
|
||||
|
||||
Token scope_start = ctx.Scope->Start;
|
||||
Token last_valid = ctx.Tokens.Idx >= array_num(ctx.Tokens.Arr) ? ctx.Tokens.Arr[array_num(ctx.Tokens.Arr) -1] : (* lex_current(& ctx.Tokens, true));
|
||||
@ -60,21 +60,21 @@ String parser_to_string(ParseContext ctx)
|
||||
length++;
|
||||
}
|
||||
|
||||
StrC scope_strc = { length, scope_start.Text };
|
||||
String line = string_make_strc( GlobalAllocator, scope_strc );
|
||||
string_append_fmt( & result, "\tScope : %s\n", line );
|
||||
string_free(& line);
|
||||
Str scope_str = { length, scope_start.Text };
|
||||
StrBuilder line = strbuilder_make_str( GlobalAllocator, scope_str );
|
||||
strbuilder_append_fmt( & result, "\tScope : %s\n", line );
|
||||
strbuilder_free(& line);
|
||||
|
||||
sptr dist = (sptr)last_valid.Text - (sptr)scope_start.Text + 2;
|
||||
sptr length_from_err = dist;
|
||||
|
||||
StrC err_strc = { length_from_err, last_valid.Text };
|
||||
String line_from_err = string_make_strc( GlobalAllocator, err_strc );
|
||||
Str err_str = { length_from_err, last_valid.Text };
|
||||
StrBuilder line_from_err = strbuilder_make_str( GlobalAllocator, err_str );
|
||||
|
||||
if ( length_from_err < 100 )
|
||||
string_append_fmt(& result, "\t(%d, %d):%*c\n", last_valid.Line, last_valid.Column, length_from_err, '^' );
|
||||
strbuilder_append_fmt(& result, "\t(%d, %d):%*c\n", last_valid.Line, last_valid.Column, length_from_err, '^' );
|
||||
else
|
||||
string_append_fmt(& result, "\t(%d, %d)\n", last_valid.Line, last_valid.Column );
|
||||
strbuilder_append_fmt(& result, "\t(%d, %d)\n", last_valid.Line, last_valid.Column );
|
||||
|
||||
StackNode* curr_scope = ctx.Scope;
|
||||
s32 level = 0;
|
||||
@ -82,11 +82,11 @@ String parser_to_string(ParseContext ctx)
|
||||
{
|
||||
if ( tok_is_valid(curr_scope->Name) )
|
||||
{
|
||||
string_append_fmt(& result, "\t%d: %s, AST Name: %.*s\n", level, curr_scope->ProcName.Ptr, curr_scope->Name.Length, curr_scope->Name.Text );
|
||||
strbuilder_append_fmt(& result, "\t%d: %s, AST Name: %.*s\n", level, curr_scope->ProcName.Ptr, curr_scope->Name.Length, curr_scope->Name.Text );
|
||||
}
|
||||
else
|
||||
{
|
||||
string_append_fmt(& result, "\t%d: %s\n", level, curr_scope->ProcName.Ptr );
|
||||
strbuilder_append_fmt(& result, "\t%d: %s\n", level, curr_scope->ProcName.Ptr );
|
||||
}
|
||||
|
||||
curr_scope = curr_scope->Prev;
|
||||
@ -129,7 +129,7 @@ bool lex__eat(TokArray* self, TokType type )
|
||||
}
|
||||
|
||||
#if 0 && GEN_BUILD_DEBUG
|
||||
log_fmt("Ate: %S\n", self->Arr[Idx].to_string() );
|
||||
log_fmt("Ate: %SB\n", self->Arr[Idx].to_string() );
|
||||
#endif
|
||||
|
||||
self->Idx ++;
|
||||
@ -144,7 +144,7 @@ void parser_init()
|
||||
);
|
||||
|
||||
fixed_arena_init(& Lexer_defines_map_arena);
|
||||
Lexer_defines = hashtable_init_reserve(StrC, fixed_arena_allocator_info( & Lexer_defines_map_arena), 256 );
|
||||
Lexer_defines = hashtable_init_reserve(Str, fixed_arena_allocator_info( & Lexer_defines_map_arena), 256 );
|
||||
}
|
||||
|
||||
internal
|
||||
@ -157,17 +157,17 @@ void parser_deinit()
|
||||
#pragma region Helper Macros
|
||||
|
||||
#define check_parse_args( def ) _check_parse_args(def, stringize(_func_) )
|
||||
bool _check_parse_args( StrC def, char const* func_name )
|
||||
bool _check_parse_args( Str def, char const* func_name )
|
||||
{
|
||||
if ( def.Len <= 0 )
|
||||
{
|
||||
log_failure( str_fmt_buf("gen::%s: length must greater than 0", func_name) );
|
||||
log_failure( c_str_fmt_buf("gen::%s: length must greater than 0", func_name) );
|
||||
parser_pop(& Context);
|
||||
return false;
|
||||
}
|
||||
if ( def.Ptr == nullptr )
|
||||
{
|
||||
log_failure( str_fmt_buf("gen::%s: def was null", func_name) );
|
||||
log_failure( c_str_fmt_buf("gen::%s: def was null", func_name) );
|
||||
parser_pop(& Context);
|
||||
return false;
|
||||
}
|
||||
@ -230,7 +230,7 @@ internal CodePreprocessCond parse_preprocess_cond ();
|
||||
internal Code parse_simple_preprocess ( TokType which, bool dont_consume_braces );
|
||||
internal Code parse_static_assert ();
|
||||
internal void parse_template_args ( Token* token );
|
||||
internal CodeVar parse_variable_after_name ( ModuleFlag mflags, CodeAttributes attributes, CodeSpecifiers specifiers, CodeTypename type, StrC name );
|
||||
internal CodeVar parse_variable_after_name ( ModuleFlag mflags, CodeAttributes attributes, CodeSpecifiers specifiers, CodeTypename type, Str name );
|
||||
internal CodeVar parse_variable_declaration_list ();
|
||||
|
||||
internal CodeClass parser_parse_class ( bool inplace_def );
|
||||
@ -268,9 +268,9 @@ constexpr bool parser_strip_formatting_dont_preserve_newlines = false;
|
||||
It has edge case failures that prevent it from being used in function bodies.
|
||||
*/
|
||||
internal
|
||||
String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
StrBuilder parser_strip_formatting( Str raw_text, bool preserve_newlines )
|
||||
{
|
||||
String content = string_make_reserve( GlobalAllocator, raw_text.Len );
|
||||
StrBuilder content = strbuilder_make_reserve( GlobalAllocator, raw_text.Len );
|
||||
|
||||
if ( raw_text.Len == 0 )
|
||||
return content;
|
||||
@ -317,7 +317,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
if ( tokleft )
|
||||
move_fwd();
|
||||
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
last_cut = rcast(sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
continue;
|
||||
}
|
||||
@ -339,7 +339,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
if ( tokleft )
|
||||
move_fwd();
|
||||
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
last_cut = rcast( sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
continue;
|
||||
}
|
||||
@ -353,7 +353,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
scanner += 2;
|
||||
tokleft -= 2;
|
||||
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
last_cut = rcast( sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
continue;
|
||||
}
|
||||
@ -372,7 +372,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
if (tokleft)
|
||||
move_fwd();
|
||||
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
last_cut = rcast( sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
continue;
|
||||
}
|
||||
@ -381,10 +381,10 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
if (scanner[0] == '\t')
|
||||
{
|
||||
if (pos > last_cut)
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length);
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length);
|
||||
|
||||
if ( * string_back( content ) != ' ' )
|
||||
string_append_char( & content, ' ' );
|
||||
if ( * strbuilder_back( content ) != ' ' )
|
||||
strbuilder_append_char( & content, ' ' );
|
||||
|
||||
move_fwd();
|
||||
last_cut = rcast( sptr, scanner) - rcast( sptr, raw_text.Ptr);
|
||||
@ -400,17 +400,17 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
scanner += 2;
|
||||
tokleft -= 2;
|
||||
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
last_cut = rcast( sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( pos > last_cut )
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
|
||||
// Replace with a space
|
||||
if ( * string_back( content ) != ' ' )
|
||||
string_append_char( & content, ' ' );
|
||||
if ( * strbuilder_back( content ) != ' ' )
|
||||
strbuilder_append_char( & content, ' ' );
|
||||
|
||||
scanner += 2;
|
||||
tokleft -= 2;
|
||||
@ -427,17 +427,17 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
|
||||
move_fwd();
|
||||
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
last_cut = rcast( sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( pos > last_cut )
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
|
||||
// Replace with a space
|
||||
if ( * string_back( content ) != ' ' )
|
||||
string_append_char( & content, ' ' );
|
||||
if ( * strbuilder_back( content ) != ' ' )
|
||||
strbuilder_append_char( & content, ' ' );
|
||||
|
||||
move_fwd();
|
||||
|
||||
@ -448,7 +448,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
// Escaped newlines
|
||||
if ( scanner[0] == '\\' )
|
||||
{
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
|
||||
s32 amount_to_skip = 1;
|
||||
if ( tokleft > 1 && scanner[1] == '\n' )
|
||||
@ -475,7 +475,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
// Consectuive spaces
|
||||
if ( tokleft > 1 && char_is_space( scanner[0] ) && char_is_space( scanner[ 1 ] ) )
|
||||
{
|
||||
string_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, cut_length );
|
||||
do
|
||||
{
|
||||
move_fwd();
|
||||
@ -485,9 +485,9 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
last_cut = rcast( sptr, scanner ) - rcast( sptr, raw_text.Ptr );
|
||||
|
||||
// Preserve only 1 space of formattting
|
||||
char* last = string_back(content);
|
||||
char* last = strbuilder_back(content);
|
||||
if ( last == nullptr || * last != ' ' )
|
||||
string_append_char( & content, ' ' );
|
||||
strbuilder_append_char( & content, ' ' );
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -497,7 +497,7 @@ String parser_strip_formatting( StrC raw_text, bool preserve_newlines )
|
||||
|
||||
if ( last_cut < raw_text.Len )
|
||||
{
|
||||
string_append_c_str_len( & content, cut_ptr, raw_text.Len - last_cut );
|
||||
strbuilder_append_c_str_len( & content, cut_ptr, raw_text.Len - last_cut );
|
||||
}
|
||||
|
||||
#undef cut_ptr
|
||||
@ -681,14 +681,14 @@ CodeAttributes parse_attributes()
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
StrC attribute_txt = { len, start.Text };
|
||||
Str attribute_txt = { len, start.Text };
|
||||
parser_pop(& Context);
|
||||
|
||||
String name_stripped = parser_strip_formatting( attribute_txt, parser_strip_formatting_dont_preserve_newlines );
|
||||
StrBuilder name_stripped = parser_strip_formatting( attribute_txt, parser_strip_formatting_dont_preserve_newlines );
|
||||
|
||||
Code result = make_code();
|
||||
result->Type = CT_PlatformAttributes;
|
||||
result->Name = get_cached_string( string_to_strc(name_stripped) );
|
||||
result->Name = get_cached_string( strbuilder_to_str(name_stripped) );
|
||||
result->Content = result->Name;
|
||||
// result->Token =
|
||||
|
||||
@ -846,7 +846,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
||||
case Tok_Statement_End:
|
||||
{
|
||||
// TODO(Ed): Convert this to a general warning procedure
|
||||
log_fmt("Dangling end statement found %S\n", tok_to_string(currtok_noskip));
|
||||
log_fmt("Dangling end statement found %SB\n", tok_to_string(currtok_noskip));
|
||||
eat( Tok_Statement_End );
|
||||
continue;
|
||||
}
|
||||
@ -1015,7 +1015,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
b32 ignore_spec = false;
|
||||
|
||||
@ -1069,10 +1069,10 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
||||
|
||||
if ( attributes )
|
||||
{
|
||||
String fused = string_make_reserve( GlobalAllocator, attributes->Content.Len + more_attributes->Content.Len );
|
||||
string_append_fmt( & fused, "%S %S", attributes->Content, more_attributes->Content );
|
||||
StrBuilder fused = strbuilder_make_reserve( GlobalAllocator, attributes->Content.Len + more_attributes->Content.Len );
|
||||
strbuilder_append_fmt( & fused, "%SB %SB", attributes->Content, more_attributes->Content );
|
||||
|
||||
StrC attrib_name = { string_length(fused), fused };
|
||||
Str attrib_name = { strbuilder_length(fused), fused };
|
||||
attributes->Name = get_cached_string( attrib_name );
|
||||
attributes->Content = attributes->Name;
|
||||
// <Attributes> <Specifiers> <Attributes>
|
||||
@ -1109,7 +1109,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
|
||||
{
|
||||
if ( nexttok.Type == Tok_Capture_Start && name.Length && currtok.Type == Tok_Identifier )
|
||||
{
|
||||
if ( str_compare_len( name.Text, currtok.Text, name.Length ) == 0 )
|
||||
if ( c_str_compare_len( name.Text, currtok.Text, name.Length ) == 0 )
|
||||
{
|
||||
member = cast(Code, parser_parse_constructor( specifiers ));
|
||||
// <Attributes> <Specifiers> <Name>()
|
||||
@ -1226,13 +1226,13 @@ Code parse_complicated_definition( TokType which )
|
||||
}
|
||||
|
||||
Token tok = tokens.Arr[ idx - 1 ];
|
||||
if ( tok_is_specifier(tok) && spec_is_trailing( strc_to_specifier( tok_to_str(tok))) )
|
||||
if ( tok_is_specifier(tok) && spec_is_trailing( str_to_specifier( tok_to_str(tok))) )
|
||||
{
|
||||
// <which> <type_identifier>(...) <specifier> ...;
|
||||
|
||||
s32 spec_idx = idx - 1;
|
||||
Token spec = tokens.Arr[spec_idx];
|
||||
while ( tok_is_specifier(spec) && spec_is_trailing( strc_to_specifier( tok_to_str(spec))) )
|
||||
while ( tok_is_specifier(spec) && spec_is_trailing( str_to_specifier( tok_to_str(spec))) )
|
||||
{
|
||||
-- spec_idx;
|
||||
spec = tokens.Arr[spec_idx];
|
||||
@ -1343,7 +1343,7 @@ Code parse_complicated_definition( TokType which )
|
||||
}
|
||||
else
|
||||
{
|
||||
log_failure( "Unsupported or bad member definition after %s declaration\n%S", toktype_to_str(which).Ptr, parser_to_string(Context) );
|
||||
log_failure( "Unsupported or bad member definition after %s declaration\n%SB", toktype_to_str(which).Ptr, parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -1389,7 +1389,7 @@ CodeDefine parse_define()
|
||||
return define;
|
||||
}
|
||||
|
||||
define->Content = get_cached_string( string_to_strc( parser_strip_formatting( tok_to_str(currtok), parser_strip_formatting_dont_preserve_newlines )) );
|
||||
define->Content = get_cached_string( strbuilder_to_str( parser_strip_formatting( tok_to_str(currtok), parser_strip_formatting_dont_preserve_newlines )) );
|
||||
eat( Tok_Preprocess_Content );
|
||||
// #define <Name> <Content>
|
||||
|
||||
@ -1486,12 +1486,12 @@ CodeFn parse_function_after_name(
|
||||
{
|
||||
if ( specifiers == nullptr )
|
||||
{
|
||||
specifiers = def_specifier( strc_to_specifier( tok_to_str(currtok)) );
|
||||
specifiers = def_specifier( str_to_specifier( tok_to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
continue;
|
||||
}
|
||||
|
||||
specifiers_append(specifiers, strc_to_specifier( tok_to_str(currtok)) );
|
||||
specifiers_append(specifiers, str_to_specifier( tok_to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
}
|
||||
// <Attributes> <Specifiers> <ReturnType> <Name> ( <Paraemters> ) <Specifiers>
|
||||
@ -1533,13 +1533,13 @@ CodeFn parse_function_after_name(
|
||||
// <Attributes> <Specifiers> <ReturnType> <Name> ( <Paraemters> ) <Specifiers>; <InlineCmt>
|
||||
}
|
||||
|
||||
String
|
||||
name_stripped = string_make_strc( GlobalAllocator, tok_to_str(name) );
|
||||
StrBuilder
|
||||
name_stripped = strbuilder_make_str( GlobalAllocator, tok_to_str(name) );
|
||||
strip_space(name_stripped);
|
||||
|
||||
CodeFn
|
||||
result = (CodeFn) make_code();
|
||||
result->Name = get_cached_string( string_to_strc(name_stripped) );
|
||||
result->Name = get_cached_string( strbuilder_to_str(name_stripped) );
|
||||
result->ModuleFlags = mflags;
|
||||
|
||||
if ( body )
|
||||
@ -1616,7 +1616,7 @@ Code parse_function_body()
|
||||
|
||||
if ( len > 0 )
|
||||
{
|
||||
StrC str = { len, start.Text };
|
||||
Str str = { len, start.Text };
|
||||
body_append( result, cast(Code, def_execution( str )) );
|
||||
}
|
||||
|
||||
@ -1661,7 +1661,7 @@ CodeBody parse_global_nspace( CodeType which )
|
||||
{
|
||||
case Tok_Comma:
|
||||
{
|
||||
log_failure("Dangling comma found: %S\nContext:\n%S", tok_to_string(currtok), parser_to_string(Context));
|
||||
log_failure("Dangling comma found: %SB\nContext:\n%SB", tok_to_string(currtok), parser_to_string(Context));
|
||||
parser_pop( & Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -1669,7 +1669,7 @@ CodeBody parse_global_nspace( CodeType which )
|
||||
case Tok_Statement_End:
|
||||
{
|
||||
// TODO(Ed): Convert this to a general warning procedure
|
||||
log_fmt("Dangling end statement found %S\n", tok_to_string(currtok_noskip));
|
||||
log_fmt("Dangling end statement found %SB\n", tok_to_string(currtok_noskip));
|
||||
eat( Tok_Statement_End );
|
||||
continue;
|
||||
}
|
||||
@ -1828,7 +1828,7 @@ CodeBody parse_global_nspace( CodeType which )
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
bool ignore_spec = false;
|
||||
|
||||
@ -1856,7 +1856,7 @@ CodeBody parse_global_nspace( CodeType which )
|
||||
break;
|
||||
|
||||
default:
|
||||
StrC spec_str = spec_to_str(spec);
|
||||
Str spec_str = spec_to_str(spec);
|
||||
|
||||
log_failure( "Invalid specifier %.*s for variable\n%s", spec_str.Len, spec_str, parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
@ -1960,7 +1960,7 @@ CodeBody parse_global_nspace( CodeType which )
|
||||
Member_Resolved_To_Lone_Macro:
|
||||
if ( member == Code_Invalid )
|
||||
{
|
||||
log_failure( "Failed to parse member\nToken: %S\nContext:\n%S", tok_to_string(currtok_noskip), parser_to_string(Context) );
|
||||
log_failure( "Failed to parse member\nToken: %SB\nContext:\n%SB", tok_to_string(currtok_noskip), parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -2087,7 +2087,7 @@ Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers )
|
||||
tok_left = tokens.Arr[idx];
|
||||
}
|
||||
|
||||
bool is_same = str_compare_len( tok_right.Text, tok_left.Text, tok_right.Length ) == 0;
|
||||
bool is_same = c_str_compare_len( tok_right.Text, tok_left.Text, tok_right.Length ) == 0;
|
||||
if (tok_left.Type == Tok_Identifier && is_same)
|
||||
{
|
||||
// We have found the pattern we desired
|
||||
@ -2136,7 +2136,7 @@ Token parse_identifier( bool* possible_member_function )
|
||||
|
||||
if ( currtok.Type == Tok_Operator && currtok.Text[0] == '~' )
|
||||
{
|
||||
bool is_destructor = strc_are_equal( Context.Scope->Prev->ProcName, txt("parser_parse_destructor"));
|
||||
bool is_destructor = str_are_equal( Context.Scope->Prev->ProcName, txt("parser_parse_destructor"));
|
||||
if (is_destructor)
|
||||
{
|
||||
name.Length = ( ( sptr )prevtok.Text + prevtok.Length ) - ( sptr )name.Text;
|
||||
@ -2144,7 +2144,7 @@ Token parse_identifier( bool* possible_member_function )
|
||||
return name;
|
||||
}
|
||||
|
||||
log_failure( "Error, had a ~ operator after %S but not a destructor\n%s", toktype_to_str( prevtok.Type ), parser_to_string(Context) );
|
||||
log_failure( "Error, had a ~ operator after %SB but not a destructor\n%s", toktype_to_str( prevtok.Type ), parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return invalid;
|
||||
}
|
||||
@ -2442,9 +2442,9 @@ CodeOperator parse_operator_after_ret_type(
|
||||
break;
|
||||
default:
|
||||
{
|
||||
StrC str_new = operator_to_str(Op_New);
|
||||
StrC str_delete = operator_to_str(Op_Delete);
|
||||
if ( str_compare_len( currtok.Text, str_new.Ptr, max(str_new.Len - 1, currtok.Length)) == 0)
|
||||
Str c_str_new = operator_to_str(Op_New);
|
||||
Str c_str_delete = operator_to_str(Op_Delete);
|
||||
if ( c_str_compare_len( currtok.Text, c_str_new.Ptr, max(c_str_new.Len - 1, currtok.Length)) == 0)
|
||||
{
|
||||
op = Op_New;
|
||||
eat( Tok_Identifier );
|
||||
@ -2456,7 +2456,7 @@ CodeOperator parse_operator_after_ret_type(
|
||||
idx++;
|
||||
}
|
||||
Token next = Context.Tokens.Arr[idx];
|
||||
if ( currtok.Type == Tok_Operator && str_compare_len(currtok.Text, "[]", 2) == 0)
|
||||
if ( currtok.Type == Tok_Operator && c_str_compare_len(currtok.Text, "[]", 2) == 0)
|
||||
{
|
||||
eat(Tok_Operator);
|
||||
op = Op_NewArray;
|
||||
@ -2468,7 +2468,7 @@ CodeOperator parse_operator_after_ret_type(
|
||||
op = Op_NewArray;
|
||||
}
|
||||
}
|
||||
else if ( str_compare_len( currtok.Text, str_delete.Ptr, max(str_delete.Len - 1, currtok.Length )) == 0)
|
||||
else if ( c_str_compare_len( currtok.Text, c_str_delete.Ptr, max(c_str_delete.Len - 1, currtok.Length )) == 0)
|
||||
{
|
||||
op = Op_Delete;
|
||||
eat(Tok_Identifier);
|
||||
@ -2480,7 +2480,7 @@ CodeOperator parse_operator_after_ret_type(
|
||||
idx++;
|
||||
}
|
||||
Token next = Context.Tokens.Arr[idx];
|
||||
if ( currtok.Type == Tok_Operator && str_compare_len(currtok.Text, "[]", 2) == 0)
|
||||
if ( currtok.Type == Tok_Operator && c_str_compare_len(currtok.Text, "[]", 2) == 0)
|
||||
{
|
||||
eat(Tok_Operator);
|
||||
op = Op_DeleteArray;
|
||||
@ -2526,12 +2526,12 @@ CodeOperator parse_operator_after_ret_type(
|
||||
{
|
||||
if ( specifiers == nullptr )
|
||||
{
|
||||
specifiers = def_specifier( strc_to_specifier( tok_to_str(currtok)) );
|
||||
specifiers = def_specifier( str_to_specifier( tok_to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
continue;
|
||||
}
|
||||
|
||||
specifiers_append(specifiers, strc_to_specifier( tok_to_str(currtok)) );
|
||||
specifiers_append(specifiers, str_to_specifier( tok_to_str(currtok)) );
|
||||
eat( currtok.Type );
|
||||
}
|
||||
// <ExportFlag> <Attributes> <Specifiers> <ReturnType> <Qualifier::...> operator <Op> ( <Parameters> ) <Specifiers>
|
||||
@ -2818,7 +2818,7 @@ CodeParams parse_params( bool use_template_capture )
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
value = untyped_str( string_to_strc(parser_strip_formatting( tok_to_str(value_tok), parser_strip_formatting_dont_preserve_newlines )) );
|
||||
value = untyped_str( strbuilder_to_str(parser_strip_formatting( tok_to_str(value_tok), parser_strip_formatting_dont_preserve_newlines )) );
|
||||
// ( <Macro> <ValueType> <Name> = <Expression>
|
||||
}
|
||||
}
|
||||
@ -2934,7 +2934,7 @@ CodeParams parse_params( bool use_template_capture )
|
||||
eat( currtok.Type );
|
||||
}
|
||||
|
||||
value = untyped_str( string_to_strc(parser_strip_formatting( tok_to_str(value_tok), parser_strip_formatting_dont_preserve_newlines )) );
|
||||
value = untyped_str( strbuilder_to_str(parser_strip_formatting( tok_to_str(value_tok), parser_strip_formatting_dont_preserve_newlines )) );
|
||||
// ( <Macro> <ValueType> <Name> = <Expression>, <Macro> <ValueType> <Name> = <Expression>
|
||||
}
|
||||
// ( <Macro> <ValueType> <Name> = <Expression>, <Macro> <ValueType> <Name> = <Expression>, ..
|
||||
@ -3045,8 +3045,8 @@ Code parse_simple_preprocess( TokType which, bool dont_consume_braces )
|
||||
eat( Tok_BraceCurly_Close );
|
||||
// <Macro> { <Body> }
|
||||
|
||||
StrC prev_proc = Context.Scope->Prev->ProcName;
|
||||
if ( str_compare_len( prev_proc.Ptr, "parser_parse_typedef", prev_proc.Len ) != 0 )
|
||||
Str prev_proc = Context.Scope->Prev->ProcName;
|
||||
if ( c_str_compare_len( prev_proc.Ptr, "parser_parse_typedef", prev_proc.Len ) != 0 )
|
||||
{
|
||||
if ( check( Tok_Statement_End ))
|
||||
{
|
||||
@ -3066,14 +3066,14 @@ Code parse_simple_preprocess( TokType which, bool dont_consume_braces )
|
||||
{
|
||||
// If the macro is just a macro in the body of an AST it may have a semi-colon for the user to close on purpsoe
|
||||
// (especially for functional macros)
|
||||
StrC calling_proc = Context.Scope->Prev->ProcName;
|
||||
Str calling_proc = Context.Scope->Prev->ProcName;
|
||||
|
||||
if (strc_contains(Context.Scope->Prev->ProcName, txt("parser_parse_enum")))
|
||||
if (str_contains(Context.Scope->Prev->ProcName, txt("parser_parse_enum")))
|
||||
{
|
||||
// Do nothing
|
||||
goto Leave_Scope_Early;
|
||||
}
|
||||
else if (strc_contains(Context.Scope->Prev->ProcName, txt("parser_parse_typedef")))
|
||||
else if (str_contains(Context.Scope->Prev->ProcName, txt("parser_parse_typedef")))
|
||||
{
|
||||
// TODO(Ed): Reveiw the context for this?
|
||||
if ( peektok.Type == Tok_Statement_End )
|
||||
@ -3095,8 +3095,8 @@ Code parse_simple_preprocess( TokType which, bool dont_consume_braces )
|
||||
}
|
||||
}
|
||||
else if (
|
||||
strc_contains(calling_proc, txt("parse_global_nspace"))
|
||||
|| strc_contains(calling_proc, txt("parse_class_struct_body"))
|
||||
str_contains(calling_proc, txt("parse_global_nspace"))
|
||||
|| str_contains(calling_proc, txt("parse_class_struct_body"))
|
||||
)
|
||||
{
|
||||
if (peektok.Type == Tok_Statement_End)
|
||||
@ -3113,9 +3113,9 @@ Code parse_simple_preprocess( TokType which, bool dont_consume_braces )
|
||||
|
||||
Leave_Scope_Early:
|
||||
|
||||
char const* content = str_fmt_buf( "%.*s ", tok.Length, tok.Text );
|
||||
char const* content = c_str_fmt_buf( "%.*s ", tok.Length, tok.Text );
|
||||
|
||||
Code result = untyped_str( to_strc_from_c_str(content) );
|
||||
Code result = untyped_str( to_str_from_c_str(content) );
|
||||
Context.Scope->Name = tok;
|
||||
|
||||
parser_pop(& Context);
|
||||
@ -3156,8 +3156,8 @@ Code parse_static_assert()
|
||||
|
||||
content.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)content.Text;
|
||||
|
||||
char const* str = str_fmt_buf( "%.*s\n", content.Length, content.Text );
|
||||
StrC content_str = { content.Length + 1, str };
|
||||
char const* str = c_str_fmt_buf( "%.*s\n", content.Length, content.Text );
|
||||
Str content_str = { content.Length + 1, str };
|
||||
assert->Content = get_cached_string( content_str );
|
||||
assert->Name = assert->Content;
|
||||
|
||||
@ -3211,7 +3211,7 @@ CodeVar parse_variable_after_name(
|
||||
, CodeAttributes attributes
|
||||
, CodeSpecifiers specifiers
|
||||
, CodeTypename type
|
||||
, StrC name
|
||||
, Str name
|
||||
)
|
||||
{
|
||||
push_scope();
|
||||
@ -3289,7 +3289,7 @@ CodeVar parse_variable_after_name(
|
||||
|
||||
if ( currtok.Type == Tok_Statement_End )
|
||||
{
|
||||
log_failure( "Expected expression after bitfield \n%S", parser_to_string(Context) );
|
||||
log_failure( "Expected expression after bitfield \n%SB", parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -3398,7 +3398,7 @@ CodeVar parse_variable_declaration_list()
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
@ -3406,7 +3406,7 @@ CodeVar parse_variable_declaration_list()
|
||||
if ( specifiers->NumEntries && specifiers->ArrSpecs[ specifiers->NumEntries - 1 ] != Spec_Ptr )
|
||||
{
|
||||
log_failure( "Error, const specifier must come after pointer specifier for variable declaration proceeding comma\n"
|
||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%S"
|
||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%SB"
|
||||
, parser_to_string(Context) );
|
||||
|
||||
specifiers_append(specifiers, spec );
|
||||
@ -3421,7 +3421,7 @@ CodeVar parse_variable_declaration_list()
|
||||
default:
|
||||
{
|
||||
log_failure( "Error, invalid specifier '%s' proceeding comma\n"
|
||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%SC"
|
||||
"(Parser will add and continue to specifiers, but will most likely fail to compile)\n%S"
|
||||
, tok_to_str(currtok), parser_to_string(Context) );
|
||||
continue;
|
||||
}
|
||||
@ -3437,7 +3437,7 @@ CodeVar parse_variable_declaration_list()
|
||||
}
|
||||
// , <Specifiers>
|
||||
|
||||
StrC name = tok_to_str(currtok);
|
||||
Str name = tok_to_str(currtok);
|
||||
eat( Tok_Identifier );
|
||||
// , <Specifiers> <Name>
|
||||
|
||||
@ -3566,7 +3566,7 @@ CodeDestructor parser_parse_destructor( CodeSpecifiers specifiers )
|
||||
push_scope();
|
||||
|
||||
bool has_context = Context.Scope && Context.Scope->Prev;
|
||||
bool is_in_global_nspace = has_context && strc_are_equal( Context.Scope->Prev->ProcName, txt("parse_global_nspace") );
|
||||
bool is_in_global_nspace = has_context && str_are_equal( Context.Scope->Prev->ProcName, txt("parse_global_nspace") );
|
||||
|
||||
if ( check( Tok_Spec_Virtual ) )
|
||||
{
|
||||
@ -3617,7 +3617,7 @@ CodeDestructor parser_parse_destructor( CodeSpecifiers specifiers )
|
||||
|
||||
specifiers_append(specifiers, Spec_Pure );
|
||||
}
|
||||
else if ( left && str_compare_len( upcoming.Text, "default", sizeof("default") - 1 ) == 0)
|
||||
else if ( left && c_str_compare_len( upcoming.Text, "default", sizeof("default") - 1 ) == 0)
|
||||
{
|
||||
body = cast(CodeBody, parse_assignment_expression());
|
||||
// <Virtual Specifier> ~<
|
||||
@ -3731,7 +3731,7 @@ CodeEnum parser_parse_enum( bool inplace_def )
|
||||
else if ( currtok.Type == Tok_Preprocess_Macro )
|
||||
{
|
||||
// We'll support the enum_underlying macro
|
||||
if ( strc_contains( tok_to_str(currtok), enum_underlying_sig) )
|
||||
if ( str_contains( tok_to_str(currtok), enum_underlying_sig) )
|
||||
{
|
||||
use_macro_underlying = true;
|
||||
underlying_macro = parse_simple_preprocess( Tok_Preprocess_Macro, parser_dont_consume_braces );
|
||||
@ -3988,7 +3988,7 @@ CodeFriend parser_parse_friend()
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
@ -4112,7 +4112,7 @@ CodeFn parser_parse_function()
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
@ -4225,7 +4225,7 @@ CodeOperator parser_parse_operator()
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
@ -4238,7 +4238,7 @@ CodeOperator parser_parse_operator()
|
||||
break;
|
||||
|
||||
default:
|
||||
log_failure( "Invalid specifier " "%SC" " for operator\n%S", spec_to_str(spec), parser_to_string(Context) );
|
||||
log_failure( "Invalid specifier " "%S" " for operator\n%SB", spec_to_str(spec), parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -4467,7 +4467,7 @@ CodeTemplate parser_parse_template()
|
||||
{
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
switch ( spec )
|
||||
{
|
||||
@ -4513,7 +4513,7 @@ CodeTemplate parser_parse_template()
|
||||
|
||||
|
||||
bool has_context = Context.Scope && Context.Scope->Prev;
|
||||
bool is_in_global_nspace = has_context && strc_are_equal( Context.Scope->Prev->ProcName, txt("parse_global_nspace") );
|
||||
bool is_in_global_nspace = has_context && str_are_equal( Context.Scope->Prev->ProcName, txt("parse_global_nspace") );
|
||||
// Possible constructor implemented at global file scope.
|
||||
if (is_in_global_nspace)
|
||||
{
|
||||
@ -4610,11 +4610,11 @@ CodeTypename parser_parse_type( bool from_template, bool* typedef_is_function )
|
||||
// Prefix specifiers
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
if ( spec != Spec_Const )
|
||||
{
|
||||
log_failure( "Error, invalid specifier used in type definition: %SC\n%S", tok_to_str(currtok), parser_to_string(Context) );
|
||||
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", tok_to_str(currtok), parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -4627,7 +4627,7 @@ CodeTypename parser_parse_type( bool from_template, bool* typedef_is_function )
|
||||
|
||||
if ( left == 0 )
|
||||
{
|
||||
log_failure( "Error, unexpected end of type definition\n%S", parser_to_string(Context) );
|
||||
log_failure( "Error, unexpected end of type definition\n%SB", parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -4749,7 +4749,7 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
// Suffix specifiers for typename.
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
if ( spec != Spec_Const && spec != Spec_Ptr && spec != Spec_Ref && spec != Spec_RValue )
|
||||
{
|
||||
@ -4808,7 +4808,7 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
}
|
||||
|
||||
bool has_context = Context.Scope && Context.Scope->Prev;
|
||||
bool is_for_opcast = has_context && strc_are_equal( Context.Scope->Prev->ProcName, txt("parser_parse_operator_cast") );
|
||||
bool is_for_opcast = has_context && str_are_equal( Context.Scope->Prev->ProcName, txt("parser_parse_operator_cast") );
|
||||
if ( is_for_opcast && is_function_typename && last_capture )
|
||||
{
|
||||
// If we're parsing for an operator cast, having one capture start is not enough
|
||||
@ -4832,8 +4832,8 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
return_type = ( CodeTypename )make_code();
|
||||
return_type->Type = CT_Typename;
|
||||
|
||||
// String
|
||||
// name_stripped = String::make( GlobalAllocator, name );
|
||||
// StrBuilder
|
||||
// name_stripped = StrBuilder::make( GlobalAllocator, name );
|
||||
// name_stripped.strip_space();
|
||||
return_type->Name = get_cached_string( tok_to_str(name) );
|
||||
|
||||
@ -4948,14 +4948,14 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
// Look for suffix specifiers for the function
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
|
||||
if ( spec != Spec_Const
|
||||
// TODO : Add support for NoExcept, l-value, volatile, l-value, etc
|
||||
// && spec != Spec_NoExcept
|
||||
&& spec != Spec_RValue )
|
||||
{
|
||||
log_failure( "Error, invalid specifier used in type definition: %SC\n%S", tok_to_str(currtok), parser_to_string(Context) );
|
||||
log_failure( "Error, invalid specifier used in type definition: %S\n%SB", tok_to_str(currtok), parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -4989,7 +4989,7 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
// result->Token = Context.Scope->Start;
|
||||
|
||||
// Need to wait until were using the new parsing method to do this.
|
||||
String name_stripped = parser_strip_formatting( tok_to_str(name), parser_strip_formatting_dont_preserve_newlines );
|
||||
StrBuilder name_stripped = parser_strip_formatting( tok_to_str(name), parser_strip_formatting_dont_preserve_newlines );
|
||||
|
||||
// name_stripped.strip_space();
|
||||
|
||||
@ -5000,7 +5000,7 @@ else if ( currtok.Type == Tok_DeclType )
|
||||
}
|
||||
#endif
|
||||
|
||||
result->Name = get_cached_string( string_to_strc(name_stripped) );
|
||||
result->Name = get_cached_string( strbuilder_to_str(name_stripped) );
|
||||
|
||||
if ( attributes )
|
||||
result->Attributes = attributes;
|
||||
@ -5082,7 +5082,7 @@ CodeTypedef parser_parse_typedef()
|
||||
|
||||
if ( currtok.Type == Tok_Identifier )
|
||||
{
|
||||
StrC name_str = { name.Length, name.Text };
|
||||
Str name_str = { name.Length, name.Text };
|
||||
type = untyped_str(name_str);
|
||||
name = currtok;
|
||||
eat(Tok_Identifier);
|
||||
@ -5161,7 +5161,7 @@ CodeTypedef parser_parse_typedef()
|
||||
|
||||
if ( ! ok_to_parse )
|
||||
{
|
||||
log_failure( "Unsupported or bad member definition after struct declaration\n%S", parser_to_string(Context) );
|
||||
log_failure( "Unsupported or bad member definition after struct declaration\n%SB", parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -5187,7 +5187,7 @@ CodeTypedef parser_parse_typedef()
|
||||
}
|
||||
else
|
||||
{
|
||||
log_failure( "Unsupported or bad member definition after struct declaration\n%S", parser_to_string(Context) );
|
||||
log_failure( "Unsupported or bad member definition after struct declaration\n%SB", parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -5208,7 +5208,7 @@ CodeTypedef parser_parse_typedef()
|
||||
}
|
||||
else if ( ! is_function )
|
||||
{
|
||||
log_failure( "Error, expected identifier for typedef\n%S", parser_to_string(Context) );
|
||||
log_failure( "Error, expected identifier for typedef\n%SB", parser_to_string(Context) );
|
||||
parser_pop(& Context);
|
||||
return InvalidCode;
|
||||
}
|
||||
@ -5279,7 +5279,7 @@ CodeUnion parser_parse_union( bool inplace_def )
|
||||
CodeAttributes attributes = parse_attributes();
|
||||
// <ModuleFlags> union <Attributes>
|
||||
|
||||
StrC name = { 0, nullptr };
|
||||
Str name = { 0, nullptr };
|
||||
if ( check( Tok_Identifier ) )
|
||||
{
|
||||
name = tok_to_str(currtok);
|
||||
@ -5527,7 +5527,7 @@ CodeVar parser_parse_variable()
|
||||
|
||||
while ( left && tok_is_specifier(currtok) )
|
||||
{
|
||||
Specifier spec = strc_to_specifier( tok_to_str(currtok) );
|
||||
Specifier spec = str_to_specifier( tok_to_str(currtok) );
|
||||
switch ( spec )
|
||||
{
|
||||
case Spec_Const:
|
||||
|
@ -28,7 +28,7 @@ global AllocatorInfo Allocator_TypeTable = {0};
|
||||
|
||||
#pragma region Constants
|
||||
|
||||
global StrC enum_underlying_sig;
|
||||
global Str enum_underlying_sig;
|
||||
|
||||
global Code access_public;
|
||||
global Code access_protected;
|
||||
|
@ -44,17 +44,17 @@ enum AccessSpec : u32
|
||||
static_assert( size_of(AccessSpec) == size_of(u32), "AccessSpec not u32 size" );
|
||||
|
||||
inline
|
||||
StrC access_spec_to_str( AccessSpec type )
|
||||
Str access_spec_to_str( AccessSpec type )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[ (u32)AccessSpec_Num_AccessSpec ] = {
|
||||
Str lookup[ (u32)AccessSpec_Num_AccessSpec ] = {
|
||||
{ sizeof("") - 1, "" },
|
||||
{ sizeof("prviate") - 1, "private" },
|
||||
{ sizeof("protected") - 1, "private" },
|
||||
{ sizeof("public") - 1, "public" },
|
||||
};
|
||||
|
||||
StrC invalid = { sizeof("Invalid") - 1, "Invalid" };
|
||||
Str invalid = { sizeof("Invalid") - 1, "Invalid" };
|
||||
if ( type > AccessSpec_Public )
|
||||
return invalid;
|
||||
|
||||
@ -97,17 +97,17 @@ enum ModuleFlag : u32
|
||||
static_assert( size_of(ModuleFlag) == size_of(u32), "ModuleFlag not u32 size" );
|
||||
|
||||
inline
|
||||
StrC module_flag_to_str( ModuleFlag flag )
|
||||
Str module_flag_to_str( ModuleFlag flag )
|
||||
{
|
||||
local_persist
|
||||
StrC lookup[ (u32)Num_ModuleFlags ] = {
|
||||
Str lookup[ (u32)Num_ModuleFlags ] = {
|
||||
{ sizeof("__none__"), "__none__" },
|
||||
{ sizeof("export"), "export" },
|
||||
{ sizeof("import"), "import" },
|
||||
};
|
||||
|
||||
local_persist
|
||||
StrC invalid_flag = { sizeof("invalid"), "invalid" };
|
||||
Str invalid_flag = { sizeof("invalid"), "invalid" };
|
||||
if ( flag > ModuleFlag_Import )
|
||||
return invalid_flag;
|
||||
|
||||
|
Reference in New Issue
Block a user