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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum AST {
Program(Vec<AST>),
EmptyStatement,
ImportStatement {
data: ImportStatement,
modifier: Option<Annotation>,
},
IfStatement {
conditions: Vec<AST>,
blocks: Vec<AST>,
default: Option<Box<AST>>,
modifier: Option<Annotation>,
},
UnaryOperators {
base: Box<AST>,
prefix: Vec<String>,
postfix: Vec<String>,
modifier: Option<Annotation>,
},
InfixOperators {
operator: String,
lhs: Box<AST>,
rhs: Box<AST>,
modifier: Option<Annotation>,
},
Symbol {
name: String,
scope: Vec<String>,
},
NumberLiteral {
handler: String,
data: String,
},
Number(Number),
StringLiteral {
handler: String,
data: String,
},
String(String),
CommentLiteral {
handler: String,
data: String,
},
Boolean(bool),
None,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum ImportStatement {
Local { root: u8, path: Vec<String> },
LocalAlias { root: u8, path: Vec<String>, alias: String },
URL { path: String },
URLAlias { path: String, alias: String },
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum Annotation {
None,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum Number {
Integer(String),
Integer8(i8),
Integer16(i16),
Integer32(i32),
Integer64(i64),
Integer128(i128),
Integer256(String),
Unsigned(String),
Unsigned8(u8),
Unsigned16(u16),
Unsigned32(u32),
Unsigned64(u64),
Unsigned128(u128),
Unsigned256(String),
Decimal(String),
Decimal32(f32),
Decimal64(f64),
}