aboutsummaryrefslogtreecommitdiff
path: root/src/lexer/ptr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer/ptr.rs')
-rw-r--r--src/lexer/ptr.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lexer/ptr.rs b/src/lexer/ptr.rs
index 4638dac21..e8aa6f37b 100644
--- a/src/lexer/ptr.rs
+++ b/src/lexer/ptr.rs
@@ -32,6 +32,17 @@ impl<'s> Ptr<'s> {
32 Some(ch) 32 Some(ch)
33 } 33 }
34 34
35 pub fn bump_while<F: Fn(char) -> bool>(&mut self, pred: F) {
36 loop {
37 match self.next() {
38 Some(c) if pred(c) => {
39 self.bump();
40 },
41 _ => return,
42 }
43 }
44 }
45
35 fn chars(&self) -> Chars { 46 fn chars(&self) -> Chars {
36 self.text[self.len.0 as usize ..].chars() 47 self.text[self.len.0 as usize ..].chars()
37 } 48 }