1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#[macro_export] macro_rules! womp { () => { &format!("{}:{}:{}", file!(), line!(), column!()) }; ($message:expr) => { &format!("{}:{}:{} {}", file!(), line!(), column!(), $message) }; } #[macro_export] macro_rules! regex { ($r:expr) => { Regex::new($r).expect(womp!()) }; } #[macro_export] macro_rules! capture { ($r:expr, $e:expr) => { regex!($r).captures($e).expect(womp!()) }; } #[macro_export] macro_rules! resp_code { ($r:ident) => { if !$r.success { return Err($r.first_line); } }; } #[macro_export] macro_rules! parse_match { ($e:expr, $i:expr) => { $e.name($i).expect(womp!()).as_str().parse().expect(womp!()) }; }