Macro impl_vocabulary
macro_rules! impl_vocabulary {
(
$ty:ty, $label:literal;
$( $variant:ident => $canonical:literal $(, [ $($alias:literal),+ $(,)? ])? ; )+
) => { ... };
}Expand description
Generates code() and FromStr for a closed-vocabulary
enum from one variant-to-spelling mapping.
The first spelling of each variant is its canonical code(); any further
spellings are accepted aliases. Matching is on normalized forms, so
separator and case variants need not be listed. The generated
ACCEPTED associated constant is what the error message lists, so the parser
and its advertisement are the same list.
ⓘ
impl_vocabulary! {
ResetCompounding, "reset compounding";
SpreadExclusive => "SpreadExclusive";
Straight => "Straight";
}