Struct PostlexSource
pub struct PostlexSource<'a, 'i, 't> { /* private fields */ }Expand description
What a crate::postlex::PostlexStream pulls upstream tokens from — one
token per call, against the LIVE parser state.
Opaque over a module-private enum: the Parser arm’s engine coupling is a
PullErrorResolver trait object, so no engine type is named here and
either engine can build one.
Three lifetimes, not one. LexerSource is invariant (its
Custom(&Mutex<dyn …>) arm), so tying the per-drain-step borrow 'a to the
source’s 'i would force 'a out to the whole-parse lifetime — and then the
driver could neither re-borrow lexer_state per step nor take &mut state
for feed_token. 'a is the step, 'i the lexer/input borrow, 't the text.
Implementations§
§impl<'a, 'i, 't> PostlexSource<'a, 'i, 't>
impl<'a, 'i, 't> PostlexSource<'a, 'i, 't>
pub fn pull(&mut self) -> Result<Option<Token>, ParseError>
pub fn pull(&mut self) -> Result<Option<Token>, ParseError>
Lex ONE upstream token. Ok(None) is exhaustion. Errors arrive ALREADY
RESOLVED against whatever state the arm has, so a stream can hand one
straight to its consumer (the Python bridge raises it inside process()).