From da4ba30544416e38542b9f1041c3b3cf1a5568be Mon Sep 17 00:00:00 2001 From: QuickWrite <54590845+QuickWrite@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:12:50 +0100 Subject: [PATCH] Remove recursion for comment parsing --- lexer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lexer.c b/lexer.c index 8091657..2fdf4c6 100644 --- a/lexer.c +++ b/lexer.c @@ -87,6 +87,7 @@ char* get_identifier(FILE* const fptr, int c) { } void next_token(struct Lexer* const lexer) { + start: skip_whitespace(lexer->fptr); struct Token next; @@ -101,8 +102,7 @@ void next_token(struct Lexer* const lexer) { // This is a comment. It should not be returned as a token as it is completely useless for a parser skip_comment(lexer->fptr); - next_token(lexer); - return; + goto start; case '=': next = new_token(TOK_EQUALS);