lex: fix incorrect keyword recognition

main
anna 2 years ago
parent c7e4244972
commit 7b715a2cfb
Signed by: fef
GPG Key ID: EC22E476DC2D3D84

@ -245,9 +245,8 @@ impl Lexer {
fn skip_if_match(&mut self, s: &str) -> bool { fn skip_if_match(&mut self, s: &str) -> bool {
let mut n: usize = 0; let mut n: usize = 0;
for c in s.chars() { for c in s.chars() {
if self.cursor.next() == Some(c) { n += 1;
n += 1; if self.cursor.next() != Some(c) {
} else {
self.cursor.seek_back(n); self.cursor.seek_back(n);
return false; return false;
} }

Loading…
Cancel
Save