diff options
Diffstat (limited to 'src/parse/scanner.rs')
| -rw-r--r-- | src/parse/scanner.rs | 10 |
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() |
