Skip to content
Snippets Groups Projects
Commit eb2d085c authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

adapt to new lexer behavior

parent c7308902
No related branches found
No related tags found
No related merge requests found
......@@ -37,12 +37,9 @@ int parse_get_section(lexer_config *acfg, unsigned int *ncfg, char const *str, s
cfg.pos = pos ;
stack_reset(&stk) ;
if (!lexer(&stk, &cfg))
if (!lexer(&stk, &cfg) || !stack_close(&stk))
return 0 ;
if (!stack_close(&stk))
log_warnu_return(LOG_EXIT_ZERO, "stack overflow") ;
if (cfg.found) {
ssize_t id = get_enum_by_key(stk.s) ;
......
......@@ -24,12 +24,9 @@ int parse_key(stack *key, lexer_config *cfg)
{
int kid = -1, next = -1 ;
if (!lexer(key, cfg))
if (!lexer(key, cfg) || !stack_close(key))
return -1 ;
if (!stack_close(key))
log_warnu_return(LOG_EXIT_LESSONE, "stack overflow") ;
if (cfg->found) {
kid = get_enum_by_key(key->s) ;
......
......@@ -28,19 +28,9 @@ int parse_list(stack *stk)
if (!stack_copy_stack(&tmp, stk))
return 0 ;
cfg.str = tmp.s ; cfg.slen = tmp.len ;
stk->len = 0 ; stk->count = 0 ;
stack_reset(stk) ;
while (cfg.pos < cfg.slen) {
lexer_reset(&cfg) ;
cfg.opos = 0 ;
cfg.cpos = 0 ;
if (!lexer(stk, &cfg))
return 0 ;
}
if (!stack_close(stk))
if (!lexer_trim_with_g(stk, tmp.s, &cfg))
return 0 ;
return 1 ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment