pub enum Statement {
Show 13 variants
Assign(AssignStatement),
Do(DoStatement),
Call(FunctionCall),
CompoundAssign(CompoundAssignStatement),
Function(Box<FunctionStatement>),
GenericFor(GenericForStatement),
If(IfStatement),
LocalAssign(LocalAssignStatement),
LocalFunction(Box<LocalFunctionStatement>),
NumericFor(Box<NumericForStatement>),
Repeat(RepeatStatement),
While(WhileStatement),
TypeDeclaration(TypeDeclarationStatement),
}Expand description
Represents all possible statement.
Variants§
Assign(AssignStatement)
An assignment statement (e.g., a = 1)
Do(DoStatement)
A do statement (e.g., do ... end)
Call(FunctionCall)
A function call statement (e.g., print("Hello"))
CompoundAssign(CompoundAssignStatement)
A compound assignment statement (e.g., a += 1)
Function(Box<FunctionStatement>)
A function declaration statement (e.g., function name() ... end)
GenericFor(GenericForStatement)
A generic for loop (e.g., for k, v in pairs(t) do ... end)
If(IfStatement)
An if statement (e.g., if condition then ... elseif ... else ... end)
LocalAssign(LocalAssignStatement)
A local variable assignment (e.g., local a, b = 1, 2)
LocalFunction(Box<LocalFunctionStatement>)
A local function declaration (e.g., local function name() ... end)
NumericFor(Box<NumericForStatement>)
A numeric for loop (e.g., for i = 1, 10, 2 do ... end)
Repeat(RepeatStatement)
A repeat loop (e.g., repeat ... until condition)
While(WhileStatement)
A while loop (e.g., while condition do ... end)
TypeDeclaration(TypeDeclarationStatement)
A type declaration statement (e.g., type T = string | number)
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn mutate_first_token(&mut self) -> &mut Token
pub fn mutate_first_token(&mut self) -> &mut Token
Returns a mutable reference to the first token of this statement.
Sourcepub fn mutate_last_token(&mut self) -> &mut Token
pub fn mutate_last_token(&mut self) -> &mut Token
Returns a mutable reference to the last token of this statement, creating it if missing.
Trait Implementations§
Source§impl From<AssignStatement> for Statement
impl From<AssignStatement> for Statement
Source§fn from(assign: AssignStatement) -> Statement
fn from(assign: AssignStatement) -> Statement
Source§impl From<CompoundAssignStatement> for Statement
impl From<CompoundAssignStatement> for Statement
Source§fn from(statement: CompoundAssignStatement) -> Statement
fn from(statement: CompoundAssignStatement) -> Statement
Source§impl From<DoStatement> for Statement
impl From<DoStatement> for Statement
Source§fn from(do_statement: DoStatement) -> Statement
fn from(do_statement: DoStatement) -> Statement
Source§impl From<FunctionCall> for Statement
impl From<FunctionCall> for Statement
Source§fn from(call: FunctionCall) -> Statement
fn from(call: FunctionCall) -> Statement
Source§impl From<FunctionStatement> for Statement
impl From<FunctionStatement> for Statement
Source§fn from(function: FunctionStatement) -> Statement
fn from(function: FunctionStatement) -> Statement
Source§impl From<GenericForStatement> for Statement
impl From<GenericForStatement> for Statement
Source§fn from(generic_for: GenericForStatement) -> Statement
fn from(generic_for: GenericForStatement) -> Statement
Source§impl From<IfStatement> for Statement
impl From<IfStatement> for Statement
Source§fn from(if_statement: IfStatement) -> Statement
fn from(if_statement: IfStatement) -> Statement
Source§impl From<LocalAssignStatement> for Statement
impl From<LocalAssignStatement> for Statement
Source§fn from(assign: LocalAssignStatement) -> Statement
fn from(assign: LocalAssignStatement) -> Statement
Source§impl From<LocalFunctionStatement> for Statement
impl From<LocalFunctionStatement> for Statement
Source§fn from(function: LocalFunctionStatement) -> Statement
fn from(function: LocalFunctionStatement) -> Statement
Source§impl From<NumericForStatement> for Statement
impl From<NumericForStatement> for Statement
Source§fn from(numeric_for: NumericForStatement) -> Statement
fn from(numeric_for: NumericForStatement) -> Statement
Source§impl From<RepeatStatement> for Statement
impl From<RepeatStatement> for Statement
Source§fn from(repeat_statement: RepeatStatement) -> Statement
fn from(repeat_statement: RepeatStatement) -> Statement
Source§impl From<TypeDeclarationStatement> for Statement
impl From<TypeDeclarationStatement> for Statement
Source§fn from(type_declaration: TypeDeclarationStatement) -> Statement
fn from(type_declaration: TypeDeclarationStatement) -> Statement
Source§impl From<WhileStatement> for Statement
impl From<WhileStatement> for Statement
Source§fn from(while_statement: WhileStatement) -> Statement
fn from(while_statement: WhileStatement) -> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more