Raxol.Terminal.Parser.State.Manager (Raxol v0.4.0)

View Source

Manages parser state transitions and state-specific functionality for the terminal emulator. This module provides a clean interface for managing the parser's state machine and delegating to appropriate state handlers.

Summary

Functions

Appends a byte to the intermediates buffer.

Appends a byte to the params buffer.

Appends a byte to the payload buffer.

Gets the current parser state.

Creates a new parser state with default values.

Processes input in the current parser state. Returns the updated emulator and parser state.

Clears all buffers and resets the state to ground.

Sets the G-set being designated.

Sets the final byte for the current sequence.

Sets the parser state to a new value.

Transitions to a new parser state, clearing relevant buffers.

Functions

append_intermediate(state, byte)

@spec append_intermediate(map(), binary()) :: map()

Appends a byte to the intermediates buffer.

append_param(state, byte)

@spec append_param(map(), binary()) :: map()

Appends a byte to the params buffer.

append_payload(state, byte)

@spec append_payload(map(), binary()) :: map()

Appends a byte to the payload buffer.

get_current_state(state)

@spec get_current_state(map()) :: map()

Gets the current parser state.

new()

@spec new() :: map()

Creates a new parser state with default values.

process_input(emulator, state, input)

@spec process_input(Raxol.Terminal.Emulator.t(), map(), binary()) ::
  {:continue, Raxol.Terminal.Emulator.t(), map(), binary()}
  | {:incomplete, Raxol.Terminal.Emulator.t(), map()}
  | {:handled, Raxol.Terminal.Emulator.t()}

Processes input in the current parser state. Returns the updated emulator and parser state.

reset(state)

@spec reset(map()) :: map()

Clears all buffers and resets the state to ground.

set_designating_gset(state, gset)

@spec set_designating_gset(map(), non_neg_integer()) :: map()

Sets the G-set being designated.

set_final_byte(state, byte)

@spec set_final_byte(map(), integer()) :: map()

Sets the final byte for the current sequence.

set_state(current_state, new_state)

@spec set_state(map(), map()) :: map()

Sets the parser state to a new value.

transition_to(state, new_state)

@spec transition_to(map(), atom()) :: map()

Transitions to a new parser state, clearing relevant buffers.