Compile-time mapping of all 45 Metastatic node types plus the wildcard.
This module is the single source of truth for node type classification in the Elixir adapter. Types are organized into four layers: core, extended, structural, and native.
Summary
Functions
Returns all 45 node types.
Returns the 19 core node types.
Returns the 14 extended node types.
Converts a dllb kind string back to a node type atom.
Returns the layer (:core, :extended, :structural, or :native)
for the given node type atom.
Returns the native node types.
Returns the 11 structural node types.
Converts a node type atom to the string used in dllb's kind field.
Returns true if the given atom is a valid Metastatic node type.
Functions
@spec all() :: [atom()]
Returns all 45 node types.
@spec core() :: [atom()]
Returns the 19 core node types.
@spec extended() :: [atom()]
Returns the 14 extended node types.
Converts a dllb kind string back to a node type atom.
Returns {:ok, atom} if the string is a recognized type, :error otherwise.
Examples
iex> Dllb.MetaAST.NodeTypes.from_dllb_kind("function_def")
{:ok, :function_def}
iex> Dllb.MetaAST.NodeTypes.from_dllb_kind("nope")
:error
@spec layer(atom()) :: :core | :extended | :structural | :native
Returns the layer (:core, :extended, :structural, or :native)
for the given node type atom.
Raises ArgumentError if the type is not valid.
Examples
iex> Dllb.MetaAST.NodeTypes.layer(:literal)
:core
iex> Dllb.MetaAST.NodeTypes.layer(:container)
:structural
@spec native() :: [atom()]
Returns the native node types.
@spec structural() :: [atom()]
Returns the 11 structural node types.
Converts a node type atom to the string used in dllb's kind field.
Examples
iex> Dllb.MetaAST.NodeTypes.to_dllb_kind(:function_call)
"function_call"
Returns true if the given atom is a valid Metastatic node type.
Examples
iex> Dllb.MetaAST.NodeTypes.valid?(:function_def)
true
iex> Dllb.MetaAST.NodeTypes.valid?(:bogus)
false