summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChloe M. <chloe@mirocom.org>2026-05-23 08:08:48 -0400
committerChloe M. <chloe@mirocom.org>2026-05-23 08:13:45 -0400
commit50bd6324feb9c129067cb60586e8690fee1a81bf (patch)
tree267630287c367756ad91594d6f11e637247120a9
parent9bc47590c3c2108902e87a1059ad867d57357068 (diff)
core: lexer: Fix up whitespace skipping
Signed-off-by: Chloe M. <chloe@mirocom.org>
-rw-r--r--core/lexer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/lexer.c b/core/lexer.c
index 1d1e900..617ba41 100644
--- a/core/lexer.c
+++ b/core/lexer.c
@@ -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;
}