diff --git a/src/scanner.zig b/src/scanner.zig index 56084a5..613b096 100644 --- a/src/scanner.zig +++ b/src/scanner.zig @@ -249,6 +249,9 @@ pub const Scanner = struct { _ = self.advance(); } + // ugly hack. + self.rollback(); + // after reading the identifier, we check // if it is any of our keywords, if it is, then we add // the specificed keyword type. if not, just .IDENTIFIER @@ -261,9 +264,6 @@ pub const Scanner = struct { toktype = TokenType.Identifier; } - // ugly hack. - self.rollback(); - return self.makeToken(toktype); }