mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Allow ,
to delimit macro 2.0 rules
This commit is contained in:
parent
eb264fb819
commit
eaffdae300
3 changed files with 30 additions and 2 deletions
|
@ -34,6 +34,17 @@ impl<'a> TtIter<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn expect_any_char(&mut self, chars: &[char]) -> Result<(), ()> {
|
||||
match self.next() {
|
||||
Some(tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: c, .. })))
|
||||
if chars.contains(c) =>
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn expect_subtree(&mut self) -> Result<&'a tt::Subtree, ()> {
|
||||
match self.next() {
|
||||
Some(tt::TokenTree::Subtree(it)) => Ok(it),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue