Enum full_moon::ast::Expression
source · #[non_exhaustive]pub enum Expression {
Show 13 variants
BinaryOperator {
lhs: Box<Expression>,
binop: BinOp,
rhs: Box<Expression>,
},
Parentheses {
contained: ContainedSpan,
expression: Box<Expression>,
},
UnaryOperator {
unop: UnOp,
expression: Box<Expression>,
},
Function((TokenReference, FunctionBody)),
FunctionCall(FunctionCall),
IfExpression(IfExpression),
InterpolatedString(InterpolatedString),
TableConstructor(TableConstructor),
Number(TokenReference),
String(TokenReference),
Symbol(TokenReference),
TypeAssertion {
expression: Box<Expression>,
type_assertion: TypeAssertion,
},
Var(Var),
}
Expand description
An expression, mostly useful for getting values
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BinaryOperator
Fields
lhs: Box<Expression>
The left hand side of the binary operation, the 1
part of 1 + 3
rhs: Box<Expression>
The right hand side of the binary operation, the 3
part of 1 + 3
A binary operation, such as 1 + 3
Parentheses
Fields
contained: ContainedSpan
The parentheses of the expression
expression: Box<Expression>
The expression inside the parentheses
A statement in parentheses, such as (#list)
UnaryOperator
Fields
expression: Box<Expression>
The expression the operation is being done on, the list
part of #list
A unary operation, such as #list
Function((TokenReference, FunctionBody))
An anonymous function, such as function() end)
FunctionCall(FunctionCall)
A call of a function, such as call()
IfExpression(IfExpression)
roblox
only.An if expression, such as if foo then true else false
.
Only available when the “roblox” feature flag is enabled.
InterpolatedString(InterpolatedString)
roblox
only.An interpolated string, such as `hello {"world"}`
Only available when the “roblox” feature flag is enabled.
TableConstructor(TableConstructor)
A table constructor, such as { 1, 2, 3 }
Number(TokenReference)
A number token, such as 3.3
String(TokenReference)
A string token, such as "hello"
Symbol(TokenReference)
A symbol, such as true
TypeAssertion
Fields
expression: Box<Expression>
The expression being asserted
type_assertion: TypeAssertion
The type assertion
roblox
only.A value that has been asserted for a particular type, for use in Luau. Only available when the “roblox” feature flag is enabled.
Var(Var)
A more complex value, such as call().x
Trait Implementations§
source§impl Clone for Expression
impl Clone for Expression
source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Expression
impl Debug for Expression
source§impl<'de> Deserialize<'de> for Expression
impl<'de> Deserialize<'de> for Expression
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for Expression
impl Display for Expression
source§impl Node for Expression
impl Node for Expression
source§fn start_position(&self) -> Option<Position>
fn start_position(&self) -> Option<Position>
source§fn end_position(&self) -> Option<Position>
fn end_position(&self) -> Option<Position>
source§fn similar(&self, other: &Self) -> bool
fn similar(&self, other: &Self) -> bool
source§impl PartialEq for Expression
impl PartialEq for Expression
source§fn eq(&self, other: &Expression) -> bool
fn eq(&self, other: &Expression) -> bool
self
and other
values to be equal, and is used
by ==
.