Macro syn::custom_keyword
[−]
[src]
macro_rules! custom_keyword { ($i:expr, $keyword:ident) => { ... }; }
Parse the given word as a keyword.
For words that are keywords in the Rust language, it is better to use the
keyword!
parser which returns a unique type for each keyword.
- Syntax:
custom_keyword!(KEYWORD)
- Output:
Ident
#[macro_use] extern crate syn; use syn::Ident; use syn::synom::Synom; struct Flag { name: Ident, } // Parses the custom keyword `flag` followed by any name for a flag. // // Example: `flag Verbose` impl Synom for Flag { named!(parse -> Flag, do_parse!( custom_keyword!(flag) >> name: syn!(Ident) >> (Flag { name }) )); }
This macro is available if Syn is built with the "parsing"
feature.