pub struct Parser<'tok> { /* private fields */ }
Expand description
The core parser with dynamic rules
Implementations§
Source§impl<'tok> Parser<'tok>
impl<'tok> Parser<'tok>
Sourcepub fn with_tokens(self, tokens: &'tok [Token<'tok>]) -> Self
pub fn with_tokens(self, tokens: &'tok [Token<'tok>]) -> Self
Assigns a token stream to the parser
Sourcepub fn peek_token(&self) -> Token<'tok>
pub fn peek_token(&self) -> Token<'tok>
Peeks at the current token
Sourcepub fn peek_back(&self) -> TokenTag<'tok>
pub fn peek_back(&self) -> TokenTag<'tok>
Peeks at the previous token, does not advance the index
Sourcepub fn consume(&mut self, token: &TokenTag<'_>) -> Result<(), ParseError>
pub fn consume(&mut self, token: &TokenTag<'_>) -> Result<(), ParseError>
Consumes the current token assuming it’s the provided Token, failing if not
Sourcepub fn consume_end(&mut self) -> Result<(), ParseError>
pub fn consume_end(&mut self) -> Result<(), ParseError>
Consumes the proper end for the tree
Sourcepub fn consume_close_paren_if_necessary(&mut self) -> Result<(), ParseError>
pub fn consume_close_paren_if_necessary(&mut self) -> Result<(), ParseError>
If the current rules require parenthesis, consume ’em
Sourcepub fn consume_open_paren_if_necessary(&mut self) -> Result<(), ParseError>
pub fn consume_open_paren_if_necessary(&mut self) -> Result<(), ParseError>
If the current rules require parenthesis, consume ’em
Auto Trait Implementations§
impl<'tok> Freeze for Parser<'tok>
impl<'tok> RefUnwindSafe for Parser<'tok>
impl<'tok> Send for Parser<'tok>
impl<'tok> Sync for Parser<'tok>
impl<'tok> Unpin for Parser<'tok>
impl<'tok> UnwindSafe for Parser<'tok>
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