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
54
55
56
57
use crate::*;
#[derive(Clone, Debug, PartialEq, Node)]
pub struct Symbol {
pub nodes: (Locate, Vec<WhiteSpace>),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct Keyword {
pub nodes: (Locate, Vec<WhiteSpace>),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub enum WhiteSpace {
Space(Box<Locate>),
Comment(Box<Comment>),
CompilerDirective(Box<CompilerDirective>),
}
#[derive(Clone, Debug, PartialEq)]
pub struct Paren<T> {
pub nodes: (Symbol, T, Symbol),
}
#[derive(Clone, Debug, PartialEq)]
pub struct Brace<T> {
pub nodes: (Symbol, T, Symbol),
}
#[derive(Clone, Debug, PartialEq)]
pub struct Bracket<T> {
pub nodes: (Symbol, T, Symbol),
}
#[derive(Clone, Debug, PartialEq)]
pub struct ApostropheBrace<T> {
pub nodes: (Symbol, T, Symbol),
}
#[derive(Clone, Debug, PartialEq)]
pub struct List<T, U> {
pub nodes: (U, Vec<(T, U)>),
}
impl<T, U> List<T, U> {
pub fn contents(&self) -> Vec<&U> {
let mut ret = vec![];
let (ref x, ref y) = self.nodes;
ret.push(x);
for (_, y) in y {
ret.push(y)
}
ret
}
}