Transition
StateTransition(from_state, to_state, start_pos, end_pos, pattern=None)
¶
Track byte positions of state changes for parsing.
This dataclass represents a transition from one state to another within a byte stream or file, marking the boundaries of a specific content region.
end_pos
¶
The exclusive byte offset in the original data where this state region ends. This marks the beginning of the next state region or the end of the file.
from_state
¶
The Enum member representing the state of the content immediately preceding
this transition.
pattern = None
¶
An optional byte string representing the pattern that triggered this state transition. This can be useful for debugging or understanding the parsing logic.
start_pos
¶
The inclusive byte offset in the original data where this new state region begins.
to_state
¶
The Enum member representing the state the content is transitioning to,
which applies to the region starting at start_pos.