pub enum Expr {
Value(i32),
Variable(usize, usize),
Operation(Operator, Box<Expr>, Box<Expr>),
FuncCall(usize, Vec<Expr>),
If(Box<Expr>, Box<Expr>, Box<Expr>),
}
Expand description
The expression tree.
Variants§
Value(i32)
The literal value.
Variable(usize, usize)
The variable’s scope depth (specified by expr.circulate
), and index (in program.vars
).
Operation(Operator, Box<Expr>, Box<Expr>)
The operator, and left side value, and right side value.
FuncCall(usize, Vec<Expr>)
The function index (in program.funcs
) and list of arguments (number integrity is already verified.)
If(Box<Expr>, Box<Expr>, Box<Expr>)
The condition, the expression evaluated if condition is true, and false.
Implementations§
Trait Implementations§
impl Eq for Expr
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 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