A text of the model, parsed as FEEL and put in the source of the unit.
The text is added to the virtual source (Dmn.Compiler.Source) with its origin, parsed with the names that are in scope where it
stands, and its tree is moved to where its text is. What cannot be parsed is not an error of the whole model: it is a diagnostic of
the element it is in, and the fragment is null (an expression) or a rule that never matches (an input entry), as DMN has an
expression that cannot be evaluated give null (7.3.8).
The state that is threaded through the compiler is a map with the :source, the :issues found so far, and the :box that is
being compiled (Dmn.Compiler.Box, nil outside a box): every part put in the source, a text or glue, is put with it, and so is
every issue.
Summary
Functions
The tree of the text as an expression. An empty text, or none, is null; a text that is not FEEL, or cannot be parsed, is null
and a diagnostic.
The zero-width span of the part of the model at path, for the nodes of the tree that stand for it and have no text.
Records a diagnostic of the element, at a place in it.
The state of a unit that has compiled nothing.
The tree of the text as a list of unary tests: {:ok, tree, state}, {:empty, state} for no text (a test that any value
satisfies), {:error, state} for a text that cannot be read.
Types
@type origin_path() :: [term()]
@type state() :: %{ source: Dmn.Compiler.Source.t(), issues: [Dmn.Diagnostic.t()], box: Dmn.Compiler.Box.t() | nil, tables: %{optional(origin_path()) => Dmn.Model.DecisionTable.t()} }
Functions
@spec expression( String.t() | nil, String.t() | nil, Dmn.Compiler.Env.t(), state(), origin_path() ) :: {Feel.AST.expression(), state()}
The tree of the text as an expression. An empty text, or none, is null; a text that is not FEEL, or cannot be parsed, is null
and a diagnostic.
@spec glue(state(), Dmn.Compiler.Env.t(), origin_path()) :: {Feel.Diagnostic.span(), state()}
The zero-width span of the part of the model at path, for the nodes of the tree that stand for it and have no text.
@spec issue( state(), Feel.Diagnostic.severity(), atom(), String.t(), Dmn.Compiler.Env.t(), origin_path(), keyword() ) :: state()
Records a diagnostic of the element, at a place in it.
@spec new_state() :: state()
The state of a unit that has compiled nothing.
@spec unary_tests( String.t() | nil, String.t() | nil, Dmn.Compiler.Env.t(), state(), origin_path() ) :: {:ok, Feel.AST.unary_tests(), state()} | {:empty, state()} | {:error, state()}
The tree of the text as a list of unary tests: {:ok, tree, state}, {:empty, state} for no text (a test that any value
satisfies), {:error, state} for a text that cannot be read.