pub enum Stat {
Show 18 variants
Do(Block),
While {
cond: ExprId,
body: Block,
},
Repeat {
body: Block,
cond: ExprId,
},
If {
arms: Vec<(ExprId, u32, Block)>,
else_body: Option<Block>,
},
NumericFor {
var: Name,
start: ExprId,
limit: ExprId,
step: Option<ExprId>,
body: Block,
},
GenericFor {
vars: Vec<Name>,
exprs: Vec<ExprId>,
body: Block,
expr_line: u32,
},
Local {
collective: Option<Attrib>,
names: Vec<AttribName>,
exprs: Vec<ExprId>,
},
Global {
collective: Option<Attrib>,
names: Vec<AttribName>,
exprs: Vec<ExprId>,
},
GlobalAll {
attrib: Option<Attrib>,
},
Assign {
targets: Vec<ExprId>,
exprs: Vec<ExprId>,
},
Call(ExprId),
Function {
name: FuncName,
body: FuncBody,
},
LocalFunction {
name: Name,
body: FuncBody,
},
GlobalFunction {
name: Name,
body: FuncBody,
},
Return {
exprs: Vec<ExprId>,
line: u32,
},
Break {
line: u32,
},
Goto(Name),
Label(Name),
}Expand description
Top-level statement kinds — every Lua syntactic form except expressions.
Variants§
Do(Block)
do ... end block.
While
while cond do ... end.
Repeat
repeat ... until cond.
If
if ... elseif ... else ... end.
Fields
arms: Vec<(ExprId, u32, Block)>(condition, then_line, body) for the if and each elseif. The
then_line is the source line of the then keyword for that arm
— PUC 5.3 attributes the conditional-skip JMP to that line so a
taken if-then-else fires a line hook for the then keyword before
the body (for i=1,n do … then … end traces include the then
keyword line). 5.4 collapsed that back to the body’s first line;
see if_stat in the compiler for the version split.
NumericFor
for var = start, limit [, step] do ... end.
Fields
GenericFor
for v1, v2, ... in exprs do ... end.
Fields
Local
local [<attrib>] names = exprs.
Fields
names: Vec<AttribName>Names being introduced, each with its optional per-name attribute.
Global
5.5 global declaration.
Fields
names: Vec<AttribName>Declared global names.
GlobalAll
5.5 global [attrib] *.
Assign
Multiple assignment targets = exprs.
Fields
Call(ExprId)
Expression statement (function or method call).
Function
function a.b.c:m() ... end.
LocalFunction
local function name() ... end.
GlobalFunction
5.5 global function f() ....
Return
return exprs.
Fields
Break
break.
Goto(Name)
goto label.
Label(Name)
::label:: declaration.