aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/mbe_expander.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-04-19 14:21:47 +0100
committerEdwin Cheng <[email protected]>2019-04-19 14:21:47 +0100
commitc5983b85fc9e520208684a8c625cdb96bb219b31 (patch)
treea990c96f3c973656663ab49d3f292dfca95a97b2 /crates/ra_mbe/src/mbe_expander.rs
parent313854c728c45ce236f23ff7a8834690e06d8306 (diff)
Add literal matcher
Diffstat (limited to 'crates/ra_mbe/src/mbe_expander.rs')
-rw-r--r--crates/ra_mbe/src/mbe_expander.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
index cacc3da19..548b15535 100644
--- a/crates/ra_mbe/src/mbe_expander.rs
+++ b/crates/ra_mbe/src/mbe_expander.rs
@@ -185,6 +185,15 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings,
185 input.eat_lifetime().ok_or(ExpandError::UnexpectedToken)?.clone(); 185 input.eat_lifetime().ok_or(ExpandError::UnexpectedToken)?.clone();
186 res.inner.insert(text.clone(), Binding::Simple(lifetime.into())); 186 res.inner.insert(text.clone(), Binding::Simple(lifetime.into()));
187 } 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
188 _ => return Err(ExpandError::UnexpectedToken), 197 _ => return Err(ExpandError::UnexpectedToken),
189 } 198 }
190 } 199 }