summaryrefslogtreecommitdiff
path: root/src/parse/scanner.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-08 19:12:07 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-08 19:12:07 +0200
commit5a500fb8a7c0ba4b8a59e2622c8cbafdc4ce1fe9 (patch)
tree5c22b012cf2c37a96735d6ec84ad19e852259e51 /src/parse/scanner.rs
parentc5635d8a3f45865619d66bc9e296da7d9e9efa5a (diff)
Range operator
Diffstat (limited to 'src/parse/scanner.rs')
-rw-r--r--src/parse/scanner.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/parse/scanner.rs b/src/parse/scanner.rs
index d2c2efed..1a0e3045 100644
--- a/src/parse/scanner.rs
+++ b/src/parse/scanner.rs
@@ -86,11 +86,6 @@ impl<'s> Scanner<'s> {
self.rest().chars().next()
}
- /// Peek at the nth-next char without consuming anything.
- pub fn peek_nth(&self, n: usize) -> Option<char> {
- self.rest().chars().nth(n)
- }
-
/// Checks whether the next char fulfills a condition.
///
/// Returns `false` if there is no next char.
@@ -101,6 +96,11 @@ impl<'s> Scanner<'s> {
self.peek().map(f).unwrap_or(false)
}
+ /// Checks whether the remaining source starts with the given string.
+ pub fn starts_with(&self, string: &str) -> bool {
+ self.rest().starts_with(string)
+ }
+
/// The previous index in the source string.
pub fn last_index(&self) -> usize {
self.eaten()