pub trait LexedSource<'a>: Iterator<Item = (Result<Token<'a>, String>, Span<'a>)> + Clone {
// Provided methods
fn report_errors(
&self,
) -> impl Iterator<Item = Report<'a, (&'a str, ByteSpan)>> { ... }
fn dump(&self, file_path: &Path) -> Result<()> { ... }
fn process(self) -> IntoIter<(Result<Token<'a>, String>, Span<'a>)> { ... }
fn tokens(self) -> impl Iterator<Item = SpannedToken<'a>> { ... }
}Expand description
An iterator over syntactical tokens for a SystemVerilog source
Provided Methods§
Sourcefn report_errors(&self) -> impl Iterator<Item = Report<'a, (&'a str, ByteSpan)>>
fn report_errors(&self) -> impl Iterator<Item = Report<'a, (&'a str, ByteSpan)>>
Generate error reports for any errors encountered in lexing
Sourcefn dump(&self, file_path: &Path) -> Result<()>
fn dump(&self, file_path: &Path) -> Result<()>
Dump a representation of the lexed source to a file, for debugging
Sourcefn process(self) -> IntoIter<(Result<Token<'a>, String>, Span<'a>)>
fn process(self) -> IntoIter<(Result<Token<'a>, String>, Span<'a>)>
Process the lexing of the source, storing the result
While this does incur memory overhead, it avoid processing the source multiple times if cloned.
Sourcefn tokens(self) -> impl Iterator<Item = SpannedToken<'a>>
fn tokens(self) -> impl Iterator<Item = SpannedToken<'a>>
Convert lexer results into tokens, turning errors into Token::Error
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".