From c8d028544787d57ae715b87cc5e6a24a45287498 Mon Sep 17 00:00:00 2001 From: Jean <47366872+jean-voila@users.noreply.github.com> Date: Sat, 31 Jan 2026 20:04:48 +0100 Subject: [PATCH] fix(while/until) --- src/lexer/lexer_utils.c | 2 +- src/parser/grammar_advanced.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lexer/lexer_utils.c b/src/lexer/lexer_utils.c index 1f40a69..53c3603 100644 --- a/src/lexer/lexer_utils.c +++ b/src/lexer/lexer_utils.c @@ -76,7 +76,7 @@ static void set_token_keyword(struct token *tok, char *begin, ssize_t size) tok->type = TOKEN_FOR; else if (strncmp(begin, "while", size) == 0 && size == 5) tok->type = TOKEN_WHILE; - else if (strncmp(begin, "until", size) == 0 && size == 4) + else if (strncmp(begin, "until", size) == 0 && size == 5) tok->type = TOKEN_UNTIL; else if (strncmp(begin, "do", size) == 0 && size == 2) tok->type = TOKEN_DO; diff --git a/src/parser/grammar_advanced.c b/src/parser/grammar_advanced.c index ae652a1..d1b7efa 100644 --- a/src/parser/grammar_advanced.c +++ b/src/parser/grammar_advanced.c @@ -220,18 +220,18 @@ struct ast *parse_while(struct lexer_context *ctx) } POP_TOKEN(); - return parse_loop(ctx, true); + return parse_loop(ctx, false); } struct ast *parse_until(struct lexer_context *ctx) { struct token *token = PEEK_TOKEN(); - // 'while' + // 'until' if (token->type != TOKEN_UNTIL) { perror( - "Internal error: expected a TOKEN_WHILE but got a different type"); + "Internal error: expected a TOKEN_UNTIL but got a different type"); return NULL; } POP_TOKEN();