The compiler's own error shape: {reason, message, location},
character-identical in style to Statifier.Lowering.Error
(lib/statifier/lowering/error.ex:21-36).
This union is deliberately small. Statifier.Validator owns every
non-expression failure mode exclusively (checks 1-11 at
lib/statifier/validator.ex:47-59): every id Statifier.Compiler looks
up is guaranteed present by the time it gets there, so an unresolved
reference reaching the compiler is a validator bug, left to raise rather
than converted into a value of this type. The one failure mode that is
the compiler's own - a cond/expr/<content> source that fails to
compile - is :expression_compile_error, built by
Statifier.Compiler.Expressions.compile/3 on its failure path.
:unknown_function is the other: an expression that compiles but calls a
function no evaluation context will hold - not In/1, not a predicator
builtin, and not a function Statifier.compile/2's :function_providers
registers. Statifier.Compiler.FunctionCalls.check/2 builds it, after
the compiler has run.
Summary
Types
Closed reason union. :expression_compile_error names the owning node
(Statifier.Compiler.Expressions.owner_ref/0 - a transition, a content
node, or a final state's donedata), the raw expression source, and
predicator's own %Predicator.Errors.ParseError{} verbatim, in
predicator's own {line, column} coordinate space - the translation into
document columns happens at reporting time, not here.
Functions
A cond/expr/<content> source that failed to compile. location is
the caller's choice - the attribute value span
(attribute_locations[:cond] / [:expr]) when the author wrote the
attribute, the owning node's own location when
Statifier.Lowering.Attributes.put_location/4 produced no entry
(lib/statifier/lowering/attributes.ex:76-98) - never derived here, since
this module has no access to the node the caller is compiling from.
An expression calls name, a function the chart cannot be evaluated
with. source is the expression's whole predicator source and
location the element that holds it.
Types
@type reason() :: {:expression_compile_error, Statifier.Compiler.Expressions.owner_ref(), source :: String.t(), Predicator.Errors.ParseError.t()} | {:unknown_function, name :: String.t(), source :: String.t()}
Closed reason union. :expression_compile_error names the owning node
(Statifier.Compiler.Expressions.owner_ref/0 - a transition, a content
node, or a final state's donedata), the raw expression source, and
predicator's own %Predicator.Errors.ParseError{} verbatim, in
predicator's own {line, column} coordinate space - the translation into
document columns happens at reporting time, not here.
@type t() :: %Statifier.Compiler.Error{ location: Statifier.Parser.Location.t(), message: binary(), reason: reason() }
Functions
@spec expression_compile_error( owner :: Statifier.Compiler.Expressions.owner_ref(), source :: String.t(), parse_error :: Predicator.Errors.ParseError.t(), location :: Statifier.Parser.Location.t() ) :: t()
A cond/expr/<content> source that failed to compile. location is
the caller's choice - the attribute value span
(attribute_locations[:cond] / [:expr]) when the author wrote the
attribute, the owning node's own location when
Statifier.Lowering.Attributes.put_location/4 produced no entry
(lib/statifier/lowering/attributes.ex:76-98) - never derived here, since
this module has no access to the node the caller is compiling from.
The message names the source, predicator's message, and predicator's own
position, so a human can find the character in the file from the message
alone even before consulting location.
@spec unknown_function( name :: String.t(), source :: String.t(), location :: Statifier.Parser.Location.t() ) :: t()
An expression calls name, a function the chart cannot be evaluated
with. source is the expression's whole predicator source and
location the element that holds it.