Runtime fixed

This commit is contained in:
Edward R. Gonzalez 2023-08-21 22:48:05 -04:00
parent 5c47777972
commit 7be3617083
7 changed files with 20 additions and 14 deletions

View File

@ -45,13 +45,21 @@ Code scan_file( char const* path, bool skip_header_includes = true )
if ( strncmp( scanner, tok.Ptr, tok.Len ) == 0 )
{
scanner += tok.Len;
while ( current != '\r' && current != '\n' )
while ( scanner < ( str.Data + str.length() ) && current != '\r' && current != '\n' )
{
++ scanner;
}
// Skip the line
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' )
{
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;
// scanner -= skip_size;
mem_move( str, scanner, new_length );
str.get_header().Length = new_length;

View File

@ -14,7 +14,7 @@
# include "gen.dep.cpp"
#endif
namespace gen {
GEN_NS_BEGIN
#include "components/static_data.cpp"
@ -27,6 +27,6 @@ namespace gen {
#include "components/interface.parsing.cpp"
#include "components/interface.untyped.cpp"
}
GEN_NS_END
#include "helpers/pop_ignores.inline.hpp"

View File

@ -3,7 +3,7 @@
#include "dependencies/src_start.cpp"
namespace gen {
GEN_NS_BEGIN
#include "dependencies/debug.cpp"
#include "dependencies/string_ops.cpp"
@ -14,4 +14,4 @@ namespace gen {
#include "dependencies/filesystem.cpp"
#include "dependencies/timing.cpp"
}
GEN_NS_END

View File

@ -3,7 +3,7 @@
#include "dependencies/header_start.hpp"
namespace gen {
GEN_NS_BEGIN
#include "dependencies/macros.hpp"
#include "dependencies/basic_types.hpp"
@ -17,4 +17,4 @@ namespace gen {
#include "dependencies/filesystem.hpp"
#include "dependencies/timing.hpp"
}
GEN_NS_END

View File

@ -11,7 +11,7 @@
#include "helpers/push_ignores.inline.hpp"
#include "components/header_start.hpp"
namespace gen {
GEN_NS_BEGIN
#include "components/types.hpp"
#include "components/temp/ecode.hpp"
@ -27,6 +27,6 @@ namespace gen {
#include "components/temp/ast_inlines.hpp"
#include "components/header_end.hpp"
}
GEN_NS_END
#include "helpers/pop_ignores.inline.hpp"

View File

@ -2,9 +2,9 @@
#include "gen.hpp"
namespace gen {
GEN_NS_BEGIN
#include "dependencies/parsing.hpp"
}
GEN_NS_END
using namespace gen;

View File

@ -208,7 +208,7 @@ int gen_main()
Code interface = scan_file( project_dir "components/interface.cpp" );
Code upfront = scan_file( project_dir "components/interface.upfront.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" );
CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );