Struct rustemo::LRParser

source ·
pub struct LRParser<'i, C: Context<'i, I, S, TK>, S: State, P, TK: Default, NTK, D: ParserDefinition<S, P, TK, NTK>, L: Lexer<'i, C, S, TK, Input = I>, B, I: Input + ?Sized> { /* private fields */ }
Expand description

An implementation of LR parsing

Implementations§

source§

impl<'i, C, S, P, I, TK, NTK, D, L, B> LRParser<'i, C, S, P, TK, NTK, D, L, B, I>
where C: Context<'i, I, S, TK>, S: State, I: Input + ?Sized, TK: Default, D: ParserDefinition<S, P, TK, NTK>, L: Lexer<'i, C, S, TK, Input = I>, B: LRBuilder<'i, I, C, S, P, TK>,

source

pub fn new( definition: &'i D, state: S, partial_parse: bool, has_layout: bool, lexer: L, builder: B ) -> Self

source

pub fn location_str(&self, file: &str, location: Location) -> String

Trait Implementations§

source§

impl<'i, C, S, P, I, TK, NTK, D, L, B> Parser<'i, I, C, S, TK> for LRParser<'i, C, S, P, TK, NTK, D, L, B, I>
where C: Context<'i, I, S, TK> + Default, S: State + Debug, P: Debug + Copy + Into<NTK>, I: Input + ?Sized + Debug + 'i, TK: Debug + Copy + Default + PartialEq + 'i, D: ParserDefinition<S, P, TK, NTK>, L: Lexer<'i, C, S, TK, Input = I>, B: LRBuilder<'i, I, C, S, P, TK>,

§

type Output = <B as Builder>::Output

source§

fn parse(&self, input: &'i I) -> Result<Self::Output>

Parse the given input and produce the result. The output type is set by the parser implementers and it is usually defined by the builder if the building is done during the parse process.
source§

fn parse_with_context( &self, context: &mut C, input: &'i I ) -> Result<Self::Output>

Parse with the given context which has information about the current parsing state (e.g. position, location). Used in situation when we need to continue parsing from a specific state, like in parsing the layout from the current location.
source§

fn parse_file<'a, F: AsRef<Path>>(&'a mut self, file: F) -> Result<Self::Output>
where 'a: 'i,

A convenience method for loading the content from the given file and calling parse. The parser will own the content being parsed and thus has to outlive Self::Output if it borrows from the content loaded from the file.

Auto Trait Implementations§

§

impl<'i, C, S, P, TK, NTK, D, L, B, I> !RefUnwindSafe for LRParser<'i, C, S, P, TK, NTK, D, L, B, I>

§

impl<'i, C, S, P, TK, NTK, D, L, B, I> !Send for LRParser<'i, C, S, P, TK, NTK, D, L, B, I>

§

impl<'i, C, S, P, TK, NTK, D, L, B, I> !Sync for LRParser<'i, C, S, P, TK, NTK, D, L, B, I>

§

impl<'i, C, S, P, TK, NTK, D, L, B, I: ?Sized> Unpin for LRParser<'i, C, S, P, TK, NTK, D, L, B, I>
where B: Unpin, I: Unpin, NTK: Unpin, P: Unpin, S: Unpin, <I as ToOwned>::Owned: Unpin,

§

impl<'i, C, S, P, TK, NTK, D, L, B, I: ?Sized> UnwindSafe for LRParser<'i, C, S, P, TK, NTK, D, L, B, I>

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>,

§

type Error = Infallible

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>,

§

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.