pub struct ParseCx { /* private fields */ }Expand description
Cursor over a spanned Algol token stream, driving the Pratt parser with peek, advance, and lookahead operations.
Implementations§
Source§impl ParseCx
impl ParseCx
Sourcepub fn new(tokens: Vec<SpannedToken>) -> Self
pub fn new(tokens: Vec<SpannedToken>) -> Self
Creates a cursor positioned at the first of tokens.
Sourcepub fn peek(&self) -> Option<&SpannedToken>
pub fn peek(&self) -> Option<&SpannedToken>
Returns the current token without consuming it, or None at end of
input.
Sourcepub fn advance(&mut self) -> Option<SpannedToken>
pub fn advance(&mut self) -> Option<SpannedToken>
Consumes and returns the current token, or None at end of input.
Sourcepub fn next_required(&mut self) -> Result<SpannedToken>
pub fn next_required(&mut self) -> Result<SpannedToken>
Consumes the current token, erroring if the stream is exhausted.
Auto Trait Implementations§
impl Freeze for ParseCx
impl RefUnwindSafe for ParseCx
impl Send for ParseCx
impl Sync for ParseCx
impl Unpin for ParseCx
impl UnsafeUnpin for ParseCx
impl UnwindSafe for ParseCx
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