pub enum Statement {
Show 15 variants
ERROR,
LocalFunction(Pointer<LocalFunction>),
LocalAssignment(Pointer<LocalAssignment>),
TypeDefinition(Pointer<TypeDefinition>),
IfStatement(Pointer<IfStatement>),
DoBlock(Pointer<DoBlock>),
GenericFor(Pointer<GenericFor>),
NumericalFor(Pointer<NumericalFor>),
RepeatBlock(Pointer<RepeatBlock>),
WhileLoop(Pointer<WhileLoop>),
SetExpression(Pointer<SetExpression>),
CompoundSetExpression(Pointer<CompoundSetExpression>),
FunctionCall(Pointer<FunctionCall>),
GlobalFunction(Pointer<GlobalFunction>),
Comment(Pointer<Comment>),
}Expand description
All possible statements in a CST, excluding
ending ones.
Variants§
ERROR
This statement had an error and couldn’t parse anything.
LocalFunction(Pointer<LocalFunction>)
A local function.
local function foo(bar: string): Qux
endLocalAssignment(Pointer<LocalAssignment>)
A variable declaration.
local foo = bar
local bar = function()
end
local qux = {}TypeDefinition(Pointer<TypeDefinition>)
A type definition.
type Foo = Bar<string, number>
export type Bar<P, R> = (param: P) -> R
type qux = {}IfStatement(Pointer<IfStatement>)
An if statement.
if a then
print("It's a")
elseif b then
print("It's b")
else
print("It's neither a or b :(")
endDoBlock(Pointer<DoBlock>)
A do block.
do
print("Hello, World!")
end§Note
This struct isn’t used for while or for loops, they have their own tokens, and have do blocks as part of their token.
GenericFor(Pointer<GenericFor>)
A generic for loop.
for i, v in ipairs(t) do
print(`{i}: {v}`)
endNumericalFor(Pointer<NumericalFor>)
A numerical for loop.
for i = 1, 100, 2 do
print(i)
endRepeatBlock(Pointer<RepeatBlock>)
A repeat block.
local i = 0
repeat
print(i)
i += 1
until i == 10WhileLoop(Pointer<WhileLoop>)
A while loop.
local i = 0
while i <= 10 do
print(i)
i += 1
endSetExpression(Pointer<SetExpression>)
A set expression.
a = "test"
b, c = true, false, 1
d, e, f = foo()CompoundSetExpression(Pointer<CompoundSetExpression>)
A compound set expression.
foo += 1
bar //= 2FunctionCall(Pointer<FunctionCall>)
A function call.
local _ = foo(1, 2, 3)GlobalFunction(Pointer<GlobalFunction>)
A global function.
function foo(bar: string): Qux
end
function foo:Qux(bar: string): Qux
endComment(Pointer<Comment>)
A comment.
Trait Implementations§
Source§impl GetRange for Statement
impl GetRange for Statement
Source§fn get_range(&self) -> Result<Range, GetRangeError>
fn get_range(&self) -> Result<Range, GetRangeError>
Get the range of the node. This will only fail if
Cst.status is
AstStatus::HasErrors.Source§impl Ord for Statement
impl Ord for Statement
Source§impl PartialOrd for Statement
impl PartialOrd for Statement
impl Eq for Statement
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl !Send for Statement
impl !Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more