Struct lrlex::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>,
impl<StorageT: 'static + Debug + Hash + PrimInt + Unsigned, LexerTypesT: LexerTypes<StorageT = StorageT>> LRNonStreamingLexerDef<LexerTypesT>where
usize: AsPrimitive<StorageT>,
LexerTypesT::StorageT: TryFrom<usize>,
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: LexerTypes> LexerDef<LexerTypesT> for LRNonStreamingLexerDef<LexerTypesT>where
usize: AsPrimitive<LexerTypesT::StorageT>,
LexerTypesT::StorageT: TryFrom<usize>,
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>>
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 moresource§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.