pub trait LexerCapability {
type Token;
// Required methods
fn next_token(
&mut self,
) -> Option<Result<(usize, Self::Token, usize), LexerError>>;
fn peek_token(
&mut self,
) -> Option<Result<(usize, Self::Token, usize), LexerError>>;
fn position(&self) -> Range<usize>;
fn source(&self) -> &str;
}Expand description
Core lexer capability trait
Required Associated Types§
Required Methods§
Sourcefn next_token(
&mut self,
) -> Option<Result<(usize, Self::Token, usize), LexerError>>
fn next_token( &mut self, ) -> Option<Result<(usize, Self::Token, usize), LexerError>>
Get the next token from the input
Sourcefn peek_token(
&mut self,
) -> Option<Result<(usize, Self::Token, usize), LexerError>>
fn peek_token( &mut self, ) -> Option<Result<(usize, Self::Token, usize), LexerError>>
Peek at the next token without consuming it