Enum endbasic_core::ast::Expr

source ·
pub enum Expr {
Show 25 variants Boolean(BooleanSpan), Double(DoubleSpan), Integer(IntegerSpan), Text(TextSpan), Symbol(SymbolSpan), Add(Box<BinaryOpSpan>), Subtract(Box<BinaryOpSpan>), Multiply(Box<BinaryOpSpan>), Divide(Box<BinaryOpSpan>), Modulo(Box<BinaryOpSpan>), Power(Box<BinaryOpSpan>), Negate(Box<UnaryOpSpan>), Equal(Box<BinaryOpSpan>), NotEqual(Box<BinaryOpSpan>), Less(Box<BinaryOpSpan>), LessEqual(Box<BinaryOpSpan>), Greater(Box<BinaryOpSpan>), GreaterEqual(Box<BinaryOpSpan>), And(Box<BinaryOpSpan>), Not(Box<UnaryOpSpan>), Or(Box<BinaryOpSpan>), Xor(Box<BinaryOpSpan>), ShiftLeft(Box<BinaryOpSpan>), ShiftRight(Box<BinaryOpSpan>), Call(FunctionCallSpan),
}
Expand description

Represents an expression and provides mechanisms to evaluate it.

Variants§

§

Boolean(BooleanSpan)

A literal boolean value.

§

Double(DoubleSpan)

A literal double-precision floating point value.

§

Integer(IntegerSpan)

A literal integer value.

§

Text(TextSpan)

A literal string value.

§

Symbol(SymbolSpan)

A reference to a variable.

§

Add(Box<BinaryOpSpan>)

Arithmetic addition of two expressions.

§

Subtract(Box<BinaryOpSpan>)

Arithmetic subtraction of two expressions.

§

Multiply(Box<BinaryOpSpan>)

Arithmetic multiplication of two expressions.

§

Divide(Box<BinaryOpSpan>)

Arithmetic division of two expressions.

§

Modulo(Box<BinaryOpSpan>)

Arithmetic modulo operation of two expressions.

§

Power(Box<BinaryOpSpan>)

Arithmetic power operation of two expressions.

§

Negate(Box<UnaryOpSpan>)

Arithmetic sign flip of an expression.

§

Equal(Box<BinaryOpSpan>)

Relational equality comparison of two expressions.

§

NotEqual(Box<BinaryOpSpan>)

Relational inequality comparison of two expressions.

§

Less(Box<BinaryOpSpan>)

Relational less-than comparison of two expressions.

§

LessEqual(Box<BinaryOpSpan>)

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

§

Greater(Box<BinaryOpSpan>)

Relational greater-than comparison of two expressions.

§

GreaterEqual(Box<BinaryOpSpan>)

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

§

And(Box<BinaryOpSpan>)

Logical and of two expressions.

§

Not(Box<UnaryOpSpan>)

Logical not of an expression.

§

Or(Box<BinaryOpSpan>)

Logical or of two expressions.

§

Xor(Box<BinaryOpSpan>)

Logical xor of two expressions.

§

ShiftLeft(Box<BinaryOpSpan>)

Shift left of a signed integer by a number of bits without rotation.

§

ShiftRight(Box<BinaryOpSpan>)

Shift right of a signed integer by a number of bits without rotation.

§

Call(FunctionCallSpan)

A function call or an array reference.

Implementations§

Returns the start position of the expression.

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 ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.