Function memoir::parsers::any

source · []
pub fn any<O, U>(p: Parser<O>) -> Parser<U> where
    O: 'static,
    U: 'static + FromIterator<O>, 
Expand description

Applies the parser any number of times.

use memoir::*;

let p = any(symbol('?'));

assert_eq!(p.to_string(), "'?'*");
assert_eq!(p.parse("???"), Ok((String::from("???"), "")));

assert!(p.parse("").is_ok());
assert!(p.parse("?").is_ok());
assert!(p.parse("??????").is_ok());