Function shrimple_parser::parse_while

source ยท
pub fn parse_while<'input>(
    pred: impl Fn(&char) -> bool
) -> impl Parser<'input, &'input str>
Expand description

Strips characters from the input until pred returned false, i.e. while it returns true, returns the string spanning the stripped characters.

This parser never returns an error, if pred returns true for all the characters in the input, then the output is the entire input, and the rest of the input is an empty string.