Raxol.Terminal.ParserStateManager (Raxol v2.0.1)

View Source

Consolidated terminal parser state manager combining simple emulator operations with comprehensive parser state management.

This module consolidates functionality from:

  • Simple parser state operations on Emulator structs
  • Comprehensive parser state management from Parser.State.Manager

Usage

For simple emulator operations:

emulator = ParserStateManager.reset_parser_state(emulator)

For comprehensive parser operations:

manager = ParserStateManager.create_parser_manager()
manager = ParserStateManager.process_char(manager, ?A)

Migration from Parser.State.Manager

Use create_parser_manager/0 instead of Parser.State.Manager.new/0

Summary

Functions

Adds an intermediate character. Returns the updated emulator.

Adds a parameter to the current parser state. Returns the updated emulator.

Clears all intermediate characters. Returns the updated emulator.

Clears all parser parameters. Returns the updated emulator.

Gets the current intermediate characters. Returns the list of intermediate characters.

Gets the current parser mode. Returns the current mode.

Gets the current parser parameters. Returns the list of parameters.

Gets the current parser state. Returns the parser state.

Processes a character in the current parser state. Returns the updated emulator and any output.

Resets the parser state to its initial state. Returns the updated emulator.

Sets the intermediate characters. Returns the updated emulator.

Sets the parser mode. Returns the updated emulator.

Sets the parser parameters. Returns the updated emulator.

Updates the parser state. Returns the updated emulator.

Functions

add_intermediate(emulator, char)

@spec add_intermediate(Raxol.Terminal.Emulator.t(), char()) ::
  Raxol.Terminal.Emulator.t()

Adds an intermediate character. Returns the updated emulator.

add_param(emulator, param)

Adds a parameter to the current parser state. Returns the updated emulator.

clear_intermediates(emulator)

@spec clear_intermediates(Raxol.Terminal.Emulator.t()) :: Raxol.Terminal.Emulator.t()

Clears all intermediate characters. Returns the updated emulator.

clear_params(emulator)

Clears all parser parameters. Returns the updated emulator.

create_parser_manager()

See Raxol.Terminal.Parser.State.Manager.new/0.

get_intermediates(emulator)

@spec get_intermediates(Raxol.Terminal.Emulator.t()) :: [char()]

Gets the current intermediate characters. Returns the list of intermediate characters.

get_mode(emulator)

@spec get_mode(Raxol.Terminal.Emulator.t()) :: atom()

Gets the current parser mode. Returns the current mode.

get_params(emulator)

@spec get_params(Raxol.Terminal.Emulator.t()) :: [String.t()]

Gets the current parser parameters. Returns the list of parameters.

get_parser_state(emulator)

Gets the current parser state. Returns the parser state.

process_char(emulator, char)

@spec process_char(Raxol.Terminal.Emulator.t(), char()) ::
  {Raxol.Terminal.Emulator.t(), any()}

Processes a character in the current parser state. Returns the updated emulator and any output.

process_parser_char(manager, char)

See Raxol.Terminal.Parser.State.Manager.process_char/2.

reset_parser_state(emulator)

@spec reset_parser_state(Raxol.Terminal.Emulator.t()) :: Raxol.Terminal.Emulator.t()

Resets the parser state to its initial state. Returns the updated emulator.

set_intermediates(emulator, intermediates)

@spec set_intermediates(Raxol.Terminal.Emulator.t(), [char()]) ::
  Raxol.Terminal.Emulator.t()

Sets the intermediate characters. Returns the updated emulator.

set_mode(emulator, mode)

Sets the parser mode. Returns the updated emulator.

set_params(emulator, params)

Sets the parser parameters. Returns the updated emulator.

update_parser_state(emulator, new_state)

Updates the parser state. Returns the updated emulator.