oni_comb_parser_rs::prelude

Function elm_alpha_digit_ref

Source
pub fn elm_alpha_digit_ref<'a, I>() -> Parser<'a, I, &'a I>
where I: Element + PartialEq + 'a,
Expand description

Returns a Parser that parses alphabets and digits (‘0’..=‘9’, ‘A’..=‘Z’, ‘a’..=‘z’).(for reference)
英数字(‘0’..=‘9’, ‘A’..=‘Z’, ‘a’..=‘z’)を解析するParserを返します。(参照版)

§Example

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

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

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

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

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