[−][src]Trait lrpar::Lexer
The trait which all lexers which want to interact with lrpar
must implement.
Required methods
fn iter<'a>(
&'a self
) -> Box<dyn Iterator<Item = Result<Lexeme<StorageT>, LexError>> + 'a>
&'a self
) -> Box<dyn Iterator<Item = Result<Lexeme<StorageT>, LexError>> + '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 whether the lexer caches anything if this method is called more than once (i.e. it might be slow to call this more than once).
fn span_str(&self, span: Span) -> &str
fn span_lines_str(&self, span: Span) -> &str
Return the lines containing the input at span
(including all the text on the lines
that span
starts and ends on).
Panics
If the span exceeds the known input.
fn line_col(&self, span: Span) -> ((usize, usize), (usize, usize))
Return ((start line, start column), (end line, end column))
for span
. Note that column
characters (not bytes) are returned.
Panics
If the span exceeds the known input.