Raxol.Terminal.Escape.Parsers.BaseParser (Raxol v2.0.1)
View SourceBase parser utilities for escape sequence parsers.
Provides common functionality for logging and handling unknown sequences.
Summary
Functions
Extracts the final byte from a CSI sequence.
Checks if a character is a valid CSI final character.
Checks if a character is a valid CSI intermediate character.
Logs an unknown escape sequence for debugging purposes.
Checks if a character is a valid CSI parameter character.
Parses a numeric parameter from a string.
Splits parameters by semicolon and parses them as integers.
Functions
Extracts the final byte from a CSI sequence.
The final byte determines the command type in CSI sequences.
Parameters
- input: The input string
Returns
{final_byte, params_string} or nil if no final byte found
Checks if a character is a valid CSI final character.
Final characters are in the range 0x40-0x7E (@ through ~)
Parameters
- char: Character code to check
Returns
Boolean indicating if it's a final character
Checks if a character is a valid CSI intermediate character.
Intermediate characters are in the range 0x20-0x2F (space through /)
Parameters
- char: Character code to check
Returns
Boolean indicating if it's an intermediate character
Logs an unknown escape sequence for debugging purposes.
Parameters
- prefix: The escape sequence prefix (e.g., "ESC", "CSI")
- sequence: The unknown sequence
Returns
:ok
Checks if a character is a valid CSI parameter character.
Parameter characters are in the range 0x30-0x3F (0 through ?)
Parameters
- char: Character code to check
Returns
Boolean indicating if it's a parameter character
Parses a numeric parameter from a string.
Parameters
- str: String containing the number
Returns
The parsed integer or nil if parsing fails
Splits parameters by semicolon and parses them as integers.
Parameters
- params: String containing semicolon-separated parameters
Returns
List of parsed integers (nils are filtered out)