pub enum Expression {
Number(f64),
Variable(String),
Unary {
op: OperatorType,
expr: Box<Expression>,
},
Binary {
left: Box<Expression>,
op: OperatorType,
right: Box<Expression>,
},
Call {
callee: String,
args: Vec<Expression>,
},
}Expand description
Expression type, represents… an expression.
It could be everything, from just a number like 2 till a function call
lexper uses this one to recursively evaluate the “main” expression, the one you get from
lexper::eval. In that expression all other expressions are nested in and
evaluated recursively.
Variants§
Number(f64)
Just a number, like “2”
Variable(String)
Some variable inside an expression, like “PI”
Unary
Unary expression, like negotiation -> “-2”
Binary
Binary expression, the most common -> “2 + 3”
Call
A function call -> “sin(2)”
Trait Implementations§
Source§impl Debug for Expression
impl Debug for Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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