wiwi_macro_decl/
macro_recurse.rs1#[macro_export]
2macro_rules! macro_recurse {
3 ($($stuff:tt)*) => {
4 $crate::__macro_recurse_impl! { $($stuff)* }
6 }
7}
8
9#[doc(hidden)]
10#[macro_export]
11macro_rules! __macro_recurse_impl {
12 {
13 $macro:ident
15 { $($stuff:tt)* }
17 { $($idents:ident)* }
19 } => {
20 $crate::__macro_recurse_impl! {
21 @impl
22 $macro
23 { $($stuff)* }
24 [$($idents)*] []
25 }
26 };
27
28 {
29 @exclude_zero
30
31 $macro:ident
33 { $($stuff:tt)* }
35 { $first:ident $($idents:ident)* }
37 } => {
38 $crate::__macro_recurse_impl! {
39 @impl
40 $macro
41 { $($stuff)* }
42 [$($idents)*] [$first]
43 }
44 };
45
46 {
47 @impl
48 $macro:ident
49 { $($stuff:tt)* }
50 [$next:ident $($remaining:ident)*] [$($rest:ident)*]
51 } => {
52 $macro! {
53 @wiwi_macro_recurse
54 { $($stuff)* }
55 { $($rest)* }
56 }
57 $crate::__macro_recurse_impl! {
58 @impl
59 $macro
60 { $($stuff)* }
61 [$($remaining)*] [$($rest)* $next]
62 }
63 };
64
65 {
66 @impl
67 $macro:ident
68 { $($stuff:tt)* }
69 [] [$($rest:ident)*]
70 } => {
71 $macro! {
72 @wiwi_macro_recurse
73 { $($stuff)* }
74 { $($rest)* }
75 }
76 };
77}