fix conditional group parser

This commit is contained in:
John Turner
2025-10-29 12:47:46 +00:00
parent f12867ea9f
commit bdd1188409

View File

@@ -29,11 +29,14 @@ impl<'a> Parseable<'a, &'a str> for Expr {
.preceded_by(tag("^^").followed_by(whitespace1())) .preceded_by(tag("^^").followed_by(whitespace1()))
.map(|exprs| Expr::OneOf(exprs)); .map(|exprs| Expr::OneOf(exprs));
let conditional_group = Expr::parser() let conditional_group = Conditional::parser()
.followed_by(whitespace1())
.and(
Expr::parser()
.separated_list(whitespace1(), 1..) .separated_list(whitespace1(), 1..)
.delimited_by(tag("(").followed_by(whitespace1()), tag(")")) .delimited_by(tag("(").followed_by(whitespace1()), tag(")")),
.preceded_by(Conditional::parser().followed_by(whitespace1())) )
.map(|exprs| Expr::OneOf(exprs)); .map(|(conditional, exprs)| Expr::ConditionalGroup(conditional, exprs));
Atom::parser() Atom::parser()
.map(|atom| Expr::Atom(atom)) .map(|atom| Expr::Atom(atom))