lrlex

Struct LRNonStreamingLexer

source
pub struct LRNonStreamingLexer<'lexer, 'input: 'lexer, LexerTypesT: LexerTypes>
where usize: AsPrimitive<LexerTypesT::StorageT>, LexerTypesT::StorageT: 'static + Debug + PrimInt,
{ /* private fields */ }
Expand description

An LRNonStreamingLexer holds a reference to a string and can lex it into lrpar::Lexemes. Although the struct is tied to a single string, no guarantees are made about whether the lexemes are cached or not.

Implementations§

source§

impl<'lexer, 'input: 'lexer, StorageT: 'static + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT>> LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where usize: AsPrimitive<StorageT>,

source

pub fn new( s: &'input str, lexemes: Vec<Result<LexerTypesT::LexemeT, LRLexError>>, newlines: NewlineCache, ) -> LRNonStreamingLexer<'lexer, 'input, LexerTypesT>

Create a new LRNonStreamingLexer that read in: the input s; and derived lexemes and newlines.

Note that if one or more lexemes or newlines was not created from s, subsequent calls to the LRNonStreamingLexer may cause panics.

Trait Implementations§

source§

impl<'lexer, 'input: 'lexer, StorageT: 'static + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT, LexErrorT = LRLexError>> Lexer<LexerTypesT> for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where usize: AsPrimitive<StorageT>,

source§

fn iter<'a>( &'a self, ) -> Box<dyn Iterator<Item = Result<LexerTypesT::LexemeT, LexerTypesT::LexErrorT>> + 'a>

Iterate over all the lexemes in this lexer. Note that: Read more
source§

impl<'lexer, 'input: 'lexer, LexerTypesT: LexerTypes<LexErrorT = LRLexError>> NonStreamingLexer<'input, LexerTypesT> for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where usize: AsPrimitive<LexerTypesT::StorageT>,

source§

fn span_str(&self, span: Span) -> &'input str

Return the user input associated with a Span. Read more
source§

fn span_lines_str(&self, span: Span) -> &'input str

Return the lines containing the input at span (including all the text on the lines that span starts and ends on). Read more
source§

fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize))

Return ((start line, start column), (end line, end column)) for span. Note that column characters (not bytes) are returned. Read more

Auto Trait Implementations§

§

impl<'lexer, 'input, LexerTypesT> Freeze for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where <LexerTypesT as LexerTypes>::StorageT: Sized, usize: Sized,

§

impl<'lexer, 'input, LexerTypesT> RefUnwindSafe for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where <LexerTypesT as LexerTypes>::StorageT: Sized + RefUnwindSafe, usize: Sized, <LexerTypesT as LexerTypes>::LexemeT: RefUnwindSafe,

§

impl<'lexer, 'input, LexerTypesT> Send for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where <LexerTypesT as LexerTypes>::StorageT: Sized + Send, usize: Sized, <LexerTypesT as LexerTypes>::LexemeT: Send,

§

impl<'lexer, 'input, LexerTypesT> Sync for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where <LexerTypesT as LexerTypes>::StorageT: Sized + Sync, usize: Sized, <LexerTypesT as LexerTypes>::LexemeT: Sync,

§

impl<'lexer, 'input, LexerTypesT> Unpin for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where <LexerTypesT as LexerTypes>::StorageT: Sized + Unpin, usize: Sized, <LexerTypesT as LexerTypes>::LexemeT: Unpin,

§

impl<'lexer, 'input, LexerTypesT> UnwindSafe for LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
where <LexerTypesT as LexerTypes>::StorageT: Sized + UnwindSafe, usize: Sized, <LexerTypesT as LexerTypes>::LexemeT: UnwindSafe,

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

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.