# `OpenUI.Parser`
[🔗](https://github.com/ideia4it/openui/blob/v0.1.1/lib/openui/parser.ex#L1)

Parses OpenUI Lang into an `OpenUI.Program` (language.md, sections 1, 2
and 8).

`parse/2` reads a complete response, which is the same as the end of a
stream. It expects the program content: read a stored message with
`OpenUI.Message.parse/2` first. Parsing never raises: a mistake in the
program drops the smallest unit and is reported in `errors`, and a failure
of the parser itself becomes a `parse-exception` error.

# `build`

```elixir
@spec build([OpenUI.Statement.t()], OpenUI.Library.t() | module(), keyword()) ::
  OpenUI.Program.t()
```

Builds a program from statements. A later statement with a name already
seen replaces it in place.

Options:

  * `:final` (default `true`): the stream has ended, so `no-root` is
    reported and enum checks run;
  * `:incomplete` (default `false`): the text ended inside a string or a
    bracket;
  * `:ignore_state` (default `[]`): state names not to declare yet, such as
    a `$name` still growing at the end of a stream.

# `parse`

```elixir
@spec parse(String.t(), OpenUI.Library.t() | module()) :: OpenUI.Program.t()
```

Parses a complete response.

# `statement`

```elixir
@spec statement(String.t()) :: OpenUI.Statement.t() | nil
```

Reads one statement text, closing it first when it was cut off. Returns
`nil` when the text is not a statement.

---

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