pub fn many<I: Input, T, E, F, U>(i: I, f: F) -> ParseResult<I, T, E>Expand description
Parses many instances of f until it does no longer match, collecting all
matches into the type T: FromIterator.
Note: Allocates data.
use chomp1::prelude::{many, parse_only, take_while1, token};
let r: Result<Vec<_>, _> = parse_only(
|i| {
many(i, |i| {
take_while1(i, |c| c != b',' && c != b' ').bind(|i, c| token(i, b',').map(|_| c))
})
},
b"a,bc,cd ",
);
assert_eq!(r, Ok(vec![&b"a"[..], &b"bc"[..]]));