pub enum Expr {
Show 20 variants
Literal(Literal),
Null,
Identifier(String),
FieldAccess {
receiver: Box<Expr>,
field: String,
},
BinaryOp {
op: BinaryOperator,
left: Box<Expr>,
right: Box<Expr>,
},
UnaryOp {
op: UnaryOperator,
operand: Box<Expr>,
},
FunctionCall {
name: String,
args: Vec<Expr>,
},
Lambda {
param: String,
body: Box<Expr>,
},
Let {
name: String,
value: Box<Expr>,
body: Box<Expr>,
},
If {
condition: Box<Expr>,
then_branch: Box<Expr>,
else_branch: Box<Expr>,
},
Array(Vec<Expr>),
Object(Vec<(String, Expr)>),
Pipe {
value: Box<Expr>,
functions: Vec<Expr>,
},
Alternative {
primary: Box<Expr>,
alternative: Box<Expr>,
},
Guard {
condition: Box<Expr>,
body: Box<Expr>,
},
Date(String),
DateTime(String),
Duration(String),
TemporalKeyword(TemporalKeyword),
String(String),
}Expand description
Top-level ELO expression type
Represents any valid ELO expression that can be parsed and executed. This is an exhaustive enum of all expression forms in ELO.
Variants§
Literal(Literal)
Literal values: numbers (int/float) or booleans
Null
Null literal
Identifier(String)
Variable reference (identifier)
FieldAccess
Field access: receiver.field (e.g., user.age)
BinaryOp
Binary operation: left op right
Fields
op: BinaryOperatorThe binary operator
UnaryOp
Unary operation: op operand
FunctionCall
Function call: name(args)
Lambda
Lambda expression: param ~> body
Let
Let binding: let name = value in body
Fields
If
If conditional: if condition then branch_a else branch_b
Fields
Array(Vec<Expr>)
Array literal: [expr1, expr2, …]
Object(Vec<(String, Expr)>)
Object literal: {key1: value1, key2: value2, …}
Pipe
Pipe operator: expr |> func() |> …
Fields
Alternative
Alternative operator: expr ?| default
Guard
Guard expression: guard condition in expr
Fields
Date(String)
Date literal: @date(2024-01-15)
DateTime(String)
DateTime literal: @datetime(2024-01-15T10:30:00Z)
Duration(String)
Duration literal: @duration(P1D), @duration(PT1H30M)
TemporalKeyword(TemporalKeyword)
Temporal keyword: NOW, TODAY, TOMORROW, etc.
String(String)
String literal (explicitly quoted with single quotes)