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 ...@@ -37,12 +37,9 @@ int parse_get_section(lexer_config *acfg, unsigned int *ncfg, char const *str, s
cfg.pos = pos ; cfg.pos = pos ;
stack_reset(&stk) ; stack_reset(&stk) ;
if (!lexer(&stk, &cfg)) if (!lexer(&stk, &cfg) || !stack_close(&stk))
return 0 ; return 0 ;
if (!stack_close(&stk))
log_warnu_return(LOG_EXIT_ZERO, "stack overflow") ;
if (cfg.found) { if (cfg.found) {
ssize_t id = get_enum_by_key(stk.s) ; ssize_t id = get_enum_by_key(stk.s) ;
......
...@@ -24,12 +24,9 @@ int parse_key(stack *key, lexer_config *cfg) ...@@ -24,12 +24,9 @@ int parse_key(stack *key, lexer_config *cfg)
{ {
int kid = -1, next = -1 ; int kid = -1, next = -1 ;
if (!lexer(key, cfg)) if (!lexer(key, cfg) || !stack_close(key))
return -1 ; return -1 ;
if (!stack_close(key))
log_warnu_return(LOG_EXIT_LESSONE, "stack overflow") ;
if (cfg->found) { if (cfg->found) {
kid = get_enum_by_key(key->s) ; kid = get_enum_by_key(key->s) ;
......
...@@ -28,19 +28,9 @@ int parse_list(stack *stk) ...@@ -28,19 +28,9 @@ int parse_list(stack *stk)
if (!stack_copy_stack(&tmp, stk)) if (!stack_copy_stack(&tmp, stk))
return 0 ; return 0 ;
cfg.str = tmp.s ; cfg.slen = tmp.len ; stack_reset(stk) ;
stk->len = 0 ; stk->count = 0 ;
while (cfg.pos < cfg.slen) { if (!lexer_trim_with_g(stk, tmp.s, &cfg))
lexer_reset(&cfg) ;
cfg.opos = 0 ;
cfg.cpos = 0 ;
if (!lexer(stk, &cfg))
return 0 ;
}
if (!stack_close(stk))
return 0 ; return 0 ;
return 1 ; 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