pub enum Expression {
/// A binary operation, such as `1 + 3`
BinaryOperator {
/// The left hand side of the binary operation, the `1` part of `1 + 3`
lhs: Box<Expression>,
/// The binary operation used, the `+` part of `1 + 3`
binop: BinOp,
/// The right hand side of the binary operation, the `3` part of `1 + 3`
rhs: Box<Expression>,
},
/// A statement in parentheses, such as `(#list)`
Parentheses {
/// The parentheses of the expression
contained: ContainedSpan,
/// The expression inside the parentheses
expression: Box<Expression>,
},
/// A unary operation, such as `#list`
UnaryOperator {
/// The unary operation, the `#` part of `#list`
unop: UnOp,
/// The expression the operation is being done on, the `list` part of `#list`
expression: Box<Expression>,
},
/// An anonymous function, such as `function() end`
Function(Box<AnonymousFunction>),
/// A call of a function, such as `call()`
FunctionCall(FunctionCall),
/// An if expression, such as `if foo then true else false` (Luau only)
#[cfg(feature = "luau")]
IfExpression(IfExpression),
/// An interpolated string, such as `` `hello {"world"}` `` (Luau only)
#[cfg(feature = "luau")]
InterpolatedString(InterpolatedString),
/// A table constructor, such as `{ 1, 2, 3 }`
TableConstructor(TableConstructor),
/// A number token, such as `3.3`
Number(TokenReference),
/// A string token, such as `"hello"`
String(TokenReference),
/// A symbol, such as `true`
Symbol(TokenReference),
/// A value that has been asserted for a particular type (Luau only)
#[cfg(feature = "luau")]
TypeAssertion {
/// The expression being asserted
expression: Box<Expression>,
/// The type assertion
type_assertion: TypeAssertion,
},
/// A more complex value, such as `call().x`
Var(Var),
}