You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before including this in a release, I would like to document all of the parsers with realistic procedural-macro-appropriate examples. @mystor would you be able to help me work through these?
alt
call
cond
cond_reduce
delimited
do_parse
epsilon
keyword
many0
map
named
not
opt_vec
option
peek
preceded
punct
separated_list
separated_nonempty_list
switch
tag
take_until
terminated
terminated_list
tuple
value
I started you off with two examples of what I have in mind but feel free to invent your own approach if you want.
One or more of something separated by some separator.
Syntax:separated_nonempty_list!(SEPARATOR, THING)
Output:Vec<THING>
externcrate syn;#[macro_use]externcrate synom;use syn::Ty;use syn::parse::ty;// One or more Rust types separated by commas.named!(comma_separated_types -> Vec<Ty>,
separated_nonempty_list!(
punct!(","),
ty));fnmain(){let input = "&str, Map<K, V>, String";let parsed = comma_separated_types(input).expect("comma-separated types");assert_eq!(parsed.len(),3);println!("{:?}", parsed);}
Before including this in a release, I would like to document all of the parsers with realistic procedural-macro-appropriate examples. @mystor would you be able to help me work through these?
I started you off with two examples of what I have in mind but feel free to invent your own approach if you want.
The text was updated successfully, but these errors were encountered: