Macro nom::not
[−]
[src]
macro_rules! not { ($i:expr, $submac:ident!( $($args:tt)* )) => { ... }; ($i:expr, $f:expr) => { ... }; }
not!(I -> IResult<I,O>) => I -> IResult<I, O>
returns a result only if the embedded parser returns Error or Incomplete
does not consume the input
named!(not_e, do_parse!( res: tag!("abc") >> not!(char!('e')) >> (res) )); let r = not_e(&b"abcd"[..]); assert_eq!(r, Done(&b"d"[..], &b"abc"[..])); let r2 = not_e(&b"abce"[..]); assert_eq!(r2, Error(error_position!(ErrorKind::Not, &b"e"[..])));