pub enum Expression {
Show 15 variants
Null,
Boolean(bool),
String(String),
Number(Decimal),
Identifier(String),
List(Vec<Spanned<Expression>>),
Object(Vec<(Spanned<String>, Spanned<Expression>)>),
Function {
args: Vec<Spanned<String>>,
body: Box<Spanned<Expression>>,
},
Unary {
right: Box<Spanned<Expression>>,
operator: UnaryOperator,
},
Binary {
left: Box<Spanned<Expression>>,
right: Box<Spanned<Expression>>,
operator: BinaryOperator,
},
Call {
function: Box<Spanned<Expression>>,
args: Vec<Spanned<Expression>>,
},
GetIndex {
container: Box<Spanned<Expression>>,
index: Box<Spanned<Expression>>,
},
GetKey {
container: Box<Spanned<Expression>>,
key: Spanned<String>,
},
GetSlice {
container: Box<Spanned<Expression>>,
start: Option<Box<Spanned<Expression>>>,
end: Option<Box<Spanned<Expression>>>,
},
Error,
}Expand description
An expression represents an entity which can be evaluated to a value.
Variants§
Null
Literal null.
Boolean(bool)
Literal boolean.
String(String)
Literal string.
Number(Decimal)
Literal number.
Identifier(String)
A named local variable.
List(Vec<Spanned<Expression>>)
Literal list.
Object(Vec<(Spanned<String>, Spanned<Expression>)>)
Literal key-value object.
Function
Function
Unary
An operation on a single Expression operand with an [Operator]
Binary
An operation on two Expression operands with a an [Operator].
Call
A function invocation with a list of Expression parameters.
GetIndex
Get index operation (a[x]).
GetKey
Get key operation (c.z).
GetSlice
Slice operation (b[x:y]).
Fields
§
container: Box<Spanned<Expression>>§
start: Option<Box<Spanned<Expression>>>§
end: Option<Box<Spanned<Expression>>>Error
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl Display for Expression
impl Display for Expression
Source§impl Hash for Expression
impl Hash for Expression
Source§impl Ord for Expression
impl Ord for Expression
Source§fn cmp(&self, other: &Expression) -> Ordering
fn cmp(&self, other: &Expression) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§impl PartialOrd for Expression
impl PartialOrd for Expression
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.