macro_rules! recognize { ($i:expr, $submac:ident!( $($args:tt)* )) => { ... }; ($i:expr, $f:expr) => { ... }; }
Expand description
recognize!(I -> IResult<I, O> ) => I -> IResult<I, I>
if the child parser was successful, return the consumed input as produced value
named!(x, recognize!(delimited!(tag!("<!--"), take!(5), tag!("-->"))));
let r = x(&b"<!-- abc --> aaa"[..]);
assert_eq!(r, Ok((&b" aaa"[..], &b"<!-- abc -->"[..])));