forked from gentoo-utils/gentoo-utils
support atoms with empty slot
This commit is contained in:
@@ -63,7 +63,7 @@ pub struct SlotName(#[get(method = "name")] String);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Get)]
|
||||
pub struct Slot {
|
||||
slot: SlotName,
|
||||
slot: Option<SlotName>,
|
||||
sub: Option<SlotName>,
|
||||
operator: Option<SlotOperator>,
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ pub fn slotname<'a>() -> impl Parser<&'a str, Output = SlotName> {
|
||||
}
|
||||
|
||||
pub fn slot<'a>() -> impl Parser<&'a str, Output = Slot> {
|
||||
slotname()
|
||||
opt(slotname())
|
||||
.and(opt(slotname().preceded_by(tag("/"))))
|
||||
.and(opt(slot_operator()))
|
||||
.map(|((slot, sub), operator)| Slot {
|
||||
@@ -273,4 +273,11 @@ mod test {
|
||||
|
||||
assert!(atom().check_finished(it).is_err())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_slot() {
|
||||
let it = InputIter::new("foo/bar-1.0.0:=");
|
||||
|
||||
atom().check_finished(it).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user