diff options
Diffstat (limited to 'crates/mbe/src/parser.rs')
-rw-r--r-- | crates/mbe/src/parser.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/crates/mbe/src/parser.rs b/crates/mbe/src/parser.rs index 7b5b8ec16..c88387653 100644 --- a/crates/mbe/src/parser.rs +++ b/crates/mbe/src/parser.rs | |||
@@ -177,16 +177,8 @@ fn next_op<'a>(first: &tt::TokenTree, src: &mut TtIter<'a>, mode: Mode) -> Resul | |||
177 | Op::Repeat { tokens: MetaTemplate(tokens), separator, kind } | 177 | Op::Repeat { tokens: MetaTemplate(tokens), separator, kind } |
178 | } | 178 | } |
179 | tt::TokenTree::Leaf(leaf) => match leaf { | 179 | tt::TokenTree::Leaf(leaf) => match leaf { |
180 | tt::Leaf::Punct(punct) => { | 180 | tt::Leaf::Punct(_) => { |
181 | static UNDERSCORE: SmolStr = SmolStr::new_inline("_"); | 181 | return Err(ParseError::Expected("ident".to_string())); |
182 | |||
183 | if punct.char != '_' { | ||
184 | return Err(ParseError::Expected("_".to_string())); | ||
185 | } | ||
186 | let name = UNDERSCORE.clone(); | ||
187 | let kind = eat_fragment_kind(src, mode)?; | ||
188 | let id = punct.id; | ||
189 | Op::Var { name, kind, id } | ||
190 | } | 182 | } |
191 | tt::Leaf::Ident(ident) if ident.text == "crate" => { | 183 | tt::Leaf::Ident(ident) if ident.text == "crate" => { |
192 | // We simply produce identifier `$crate` here. And it will be resolved when lowering ast to Path. | 184 | // We simply produce identifier `$crate` here. And it will be resolved when lowering ast to Path. |