We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 85cef7e commit 0055561Copy full SHA for 0055561
src/stream/token.rs
@@ -51,6 +51,15 @@ where
51
let start = self.initial.checkpoint();
52
self.input.reset(&start);
53
}
54
+
55
+ /// Iterate over consumed tokens starting with the last emitted
56
+ ///
57
+ /// This is intended to help build up appropriate context when reporting errors.
58
+ #[inline]
59
+ pub fn previous_tokens(&self) -> impl Iterator<Item = &'t T> {
60
+ let offset = self.input.offset_from(&self.initial);
61
+ self.initial[0..offset].iter().rev()
62
+ }
63
64
65
/// Track locations by implementing [`Location`] on the Token.
0 commit comments