Macro cpp_synom::separated_list
[−]
[src]
macro_rules! separated_list { ($i:expr, punct!($sep:expr), $f:expr) => { ... }; }
Zero or more values separated by some separator. Does not allow a trailing seperator.
The implementation requires that the first parameter is a punct!
macro,
and the second is a named parser.
- Syntax:
separated_list!(punct!("..."), THING)
- Output:
Vec<THING>
You may also be looking for:
separated_nonempty_list!
- one or more valuesterminated_list!
- zero or more, allows trailing separatormany0!
- zero or more, no separator
extern crate syn; #[macro_use] extern crate synom; use syn::Expr; use syn::parse::expr; named!(expr_list -> Vec<Expr>, separated_list!(punct!(","), expr) ); fn main() { let input = "1 + 1, things, Construct { this: thing }"; let parsed = expr_list(input).expect("expr list"); assert_eq!(parsed.len(), 3); }