summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-11-14 22:25:20 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-11-14 22:25:20 +0000
commit61292f664608def91a03417893556ebd95424849 (patch)
tree4898000f12c266f07861b5a061936c87fc28833d /src
parent85853ada1e3c8ecfdffa72fad4fcf34860661f35 (diff)
downloadgentoo-utils-61292f664608def91a03417893556ebd95424849.tar.gz
bump mon and use SeparatedByWithTrailing combinator where needed
The new version of mon fixed the SeparatedBy combinator to not allow trailing delimiters. This broke the Depend expr parser, because the exprs are padded with whitespace. Using the new SeparatedByWithTrailing combinator fixes this issue.
Diffstat (limited to 'src')
-rw-r--r--src/ebuild/parsers.rs30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/ebuild/parsers.rs b/src/ebuild/parsers.rs
index 8ab2978..77eb494 100644
--- a/src/ebuild/parsers.rs
+++ b/src/ebuild/parsers.rs
@@ -114,34 +114,26 @@ where
fn parser() -> Self::Parser {
|it| {
- let all_of_group = Depend::parser()
- .separated_by(whitespace1())
- .at_least(1)
- .delimited_by(tag("(").followed_by(whitespace1()), tag(")"))
- .map(|exprs| Depend::AllOf(exprs));
+ let exprs = || {
+ Depend::parser()
+ .separated_by_with_trailing(whitespace1())
+ .at_least(1)
+ .delimited_by(tag("(").followed_by(whitespace1()), tag(")"))
+ };
- let any_of_group = Depend::parser()
- .separated_by(whitespace1())
- .at_least(1)
- .delimited_by(tag("(").followed_by(whitespace1()), tag(")"))
+ let all_of_group = exprs().map(|exprs| Depend::AllOf(exprs));
+
+ let any_of_group = exprs()
.preceded_by(tag("||").followed_by(whitespace1()))
.map(|exprs| Depend::AnyOf(exprs));
- let one_of_group = Depend::parser()
- .separated_by(whitespace1())
- .at_least(1)
- .delimited_by(tag("(").followed_by(whitespace1()), tag(")"))
+ let one_of_group = exprs()
.preceded_by(tag("^^").followed_by(whitespace1()))
.map(|exprs| Depend::OneOf(exprs));
let conditional_group = Conditional::parser()
.followed_by(whitespace1())
- .and(
- Depend::parser()
- .separated_by(whitespace1())
- .at_least(1)
- .delimited_by(tag("(").followed_by(whitespace1()), tag(")")),
- )
+ .and(exprs())
.map(|(conditional, exprs)| Depend::ConditionalGroup(conditional, exprs));
T::parser()