From b591ecdf9b5b13c4e2f8ab0ced0acd70358c87a7 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 1 Jul 2019 15:07:17 -0300 Subject: [PATCH] fix identifier -> keyword conversion --- src/scanner.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); }