This commit is contained in:
Lukas Wirth 2022-01-02 02:39:14 +01:00
parent 809461cc42
commit a0e0e4575b
4 changed files with 47 additions and 59 deletions

View file

@ -1,11 +1,11 @@
//! A "Parser" structure for token trees. We use this when parsing a declarative
//! macro definition into a list of patterns and templates.
use crate::{to_parser_input::to_parser_input, ExpandError, ExpandResult};
use syntax::SyntaxKind;
use tt::buffer::TokenBuffer;
use crate::{to_parser_input::to_parser_input, ExpandError, ExpandResult};
macro_rules! err {
() => {
ExpandError::BindingError(format!(""))
@ -27,7 +27,7 @@ impl<'a> TtIter<'a> {
pub(crate) fn expect_char(&mut self, char: char) -> Result<(), ()> {
match self.next() {
Some(tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: c, .. }))) if *c == char => {
Some(&tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: c, .. }))) if c == char => {
Ok(())
}
_ => Err(()),