1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
mod methods;
mod parse;
#[cfg(test)]
mod tests;
// mod tests;
use nom::{
    bytes::complete::tag, character::complete::char, combinator::opt, sequence::tuple, IResult,
};

///
#[derive(Clone, Debug, PartialEq)]
pub struct AstGroup<'a> {
    head: AstStyle<'a>,
    children: Vec<AstGroupItem<'a>>,
}

///
#[derive(Clone, Debug, PartialEq)]
pub enum AstGroupItem<'a> {
    Grouped(AstGroup<'a>),
    Styled(AstStyle<'a>),
    // SelfReference(AstReference),
}

///
#[derive(Clone, Debug, PartialEq)]
pub struct AstStyle<'a> {
    pub negative: bool,
    pub variants: Vec<ASTVariant<'a>>,
    pub elements: Vec<&'a str>,
    pub arbitrary: Option<&'a str>,
}

///
#[derive(Clone, Debug, PartialEq)]
pub struct AstArbitrary<'a> {
    pub arbitrary: &'a str,
}

#[derive(Clone, Debug, PartialEq, Default)]
pub struct AstElements<'a> {
    pub elements: Vec<&'a str>,
}

#[derive(Clone, Debug, PartialEq)]
pub struct AstReference {}

#[derive(Clone, Debug, PartialEq)]
pub struct ASTVariant<'a> {
    pub not: bool,
    pub pseudo: bool,
    pub names: Vec<&'a str>,
}