From 891e0c5fa6cd9200c24011c33b6f2115d84d4d74 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 10 Jul 2021 20:42:28 +0200 Subject: Remove warnings from parsing and casting --- src/parse/parser.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/parse/parser.rs') diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 1e0f2f5d..d4192b50 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -322,6 +322,11 @@ impl<'s> Parser<'s> { Span::new(start, self.prev_end()) } + /// Return the source string from `start` to the end of the previous token. + pub fn eaten_from(&self, start: usize) -> &'s str { + self.tokens.scanner().get(start .. self.prev_end()) + } + /// Jump to an index in the string. /// /// You need to know the correct column. -- cgit v1.2.3