mirror of
				https://github.com/Ed94/gencpp.git
				synced 2025-10-30 22:40:54 -07:00 
			
		
		
		
	Runtime fixed
This commit is contained in:
		| @@ -45,13 +45,21 @@ Code scan_file( char const* path, bool skip_header_includes = true ) | |||||||
| 				if ( strncmp( scanner, tok.Ptr, tok.Len ) == 0 ) | 				if ( strncmp( scanner, tok.Ptr, tok.Len ) == 0 ) | ||||||
| 				{ | 				{ | ||||||
| 					scanner += tok.Len; | 					scanner += tok.Len; | ||||||
| 					while ( current != '\r' && current != '\n' ) | 					while ( scanner < ( str.Data + str.length() ) && current != '\r' && current != '\n' ) | ||||||
| 					{ | 					{ | ||||||
| 						++ scanner; | 						++ scanner; | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					// Skip the line | 					// Skip the line | ||||||
| 					sptr skip_size = sptr( scanner - str.Data ); | 					sptr skip_size = sptr( scanner - str.Data ); | ||||||
|  | 					if ( (scanner + 2) >= ( str.Data + str.length() ) ) | ||||||
|  | 					{ | ||||||
|  | 						sptr new_length = sptr( str.get_header().Length ) - skip_size; | ||||||
|  | 						mem_move( str, scanner, new_length ); | ||||||
|  | 						str.get_header().Length = new_length; | ||||||
|  | 						break; | ||||||
|  | 					} | ||||||
|  |  | ||||||
| 					if ( current == '\r' ) | 					if ( current == '\r' ) | ||||||
| 					{ | 					{ | ||||||
| 						skip_size += 2; | 						skip_size += 2; | ||||||
| @@ -64,8 +72,6 @@ Code scan_file( char const* path, bool skip_header_includes = true ) | |||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					sptr new_length = sptr( str.get_header().Length ) - skip_size; | 					sptr new_length = sptr( str.get_header().Length ) - skip_size; | ||||||
|  |  | ||||||
| 					// scanner -= skip_size; |  | ||||||
| 					mem_move( str, scanner, new_length ); | 					mem_move( str, scanner, new_length ); | ||||||
| 					str.get_header().Length = new_length; | 					str.get_header().Length = new_length; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ | |||||||
| #	include "gen.dep.cpp" | #	include "gen.dep.cpp" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| namespace gen { | GEN_NS_BEGIN | ||||||
|  |  | ||||||
| #include "components/static_data.cpp" | #include "components/static_data.cpp" | ||||||
|  |  | ||||||
| @@ -27,6 +27,6 @@ namespace gen { | |||||||
| #include "components/interface.parsing.cpp" | #include "components/interface.parsing.cpp" | ||||||
| #include "components/interface.untyped.cpp" | #include "components/interface.untyped.cpp" | ||||||
|  |  | ||||||
| } | GEN_NS_END | ||||||
|  |  | ||||||
| #include "helpers/pop_ignores.inline.hpp" | #include "helpers/pop_ignores.inline.hpp" | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| #include "dependencies/src_start.cpp" | #include "dependencies/src_start.cpp" | ||||||
|  |  | ||||||
| namespace gen { | GEN_NS_BEGIN | ||||||
|  |  | ||||||
| #include "dependencies/debug.cpp" | #include "dependencies/debug.cpp" | ||||||
| #include "dependencies/string_ops.cpp" | #include "dependencies/string_ops.cpp" | ||||||
| @@ -14,4 +14,4 @@ namespace gen { | |||||||
| #include "dependencies/filesystem.cpp" | #include "dependencies/filesystem.cpp" | ||||||
| #include "dependencies/timing.cpp" | #include "dependencies/timing.cpp" | ||||||
|  |  | ||||||
| } | GEN_NS_END | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| #include "dependencies/header_start.hpp" | #include "dependencies/header_start.hpp" | ||||||
|  |  | ||||||
| namespace gen { | GEN_NS_BEGIN | ||||||
|  |  | ||||||
| #include "dependencies/macros.hpp" | #include "dependencies/macros.hpp" | ||||||
| #include "dependencies/basic_types.hpp" | #include "dependencies/basic_types.hpp" | ||||||
| @@ -17,4 +17,4 @@ namespace gen { | |||||||
| #include "dependencies/filesystem.hpp" | #include "dependencies/filesystem.hpp" | ||||||
| #include "dependencies/timing.hpp" | #include "dependencies/timing.hpp" | ||||||
|  |  | ||||||
| } | GEN_NS_END | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
| #include "helpers/push_ignores.inline.hpp" | #include "helpers/push_ignores.inline.hpp" | ||||||
| #include "components/header_start.hpp" | #include "components/header_start.hpp" | ||||||
|  |  | ||||||
| namespace gen { | GEN_NS_BEGIN | ||||||
|  |  | ||||||
| #include "components/types.hpp" | #include "components/types.hpp" | ||||||
| #include "components/temp/ecode.hpp" | #include "components/temp/ecode.hpp" | ||||||
| @@ -27,6 +27,6 @@ namespace gen { | |||||||
| #include "components/temp/ast_inlines.hpp" | #include "components/temp/ast_inlines.hpp" | ||||||
| #include "components/header_end.hpp" | #include "components/header_end.hpp" | ||||||
|  |  | ||||||
| } | GEN_NS_END | ||||||
|  |  | ||||||
| #include "helpers/pop_ignores.inline.hpp" | #include "helpers/pop_ignores.inline.hpp" | ||||||
|   | |||||||
| @@ -2,9 +2,9 @@ | |||||||
|  |  | ||||||
| #include "gen.hpp" | #include "gen.hpp" | ||||||
|  |  | ||||||
| namespace gen { | GEN_NS_BEGIN | ||||||
| #include "dependencies/parsing.hpp" | #include "dependencies/parsing.hpp" | ||||||
| } | GEN_NS_END | ||||||
|  |  | ||||||
| using namespace gen; | using namespace gen; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -208,7 +208,7 @@ int gen_main() | |||||||
| 		Code interface       = scan_file( project_dir "components/interface.cpp" ); | 		Code interface       = scan_file( project_dir "components/interface.cpp" ); | ||||||
| 		Code upfront         = scan_file( project_dir "components/interface.upfront.cpp" ); | 		Code upfront         = scan_file( project_dir "components/interface.upfront.cpp" ); | ||||||
| 		Code parsing         = scan_file( project_dir "components/interface.parsing.cpp" ); | 		Code parsing         = scan_file( project_dir "components/interface.parsing.cpp" ); | ||||||
| 		Code untyped         = scan_file( project_dir "components/untyped.cpp" ); | 		Code untyped         = scan_file( project_dir "components/interface.untyped.cpp" ); | ||||||
|  |  | ||||||
| 		CodeBody      etoktype      = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" ); | 		CodeBody      etoktype      = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" ); | ||||||
| 		CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) ); | 		CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) ); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user