mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-31 06:50:53 -07:00 
			
		
		
		
	formatting, fixes from testing latest in Odin fork
This commit is contained in:
		| @@ -242,7 +242,7 @@ GEN_NS_PARSER_END | ||||
| // I have ideas for ways to pack that into the typedef/using ast, but for now just keeping it like this | ||||
| #define ParserTokenType GEN_NS_PARSER Token | ||||
| typedef ParserTokenType Token; | ||||
| #undef ParserTokenType | ||||
| #undef  ParserTokenType | ||||
| #endif | ||||
|  | ||||
| #if GEN_COMPILER_CPP | ||||
| @@ -251,19 +251,19 @@ template< class Type> forceinline Type tmpl_cast( Code self ) { return * rcast( | ||||
|  | ||||
| #pragma region Code C-Interface | ||||
|  | ||||
| void   code_append       (Code code, Code other ); | ||||
| Str   code_debug_str    (Code code); | ||||
| Code   code_duplicate    (Code code); | ||||
| Code*  code_entry        (Code code, u32 idx ); | ||||
| bool   code_has_entries  (Code code); | ||||
| 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); | ||||
| 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 ); | ||||
| void       code_append           (Code code, Code other ); | ||||
| Str        code_debug_str        (Code code); | ||||
| Code       code_duplicate        (Code code); | ||||
| Code*      code_entry            (Code code, u32 idx ); | ||||
| bool       code_has_entries      (Code code); | ||||
| 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); | ||||
| 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 Str 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); }         \ | ||||
| @@ -295,16 +295,17 @@ struct Code | ||||
|  | ||||
| #if ! GEN_C_LIKE_CPP | ||||
| 	Using_Code( 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 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); } | ||||
| 	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 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 | ||||
|  | ||||
| 	Using_CodeOps( Code ); | ||||
| 	forceinline Code operator *() { return * this; } // Required for for-range iteration. | ||||
| 	forceinline AST* operator ->() { return ast; } | ||||
|  | ||||
| 	Code& operator ++(); | ||||
|   | ||||
| @@ -1414,7 +1414,7 @@ void var_to_strbuilder_ref(CodeVar self, StrBuilder* result ) | ||||
|  | ||||
| 		strbuilder_append_fmt( result, "%SB %S", typename_to_string(self->ValueType), self->Name ); | ||||
|  | ||||
| 		if ( self->ValueType->ArrExpr ) | ||||
| 		if ( self->ValueType && self->ValueType->ArrExpr ) | ||||
| 		{ | ||||
| 			strbuilder_append_fmt( result, "[ %SB ]", code_to_string(self->ValueType->ArrExpr) ); | ||||
|  | ||||
|   | ||||
| @@ -161,9 +161,9 @@ struct CodeBody | ||||
| 	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); } | ||||
|  | ||||
| #endif | ||||
| 	forceinline Code begin() { return begin_CodeBody(* this); } | ||||
| 	forceinline Code end()   { return end_CodeBody(* this); } | ||||
| #endif | ||||
| 	Using_CodeOps( CodeBody ); | ||||
| 	forceinline operator Code() { return * rcast( Code*, this ); } | ||||
| 	forceinline AST_Body* operator->() { return ast; } | ||||
|   | ||||
| @@ -64,7 +64,7 @@ inline AST_Attributes* CodeAttributes::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -95,7 +95,7 @@ inline AST_Comment* CodeComment::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -126,7 +126,7 @@ inline AST_Constructor* CodeConstructor::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -173,7 +173,7 @@ inline AST_Define* CodeDefine::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -204,7 +204,7 @@ inline AST_Destructor* CodeDestructor::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -235,7 +235,7 @@ inline AST_Enum* CodeEnum::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -266,7 +266,7 @@ inline AST_Exec* CodeExec::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -297,7 +297,7 @@ inline AST_Extern* CodeExtern::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -328,7 +328,7 @@ inline AST_Friend* CodeFriend::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -359,7 +359,7 @@ inline AST_Fn* CodeFn::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -390,7 +390,7 @@ inline AST_Include* CodeInclude::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -421,7 +421,7 @@ inline AST_Module* CodeModule::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -452,7 +452,7 @@ inline AST_NS* CodeNS::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -483,7 +483,7 @@ inline AST_Operator* CodeOperator::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -514,7 +514,7 @@ inline AST_OpCast* CodeOpCast::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -561,7 +561,7 @@ inline AST_Pragma* CodePragma::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -592,7 +592,7 @@ inline AST_PreprocessCond* CodePreprocessCond::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -655,7 +655,7 @@ inline AST_Template* CodeTemplate::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -686,7 +686,7 @@ inline AST_Typename* CodeTypename::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -717,7 +717,7 @@ inline AST_Typedef* CodeTypedef::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -748,7 +748,7 @@ inline AST_Union* CodeUnion::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -779,7 +779,7 @@ inline AST_Using* CodeUsing::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
| @@ -810,7 +810,7 @@ inline AST_Var* CodeVar::operator->() | ||||
| { | ||||
| 	if ( ast == nullptr ) | ||||
| 	{ | ||||
| 		log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 		log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	return ast; | ||||
|   | ||||
| @@ -124,7 +124,7 @@ bool lex__eat(TokArray* self, TokType type ) | ||||
| 			, tok.Column | ||||
| 			, parser_to_string(Context) | ||||
| 		); | ||||
|  | ||||
| 		GEN_DEBUG_TRAP(); | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| @@ -515,7 +515,7 @@ Code parse_array_decl() | ||||
|  | ||||
| 	if ( check( Tok_Operator ) && currtok.Text[0] == '[' && currtok.Text[1] == ']' ) | ||||
| 	{ | ||||
| 		Code array_expr = untyped_str( tok_to_str(currtok) ); | ||||
| 		Code array_expr = untyped_str( txt(" ") ); | ||||
| 		eat( Tok_Operator ); | ||||
| 		// [] | ||||
|  | ||||
| @@ -2391,7 +2391,7 @@ CodeOperator parse_operator_after_ret_type( | ||||
| 		case '<': | ||||
| 		{ | ||||
| 			if ( currtok.Text[1] == '=' ) | ||||
| 				op = Op_LEqual; | ||||
| 				op = Op_LesserEqual; | ||||
|  | ||||
| 			else if ( currtok.Text[1] == '<' ) | ||||
| 			{ | ||||
| @@ -3428,12 +3428,12 @@ CodeVar parse_variable_declaration_list() | ||||
| 				break; | ||||
| 			} | ||||
|  | ||||
| 			// eat(currtok.Type); | ||||
|  | ||||
| 			if ( specifiers ) | ||||
| 				specifiers_append(specifiers, spec ); | ||||
| 			else | ||||
| 				specifiers = def_specifier( spec ); | ||||
|  | ||||
| 			eat(currtok.Type); | ||||
| 		} | ||||
| 		// , <Specifiers> | ||||
|  | ||||
|   | ||||
| @@ -505,7 +505,7 @@ CodeBody gen_ast_inlines() | ||||
| 		{ | ||||
| 			if ( ast == nullptr ) | ||||
| 			{ | ||||
| 				log_failure( "Attempt to dereference a nullptr!" ); | ||||
| 				log_failure( "Attempt to dereference a nullptr!\n" ); | ||||
| 				return nullptr; | ||||
| 			} | ||||
| 			return ast; | ||||
|   | ||||
| @@ -176,9 +176,9 @@ int gen_main() | ||||
| 			Code timing     = scan_file( path_base "dependencies/timing.cpp" ); | ||||
|  | ||||
| 			header.print_fmt( roll_own_dependencies_guard_start ); | ||||
| 			header.print( impl_start ); | ||||
| 			header.print_fmt( "GEN_NS_BEGIN\n\n"); | ||||
|  | ||||
| 			header.print( impl_start ); | ||||
| 			header.print( debug ); | ||||
| 			header.print( string_ops ); | ||||
| 			header.print( printing ); | ||||
| @@ -209,8 +209,7 @@ int gen_main() | ||||
| 		Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" ); | ||||
| 		Code untyped           = scan_file( path_base "components/interface.untyped.cpp" ); | ||||
|  | ||||
| 		CodeBody etoktype      = gen_etoktype( path_base "enums/ETokType.csv", path_base "enums/AttributeTokens.csv" ); | ||||
| 		CodeNS   parser_nspace = def_namespace( name(parser), def_namespace_body( args(etoktype)) ); | ||||
| 		CodeBody etoktype = gen_etoktype( path_base "enums/ETokType.csv", path_base "enums/AttributeTokens.csv" ); | ||||
|  | ||||
| 		header.print_fmt( "\nGEN_NS_BEGIN\n"); | ||||
| 		header.print( static_data ); | ||||
| @@ -225,7 +224,7 @@ int gen_main() | ||||
| 		header.print( interface ); | ||||
| 		header.print( upfront ); | ||||
| 		header.print_fmt( "\n#pragma region Parsing\n\n" ); | ||||
| 		header.print( format(parser_nspace) ); | ||||
| 		header.print( format(etoktype) ); | ||||
| 		header.print( lexer ); | ||||
| 		header.print( parser ); | ||||
| 		header.print( parsing_interface ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user