From d4ed26bf842305a598b0adf5fcfff5394d49dbb5 Mon Sep 17 00:00:00 2001 From: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Date: Mon, 30 Dec 2024 03:38:12 +0800 Subject: [PATCH] Simplify loop --- tokenize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokenize.c b/tokenize.c index 2d73357..4182eff 100644 --- a/tokenize.c +++ b/tokenize.c @@ -150,7 +150,7 @@ static Token *new_token(TokenKind kind, char *start, char *end) { static int read_ident(char *p) { char *start = p; - for (bool is_first = true;; is_first = false) { + for (;;) { if (Isalnum(*p) || *p == '_' || *p == '$') { p++; continue; @@ -158,7 +158,7 @@ static int read_ident(char *p) { if ((unsigned char)*p >= 128) { char *pos; uint32_t c = decode_utf8(&pos, p); - if (is_first ? is_ident1(c) : is_ident2(c)) { + if (p == start ? is_ident1(c) : is_ident2(c)) { p = pos; continue; }