oni_comb_parser_rs::prelude

Function none_of

Source
pub fn none_of<'a, I, S>(set: &'a S) -> Parser<'a, I, I>
where I: PartialEq + Display + Clone + Debug + 'a, S: Set<I> + ?Sized,
Expand description

Returns a Parser that parses elements that do not contain elements of the specified set.
指定した集合の要素を含まない要素を解析するParserを返します。

  • set: an element of sets
  • set: 要素の集合

§Example

use std::iter::FromIterator;
use oni_comb_parser_rs::prelude::*;

let text: &str = "xyz";
let input = text.chars().collect::<Vec<_>>();

let parser: Parser<char, String> = none_of("abc").of_many1().map(String::from_iter);

let result: ParseResult<char, String> = parser.parse(&input);

assert!(result.is_success());
assert_eq!(result.success().unwrap(), text);