pub struct Parser<'a> { /* private fields */ }Expand description
The heart struct of the lexper. It parses the token vector into a nested AST of Expressions.
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn new(tokens: &'a [Token]) -> Self
pub fn new(tokens: &'a [Token]) -> Self
Creates a new instance of the Parser, but as the argument requires a slice of tokens.
This one was made to not to clone a vector of tokens after lexing.
Sourcepub fn parse_expression(&mut self, min_prec: u8) -> Result<Expression>
pub fn parse_expression(&mut self, min_prec: u8) -> Result<Expression>
The main method, parses the whole slice of tokens into a nested expression… recursively.
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'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