Skip to main content

luaparser/nodes/statements/
mod.rs

1mod assign;
2mod do_statement;
3mod function_statement;
4mod generic_for;
5mod if_statement;
6mod local_assign;
7mod local_function;
8mod numeric_for;
9mod repeat_statement;
10mod while_statement;
11
12pub use assign::*;
13pub use do_statement::*;
14pub use function_statement::*;
15pub use generic_for::*;
16pub use if_statement::*;
17pub use local_assign::*;
18pub use local_function::*;
19pub use numeric_for::*;
20pub use repeat_statement::*;
21pub use while_statement::*;
22
23use crate::nodes::{Expression, FunctionCall};
24use crate::parser::builders;
25
26#[derive(Clone, Debug, PartialEq, Eq)]
27pub enum Statement {
28    Assign(AssignStatement),
29    Do(DoStatement),
30    Call(FunctionCall),
31    Function(FunctionStatement),
32    GenericFor(GenericForStatement),
33    If(IfStatement),
34    LocalAssign(LocalAssignStatement),
35    LocalFunction(LocalFunctionStatement),
36    NumericFor(NumericForStatement),
37    Repeat(RepeatStatement),
38    While(WhileStatement),
39}
40
41#[derive(Clone, Debug, PartialEq, Eq)]
42pub enum LastStatement {
43    Break,
44    Return(Vec<Expression>),
45}
46
47impl builders::LastStatement<Expression> for LastStatement {
48    fn break_statement() -> Self {
49        Self::Break
50    }
51
52    fn return_statement(expressions: Vec<Expression>) -> Self {
53        Self::Return(expressions)
54    }
55}