[][src]Function lip::chomp_while1

pub fn chomp_while1<'a, F: 'a, S: Clone + 'a>(
    predicate: F,
    expecting: &'a str
) -> BoxedParser<'a, (), S> where
    F: Fn(&char) -> bool

Chomp one or more characters if they pass the test.

This can be used to chomp digits:

fn digits<'a, S: Clone + 'a>() -> impl Parser<'a, String, S> {
  take_chomped(chomp_while1(
    &(| character: &char | character.is_digit(10)),
    "decimal digits"
  ))
}

See digits for a more complete digits parser with leading zero checks.