use foo_macros::*;
macro_rules! one_plus { { $v:expr } => {
- 1 + $v
+ 2 * $v
} }
macro_rules! one_plus_dbg { { $v:expr } => {
- dbg_dump!(1 + $v)
+ dbg_dump!(2 * $v)
} }
macro_rules! one_plus_reconstruct { { $v:expr } => {
- reconstruct_groups!(1 + $v)
+ reconstruct_groups!(2 * $v)
} }
fn main() {
- println!("1 + (2<<3) should be 17");
- println!("{} without proc_macro", one_plus!(2 << 3));
- println!("{} dbg_dump", one_plus_dbg!(2 << 3));
- println!("{} reconstruct", one_plus_reconstruct!(2 << 3));
+ println!("2 * (3 + 4) should be 14");
+ println!("{} without proc_macro", one_plus!(3 + 4));
+ println!("{} dbg_dump", one_plus_dbg!(3 + 4));
+ println!("{} reconstruct", one_plus_reconstruct!(3 + 4));
}