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

Parses tokens into an expression tree (language.md, sections 1.5 and 1.6)
by precedence climbing, and classifies statements (section 2.1).

Like the lexer, parsing never fails: a token that cannot start an operand
reads as `null`, a missing closer is assumed, and tokens left after a
complete expression are dropped.

# `ast`

```elixir
@type ast() ::
  {:string, String.t()}
  | {:number, number()}
  | {:boolean, boolean()}
  | :null
  | {:array, [ast()]}
  | {:object, [{String.t(), ast()}]}
  | {:ref, String.t()}
  | {:state, String.t()}
  | {:component, String.t(), [ast()]}
  | {:call, String.t(), [ast()]}
  | {:binary, String.t(), ast(), ast()}
  | {:unary, String.t(), ast()}
  | {:ternary, ast(), ast(), ast()}
  | {:member, ast(), String.t()}
  | {:index, ast(), ast()}
  | {:assign, String.t(), ast()}
  | {:unresolved, String.t()}
  | {:runtime_ref, String.t(), :query | :mutation}
```

# `parse`

```elixir
@spec parse([OpenUI.Parser.Lexer.token()]) :: ast()
```

Parses one expression from `tokens`.

# `parse_statement`

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

Parses the source of one statement. Returns `nil` when the text does not
have the `name = expression` shape.

---

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