pub struct Lexer<'a> {
pub pos: usize,
/* private fields */
}Expand description
The lexer struct, which produces tokens from an input string.
Fields§
§pos: usizeImplementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
pub fn new(input: &'a str) -> Self
Sourcepub fn peek_token(&self) -> Option<Token>
pub fn peek_token(&self) -> Option<Token>
Peek at the next token without consuming it
Sourcepub fn get_remaining_input(&self) -> Option<&str>
pub fn get_remaining_input(&self) -> Option<&str>
Get the remaining input from the current position
Sourcepub fn get_original_input(&self) -> &'a str
pub fn get_original_input(&self) -> &'a str
Get the original input string
Sourcepub fn next_token(&mut self) -> Option<Token>
pub fn next_token(&mut self) -> Option<Token>
Get the next token from the input.
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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)