Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/tt_iter.rs')
| -rw-r--r-- | crates/mbe/src/tt_iter.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/mbe/src/tt_iter.rs b/crates/mbe/src/tt_iter.rs index fc5590b718..7aceb676c7 100644 --- a/crates/mbe/src/tt_iter.rs +++ b/crates/mbe/src/tt_iter.rs @@ -73,6 +73,13 @@ impl<'a> TtIter<'a> { } } + pub(crate) fn expect_u32_literal(&mut self) -> Result<u32, ()> { + match self.expect_literal()? { + tt::Leaf::Literal(lit) => lit.text.parse().map_err(drop), + _ => Err(()), + } + } + pub(crate) fn expect_punct(&mut self) -> Result<&'a tt::Punct, ()> { match self.expect_leaf()? { tt::Leaf::Punct(it) => Ok(it), |