pub struct LRNonStreamingLexerDef<LexerTypesT: LexerTypes>{ /* 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>
impl<StorageT: 'static + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT>> LRNonStreamingLexerDef<LexerTypesT>
pub fn new_with_options( s: &str, re_opts: RegexOptions, ) -> LexBuildResult<LRNonStreamingLexerDef<LexerTypesT>>
sourcepub fn lexer<'lexer, 'input: 'lexer>(
&'lexer self,
s: &'input str,
) -> LRNonStreamingLexer<'lexer, 'input, LexerTypesT>
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>
impl<LexerTypesT: Debug + LexerTypes> Debug for LRNonStreamingLexerDef<LexerTypesT>
source§impl<LexerTypesT: LexerTypes> LexerDef<LexerTypesT> for LRNonStreamingLexerDef<LexerTypesT>
impl<LexerTypesT: LexerTypes> LexerDef<LexerTypesT> for LRNonStreamingLexerDef<LexerTypesT>
source§fn from_str(s: &str) -> LexBuildResult<LRNonStreamingLexerDef<LexerTypesT>>
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>>
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>
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>>
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>>)
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 morefn 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>>
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>
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>
impl<LexerTypesT> RefUnwindSafe for LRNonStreamingLexerDef<LexerTypesT>where
usize: Sized,
LexerTypesT: RefUnwindSafe,
<LexerTypesT as LexerTypes>::StorageT: RefUnwindSafe,
impl<LexerTypesT> Send for LRNonStreamingLexerDef<LexerTypesT>
impl<LexerTypesT> Sync for LRNonStreamingLexerDef<LexerTypesT>
impl<LexerTypesT> Unpin for LRNonStreamingLexerDef<LexerTypesT>
impl<LexerTypesT> UnwindSafe for LRNonStreamingLexerDef<LexerTypesT>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more