pub fn not<I: Clone, E: ParseError<I>, F>(
parser: F,
) -> impl Parser<I, Output = (), Error = E>where
F: Parser<I, Error = E>,
Expand description
Succeeds if the child parser returns an error.
use nom::combinator::not;
use nom::character::complete::alpha1;
let mut parser = not(alpha1);
assert_eq!(parser.parse("123"), Ok(("123", ())));
assert_eq!(parser.parse("abcd"), Err(Err::Error(("abcd", ErrorKind::Not))));