core: lexer: Fix up whitespace skipping
Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
+6
-2
@@ -73,13 +73,17 @@ lexer_consume_single(struct cescal_state *state, bool skip_ws)
|
||||
}
|
||||
|
||||
if ((c = lexer_putback_pop(state)) != '\0') {
|
||||
if (lexer_is_ws(c) && !skip_ws) {
|
||||
if (!skip_ws) {
|
||||
return c;
|
||||
}
|
||||
|
||||
if (skip_ws && !lexer_is_ws(c)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
while ((c = readbuf_read(&state->rb, state->in_fd)) != '\0') {
|
||||
if (lexer_is_ws(c)) {
|
||||
if (lexer_is_ws(c) && skip_ws) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user