Struct cranelift_isle::lexer::Lexer
source · pub struct Lexer<'a> {
pub filenames: Vec<Arc<str>>,
pub file_texts: Vec<Arc<str>>,
/* private fields */
}
Expand description
The lexer.
Breaks source text up into a sequence of tokens (with source positions).
Fields§
§filenames: Vec<Arc<str>>
Arena of filenames from the input source.
Indexed via Pos::file
.
file_texts: Vec<Arc<str>>
Arena of file source texts.
Indexed via Pos::file
.
Implementations§
source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
sourcepub fn from_str(s: &'a str, filename: &'a str) -> Result<Lexer<'a>, Errors>
pub fn from_str(s: &'a str, filename: &'a str) -> Result<Lexer<'a>, Errors>
Create a new lexer for the given source contents and filename.
sourcepub fn from_files<P>(
file_paths: impl IntoIterator<Item = P>
) -> Result<Lexer<'a>, Errors>where
P: AsRef<Path>,
pub fn from_files<P>( file_paths: impl IntoIterator<Item = P> ) -> Result<Lexer<'a>, Errors>where P: AsRef<Path>,
Create a new lexer from the given files.