lrlex

Struct LRNonStreamingLexerDef

source
pub struct LRNonStreamingLexerDef<LexerTypesT: LexerTypes>
where usize: AsPrimitive<LexerTypesT::StorageT>,
{ /* private fields */ }
Expand description

This struct represents, in essence, a .l file in memory. From it one can produce an LRNonStreamingLexer which actually lexes inputs.

Implementations§

source§

impl<StorageT: 'static + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT>> LRNonStreamingLexerDef<LexerTypesT>
where usize: AsPrimitive<StorageT>, LexerTypesT::StorageT: TryFrom<usize>,

source

pub fn new_with_options( s: &str, re_opts: RegexOptions, ) -> LexBuildResult<LRNonStreamingLexerDef<LexerTypesT>>

source

pub fn lexer<'lexer, 'input: 'lexer>( &'lexer self, s: &'input str, ) -> LRNonStreamingLexer<'lexer, 'input, LexerTypesT>

Return an LRNonStreamingLexer for the String s that will lex relative to this LRNonStreamingLexerDef.

Trait Implementations§

source§

impl<LexerTypesT: Debug + LexerTypes> Debug for LRNonStreamingLexerDef<LexerTypesT>
where usize: AsPrimitive<LexerTypesT::StorageT>, LexerTypesT::StorageT: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<LexerTypesT: LexerTypes> LexerDef<LexerTypesT> for LRNonStreamingLexerDef<LexerTypesT>
where usize: AsPrimitive<LexerTypesT::StorageT>, LexerTypesT::StorageT: TryFrom<usize>,

source§

fn from_str(s: &str) -> LexBuildResult<LRNonStreamingLexerDef<LexerTypesT>>

Instantiate a lexer from a string (e.g. representing a .l file).
source§

fn get_rule(&self, idx: usize) -> Option<&Rule<LexerTypesT::StorageT>>

Get the Rule at index idx.
source§

fn get_rule_by_id( &self, tok_id: LexerTypesT::StorageT, ) -> &Rule<LexerTypesT::StorageT>

Get the Rule instance associated with a particular lexeme ID. Panics if no such rule exists.
source§

fn get_rule_by_name(&self, n: &str) -> Option<&Rule<LexerTypesT::StorageT>>

Get the Rule instance associated with a particular name.
source§

fn set_rule_ids<'a>( &'a mut self, rule_ids_map: &HashMap<&'a str, LexerTypesT::StorageT>, ) -> (Option<HashSet<&'a str>>, Option<HashSet<&'a str>>)

Set the id attribute on rules to the corresponding value in map. This is typically used to synchronise a parser’s notion of lexeme IDs with the lexers. While doing this, it keeps track of which lexemes: Read more
source§

fn set_rule_ids_spanned<'a>( &'a mut self, rule_ids_map: &HashMap<&'a str, LexerTypesT::StorageT>, ) -> (Option<HashSet<&'a str>>, Option<HashSet<(&'a str, Span)>>)

source§

fn iter_rules(&self) -> Iter<'_, Rule<LexerTypesT::StorageT>>

Returns an iterator over all rules in this AST.
source§

fn iter_start_states(&self) -> Iter<'_, StartState>

Returns an iterator over all start states in this AST.

Auto Trait Implementations§

§

impl<LexerTypesT> Freeze for LRNonStreamingLexerDef<LexerTypesT>
where usize: Sized,

§

impl<LexerTypesT> RefUnwindSafe for LRNonStreamingLexerDef<LexerTypesT>
where usize: Sized, LexerTypesT: RefUnwindSafe, <LexerTypesT as LexerTypes>::StorageT: RefUnwindSafe,

§

impl<LexerTypesT> Send for LRNonStreamingLexerDef<LexerTypesT>
where usize: Sized, LexerTypesT: Send, <LexerTypesT as LexerTypes>::StorageT: Send,

§

impl<LexerTypesT> Sync for LRNonStreamingLexerDef<LexerTypesT>
where usize: Sized, LexerTypesT: Sync, <LexerTypesT as LexerTypes>::StorageT: Sync,

§

impl<LexerTypesT> Unpin for LRNonStreamingLexerDef<LexerTypesT>
where usize: Sized, LexerTypesT: Unpin, <LexerTypesT as LexerTypes>::StorageT: Unpin,

§

impl<LexerTypesT> UnwindSafe for LRNonStreamingLexerDef<LexerTypesT>
where usize: Sized, LexerTypesT: UnwindSafe, <LexerTypesT as LexerTypes>::StorageT: 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.