From a1b5cf81ebcac15299cc612b49023bb418507027 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 19 Apr 2020 03:24:17 +0800 Subject: Convert bool to ident instead of literal in mbe --- crates/ra_mbe/src/tt_iter.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/ra_mbe/src/tt_iter.rs') diff --git a/crates/ra_mbe/src/tt_iter.rs b/crates/ra_mbe/src/tt_iter.rs index 100184e66..46c420718 100644 --- a/crates/ra_mbe/src/tt_iter.rs +++ b/crates/ra_mbe/src/tt_iter.rs @@ -40,9 +40,11 @@ impl<'a> TtIter<'a> { } } - pub(crate) fn expect_literal(&mut self) -> Result<&'a tt::Literal, ()> { - match self.expect_leaf()? { - tt::Leaf::Literal(it) => Ok(it), + pub(crate) fn expect_literal(&mut self) -> Result<&'a tt::Leaf, ()> { + let it = self.expect_leaf()?; + match it { + tt::Leaf::Literal(_) => Ok(it), + tt::Leaf::Ident(ident) if ident.text == "true" || ident.text == "false" => Ok(it), _ => Err(()), } } -- cgit v1.2.3