Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 14 variants Assign(AssignStatement), Do(DoStatement), Call(FunctionCall), CompoundAssign(CompoundAssignStatement), Function(Box<FunctionStatement>), GenericFor(GenericForStatement), If(IfStatement), LocalAssign(VariableAssignment), LocalFunction(Box<FunctionAssignment>), NumericFor(Box<NumericForStatement>), Repeat(RepeatStatement), While(WhileStatement), TypeDeclaration(TypeDeclarationStatement), TypeFunction(Box<TypeFunctionStatement>),
}
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(VariableAssignment)

A local variable assignment (e.g., local a, b = 1, 2)

§

LocalFunction(Box<FunctionAssignment>)

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)

§

TypeFunction(Box<TypeFunctionStatement>)

A type function declaration (e.g., type function name() ... end)

Implementations§

Source§

impl Statement

Source

pub fn mutate_first_token(&mut self) -> &mut Token

Returns a mutable reference to the first token of this statement.

Source

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 Clone for Statement

Source§

fn clone(&self) -> Statement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Statement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Statement

Source§

impl From<AssignStatement> for Statement

Source§

fn from(assign: AssignStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<CompoundAssignStatement> for Statement

Source§

fn from(statement: CompoundAssignStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<DoStatement> for Statement

Source§

fn from(do_statement: DoStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<FunctionAssignment> for Statement

Source§

fn from(function: FunctionAssignment) -> Statement

Converts to this type from the input type.
Source§

impl From<FunctionCall> for Statement

Source§

fn from(call: FunctionCall) -> Statement

Converts to this type from the input type.
Source§

impl From<FunctionStatement> for Statement

Source§

fn from(function: FunctionStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<GenericForStatement> for Statement

Source§

fn from(generic_for: GenericForStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<IfStatement> for Statement

Source§

fn from(if_statement: IfStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<NumericForStatement> for Statement

Source§

fn from(numeric_for: NumericForStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<RepeatStatement> for Statement

Source§

fn from(repeat_statement: RepeatStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<TypeDeclarationStatement> for Statement

Source§

fn from(type_declaration: TypeDeclarationStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<TypeFunctionStatement> for Statement

Source§

fn from(type_function: TypeFunctionStatement) -> Statement

Converts to this type from the input type.
Source§

impl From<VariableAssignment> for Statement

Source§

fn from(assign: VariableAssignment) -> Statement

Converts to this type from the input type.
Source§

impl From<WhileStatement> for Statement

Source§

fn from(while_statement: WhileStatement) -> Statement

Converts to this type from the input type.
Source§

impl PartialEq for Statement

Source§

fn eq(&self, other: &Statement) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Statement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.