ExSel v0.0.2 ExSel.Ast
Simple expression language AST
Link to this section Summary
Functions
Evaluates the passed ast and variables
Link to this section Types
Link to this type
aexpr()
aexpr()
aexpr() :: vexpr_num() | vexpr_var() | aexpr_binop()
aexpr() :: vexpr_num() | vexpr_var() | aexpr_binop()
Link to this type
aexpr_binop()
Link to this type
bexpr()
Link to this type
cexpr()
Link to this type
cexpr_eq()
Link to this type
cexpr_ord()
Link to this type
eval_ctx()
Link to this type
eval_result()
Link to this type
vexpr()
vexpr()
vexpr() :: vexpr_bool() | vexpr_num() | vexpr_str() | vexpr_var()
vexpr() :: vexpr_bool() | vexpr_num() | vexpr_str() | vexpr_var()
Link to this type
vexpr_bool()
vexpr_bool()
vexpr_bool() :: boolean()
vexpr_bool() :: boolean()
Link to this type
vexpr_num()
vexpr_num()
vexpr_num() :: number()
vexpr_num() :: number()
Link to this type
vexpr_str()
vexpr_str()
vexpr_str() :: binary()
vexpr_str() :: binary()
Link to this type
vexpr_var()
vexpr_var()
vexpr_var() :: {:var, binary()}
vexpr_var() :: {:var, binary()}
Link to this section Functions
Link to this function
eval!(ast, ctx \\ %{})
eval!(ast, ctx \\ %{})
eval!(ast :: t(), ctx :: eval_ctx()) :: eval_result() | none()
eval!(ast :: t(), ctx :: eval_ctx()) :: eval_result() | none()
Evaluates the passed ast and variables
Examples
iex> alias ExSel.Ast
iex> Ast.eval!(true, %{})
true
iex> Ast.eval!({:+,[1,{:var, "a"}]}, %{"a" => 1})
2
iex> Ast.eval!({:==,[1,1]}, %{})
true
iex> Ast.eval!({:/,[1,0]}, %{})
** (ArithmeticError) bad argument in arithmetic expression