z_expression (zotonic_core v1.0.0-rc.17)
Expression parsing and evaluation.
Summary
Functions
Evaluate a parsed expression tree.
Parse an expression to an expression tree. Uses the template_compiler parser.
Types
Functions
-spec eval(Tree, Vars, Context) -> Value when Tree :: tree(), Vars :: proplists:proplist() | #{binary() => term()} | fun((binary()) -> term()) | fun((binary(), z:context()) -> term()), Context :: z:context(), Value :: term().
Evaluate a parsed expression tree.
-spec eval(Tree, Vars, Options, Context) -> Value when Tree :: tree(), Vars :: proplists:proplist() | #{binary() => term()} | fun((binary() | atom()) -> term()), Options :: [Option], Option :: {filters_allowed, [atom()]} | {p, fun((term(), binary(), z:context()) -> term())}, Context :: z:context(), Value :: term().
-spec parse(Expr) -> {ok, ParseTree} | {error, Reason} when Expr :: binary(), ParseTree :: tree(), Reason :: term().
Parse an expression to an expression tree. Uses the template_compiler parser.