# `Eyeon.Decoder`
[🔗](https://gitlab.com/phinnaeus/eyeon/blob/main/lib/eyeon/decoder.ex#L1)

Decodes Ion parser AST nodes to Elixir values.

This module is codec-agnostic: both `Eyeon.TextDecoder` (text path) and
`Eyeon.BinaryDecoder.V11` (binary path) produce AST nodes that flow through
`decode_values/4` or `decode_value/4` to produce final Elixir values.

# `decode_value`

```elixir
@spec decode_value(term(), term(), Eyeon.Catalog.t(), map()) :: any()
```

Decode a single AST node to an Elixir value.

# `decode_values`

```elixir
@spec decode_values(list(), term(), Eyeon.Catalog.t(), map()) ::
  [any()] | {:error, any()}
```

Decode a list of AST nodes, returning a list of Elixir values or `{:error, reason}`.

# `flatten_ast_node`

```elixir
@spec flatten_ast_node(term()) :: [term(), ...]
```

Flatten compound AST nodes produced by parser shift/reduce conflicts.

These are 2-tuples where the first element is a 3-element token tuple `{atom, line, chars}`.
e.g. `{{:id_symbol, 5, ~c"a"}, {:sexp, [...]}}` should become two separate nodes.
We only flatten 3-element first tuples to avoid breaking typed nulls `{{:null, line}, {:type, ...}}`
and other legitimate 2-tuple AST nodes like `{:struct, fields}`, `{:list, values}`, etc.

---

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