# `A2UICore.Identifier`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_core/lib/a2ui_core/identifier.ex#L1)

UAX #31 identifier validation for catalog entity names, with the
upstream pattern `^[\p{XID_Start}_][\p{XID_Continue}]*$`, compiled
like a schema pattern by `A2UICore.Schema.ECMA262`: exact on
Erlang/OTP 28 and later, an approximation on older PCRE.

Two structural points follow the reference:

* the empty string is invalid;
* a leading `@` makes a name invalid, unless `allow_leading_at: true`
  (payload validation, where a call may name a system function such
  as `@index`): then one leading `@` is ignored. Catalog declarations
  never allow it.

# `assert_valid!`
*since 0.1.0* 

```elixir
@spec assert_valid!(String.t(), String.t()) :: :ok
```

Raises `A2UICore.Error` with category `:catalog` if `name` is not a
valid UAX #31 identifier.

# `continue?`
*since 0.1.0* 

```elixir
@spec continue?(term()) :: boolean()
```

Returns whether `codepoint` (a one-character string) continues an
identifier (`XID_Continue`, as in `valid?/1`). Expression and path
scanning use it to find token boundaries.

    iex> A2UICore.Identifier.continue?("a")
    true
    iex> A2UICore.Identifier.continue?("-")
    false

# `valid?`
*since 0.1.0* 

```elixir
@spec valid?(term(), keyword()) :: boolean()
```

Returns whether `name` is a valid UAX #31 identifier.

Options: `allow_leading_at: true` ignores one leading `@`.

    iex> A2UICore.Identifier.valid?("submit_form")
    true
    iex> A2UICore.Identifier.valid?("@index")
    false
    iex> A2UICore.Identifier.valid?("@index", allow_leading_at: true)
    true

---

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