pub struct Lexer { /* private fields */ }Expand description
Character-by-character scanner producing tokens.
Implementations§
Source§impl Lexer
impl Lexer
pub fn new(source: &str) -> Self
Sourcepub fn with_position(source: &str, line: usize, column: usize) -> Self
pub fn with_position(source: &str, line: usize, column: usize) -> Self
Create a lexer that starts counting from the given source position. Useful for re-lexing interpolated expressions at their original location.
Sourcepub fn tokenize_with_comments(&mut self) -> Result<Vec<Token>, LexerError>
pub fn tokenize_with_comments(&mut self) -> Result<Vec<Token>, LexerError>
Tokenize source code, including comment tokens.
pub fn tokenize(&mut self) -> Result<Vec<Token>, LexerError>
Auto Trait Implementations§
impl Freeze for Lexer
impl RefUnwindSafe for Lexer
impl Send for Lexer
impl Sync for Lexer
impl Unpin for Lexer
impl UnsafeUnpin for Lexer
impl UnwindSafe for Lexer
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