From ed4c3d475c35f875c60b066e22ebf113789efe43 Mon Sep 17 00:00:00 2001 From: Matteo Flebus Date: Mon, 19 Jan 2026 17:47:29 +0100 Subject: [PATCH] fix(lexer): lexing_mode depending on quote --- src/lexer/lexer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c index fd54c98..2505649 100644 --- a/src/lexer/lexer.c +++ b/src/lexer/lexer.c @@ -270,8 +270,13 @@ struct token *peek_token(void) while (i < remaining_chars) { - // true if we didn't encounter a quotes of any type at stream[i] - if (!update_lexing_mode(stream, i, &lexing_mode)) + // true if encountered a quotes of any type at stream[i] + if (update_lexing_mode(stream, i, &lexing_mode)) + { + i++; + continue; + } + else { if (is_special_char(stream[i])) { @@ -309,8 +314,13 @@ struct token *pop_token(void) while (i < remaining_chars) { - // true if we didn't encounter a quotes of any type at stream[i] - if (!update_lexing_mode(stream, i, &lexing_mode)) + // true if encountered a quotes of any type at stream[i] + if (update_lexing_mode(stream, i, &lexing_mode)) + { + i++; + continue; + } + else { if (is_special_char(stream[i])) {