Fixed bugs with spec file parsing related to word ignores.

This commit is contained in:
Edward R. Gonzalez 2023-03-30 17:35:57 -04:00
parent 17458b4b4c
commit c4f0b35a30
4 changed files with 8 additions and 21 deletions

View File

@ -60,7 +60,7 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
if (*arg) if (*arg)
{ {
arg = cast(char*)zpl_str_trim(arg, false); arg = (char*)zpl_str_trim(arg, false);
if (*arg == '-') 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); zpl__opts_set_value(opts, entry, b);
if ( (i + 1) < argc ) if ( (i + 1) < argc )

View File

@ -80,7 +80,7 @@ namespace IO
fatal("No content in specificaiton to process"); 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) ); char* content = rcast( char*, zpl_alloc( zpl_arena_allocator( & MemSpec), fsize + 1) );

View File

@ -123,7 +123,6 @@ namespace Spec
// Ignore line if its a comment // Ignore line if its a comment
if ( line[0] == '/' && line[1] == '/') if ( line[0] == '/' && line[1] == '/')
{ {
lines++;
continue; continue;
} }
@ -134,7 +133,6 @@ namespace Spec
if ( line[0] == '\0' ) if ( line[0] == '\0' )
{ {
lines++;
continue; continue;
} }
} }
@ -144,6 +142,8 @@ namespace Spec
bool ignore = false; bool ignore = false;
Entry entry {}; Entry entry {};
log_fmt("\nIGNORE WORD COUNT: %d", zpl_array_count(Ignore_Words));
// Find a valid token // Find a valid token
find_next_token( type, token, line, length ); find_next_token( type, token, line, length );
@ -158,7 +158,6 @@ namespace Spec
if ( line[0] == '\0' ) if ( line[0] == '\0' )
{ {
lines++;
continue; continue;
} }
@ -171,7 +170,6 @@ namespace Spec
// Custom comment signatures not supported yet (only C/C++ comments for now) // Custom comment signatures not supported yet (only C/C++ comments for now)
Ignore_Comments = true; Ignore_Comments = true;
lines++;
continue; continue;
} }
else if ( is_tok( Tok::Word, token, length ) ) else if ( is_tok( Tok::Word, token, length ) )
@ -189,7 +187,6 @@ namespace Spec
else else
{ {
log_fmt( "Sec::Parse - Unsupported keyword: %s on line: %d", token, zpl_array_count(lines) - left ); log_fmt( "Sec::Parse - Unsupported keyword: %s on line: %d", token, zpl_array_count(lines) - left );
lines++;
continue; continue;
} }
@ -199,7 +196,6 @@ namespace Spec
if ( line[0] == '\0' ) if ( line[0] == '\0' )
{ {
lines++;
continue; continue;
} }
@ -240,7 +236,6 @@ namespace Spec
break; break;
} }
lines++;
continue; continue;
} }
@ -276,7 +271,6 @@ namespace Spec
if ( bSkip ) if ( bSkip )
{ {
lines++;
continue; continue;
} }
} }
@ -308,7 +302,6 @@ namespace Spec
break; break;
} }
lines++;
continue; continue;
} }
} }
@ -322,24 +315,21 @@ namespace Spec
{ {
case Tok::Word: case Tok::Word:
zpl_array_append( Words, entry ); zpl_array_append( Words, entry );
lines++;
continue; continue;
case Tok::Namespace: case Tok::Namespace:
zpl_array_append( Namespaces, entry ); zpl_array_append( Namespaces, entry );
lines++;
continue; continue;
case Tok::Include: case Tok::Include:
zpl_array_append( Includes, entry ); zpl_array_append( Includes, entry );
lines++;
continue; continue;
} }
} }
while ( --left ); while ( lines++, left--, left > 0 );
Spec::Entry* ignore = Spec::Ignore_Includes; Spec::Entry* ignore = Spec::Ignore_Words;
sw ignores_left = zpl_array_count( Spec::Ignore_Includes); sw ignores_left = zpl_array_count( Spec::Ignore_Words);
zpl_printf("\nIgnores: "); zpl_printf("\nIgnores: ");
for ( ; ignores_left; ignores_left--, ignore++ ) for ( ; ignores_left; ignores_left--, ignore++ )

View File

@ -3,9 +3,6 @@
#include "Spec.cpp" #include "Spec.cpp"
#define Build_Debug 1
void parse_options( int num, char** arguments ) void parse_options( int num, char** arguments )
{ {
zpl_opts opts; zpl_opts opts;