AbstractThe input item type
The output item type
ProtectedbufferBuffer holding input items
ProtectedbufferCurrent position in the buffer
Whether end of file has been signaled
ProtectedinputCurrent position in the input stream
ProtectedoutputNumber of outputs generated
ProtectedatChecks if end of file has been reached and buffer is exhausted.
True if no more input is available
ProtectedcanOverride to customize when to compact the buffer By default, compacts when more than 1000 items have been consumed
boolean indicating whether to compact the buffer
ProtectedcompactCompacts the buffer by removing consumed items
ProtectedexpectConsumes and validates the next item against an expected type or value.
The expected item type
The consumed item cast to the expected type
ProtectednextGenerates parsed output items from the buffer. Handles backtracking when more input is needed.
A generator yielding parsed output items
ProtectedoneProtected AbstractparseAbstract method to parse the next output item from the buffer. Subclasses must implement this to define parsing logic.
The parsed output item
ProtectedpeekPeeks at an item in the buffer without consuming it.
Number of positions to look ahead (default: 0)
The item at the peek position, or null if at EOF
Abstract base class for incremental parsers that can process input as it becomes available. Supports buffering, lookahead, and backtracking for complex parsing scenarios.