Function chumsky::primitive::none_of

source ·
pub fn none_of<I, C: Container<I>, E: Error<I>>(inputs: C) -> NoneOf<I, C, E>
Expand description

A parser that accepts any input that is not in a sequence of specific inputs.

The output type of this parser is I, the input that was found.

Examples

let string = one_of::<_, _, Cheap<char>>("\"'")
    .ignore_then(none_of("\"'").repeated())
    .then_ignore(one_of("\"'"))
    .then_ignore(end())
    .collect::<String>();

assert_eq!(string.parse("'hello'"), Ok("hello".to_string()));
assert_eq!(string.parse("\"world\""), Ok("world".to_string()));
assert!(string.parse("\"421!53").is_err());