Enum LexerSource
pub enum LexerSource<'a> {
Basic(&'a BasicLexer),
Contextual(&'a ContextualLexer),
Custom(&'a Mutex<dyn TokenSource + Send + 'a>),
}Expand description
Which lexer drives a parse (contextual becomes the real LALR default;
the basic path stays for bootstrap/diagnostics). Copy — it holds only
immutable references, so a caller can drive the same source through
more than one entry (e.g. the tree vs. no-tree parity A/B).
Variants§
Basic(&'a BasicLexer)
Contextual(&'a ContextualLexer)
Custom(&'a Mutex<dyn TokenSource + Send + 'a>)
A caller-implemented crate::custom::TokenSource (Lark’s custom
lexer class). Behind a shared &Mutex so this enum stays Copy and an
interactive copy() shares the source — exactly Lark’s
LexerThread.__copy__, which copies the lexer state but shares the
lexer object (a custom source owns its own cursor, so forks share it).
The loop pulls it lazily, one token per needed feed, keyed on the live
parser state (custom.rs module docs).
Trait Implementations§
§impl<'a> Clone for LexerSource<'a>
impl<'a> Clone for LexerSource<'a>
§fn clone(&self) -> LexerSource<'a>
fn clone(&self) -> LexerSource<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for LexerSource<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for LexerSource<'a>
impl<'a> !UnwindSafe for LexerSource<'a>
impl<'a> Freeze for LexerSource<'a>
impl<'a> Send for LexerSource<'a>
impl<'a> Sync for LexerSource<'a>
impl<'a> Unpin for LexerSource<'a>
impl<'a> UnsafeUnpin for LexerSource<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more