Enum endbasic_core::ast::Expr[][src]

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(VarRefVec<Expr>),
}
Expand description

Represents an expression and provides mechanisms to evaluate it.

Variants

Boolean(bool)

A literal boolean value.

Tuple Fields of Boolean

0: bool
Double(f64)

A literal double-precision floating point value.

Tuple Fields of Double

0: f64
Integer(i32)

A literal integer value.

Tuple Fields of Integer

0: i32
Symbol(VarRef)

A reference to a variable.

Tuple Fields of Symbol

0: VarRef
Text(String)

A literal string value.

Tuple Fields of Text

0: String
Add(Box<Expr>, Box<Expr>)

Arithmetic addition of two expressions.

Tuple Fields of Add

0: Box<Expr>1: Box<Expr>
Subtract(Box<Expr>, Box<Expr>)

Arithmetic subtraction of two expressions.

Tuple Fields of Subtract

0: Box<Expr>1: Box<Expr>
Multiply(Box<Expr>, Box<Expr>)

Arithmetic multiplication of two expressions.

Tuple Fields of Multiply

0: Box<Expr>1: Box<Expr>
Divide(Box<Expr>, Box<Expr>)

Arithmetic division of two expressions.

Tuple Fields of Divide

0: Box<Expr>1: Box<Expr>
Modulo(Box<Expr>, Box<Expr>)

Arithmetic modulo operation of two expressions.

Tuple Fields of Modulo

0: Box<Expr>1: Box<Expr>
Negate(Box<Expr>)

Arithmetic sign flip of an expression.

Tuple Fields of Negate

0: Box<Expr>
Equal(Box<Expr>, Box<Expr>)

Relational equality comparison of two expressions.

Tuple Fields of Equal

0: Box<Expr>1: Box<Expr>
NotEqual(Box<Expr>, Box<Expr>)

Relational inequality comparison of two expressions.

Tuple Fields of NotEqual

0: Box<Expr>1: Box<Expr>
Less(Box<Expr>, Box<Expr>)

Relational less-than comparison of two expressions.

Tuple Fields of Less

0: Box<Expr>1: Box<Expr>
LessEqual(Box<Expr>, Box<Expr>)

Relational less-than or equal-to comparison of two expressions.

Tuple Fields of LessEqual

0: Box<Expr>1: Box<Expr>
Greater(Box<Expr>, Box<Expr>)

Relational greater-than comparison of two expressions.

Tuple Fields of Greater

0: Box<Expr>1: Box<Expr>
GreaterEqual(Box<Expr>, Box<Expr>)

Relational greater-than or equal-to comparison of two expressions.

Tuple Fields of GreaterEqual

0: Box<Expr>1: Box<Expr>
And(Box<Expr>, Box<Expr>)

Logical and of two expressions.

Tuple Fields of And

0: Box<Expr>1: Box<Expr>
Not(Box<Expr>)

Logical not of an expression.

Tuple Fields of Not

0: Box<Expr>
Or(Box<Expr>, Box<Expr>)

Logical or of two expressions.

Tuple Fields of Or

0: Box<Expr>1: Box<Expr>
Xor(Box<Expr>, Box<Expr>)

Logical xor of two expressions.

Tuple Fields of Xor

0: Box<Expr>1: Box<Expr>
Call(VarRefVec<Expr>)

A function call or an array reference.

Tuple Fields of Call

0: VarRef1: Vec<Expr>

Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.