diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/macros.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs index 9ba381685..c23ad53cc 100644 --- a/crates/ra_hir/src/macros.rs +++ b/crates/ra_hir/src/macros.rs | |||
@@ -221,12 +221,24 @@ fn convert_tt(tt: &SyntaxNode) -> Option<tt::Subtree> { | |||
221 | if child == first_child || child == last_child || child.kind().is_trivia() { | 221 | if child == first_child || child == last_child || child.kind().is_trivia() { |
222 | continue; | 222 | continue; |
223 | } | 223 | } |
224 | let child = if child.kind() == TOKEN_TREE { | 224 | let child: tt::TokenTree = if child.kind() == TOKEN_TREE { |
225 | convert_tt(child)?.into() | 225 | convert_tt(child)?.into() |
226 | } else if child.kind().is_keyword() { | 226 | } else if child.kind().is_keyword() || child.kind() == IDENT { |
227 | let text = child.leaf_text().unwrap().clone(); | 227 | let text = child.leaf_text().unwrap().clone(); |
228 | tt::Leaf::from(tt::Ident { text }).into() | 228 | tt::Leaf::from(tt::Ident { text }).into() |
229 | } else if child.kind().is_punct() { | ||
230 | // FIXME: multibyte tokens | ||
231 | tt::Leaf::from(tt::Punct { | ||
232 | char: child.text().char_at(0)?, | ||
233 | }) | ||
234 | .into() | ||
235 | } else if child.kind().is_literal() { | ||
236 | tt::Leaf::from(tt::Literal { | ||
237 | text: child.leaf_text().unwrap().clone(), | ||
238 | }) | ||
239 | .into() | ||
229 | } else { | 240 | } else { |
241 | log::error!("unknown kind: {:?}", child); | ||
230 | return None; | 242 | return None; |
231 | }; | 243 | }; |
232 | token_trees.push(child) | 244 | token_trees.push(child) |