From c4f0b35a30eff116134dc548e8255dc25cd1c2e9 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 30 Mar 2023 17:35:57 -0400 Subject: [PATCH] Fixed bugs with spec file parsing related to word ignores. --- project/Bloat.cpp | 4 ++-- project/IO.cpp | 2 +- project/Spec.cpp | 20 +++++--------------- project/refactor.cpp | 3 --- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/project/Bloat.cpp b/project/Bloat.cpp index 675b45c..0423a8e 100644 --- a/project/Bloat.cpp +++ b/project/Bloat.cpp @@ -60,7 +60,7 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv) if (*arg) { - arg = cast(char*)zpl_str_trim(arg, false); + arg = (char*)zpl_str_trim(arg, false); if (*arg == '-') { @@ -132,7 +132,7 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv) } } - e = cast(char *)zpl_str_control_skip(e, '\0'); + e = (char *)zpl_str_control_skip(e, '\0'); zpl__opts_set_value(opts, entry, b); if ( (i + 1) < argc ) diff --git a/project/IO.cpp b/project/IO.cpp index cb439d6..4e5ba68 100644 --- a/project/IO.cpp +++ b/project/IO.cpp @@ -80,7 +80,7 @@ namespace IO fatal("No content in specificaiton to process"); } - zpl_arena_init_from_allocator( & MemSpec, zpl_heap(), fsize * 2 + 8 ); + zpl_arena_init_from_allocator( & MemSpec, zpl_heap(), fsize * 3 + 8 ); char* content = rcast( char*, zpl_alloc( zpl_arena_allocator( & MemSpec), fsize + 1) ); diff --git a/project/Spec.cpp b/project/Spec.cpp index 83d9015..eb38dd0 100644 --- a/project/Spec.cpp +++ b/project/Spec.cpp @@ -123,7 +123,6 @@ namespace Spec // Ignore line if its a comment if ( line[0] == '/' && line[1] == '/') { - lines++; continue; } @@ -134,7 +133,6 @@ namespace Spec if ( line[0] == '\0' ) { - lines++; continue; } } @@ -144,6 +142,8 @@ namespace Spec bool ignore = false; Entry entry {}; + log_fmt("\nIGNORE WORD COUNT: %d", zpl_array_count(Ignore_Words)); + // Find a valid token find_next_token( type, token, line, length ); @@ -158,7 +158,6 @@ namespace Spec if ( line[0] == '\0' ) { - lines++; continue; } @@ -171,7 +170,6 @@ namespace Spec // Custom comment signatures not supported yet (only C/C++ comments for now) Ignore_Comments = true; - lines++; continue; } else if ( is_tok( Tok::Word, token, length ) ) @@ -189,7 +187,6 @@ namespace Spec else { log_fmt( "Sec::Parse - Unsupported keyword: %s on line: %d", token, zpl_array_count(lines) - left ); - lines++; continue; } @@ -199,7 +196,6 @@ namespace Spec if ( line[0] == '\0' ) { - lines++; continue; } @@ -240,7 +236,6 @@ namespace Spec break; } - lines++; continue; } @@ -276,7 +271,6 @@ namespace Spec if ( bSkip ) { - lines++; continue; } } @@ -308,7 +302,6 @@ namespace Spec break; } - lines++; continue; } } @@ -322,24 +315,21 @@ namespace Spec { case Tok::Word: zpl_array_append( Words, entry ); - lines++; continue; case Tok::Namespace: zpl_array_append( Namespaces, entry ); - lines++; continue; case Tok::Include: zpl_array_append( Includes, entry ); - lines++; continue; } } - while ( --left ); + while ( lines++, left--, left > 0 ); - Spec::Entry* ignore = Spec::Ignore_Includes; - sw ignores_left = zpl_array_count( Spec::Ignore_Includes); + Spec::Entry* ignore = Spec::Ignore_Words; + sw ignores_left = zpl_array_count( Spec::Ignore_Words); zpl_printf("\nIgnores: "); for ( ; ignores_left; ignores_left--, ignore++ ) diff --git a/project/refactor.cpp b/project/refactor.cpp index 8d22bbc..0c6149f 100644 --- a/project/refactor.cpp +++ b/project/refactor.cpp @@ -3,9 +3,6 @@ #include "Spec.cpp" -#define Build_Debug 1 - - void parse_options( int num, char** arguments ) { zpl_opts opts;