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) -> LogosLexer<'a>
pub fn new(source: &'a str) -> LogosLexer<'a>
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) -> LogosLexer<'a>
pub fn with_interner(source: &'a str, interner: ThreadedRodeo) -> LogosLexer<'a>
Create a new lexer with an existing interner.
Sourcepub fn with_file_id(source: &'a str, file_id: FileId) -> LogosLexer<'a>
pub fn with_file_id(source: &'a str, file_id: FileId) -> LogosLexer<'a>
Create a new lexer with a specific file ID.
Sourcepub fn with_interner_and_file_id(
source: &'a str,
interner: ThreadedRodeo,
file_id: FileId,
) -> LogosLexer<'a>
pub fn with_interner_and_file_id( source: &'a str, interner: ThreadedRodeo, file_id: FileId, ) -> LogosLexer<'a>
Create a new lexer with both an existing interner and a specific file ID.
Sourcepub fn tokenize(
self,
) -> Result<(Vec<Token>, ThreadedRodeo), DiagnosticWrapper<ErrorKind>>
pub fn tokenize( self, ) -> Result<(Vec<Token>, ThreadedRodeo), DiagnosticWrapper<ErrorKind>>
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> 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more