oni_comb_parser_rs::prelude

Function elm_from_until

Source
pub fn elm_from_until<'a, I>(start: I, end: I) -> Parser<'a, I, I>
where I: PartialEq + PartialOrd + Display + Copy + Clone + Debug + 'a,
Expand description

Returns a Parser that parses the elements in the specified range.
指定した範囲の要素を解析するParserを返します。

  • start: a start element

  • end: an end element, process up to the element at end - 1

  • start: 開始要素

  • end: 終了要素, end - 1の要素まで処理

§Example

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

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

let parser: Parser<char, String> = elm_from_until('w', 'z').of_many1().map(String::from_iter);

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

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