Last active
July 18, 2017 21:18
Error Index Gen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
register_long_diagnostics! { | |
E001: r##"hello"##, | |
E002: r##"world"##, | |
} | |
register_diagnostics! { | |
E003, | |
E004 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(trace_macros)] | |
trace_macros!(true); | |
fn main() { | |
macro_rules! register_diagnostic { | |
($code:tt, $description:tt) => { println!( "code is {}", stringify!($code)); }; | |
($code:tt) => { println!( "code is {}", stringify!($code)); } | |
} | |
macro_rules! register_diagnostics { | |
($($code:tt),*) => { | |
$(register_diagnostic! { $code })* | |
}; | |
($($code:tt),*,) => { | |
$(register_diagnostic! { $code })* | |
}; | |
} | |
macro_rules! register_long_diagnostics { | |
($($code:tt: $description:tt),*) => { | |
$(register_diagnostic! { $code, $description })* | |
}; | |
($($code:tt: $description:tt),*,) => { | |
$(register_diagnostic! { $code, $description })* | |
}; | |
} | |
#[path = "diagnostics.rs"] mod diags; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment