implement eat_until leveraging memchr in lexer

This commit is contained in:
gvozdvmozgu
2025-02-05 07:03:53 -08:00
parent 8df89d1cb0
commit 9f469eb600
4 changed files with 11 additions and 2 deletions

View File

@@ -103,4 +103,11 @@ impl<'a> Cursor<'a> {
self.bump();
}
}
pub(crate) fn eat_until(&mut self, byte: u8) {
self.chars = match memchr::memchr(byte, self.as_str().as_bytes()) {
Some(index) => self.as_str()[index..].chars(),
None => "".chars(),
}
}
}