Skip to main content

EarleyLexerSource

Enum EarleyLexerSource 

pub enum EarleyLexerSource<'a> {
    Basic(&'a BasicLexer),
    Dynamic {
        matchers: &'a DynamicMatchers,
        ignore: &'a [String],
    },
    DynamicComplete {
        matchers: &'a DynamicMatchers,
        ignore: &'a [String],
    },
    Custom(&'a Mutex<dyn TokenSource + Send + 'a>),
}
Expand description

Which scan strategy drives an Earley parse (Lark’s resolved lexer; the frontends facade’s ResolvedLexer). Earley defines its own source enum rather than importing LALR’s LexerSource (engine boundary): the basic path takes a pre-lexing BasicLexer token stream; the dynamic paths take the construction-built matchers.

Variants§

§

Basic(&'a BasicLexer)

Basic-lexer Earley. Under a postlex the token stream is wrapped by the engine-agnostic connector.

§

Dynamic

Dynamic-lexer Earley (xearley): per-terminal forward regex; forbids postlex + lexer_callbacks (enforced at the frontend). The per-terminal DynamicMatchers are built once at construction (build_dynamic_matchers, where a zero-width/bad regexp already raised the GrammarError) and borrowed here — the parse never compiles a matcher.

Fields

§matchers: &'a DynamicMatchers
§ignore: &'a [String]
§

DynamicComplete

dynamic_complete: dynamic + shorter-prefix enumeration.

Fields

§matchers: &'a DynamicMatchers
§ignore: &'a [String]
§

Custom(&'a Mutex<dyn TokenSource + Send + 'a>)

A caller-implemented crate::custom::TokenSource feeding the basic scan (Lark: a lexer class bypasses the parser×lexer matrix and Earley drives it through _match_earley_basic; the [custom_old0,earley]/[custom_old1,earley] Lark cells). Pulled lazily, one token per recognizer step, with the live pre-closure expects snapshot handed to each pull ([CustomScan]). Postlex composes on top, as for Basic. An unknown type name stalls the recognizer at that token — Lark’s name-mismatch — and the stall reports the raw name (UnexpectedToken('WAT')).

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for EarleyLexerSource<'a>

§

impl<'a> !UnwindSafe for EarleyLexerSource<'a>

§

impl<'a> Freeze for EarleyLexerSource<'a>

§

impl<'a> Send for EarleyLexerSource<'a>

§

impl<'a> Sync for EarleyLexerSource<'a>

§

impl<'a> Unpin for EarleyLexerSource<'a>

§

impl<'a> UnsafeUnpin for EarleyLexerSource<'a>

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.