pub enum Expr {
Show 16 variants
Nil,
Bool(bool),
Int(i64),
Float(f64),
Str(String),
Vararg,
Ident(String),
Index {
table: Box<Expr>,
key: Box<Expr>,
},
Field {
table: Box<Expr>,
name: String,
},
Call {
callee: Box<Expr>,
args: Vec<Expr>,
},
MethodCall {
obj: Box<Expr>,
method: String,
args: Vec<Expr>,
},
Unary {
op: UnOp,
expr: Box<Expr>,
},
Binary {
op: BinOp,
lhs: Box<Expr>,
rhs: Box<Expr>,
},
TableCtor(Vec<TableField>),
FuncExpr {
params: Vec<String>,
vararg: bool,
body: Vec<Stmt>,
},
Ternary {
cond: Box<Expr>,
then_val: Box<Expr>,
else_val: Box<Expr>,
},
}Variants§
Nil
nil
Bool(bool)
true / false
Int(i64)
integer literal
Float(f64)
float literal
Str(String)
string literal
Vararg
… (varargs)
Ident(String)
identifier reference
Index
table access: expr[expr]
Field
field access: expr.name
Call
function call: expr(args)
MethodCall
method call: expr:name(args)
Unary
unary op: op expr
Binary
binary op: lhs op rhs
TableCtor(Vec<TableField>)
table constructor: { [k]=v, … }
FuncExpr
anonymous function: function(params) body end
Ternary
ternary: cond ? then_val : else_val (sugar)
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.