pub struct Scanner<'a> { /* private fields */ }
Expand description
Converts text into a stream of tokens.
Implementations§
Source§impl<'a> Scanner<'a>
impl<'a> Scanner<'a>
Sourcepub fn new(file_text: &'a str) -> Scanner<'a>
pub fn new(file_text: &'a str) -> Scanner<'a>
Creates a new scanner based on the provided text.
pub fn file_text(&self) -> &str
Sourcepub fn scan(&mut self) -> Result<Option<Token<'a>>, ParseError>
pub fn scan(&mut self) -> Result<Option<Token<'a>>, ParseError>
Moves to and returns the next token.
Sourcepub fn token_start(&self) -> usize
pub fn token_start(&self) -> usize
Gets the start position of the token.
Auto Trait Implementations§
impl<'a> Freeze for Scanner<'a>
impl<'a> RefUnwindSafe for Scanner<'a>
impl<'a> Send for Scanner<'a>
impl<'a> Sync for Scanner<'a>
impl<'a> Unpin for Scanner<'a>
impl<'a> UnwindSafe for Scanner<'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