combinators

This commit is contained in:
Greg Shuflin 2024-01-26 00:23:21 -08:00
parent 97d35df687
commit bffaca4d68

View File

@ -67,4 +67,11 @@ mod tests {
let output = parser.parse("abcd").unwrap();
assert_eq!((59, "cd"), output);
}
#[test]
fn test_combinators() {
let parser = sequence(map(repeated(literal_char('a')), |_| 10), literal_char('b'));
let output = parser.parse("aaaaaaaabcd").unwrap();
assert_eq! {((10, 'b'), "cd"), output};
}
}