From 61292f664608def91a03417893556ebd95424849 Mon Sep 17 00:00:00 2001 From: John Turner Date: Fri, 14 Nov 2025 22:25:20 +0000 Subject: [PATCH] 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. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/ebuild/parsers.rs | 30 +++++++++++------------------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4b5c42..824205e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,7 +40,7 @@ dependencies = [ [[package]] name = "mon" version = "0.1.0" -source = "git+https://jturnerusa.dev/cgit/mon/?rev=5b7d7eec545864727d33bb59503f0349cf02b337#5b7d7eec545864727d33bb59503f0349cf02b337" +source = "git+https://jturnerusa.dev/cgit/mon/?rev=34d8eeb989012b0f20041b11a60ced24ca702527#34d8eeb989012b0f20041b11a60ced24ca702527" [[package]] name = "proc-macro2" diff --git a/Cargo.toml b/Cargo.toml index 26d1de3..345c08d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2024" [dependencies] -mon = { git = "https://jturnerusa.dev/cgit/mon/", rev = "5b7d7eec545864727d33bb59503f0349cf02b337" } +mon = { git = "https://jturnerusa.dev/cgit/mon/", rev = "34d8eeb989012b0f20041b11a60ced24ca702527" } get = { git = "https://jturnerusa.dev/cgit/get/", rev = "cd5f75b65777a855ab010c3137304ac05f2e56b8" } itertools = "0.14.0" thiserror = "2.0.17" 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()