Expression.Callbacks (expression v2.5.0)

The function callbacks for the standard function set available in FLOIP expressions.

This should be relatively swappable with another implementation. The only requirement is the handle/3 function.

FLOIP functions are case insensitive. All functions in this callback module are implemented as lowercase names.

Some functions accept a variable amount of arguments. Elixir doesn't support variable arguments in functions.

If a function accepts a variable number of arguments the convention is to call the <function_name>_vargs/2 callback where the context is given as the first argument and the argument list as a second argument.

Reserved names such as and, if, and or are suffixed with an underscore.

Link to this section Summary

Functions

Convert a string function name into an atom meant to handle that function

Handle a function call while evaluating the AST.

Link to this section Functions

Link to this function

atom_function_name(function_name)

Convert a string function name into an atom meant to handle that function

Reserved words such as and, if, and or are automatically suffixed with an _ underscore.

Link to this function

handle(module \\ Standard, function_name, arguments, context)

@spec handle(
  module :: module(),
  function_name :: binary(),
  arguments :: [any()],
  context :: map()
) :: {:ok, any()} | {:error, :not_implemented}

Handle a function call while evaluating the AST.

Handlers in this module are either:

  1. The function name as is
  2. The function name with an underscore suffix if the function name is a reserved word
  3. The function name suffixed with _vargs if the takes a variable set of arguments
Link to this function

implements(module \\ Standard, function_name, arguments)