Skip to main content

salsa_macro_rules/
macro_if.rs

1#[macro_export]
2macro_rules! macro_if {
3    (true => $($t:tt)*) => {
4        $($t)*
5    };
6
7    (false => $($t:tt)*) => {
8    };
9
10    (if true { $($t:tt)* } else { $($f:tt)*}) => {
11        $($t)*
12    };
13
14    (if false { $($t:tt)* } else { $($f:tt)*}) => {
15        $($f)*
16    };
17
18    (if0 0 { $($t:tt)* } else { $($f:tt)*}) => {
19        $($t)*
20    };
21
22    (if0 $n:literal { $($t:tt)* } else { $($f:tt)*}) => {
23        $($f)*
24    };
25
26    (iftt () { $($t:tt)* } else { $($f:tt)*}) => {
27        $($f)*
28    };
29
30    (iftt ($($tt:tt)+) { $($t:tt)* } else { $($f:tt)*}) => {
31        $($t)*
32    };
33}