forked from gentoo-utils/gentoo-utils
impl atom parsing
This commit is contained in:
106
src/atom/mod.rs
Normal file
106
src/atom/mod.rs
Normal file
@@ -0,0 +1,106 @@
|
||||
use core::option::Option;
|
||||
|
||||
use crate::useflag::UseFlag;
|
||||
use get::Get;
|
||||
|
||||
pub mod parsers;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Blocker {
|
||||
Weak,
|
||||
Strong,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum VersionOperator {
|
||||
Lt,
|
||||
Gt,
|
||||
LtEq,
|
||||
GtEq,
|
||||
Roughly,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Get)]
|
||||
pub struct Category(#[get(method = "get")] String);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Get)]
|
||||
pub struct Name(#[get(method = "get")] String);
|
||||
|
||||
#[derive(Clone, Debug, Get)]
|
||||
pub struct VersionNumber(#[get(method = "get")] String);
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum VersionSuffixKind {
|
||||
Alpha,
|
||||
Beta,
|
||||
Pre,
|
||||
Rc,
|
||||
P,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Get)]
|
||||
pub struct VersionSuffix {
|
||||
kind: VersionSuffixKind,
|
||||
number: Option<VersionNumber>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Get)]
|
||||
pub struct Version {
|
||||
numbers: Vec<VersionNumber>,
|
||||
letter: Option<char>,
|
||||
suffixes: Vec<VersionSuffix>,
|
||||
rev: Option<VersionNumber>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum SlotOperator {
|
||||
Eq,
|
||||
Star,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Get)]
|
||||
pub struct SlotName(#[get(method = "name")] String);
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Get)]
|
||||
pub struct Slot {
|
||||
slot: SlotName,
|
||||
sub: Option<SlotName>,
|
||||
operator: Option<SlotOperator>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum UseDepNegate {
|
||||
Minus,
|
||||
Exclamation,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum UseDepSign {
|
||||
Enabled,
|
||||
Disabled,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum UseDepCondition {
|
||||
Eq,
|
||||
Question,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Get)]
|
||||
pub struct UseDep {
|
||||
negate: Option<UseDepNegate>,
|
||||
flag: UseFlag,
|
||||
sign: Option<UseDepSign>,
|
||||
condition: Option<UseDepCondition>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Get)]
|
||||
pub struct Atom {
|
||||
blocker: Option<Blocker>,
|
||||
version_operator: Option<VersionOperator>,
|
||||
category: Category,
|
||||
name: Name,
|
||||
version: Option<Version>,
|
||||
slot: Option<Slot>,
|
||||
usedeps: Vec<UseDep>,
|
||||
}
|
||||
Reference in New Issue
Block a user