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; }