pub struct LexerStream { /* private fields */ }Expand description
A position-tracking stream over a Vec<LexToken>.
Implementations§
Source§impl LexerStream
impl LexerStream
pub fn new(tokens: Vec<LexToken>) -> Self
pub fn is_empty(&self) -> bool
pub fn remaining(&self) -> usize
pub fn current_pos(&self) -> usize
pub fn peek(&self) -> Option<&LexToken>
pub fn peek_nth(&self, n: usize) -> Option<&LexToken>
pub fn next_token(&mut self) -> Option<&LexToken>
pub fn skip(&mut self, n: usize)
pub fn set_mark(&mut self)
pub fn restore_mark(&mut self)
pub fn clear_mark(&mut self)
Sourcepub fn consume_while(
&mut self,
pred: impl Fn(&LexToken) -> bool,
) -> Vec<&LexToken>
pub fn consume_while( &mut self, pred: impl Fn(&LexToken) -> bool, ) -> Vec<&LexToken>
Consume tokens while the predicate holds.
pub fn total(&self) -> usize
Trait Implementations§
Source§impl Clone for LexerStream
impl Clone for LexerStream
Source§fn clone(&self) -> LexerStream
fn clone(&self) -> LexerStream
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LexerStream
impl RefUnwindSafe for LexerStream
impl Send for LexerStream
impl Sync for LexerStream
impl Unpin for LexerStream
impl UnsafeUnpin for LexerStream
impl UnwindSafe for LexerStream
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