From 7b715a2cfb7cc68a2cd58b770300078bcabc715e Mon Sep 17 00:00:00 2001 From: fef Date: Sat, 23 Jul 2022 20:52:15 +0200 Subject: [PATCH] lex: fix incorrect keyword recognition --- src/lex/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lex/mod.rs b/src/lex/mod.rs index 83beb4d..f67adb1 100644 --- a/src/lex/mod.rs +++ b/src/lex/mod.rs @@ -245,9 +245,8 @@ impl Lexer { fn skip_if_match(&mut self, s: &str) -> bool { let mut n: usize = 0; for c in s.chars() { - if self.cursor.next() == Some(c) { - n += 1; - } else { + n += 1; + if self.cursor.next() != Some(c) { self.cursor.seek_back(n); return false; }