Hi,
I encountered a problem with nom5
when trying to use nested separated lists.
Here's the code (can't use playground since it still has nom 4):
fn and_parser(i: &str) -> IResult<&str, Vec<&str>> {
separated_list(tag(" and "), tag("foo"))(i)
}
fn or_parser(i: &str) -> IResult<&str, Vec<Vec<&str>>> {
separated_list(tag(" or "), and_parser)(i)
}
assert_eq!(parser("foo and foo or foo"), Ok(("", vec![vec!["foo", "foo"], vec!["foo"]])));
// FAILS with `Err(Error(("", SeparatedList)))`
assert_eq!(or_parser(""), Ok(("", vec![vec![]])));
Anyone has any insight into what may be causing this error?