From 41c15df3962c41c20f17e52c6b3b5849204a5358 Mon Sep 17 00:00:00 2001 From: Fabian Schmalzried Date: Wed, 5 Nov 2025 23:55:57 +0100 Subject: [PATCH 1/2] Fix $if is not if, but a LowerIdent --- src/parse/tokenize.zig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/parse/tokenize.zig b/src/parse/tokenize.zig index 2a244118cc..37413b1ba4 100644 --- a/src/parse/tokenize.zig +++ b/src/parse/tokenize.zig @@ -1465,13 +1465,12 @@ pub const Tokenizer = struct { if (next) |n| { if (n >= 'a' and n <= 'z') { // Dollar sign followed by lowercase letter - reusable identifier + var tag: Token.Tag = .LowerIdent; self.cursor.pos += 1; - const tag = self.cursor.chompIdentLower(); - if (tag == .LowerIdent or tag == .MalformedUnicodeIdent) { - try self.pushTokenInternedHere(gpa, tag, start, start); - } else { - try self.pushTokenNormalHere(gpa, tag, start); + if (!self.cursor.chompIdentGeneral()) { + tag = .MalformedUnicodeIdent; } + try self.pushTokenInternedHere(gpa, tag, start, start); } else if (n >= 'A' and n <= 'Z') { // Dollar sign followed by uppercase letter - reusable identifier var tag: Token.Tag = .UpperIdent; From 99f274679da4f9d18727845e26d917a432ef8a22 Mon Sep 17 00:00:00 2001 From: Fabian Schmalzried Date: Thu, 6 Nov 2025 00:07:55 +0100 Subject: [PATCH 2/2] Add $ as (invalid) number suffix --- src/parse/tokenize.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse/tokenize.zig b/src/parse/tokenize.zig index 37413b1ba4..f5291cb436 100644 --- a/src/parse/tokenize.zig +++ b/src/parse/tokenize.zig @@ -688,7 +688,7 @@ pub const Cursor = struct { /// Returns either the original token hypothesis, or a malformed token tag. pub fn chompNumberSuffix(self: *Cursor, hypothesis: Token.Tag) Token.Tag { if (self.peek()) |c| { - const is_ident_char = (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '_' or c >= 0x80; + const is_ident_char = (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '_' or c == '$' or c >= 0x80; if (!is_ident_char) { return hypothesis; }