2022-08-08 00:05:20 +02:00
|
|
|
macro_rules! values {
|
|
|
|
($($token:ident($value:literal) $(as $inner:ty)? => $attr:meta,)*) => {
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum TokenKind {
|
|
|
|
$(
|
|
|
|
#[$attr]
|
|
|
|
$token $($inner)? = $value,
|
2024-07-04 10:16:51 +10:00
|
|
|
//~^ ERROR expected one of `!` or `::`, found `<eof>`
|
2022-08-08 00:05:20 +02:00
|
|
|
)*
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2024-07-04 10:16:51 +10:00
|
|
|
//~^^^^^^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `ty` metavariable
|
2024-04-17 13:17:44 +10:00
|
|
|
//~| ERROR macro expansion ignores `ty` metavariable and any tokens following
|
2022-08-08 00:05:20 +02:00
|
|
|
|
|
|
|
values!(STRING(1) as (String) => cfg(test),);
|
|
|
|
|
|
|
|
fn main() {}
|