Trait lrpar::Lexer

source ·
pub trait Lexer<LexerTypesT: LexerTypes>where
    usize: AsPrimitive<LexerTypesT::StorageT>,{
    // Required method
    fn iter<'a>(
        &'a self
    ) -> Box<dyn Iterator<Item = Result<LexerTypesT::LexemeT, LexerTypesT::LexErrorT>> + 'a>;
}
Expand description

The base trait which all lexers which want to interact with lrpar must implement.

Required Methods§

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:

  • The lexer may or may not stop after the first LexError is encountered.
  • There are no guarantees about what happens if this function is called more than once. For example, a streaming lexer may only produce Lexemes on the first call.

Implementors§