diff options
Diffstat (limited to 'crates/mbe/src/tt_iter.rs')
-rw-r--r-- | crates/mbe/src/tt_iter.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/mbe/src/tt_iter.rs b/crates/mbe/src/tt_iter.rs index 319a40f2a..195b8cf30 100644 --- a/crates/mbe/src/tt_iter.rs +++ b/crates/mbe/src/tt_iter.rs | |||
@@ -34,6 +34,17 @@ impl<'a> TtIter<'a> { | |||
34 | } | 34 | } |
35 | } | 35 | } |
36 | 36 | ||
37 | pub(crate) fn expect_any_char(&mut self, chars: &[char]) -> Result<(), ()> { | ||
38 | match self.next() { | ||
39 | Some(tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: c, .. }))) | ||
40 | if chars.contains(c) => | ||
41 | { | ||
42 | Ok(()) | ||
43 | } | ||
44 | _ => Err(()), | ||
45 | } | ||
46 | } | ||
47 | |||
37 | pub(crate) fn expect_subtree(&mut self) -> Result<&'a tt::Subtree, ()> { | 48 | pub(crate) fn expect_subtree(&mut self) -> Result<&'a tt::Subtree, ()> { |
38 | match self.next() { | 49 | match self.next() { |
39 | Some(tt::TokenTree::Subtree(it)) => Ok(it), | 50 | Some(tt::TokenTree::Subtree(it)) => Ok(it), |