1use alloc::string::String;
2use alloc::vec::Vec;
3use thisisplural::Plural;
4
5#[derive(Debug, Clone, PartialEq)]
7pub struct EureTree {
8 pub sections: Vec<TreeSection>,
9 pub bindings: Vec<EureBinding>,
10}
11
12#[derive(Debug, Clone, PartialEq)]
13pub struct TreeSection {
14 pub keys: EureKeys,
15 pub body: SectionBody,
16}
17
18#[derive(Debug, Clone, PartialEq)]
19pub enum SectionBody {
20 Nested(EureTree),
21 Bindings(Vec<EureBinding>),
22}
23
24#[derive(Debug, Clone, PartialEq)]
25pub struct EureBinding {
26 pub keys: Vec<TreeKey>,
27 pub rhs: BindingRhs,
28}
29
30#[derive(Debug, Clone, PartialEq)]
31pub enum BindingRhs {
32 Value(TreeValue),
33 Text(String),
34 Eure(EureTree),
35}
36
37#[derive(Debug, Clone, PartialEq, Eq, Plural)]
38pub struct EureKeys(Vec<TreeKey>);
39
40#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd, Hash)]
41pub enum TreeKey {
42 Ident(String),
43 String(String),
44 Extension(String),
45 ArrayIndex(u32),
46 Array,
47 TupleIndex(u8),
48}
49
50#[derive(Debug, Clone, PartialEq)]
51pub enum TreeValue {
52 String(String),
53 Number(f64),
54 Integer(i64),
55 Boolean(bool),
56 Array(Vec<TreeValue>),
57 Tuple(Vec<TreeValue>),
58 Map(Vec<(TreeValue, TreeValue)>),
59 Eure(EureTree),
60}