pub fn not<I, E, F>(parser: F) -> impl Parser<I, Output = (), 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))));