summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-01-13 19:49:52 +0100
committerLaurenz <laurmaedje@gmail.com>2022-01-13 19:55:32 +0100
commit4abdafcd158ab15d9d2ae18553067578ae559d33 (patch)
treeb1081ad25b7984bd8504008cd971bc2ce20224b3 /src/parse
parentb3062ee8804580f65d5232846f1ccd199b2ff1c7 (diff)
Faster byte/utf-16 offset conversions
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/scanner.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/parse/scanner.rs b/src/parse/scanner.rs
index 6db89132..81fa4fba 100644
--- a/src/parse/scanner.rs
+++ b/src/parse/scanner.rs
@@ -19,6 +19,11 @@ impl<'s> Scanner<'s> {
Self { src, index: 0 }
}
+ /// Whether the end of the string is reached.
+ pub fn eof(&self) -> bool {
+ self.index == self.src.len()
+ }
+
/// Consume the next char.
#[inline]
pub fn eat(&mut self) -> Option<char> {