# `Minga.Parser.ParseScheduler`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/parser/parse_scheduler.ex#L1)

Pure global admission state for editor-buffer parser synchronization.

The parser Port is single-threaded, so the manager admits one buffer snapshot or parse at a time. Repeated readiness signals coalesce by buffer PID.

# `t`

```elixir
@type t() :: %Minga.Parser.ParseScheduler{
  active: pid() | nil,
  queue: term(),
  queued: term(),
  timeout_ref: reference() | nil,
  timeout_token: term() | nil
}
```

# `activate_next`

```elixir
@spec activate_next(t()) :: {:ok, pid(), t()} | :busy | :empty
```

Activates the next queued buffer when no work is active.

# `active?`

```elixir
@spec active?(t(), pid()) :: boolean()
```

Returns whether the supplied buffer owns the active admission.

# `arm_timeout`

```elixir
@spec arm_timeout(t(), term(), reference()) :: t()
```

Associates a timeout token and timer with the active admission.

# `enqueue`

```elixir
@spec enqueue(t(), pid()) :: t()
```

Queues a buffer once unless it is already active or queued.

# `new`

```elixir
@spec new() :: t()
```

Creates an empty scheduler.

# `release`

```elixir
@spec release(t(), pid()) :: t()
```

Releases the matching active buffer.

# `reset`

```elixir
@spec reset(t()) :: t()
```

Drops all active and queued admission state.

# `timeout?`

```elixir
@spec timeout?(t(), pid(), term()) :: boolean()
```

Returns whether a timeout belongs to the current active admission.

# `timeout_ref`

```elixir
@spec timeout_ref(t()) :: reference() | nil
```

Returns the current admission timer reference.

---

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