pub struct Parser<'t> { /* private fields */ }
Implementations§
Source§impl<'t> Parser<'t>
Basic parser functionality
impl<'t> Parser<'t>
Basic parser functionality
pub fn new(lexer: Lexer<'t>) -> Self
Sourcepub fn parse<P: Parse<'t>>(&mut self) -> PResult<P>
pub fn parse<P: Parse<'t>>(&mut self) -> PResult<P>
Attempts to parse anything that implements the Parse trait
Sourcepub fn peek(&mut self, while_parsing: Parsing) -> PResult<&Token>
pub fn peek(&mut self, while_parsing: Parsing) -> PResult<&Token>
Looks ahead one token
Stores the token in an internal lookahead buffer
Sourcepub fn peek_kind(&mut self, while_parsing: Parsing) -> PResult<TokenKind>
pub fn peek_kind(&mut self, while_parsing: Parsing) -> PResult<TokenKind>
Looks ahead at the next [Token]’s [TokenKind]
Sourcepub fn consume_peeked(&mut self) -> Option<Token>
pub fn consume_peeked(&mut self) -> Option<Token>
Sourcepub fn match_type(
&mut self,
want: TokenKind,
while_parsing: Parsing,
) -> PResult<Token>
pub fn match_type( &mut self, want: TokenKind, while_parsing: Parsing, ) -> PResult<Token>
Consumes the next [Token] if it matches the pattern [TokenKind]
Trait Implementations§
Auto Trait Implementations§
impl<'t> Freeze for Parser<'t>
impl<'t> RefUnwindSafe for Parser<'t>
impl<'t> Send for Parser<'t>
impl<'t> Sync for Parser<'t>
impl<'t> Unpin for Parser<'t>
impl<'t> UnwindSafe for Parser<'t>
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