diff options
Diffstat (limited to 'crates/ra_mbe/src/mbe_expander.rs')
-rw-r--r-- | crates/ra_mbe/src/mbe_expander.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs index acba42809..01e29b556 100644 --- a/crates/ra_mbe/src/mbe_expander.rs +++ b/crates/ra_mbe/src/mbe_expander.rs | |||
@@ -161,11 +161,43 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings, | |||
161 | let pat = input.eat_stmt().ok_or(ExpandError::UnexpectedToken)?.clone(); | 161 | let pat = input.eat_stmt().ok_or(ExpandError::UnexpectedToken)?.clone(); |
162 | res.inner.insert(text.clone(), Binding::Simple(pat.into())); | 162 | res.inner.insert(text.clone(), Binding::Simple(pat.into())); |
163 | } | 163 | } |
164 | "block" => { | ||
165 | let block = | ||
166 | input.eat_block().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
167 | res.inner.insert(text.clone(), Binding::Simple(block.into())); | ||
168 | } | ||
169 | "meta" => { | ||
170 | let meta = | ||
171 | input.eat_meta().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
172 | res.inner.insert(text.clone(), Binding::Simple(meta.into())); | ||
173 | } | ||
174 | "tt" => { | ||
175 | let token = input.eat().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
176 | res.inner.insert(text.clone(), Binding::Simple(token.into())); | ||
177 | } | ||
164 | "item" => { | 178 | "item" => { |
165 | let item = | 179 | let item = |
166 | input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone(); | 180 | input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone(); |
167 | res.inner.insert(text.clone(), Binding::Simple(item.into())); | 181 | res.inner.insert(text.clone(), Binding::Simple(item.into())); |
168 | } | 182 | } |
183 | "lifetime" => { | ||
184 | let lifetime = | ||
185 | input.eat_lifetime().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
186 | res.inner.insert(text.clone(), Binding::Simple(lifetime.into())); | ||
187 | } | ||
188 | "literal" => { | ||
189 | let literal = | ||
190 | input.eat_literal().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
191 | res.inner.insert( | ||
192 | text.clone(), | ||
193 | Binding::Simple(tt::Leaf::from(literal).into()), | ||
194 | ); | ||
195 | } | ||
196 | "vis" => { | ||
197 | let vis = input.eat_vis().ok_or(ExpandError::UnexpectedToken)?.clone(); | ||
198 | res.inner.insert(text.clone(), Binding::Simple(vis.into())); | ||
199 | } | ||
200 | |||
169 | _ => return Err(ExpandError::UnexpectedToken), | 201 | _ => return Err(ExpandError::UnexpectedToken), |
170 | } | 202 | } |
171 | } | 203 | } |