Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/token_map.rs')
| -rw-r--r-- | crates/mbe/src/token_map.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/mbe/src/token_map.rs b/crates/mbe/src/token_map.rs index c923e7a69a..9b2df89f9c 100644 --- a/crates/mbe/src/token_map.rs +++ b/crates/mbe/src/token_map.rs @@ -110,4 +110,11 @@ impl TokenMap { // FIXME: This could be accidentally quadratic self.entries.remove(idx); } + + pub fn entries(&self) -> impl Iterator<Item = (tt::TokenId, TextRange)> + '_ { + self.entries.iter().filter_map(|&(tid, tr)| match tr { + TokenTextRange::Token(range) => Some((tid, range)), + TokenTextRange::Delimiter(_) => None, + }) + } } |