# `Dllb.MetaAST.NodeTypes`
[🔗](https://github.com/Oeditus/dllb_ex/blob/v0.1.0/lib/dllb/meta_ast/node_types.ex#L1)

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.

# `all`

```elixir
@spec all() :: [atom()]
```

Returns all 45 node types.

# `core`

```elixir
@spec core() :: [atom()]
```

Returns the 19 core node types.

# `extended`

```elixir
@spec extended() :: [atom()]
```

Returns the 14 extended node types.

# `from_dllb_kind`

```elixir
@spec from_dllb_kind(String.t()) :: {:ok, atom()} | :error
```

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

# `layer`

```elixir
@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

# `native`

```elixir
@spec native() :: [atom()]
```

Returns the native node types.

# `structural`

```elixir
@spec structural() :: [atom()]
```

Returns the 11 structural node types.

# `to_dllb_kind`

```elixir
@spec to_dllb_kind(atom()) :: String.t()
```

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"

# `valid?`

```elixir
@spec valid?(atom()) :: boolean()
```

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
