nom::not [] [src]

macro_rules! not {
    ($i:expr, $submac:ident!( $($args:tt)* )) => { ... };
}

not!(I -> IResult<I,0>) => I -> IResult<I, O> returns a result only if the embedded parser returns Error or Incomplete does not consume the input

named!(not_e, chain!(
    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(Position(ErrorKind::Not, &b"e"[..])));