diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-11-13 18:03:34 +0000 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-11-13 18:03:34 +0000 |
| commit | 1882ce3137e246aaa145568c6ba405f1be3f3a53 (patch) | |
| tree | 04693f304160a720fa57b2d869a78b75e9e767ba /src/atom/parsers.rs | |
| parent | f4a45717d2bc952a545f7cee28e941a65744604b (diff) | |
| download | gentoo-utils-1882ce3137e246aaa145568c6ba405f1be3f3a53.tar.gz | |
impl Cpv type
Diffstat (limited to 'src/atom/parsers.rs')
| -rw-r--r-- | src/atom/parsers.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/atom/parsers.rs b/src/atom/parsers.rs index 0f95d16..9d3cb15 100644 --- a/src/atom/parsers.rs +++ b/src/atom/parsers.rs @@ -5,7 +5,7 @@ use mon::{Parser, ParserIter, r#if, numeric1, one_of, tag}; use crate::{ Parseable, atom::{ - Atom, Blocker, Category, Name, Slot, SlotName, SlotOperator, UseDep, UseDepCondition, + Atom, Blocker, Category, Cpv, Name, Slot, SlotName, SlotOperator, UseDep, UseDepCondition, UseDepNegate, UseDepSign, Version, VersionNumber, VersionNumbers, VersionOperator, VersionSuffix, VersionSuffixKind, VersionSuffixes, }, @@ -334,6 +334,21 @@ impl<'a> Parseable<'a, &'a str> for Atom { } } +impl<'a> Parseable<'a, &'a str> for Cpv { + type Parser = impl Parser<&'a str, Output = Self>; + + fn parser() -> Self::Parser { + Category::parser() + .and(Name::parser().preceded_by(tag("/"))) + .and(Version::parser().preceded_by(tag("-"))) + .map(|((category, name), version)| Cpv { + category, + name, + version, + }) + } +} + #[cfg(test)] mod test { |
