1#![allow(dead_code)]
2
3#[derive(Debug)]
4pub struct BinaryOp {
5 pub op: String,
6 pub left: Box<LuauNode>,
7 pub right: Box<LuauNode>,
8}
9
10#[derive(Debug)]
11pub struct Block {
12 pub statements: Vec<LuauNode>,
13}
14
15#[derive(Debug)]
16pub struct Call {
17 pub func: String,
18 pub args: Vec<LuauNode>,
19}
20
21#[derive(Debug)]
22pub struct Deref {
23 pub expr: Box<LuauNode>,
24}
25
26#[derive(Debug)]
27pub struct Range {
28 pub start: Option<Box<LuauNode>>,
29 pub end: Option<Box<LuauNode>>,
30}
31
32#[derive(Debug)]
33pub struct ForIn {
34 pub vars: Vec<String>,
35 pub iter: Box<LuauNode>,
36 pub body: Box<LuauNode>,
37}
38
39#[derive(Debug)]
40pub struct Function {
41 pub name: String,
42 pub params: Vec<LuauParam>,
43 pub ret_type: Option<LuauType>,
44 pub body: Box<LuauNode>,
45}
46
47#[derive(Debug)]
48pub struct If {
49 pub condition: Box<LuauNode>,
50 pub then_branch: Box<LuauNode>,
51 pub else_branch: Option<Box<LuauNode>>,
52}
53
54#[derive(Debug)]
55pub struct Let {
56 pub name: String,
57 pub expr: Box<LuauNode>,
58}
59
60#[derive(Debug)]
61pub struct Ref {
62 pub name: String,
63 pub mutable: bool,
64}
65
66#[derive(Debug)]
67pub struct Return {
68 pub value: Option<Box<LuauNode>>,
69}
70
71#[derive(Debug)]
72pub struct While {
73 pub condition: Box<LuauNode>,
74 pub body: Box<LuauNode>,
75}
76
77#[derive(Debug)]
78pub struct Value {
79 pub value: String,
80}
81
82#[derive(Debug)]
84pub enum LuauNode {
85 BinaryOp(BinaryOp),
86 Block(Block),
87 Call(Call),
88 Deref(Deref),
89 Range(Range),
90 ForIn(ForIn),
91 Function(Function),
92 If(If),
93 Let(Let),
94 Ref(Ref),
95 Return(Return),
96 While(While),
97 Value(Value),
98}
99
100#[derive(Debug)]
101pub struct LuauParam {
102 pub name: String,
103 pub typ: LuauType,
104}
105
106#[derive(Debug)]
107pub struct LuauField {
108 pub name: String,
109 pub typ: String,
110}
111
112#[derive(Debug)]
113pub struct LuauType {
114 pub type_name: String,
115 pub is_mut: bool,
116 pub is_ref: bool,
117}