Skip to main content

EarleyParseJob

Struct EarleyParseJob 

pub struct EarleyParseJob<'i, 's> {
    pub table: &'s Arc<ParseTable>,
    pub lexer: EarleyLexerSource<'i>,
    pub text: &'i str,
    pub start: &'s str,
    pub options: ParseOptions,
    pub postlex: Option<&'s dyn Postlex>,
}
Expand description

The invariant inputs to an Earley parse — the peer to the LALR engine’s crate::lalr::ParseJob, keeping the two entry surfaces parallel (this engine’s parse_with deliberately mirrors LALR’s). Bundles what to parse and how to lex it; the strategy (transform) stays a separate argument.

Two lifetimes, matching the LALR peer: 'i (inputlexer + text) and 's (setuptable / start / postlex). Earley has no interactive mode, so no borrow escapes the call; the split is still needed because EarleyLexerSource is invariant (its Custom/dynamic arms) and so cannot share a lifetime with a short-lived resolved start (the facade’s resolve_start local) — exactly the LALR situation.

Not Copy (unlike the LALR peer): EarleyLexerSource is not Copy. No loss — on both engines a job is consumed by exactly one entry (even the LALR tree vs. no-tree parity A/B deliberately builds two jobs; see the LALR crate::lalr::ParseJob doc), so a by-value bundle consumed once suffices.

Fields§

§table: &'s Arc<ParseTable>

The compiled parse table (Arc::cloned into the recognizer tables).

§lexer: EarleyLexerSource<'i>

Which lexer drives the parse (EarleyLexerSource: basic / custom / dynamic).

§text: &'i str

The input to parse.

§start: &'s str

The start rule name.

§options: ParseOptions

Per-parse options (ParseOptions, incl. Earley’s ambiguity).

§postlex: Option<&'s dyn Postlex>

Optional streaming postlex (indenter) interposed between lexer and parser.

Auto Trait Implementations§

§

impl<'i, 's> !RefUnwindSafe for ParseJob<'i, 's>

§

impl<'i, 's> !UnwindSafe for ParseJob<'i, 's>

§

impl<'i, 's> Freeze for ParseJob<'i, 's>

§

impl<'i, 's> Send for ParseJob<'i, 's>

§

impl<'i, 's> Sync for ParseJob<'i, 's>

§

impl<'i, 's> Unpin for ParseJob<'i, 's>

§

impl<'i, 's> UnsafeUnpin for ParseJob<'i, 's>

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.