View Source edb_expr (edb_core v0.5.0)
Support for creating dynamic Erlang expressions that can be executed on the context of a process stack-frame.
Summary
Functions
Takes an Erlang expression Expr
, that can refer to any free-variable referred to
in the free_vars
field of Opts
, and compiles.
Returns the function to call in order to evaluate a compiled expression.
Types
-type compile_error() :: erl_scan:error_info() | erl_parse:error_info() | erl_lint:error_info().
-type compile_opts() :: #{free_vars := [binary()], start_line => pos_integer(), start_col => pos_integer()}.
-type source_code() :: binary().
Functions
-spec compile_expr(Expr, Opts) -> {ok, compiled_expr()} | {error, compile_error()} when Expr :: source_code(), Opts :: compile_opts().
Takes an Erlang expression Expr
, that can refer to any free-variable referred to
in the free_vars
field of Opts
, and compiles.
Any error at compile or run-time, will refer to locations relative to
start_line
and start_col
(both defaulting to 1 if missing).
-spec compile_guard(GuardExpr, Opts) -> {ok, compiled_expr()} | {error, compile_error()} when GuardExpr :: source_code(), Opts :: compile_opts().
-spec entrypoint(CompiledExpr) -> Entrypoint when CompiledExpr :: compiled_expr(), Entrypoint :: fun((Vars :: edb:stack_frame_vars()) -> dynamic()).
Returns the function to call in order to evaluate a compiled expression.