Module parser

Module parser 

Source
Expand description

Builds crate::ast::Node trees from crate::lexer::Token streams.

{{ … }} bodies are parsed with parse_expr (nom-driven, Nunjucks-style precedence; see expr). {% … %} supports if / elif / else / endif, switch / case / default / endswitch, for / else / endfor (multi-var / tuple unpack), set (incl. endset capture), include (expression + ignore missing + with/without context), import / from (macro libraries), extends (expression), block / endblock, macro / endmacro (defaults + call kwargs), filter / endfilter, call / endcall, and raw / endraw / verbatim / endverbatim (see [template]). For unimplemented tags, use crate::tag_lex::tokenize_tag_body for tokenization only.

Modules§

expr
Expression parsing for {{ … }} bodies (Nunjucks-style precedence).

Functions§

parse
Parses a token stream into a single Node::Root containing child nodes.
parse_expr
Parses the inside of a {{}} region into an Expr.
parse_with_env
Parse with custom extension tags registered on the crate::Environment.