Module ast

Module ast 

Source
Expand description

Abstract syntax tree for templates after crate::parser::parse.

Expr covers outputs ({{ … }}) including literals, variables, and operators (aligned with Nunjucks parseExpression).

Structs§

IfBranch
One branch of an {% if %} / {% elif %} / {% else %} chain.
MacroDef
A template macro definition ({% macro name(args) %}…{% endmacro %}).
MacroParam
One formal parameter in a {% macro %} header (a or a = expr).
SwitchCase
One {% case expr %}… branch inside {% switch %}.

Enums§

BinOp
Binary operators (arithmetic, logical short-circuit forms use these in the AST).
CompareOp
Comparison operators in a Nunjucks-style chain (a == b < c).
Expr
Expression inside a variable tag or tag body (when wired up).
ForVars
Loop binding list after for (x or k, v or a, b, c).
Node
Template structure produced by the parser.
UnaryOp