Feel.Analysis.QuotedNames (feel v0.1.0)

Copy Markdown View Source

The report of the names that were written in backticks (D-81).

A name in backticks, `first name`, is accepted whatever the dialect of DMN 1.6 says and whichever names are in scope: the lexer checks that what is in them is a name in its canonical form (Feel.Syntax.Lexer), so it is the name it would be without them. It is not FEEL as DMN 1.6 writes it, though, and a model that uses it is one that an engine which follows only the specification does not accept. So it is said, as an :info (D-46), once for the expression, at the first one, with all the names in details.names. The code is :quoted_name: a caller that wants plain DMN 1.6 treats a diagnostic with that code as an error, which is all the switch there is.

The parser marks a name, or the path that ends in one, with quoted: span in its metadata, the span of what was in backticks (Feel.AST); this reads the syntax tree and so does not depend on what the names resolve to.

iex> {:ok, ast} = Feel.parse("`first name` + `tracking-id`")
iex> [info] = Feel.Analysis.QuotedNames.diagnostics(ast)
iex> {info.code, info.severity, info.span, info.details.names}
{:quoted_name, :info, {0, 12}, ["first name", "tracking-id"]}
iex> {:ok, ast} = Feel.parse("price + 1")
iex> Feel.Analysis.QuotedNames.diagnostics(ast)
[]

Summary

Functions

Returns the diagnostic for the names in backticks of a syntax tree: none if there are none, else one, at the first.

Functions

diagnostics(ast)

@spec diagnostics(Feel.AST.t()) :: [Feel.Diagnostic.t()]

Returns the diagnostic for the names in backticks of a syntax tree: none if there are none, else one, at the first.