Enum endbasic_core::ast::Expr
source · [−]pub enum Expr {
Show 22 variants
Boolean(bool),
Double(f64),
Integer(i32),
Symbol(VarRef),
Text(String),
Add(Box<Expr>, Box<Expr>),
Subtract(Box<Expr>, Box<Expr>),
Multiply(Box<Expr>, Box<Expr>),
Divide(Box<Expr>, Box<Expr>),
Modulo(Box<Expr>, Box<Expr>),
Negate(Box<Expr>),
Equal(Box<Expr>, Box<Expr>),
NotEqual(Box<Expr>, Box<Expr>),
Less(Box<Expr>, Box<Expr>),
LessEqual(Box<Expr>, Box<Expr>),
Greater(Box<Expr>, Box<Expr>),
GreaterEqual(Box<Expr>, Box<Expr>),
And(Box<Expr>, Box<Expr>),
Not(Box<Expr>),
Or(Box<Expr>, Box<Expr>),
Xor(Box<Expr>, Box<Expr>),
Call(VarRef, Vec<Expr>),
}
Expand description
Represents an expression and provides mechanisms to evaluate it.
Variants
Boolean(bool)
A literal boolean value.
Double(f64)
A literal double-precision floating point value.
Integer(i32)
A literal integer value.
Symbol(VarRef)
A reference to a variable.
Text(String)
A literal string value.
Add(Box<Expr>, Box<Expr>)
Arithmetic addition of two expressions.
Subtract(Box<Expr>, Box<Expr>)
Arithmetic subtraction of two expressions.
Multiply(Box<Expr>, Box<Expr>)
Arithmetic multiplication of two expressions.
Divide(Box<Expr>, Box<Expr>)
Arithmetic division of two expressions.
Modulo(Box<Expr>, Box<Expr>)
Arithmetic modulo operation of two expressions.
Negate(Box<Expr>)
Arithmetic sign flip of an expression.
Equal(Box<Expr>, Box<Expr>)
Relational equality comparison of two expressions.
NotEqual(Box<Expr>, Box<Expr>)
Relational inequality comparison of two expressions.
Less(Box<Expr>, Box<Expr>)
Relational less-than comparison of two expressions.
LessEqual(Box<Expr>, Box<Expr>)
Relational less-than or equal-to comparison of two expressions.
Greater(Box<Expr>, Box<Expr>)
Relational greater-than comparison of two expressions.
GreaterEqual(Box<Expr>, Box<Expr>)
Relational greater-than or equal-to comparison of two expressions.
And(Box<Expr>, Box<Expr>)
Logical and of two expressions.
Not(Box<Expr>)
Logical not of an expression.
Or(Box<Expr>, Box<Expr>)
Logical or of two expressions.
Xor(Box<Expr>, Box<Expr>)
Logical xor of two expressions.
Call(VarRef, Vec<Expr>)
A function call or an array reference.
Implementations
sourceimpl Expr
impl Expr
sourcepub fn eval<'life0, 'life_self, 'async_recursion>(
&'life_self self,
syms: &'life0 mut Symbols
) -> Pin<Box<dyn Future<Output = Result<Value>> + 'async_recursion>> where
'life0: 'async_recursion,
'life_self: 'async_recursion,
pub fn eval<'life0, 'life_self, 'async_recursion>(
&'life_self self,
syms: &'life0 mut Symbols
) -> Pin<Box<dyn Future<Output = Result<Value>> + 'async_recursion>> where
'life0: 'async_recursion,
'life_self: 'async_recursion,
Evaluates the expression to a value.
Symbols are resolved by querying syms
. Errors in the computation are returned via the
special Value::Bad
type.
Trait Implementations
impl StructuralPartialEq for Expr
Auto Trait Implementations
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more