Remove some uses of closures in test

This commit is contained in:
Greg Shuflin 2023-02-25 02:50:20 -08:00
parent 116e2fc361
commit f15488194c

View File

@ -61,8 +61,13 @@ fn json_bool<'a>() -> impl JsonParser<'a, JsonValue> {
} }
fn json_number<'a>() -> impl JsonParser<'a, JsonValue> { fn json_number<'a>() -> impl JsonParser<'a, JsonValue> {
let digit = || one_of("1234567890"); fn digit<'a>() -> impl JsonParser<'a, &'a str> {
let digits = || repeated(digit()).at_least(1); one_of("1234567890")
}
fn digits<'a>() -> impl JsonParser<'a, Vec<&'a str>> {
repeated(digit()).at_least(1)
}
let json_number_inner = choice(( let json_number_inner = choice((
seq((digits(), literal(".").ignore_then(digits()).optional())).map( seq((digits(), literal(".").ignore_then(digits()).optional())).map(