Skip to content

Parser

io.text.parser.S = TypeVar('S') module-attribute

io.text.parser.FileParser

Bases: ABC, Generic[S]

Main parser orchestrator for a specific file type

get_parser()

Return parser for specific state, None if no parsing needed

get_scanner()

Return the scanner for this file type

parse_file(file_path)

Full parse of file

scan_bytes(buf)

scan_file(file_path)

Single pass through file to scan for states and their transitions.

io.text.parser.ParsedFile(file_path, file_type, regions, metadata) dataclass

Complete parsed file result

file_path instance-attribute

file_type instance-attribute

metadata instance-attribute

regions instance-attribute

io.text.parser.ParsedRegion(state, byte_range, data) dataclass

Container for parsed data from a state region

byte_range instance-attribute

data instance-attribute

state instance-attribute

io.text.parser.ParserRegistry()

Registry for file type parsers

get_parser(file_type)

Get parser for file type

register(file_type, parser)

Register a parser for a file type

io.text.parser.StateParser

Bases: ABC, Generic[S]

Abstract parser for parsing specific state regions

parse(data, state) abstractmethod

Parse the bytes for a specific state region