Skip to main content

PostlexSource

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>

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()).

pub fn text(&self) -> &str

The input being lexed, for a binding’s caret rendering. "" on the custom arm, which genuinely has no text.

Auto Trait Implementations§

§

impl<'a, 'i, 't> !RefUnwindSafe for PostlexSource<'a, 'i, 't>

§

impl<'a, 'i, 't> !UnwindSafe for PostlexSource<'a, 'i, 't>

§

impl<'a, 'i, 't> Freeze for PostlexSource<'a, 'i, 't>

§

impl<'a, 'i, 't> Send for PostlexSource<'a, 'i, 't>

§

impl<'a, 'i, 't> Sync for PostlexSource<'a, 'i, 't>

§

impl<'a, 'i, 't> Unpin for PostlexSource<'a, 'i, 't>

§

impl<'a, 'i, 't> UnsafeUnpin for PostlexSource<'a, 'i, 't>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.