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>
pub fn from_files<P>( file_paths: impl IntoIterator<Item = P>, ) -> Result<Lexer<'a>, Errors>
Create a new lexer from the given files.
sourcepub fn from_file_contents(
files: Vec<(PathBuf, String)>,
) -> Result<Lexer<'a>, Errors>
pub fn from_file_contents( files: Vec<(PathBuf, String)>, ) -> Result<Lexer<'a>, Errors>
Create a new lexer from the given files and contents.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)