diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-10-28 12:26:30 +0000 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-10-28 12:26:30 +0000 |
| commit | 024b3df6913ed13201de087646bf86fe4d6ae440 (patch) | |
| tree | e86a5f155035d2c258a34811ea1d520d02a3180c /src | |
| parent | b54616a6dd4f512b4ec87c3780c36257e5c322b3 (diff) | |
| download | gentoo-utils-024b3df6913ed13201de087646bf86fe4d6ae440.tar.gz | |
change depend::Expr::Conditional to ConditionalGroup
Diffstat (limited to 'src')
| -rw-r--r-- | src/depend/mod.rs | 2 | ||||
| -rw-r--r-- | src/depend/parsers.rs | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/depend/mod.rs b/src/depend/mod.rs index ffa7836..9a7fb71 100644 --- a/src/depend/mod.rs +++ b/src/depend/mod.rs @@ -11,8 +11,8 @@ pub enum Conditional { #[derive(Clone, Debug)] pub enum Expr { Atom(Atom), - Conditional(Conditional), AllOf(Vec<Expr>), AnyOf(Vec<Expr>), OneOf(Vec<Expr>), + ConditionalGroup(Conditional, Vec<Expr>), } diff --git a/src/depend/parsers.rs b/src/depend/parsers.rs index 7a69fee..26139ea 100644 --- a/src/depend/parsers.rs +++ b/src/depend/parsers.rs @@ -12,29 +12,35 @@ impl<'a> Parseable<'a, &'a str> for Expr { fn parser() -> Self::Parser { |it| { - let all_of = Expr::parser() + let all_of_group = Expr::parser() .separated_list(whitespace1(), 1..) .delimited_by(tag("(").followed_by(whitespace1()), tag(")")) .map(|exprs| Expr::AllOf(exprs)); - let any_of = Expr::parser() + let any_of_group = Expr::parser() .separated_list(whitespace1(), 1..) .delimited_by(tag("(").followed_by(whitespace1()), tag(")")) .preceded_by(tag("||").followed_by(whitespace1())) .map(|exprs| Expr::AnyOf(exprs)); - let one_of = Expr::parser() + let one_of_group = Expr::parser() .separated_list(whitespace1(), 1..) .delimited_by(tag("(").followed_by(whitespace1()), tag(")")) .preceded_by(tag("^^").followed_by(whitespace1())) .map(|exprs| Expr::OneOf(exprs)); + let conditional_group = Expr::parser() + .separated_list(whitespace1(), 1..) + .delimited_by(tag("(").followed_by(whitespace1()), tag(")")) + .preceded_by(Conditional::parser().followed_by(whitespace1())) + .map(|exprs| Expr::OneOf(exprs)); + Atom::parser() .map(|atom| Expr::Atom(atom)) - .or(Conditional::parser().map(|conditional| Expr::Conditional(conditional))) - .or(any_of) - .or(all_of) - .or(one_of) + .or(conditional_group) + .or(any_of_group) + .or(all_of_group) + .or(one_of_group) .parse(it) } } |
