Macro nom::many1
[−]
[src]
macro_rules! many1 { ($i:expr, $submac:ident!( $($args:tt)* )) => { ... }; ($i:expr, $f:expr) => { ... }; }
many1!(I -> IResult<I,O>) => I -> IResult<I, Vec<O>>
Applies the parser 1 or more times and returns the list of results in a Vec
the embedded parser may return Incomplete
named!(multi<&[u8], Vec<&[u8]> >, many1!( tag!( "abcd" ) ) ); let a = b"abcdabcdefgh"; let b = b"azerty"; let res = vec![&b"abcd"[..], &b"abcd"[..]]; assert_eq!(multi(&a[..]),Ok((&b"efgh"[..], res))); assert_eq!(multi(&b[..]), Err(Err::Error(error_position!(&b[..], ErrorKind::Many1))));