oni_comb_parser_rs::prelude

Function elm_oct_digit

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

Returns a Parser that parses oct digits (‘0’..=‘8’).
8進の数字(‘0’..=‘8’)を解析するParserを返します。

§Example

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

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

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

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

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