Packages

Terminal emulation and driver infrastructure for Raxol. ANSI parsing, screen buffers, command processing, cursor management, input handling, session management, and termbox2 NIF integration.

Current section

Files

Jump to
raxol_terminal lib raxol terminal parser state_behaviour.ex
Raw

lib/raxol/terminal/parser/state_behaviour.ex

defmodule Raxol.Terminal.Parser.StateBehaviour do
@moduledoc """
Defines the behaviour for parser states.
"""
alias Raxol.Terminal.Emulator
@type emulator :: Emulator.t()
@type state :: any()
@callback handle(emulator(), state(), binary()) ::
{:continue, emulator(), state(), binary()}
| {:finished, emulator(), state()}
| {:incomplete, emulator(), state()}
@callback handle_byte(byte(), emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_escape(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_control_sequence(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_osc_string(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_dcs_string(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_apc_string(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_pm_string(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_sos_string(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
@callback handle_unknown(emulator(), state()) ::
{:ok, emulator(), state()} | {:error, atom(), emulator(), state()}
end