pub struct Lexer<'a> { /* private fields */ }Expand description
Logos-based lexer that converts source text into tokens.
Implementations§
Source§impl<'a> LogosLexer<'a>
impl<'a> LogosLexer<'a>
Sourcepub fn new(source: &'a str) -> Self
pub fn new(source: &'a str) -> Self
Create a new lexer for the given source text with a fresh interner.
Uses the default file ID. For multi-file compilation, use with_file_id.
Sourcepub fn with_interner(source: &'a str, interner: ThreadedRodeo) -> Self
pub fn with_interner(source: &'a str, interner: ThreadedRodeo) -> Self
Create a new lexer with an existing interner.
Sourcepub fn with_file_id(source: &'a str, file_id: FileId) -> Self
pub fn with_file_id(source: &'a str, file_id: FileId) -> Self
Create a new lexer with a specific file ID.
Sourcepub fn with_interner_and_file_id(
source: &'a str,
interner: ThreadedRodeo,
file_id: FileId,
) -> Self
pub fn with_interner_and_file_id( source: &'a str, interner: ThreadedRodeo, file_id: FileId, ) -> Self
Create a new lexer with both an existing interner and a specific file ID.
Sourcepub fn tokenize(self) -> CompileResult<(Vec<Token>, ThreadedRodeo)>
pub fn tokenize(self) -> CompileResult<(Vec<Token>, ThreadedRodeo)>
Tokenize the entire source, returning all tokens and the interner.
Auto Trait Implementations§
impl<'a> !Freeze for LogosLexer<'a>
impl<'a> !RefUnwindSafe for LogosLexer<'a>
impl<'a> Send for LogosLexer<'a>
impl<'a> Sync for LogosLexer<'a>
impl<'a> Unpin for LogosLexer<'a>
impl<'a> UnsafeUnpin for LogosLexer<'a>
impl<'a> UnwindSafe for LogosLexer<'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