aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src/quote.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src/quote.rs')
-rw-r--r--crates/ra_hir_expand/src/quote.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_hir_expand/src/quote.rs b/crates/ra_hir_expand/src/quote.rs
index 65a35e52f..4f698ff13 100644
--- a/crates/ra_hir_expand/src/quote.rs
+++ b/crates/ra_hir_expand/src/quote.rs
@@ -60,6 +60,15 @@ macro_rules! __quote {
60 } 60 }
61 }; 61 };
62 62
63 ( ## $first:ident $($tail:tt)* ) => {
64 {
65 let mut tokens = $first.into_iter().map($crate::quote::ToTokenTree::to_token).collect::<Vec<tt::TokenTree>>();
66 let mut tail_tokens = $crate::quote::IntoTt::to_tokens($crate::__quote!($($tail)*));
67 tokens.append(&mut tail_tokens);
68 tokens
69 }
70 };
71
63 // Brace 72 // Brace
64 ( { $($tt:tt)* } ) => { $crate::__quote!(@SUBTREE Brace $($tt)*) }; 73 ( { $($tt:tt)* } ) => { $crate::__quote!(@SUBTREE Brace $($tt)*) };
65 // Bracket 74 // Bracket
@@ -85,6 +94,7 @@ macro_rules! __quote {
85 ( & ) => {$crate::__quote!(@PUNCT '&')}; 94 ( & ) => {$crate::__quote!(@PUNCT '&')};
86 ( , ) => {$crate::__quote!(@PUNCT ',')}; 95 ( , ) => {$crate::__quote!(@PUNCT ',')};
87 ( : ) => {$crate::__quote!(@PUNCT ':')}; 96 ( : ) => {$crate::__quote!(@PUNCT ':')};
97 ( :: ) => {$crate::__quote!(@PUNCT ':', ':')};
88 ( . ) => {$crate::__quote!(@PUNCT '.')}; 98 ( . ) => {$crate::__quote!(@PUNCT '.')};
89 99
90 ( $first:tt $($tail:tt)+ ) => { 100 ( $first:tt $($tail:tt)+ ) => {