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)
{
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 )

View File

@ -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) );

View File

@ -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++ )

View File

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