pub enum Expr {
Show 14 variants
Literal(Value),
Variable(String),
GetAttr {
base: Box<Expr>,
attr: String,
},
GetItem {
base: Box<Expr>,
index: Box<Expr>,
},
Slice {
start: Option<Box<Expr>>,
stop: Option<Box<Expr>>,
step: Option<Box<Expr>>,
},
Call {
callee: Box<Expr>,
args: Vec<Expr>,
kwargs: Vec<(String, Expr)>,
},
Filter {
name: String,
input: Box<Expr>,
args: Vec<Expr>,
},
List(Vec<Expr>),
Dict(Vec<(Expr, Expr)>),
InlineIf {
cond: Box<Expr>,
then_expr: Box<Expr>,
else_expr: Option<Box<Expr>>,
},
Unary {
op: UnaryOp,
expr: Box<Expr>,
},
Binary {
op: BinOp,
left: Box<Expr>,
right: Box<Expr>,
},
Compare {
head: Box<Expr>,
rest: Vec<(CompareOp, Expr)>,
},
RegexLiteral {
pattern: String,
flags: String,
},
}Expand description
Expression inside a variable tag or tag body (when wired up).
Variants§
Literal(Value)
JSON literal (numbers, strings, booleans, null).
Variable(String)
Context key; non-existent keys render as empty (Nunjucks-style).
GetAttr
Attribute access: base.attr (Nunjucks LookupVal).
GetItem
Subscript: base[index] or Jinja-style base[start:stop:step].
Slice
Slice inside [ … ] (start:stop:step; any part may be omitted).
Call
Function-style call callee(args…) (runtime may be limited until globals exist).
Fields
Filter
Filter pipeline step: input | name or input | name(arg, …).
List(Vec<Expr>)
Array literal [a, b, …] with arbitrary expressions.
Dict(Vec<(Expr, Expr)>)
Object literal { key: val, …} (keys are expressions, usually strings or identifiers).
InlineIf
Python-style conditional: body if cond else else_.
Unary
Binary
Compare
Chained comparisons (a == b < c → left-associative JS-style emit in Nunjucks).
RegexLiteral
JavaScript-style regex literal r/pattern/flags (Nunjucks lexer).