darklua_core/nodes/statements/
mod.rs

1mod assign;
2mod compound_assign;
3mod do_statement;
4mod function;
5mod generic_for;
6mod if_statement;
7mod last_statement;
8mod local_assign;
9mod local_function;
10mod numeric_for;
11mod repeat_statement;
12mod type_declaration;
13mod while_statement;
14
15pub use assign::*;
16pub use compound_assign::*;
17pub use do_statement::*;
18pub use function::*;
19pub use generic_for::*;
20pub use if_statement::*;
21pub use last_statement::*;
22pub use local_assign::*;
23pub use local_function::*;
24pub use numeric_for::*;
25pub use repeat_statement::*;
26pub use type_declaration::*;
27pub use while_statement::*;
28
29use crate::nodes::FunctionCall;
30
31use super::impl_token_fns;
32
33#[derive(Clone, Debug, PartialEq, Eq)]
34pub enum Statement {
35    Assign(AssignStatement),
36    Do(DoStatement),
37    Call(FunctionCall),
38    CompoundAssign(CompoundAssignStatement),
39    Function(FunctionStatement),
40    GenericFor(GenericForStatement),
41    If(IfStatement),
42    LocalAssign(LocalAssignStatement),
43    LocalFunction(LocalFunctionStatement),
44    NumericFor(Box<NumericForStatement>),
45    Repeat(RepeatStatement),
46    While(WhileStatement),
47    TypeDeclaration(TypeDeclarationStatement),
48}
49
50impl From<AssignStatement> for Statement {
51    fn from(assign: AssignStatement) -> Statement {
52        Statement::Assign(assign)
53    }
54}
55
56impl From<DoStatement> for Statement {
57    fn from(do_statement: DoStatement) -> Statement {
58        Statement::Do(do_statement)
59    }
60}
61
62impl From<CompoundAssignStatement> for Statement {
63    fn from(statement: CompoundAssignStatement) -> Statement {
64        Statement::CompoundAssign(statement)
65    }
66}
67
68impl From<FunctionCall> for Statement {
69    fn from(call: FunctionCall) -> Statement {
70        Statement::Call(call)
71    }
72}
73
74impl From<FunctionStatement> for Statement {
75    fn from(function: FunctionStatement) -> Statement {
76        Statement::Function(function)
77    }
78}
79
80impl From<GenericForStatement> for Statement {
81    fn from(generic_for: GenericForStatement) -> Statement {
82        Statement::GenericFor(generic_for)
83    }
84}
85
86impl From<IfStatement> for Statement {
87    fn from(if_statement: IfStatement) -> Statement {
88        Statement::If(if_statement)
89    }
90}
91
92impl From<LocalAssignStatement> for Statement {
93    fn from(assign: LocalAssignStatement) -> Statement {
94        Statement::LocalAssign(assign)
95    }
96}
97
98impl From<LocalFunctionStatement> for Statement {
99    fn from(function: LocalFunctionStatement) -> Statement {
100        Statement::LocalFunction(function)
101    }
102}
103
104impl From<NumericForStatement> for Statement {
105    fn from(numeric_for: NumericForStatement) -> Statement {
106        Statement::NumericFor(numeric_for.into())
107    }
108}
109
110impl From<RepeatStatement> for Statement {
111    fn from(repeat_statement: RepeatStatement) -> Statement {
112        Statement::Repeat(repeat_statement)
113    }
114}
115
116impl From<WhileStatement> for Statement {
117    fn from(while_statement: WhileStatement) -> Statement {
118        Statement::While(while_statement)
119    }
120}
121
122impl From<TypeDeclarationStatement> for Statement {
123    fn from(type_declaration: TypeDeclarationStatement) -> Statement {
124        Statement::TypeDeclaration(type_declaration)
125    }
126}