David Tolnay | 5553501 | 2018-01-05 16:39:23 -0800 | [diff] [blame^] | 1 | // Copyright 2018 Syn Developers |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 4 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 5 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 6 | // option. This file may not be copied, modified, or distributed |
| 7 | // except according to those terms. |
| 8 | |
David Tolnay | dd12556 | 2017-12-31 02:16:22 -0500 | [diff] [blame] | 9 | #[macro_export] |
| 10 | macro_rules! errorf { |
| 11 | ($($tt:tt)*) => {{ |
| 12 | use ::std::io::Write; |
| 13 | let stderr = ::std::io::stderr(); |
| 14 | write!(stderr.lock(), $($tt)*).unwrap(); |
| 15 | }}; |
| 16 | } |
| 17 | |
| 18 | #[macro_export] |
David Tolnay | f2cfd72 | 2017-12-31 18:02:51 -0500 | [diff] [blame] | 19 | macro_rules! punctuated { |
David Tolnay | a0834b4 | 2018-01-01 21:30:02 -0800 | [diff] [blame] | 20 | ($($e:expr,)+) => {{ |
David Tolnay | f2cfd72 | 2017-12-31 18:02:51 -0500 | [diff] [blame] | 21 | let mut seq = ::syn::punctuated::Punctuated::new(); |
David Tolnay | dd12556 | 2017-12-31 02:16:22 -0500 | [diff] [blame] | 22 | $( |
David Tolnay | a0834b4 | 2018-01-01 21:30:02 -0800 | [diff] [blame] | 23 | seq.push($e); |
| 24 | )+ |
David Tolnay | f2cfd72 | 2017-12-31 18:02:51 -0500 | [diff] [blame] | 25 | seq |
David Tolnay | dd12556 | 2017-12-31 02:16:22 -0500 | [diff] [blame] | 26 | }}; |
| 27 | |
| 28 | ($($e:expr),+) => { |
David Tolnay | f2cfd72 | 2017-12-31 18:02:51 -0500 | [diff] [blame] | 29 | punctuated!($($e,)+) |
David Tolnay | dd12556 | 2017-12-31 02:16:22 -0500 | [diff] [blame] | 30 | }; |
| 31 | } |