Feel.Dialect (feel v0.1.0)

Copy Markdown View Source

The dialects of FEEL that an expression can be prepared in (D-49).

  • :feel - FEEL as clause 10 of DMN 1.6 defines it. The default.
  • :s_feel - S-FEEL, the subset of clause 9. It is a restriction of the syntax: what it accepts, FEEL runs with its own semantics, so it changes how an expression is read (Feel.Syntax.SFeel) and nothing about how it runs.
  • :b_feel - B-FEEL, clause 11. It has the grammar of FEEL and different semantics: an error does not make a result null but gives a value of the type the operation returns. It is not written yet, and runs as FEEL.

The dialect is chosen when an expression is prepared, as a model chooses it with the language of an expression, and it goes with the prepared expression (Feel.Expression.dialect/1) into every run of it. A run cannot choose another.

iex> Feel.Dialect.all()
[:feel, :s_feel, :b_feel]

Summary

Types

t()

A dialect of FEEL.

Functions

Returns every dialect.

Returns true for a dialect.

Returns the dialect, or raises ArgumentError when it is not one.

Types

t()

@type t() :: :feel | :s_feel | :b_feel

A dialect of FEEL.

Functions

all()

@spec all() :: [t(), ...]

Returns every dialect.

valid?(dialect)

@spec valid?(term()) :: boolean()

Returns true for a dialect.

iex> Feel.Dialect.valid?(:s_feel)
true
iex> Feel.Dialect.valid?(:feel_2)
false

validate!(dialect)

@spec validate!(term()) :: t()

Returns the dialect, or raises ArgumentError when it is not one.

iex> Feel.Dialect.validate!(:b_feel)
:b_feel
iex> Feel.Dialect.validate!(:bogus)
** (ArgumentError) expected :dialect to be :feel, :s_feel, or :b_feel, got: :bogus