pub struct Parser {
lexer: Lexer,
cur_token: Token,
next_token: Token,
}Fields§
§lexer: Lexer§cur_token: Token§next_token: TokenImplementations§
Source§impl Parser
impl Parser
pub fn new(lexer: Lexer) -> Self
fn next(&mut self)
fn peek_next(&self) -> &Token
fn peek_next_is(&self, kind: &Kind) -> bool
fn expect_next_is(&mut self, kind: &Kind) -> bool
fn cur_precedence(&self) -> Precedence
fn peek_precedence(&self) -> Precedence
pub fn parse(&mut self) -> Result<Program, Vec<Vec<Box<dyn ParserError>>>>
fn parse_statement(&mut self) -> Result<Statement, Vec<Box<dyn ParserError>>>
fn parse_let_statement(&mut self) -> Result<LetStatement, ParseError>
fn parse_return_statement( &mut self, ) -> Result<ReturnStatement, Vec<Box<dyn ParserError>>>
fn parse_expression_statement( &mut self, ) -> Result<ExpressionStatement, Vec<Box<dyn ParserError>>>
fn parse_identifier(&mut self) -> Identifier
fn parse_integer_literal( &mut self, ) -> Result<IntegerLiteral, PrefixFunctionError>
fn parse_bool_literal(&mut self) -> BooleanLiteral
fn parse_string_literal(&mut self) -> StringLiteral
fn parse_block_statement( &mut self, ) -> Result<BlockStatement, Vec<Box<dyn ParserError>>>
fn parse_prefix_expression( &mut self, ) -> Result<Expression, Vec<Box<dyn ParserError>>>
fn parse_group_expression( &mut self, ) -> Result<Expression, Vec<Box<dyn ParserError>>>
fn parse_if_expression( &mut self, ) -> Result<IfExpression, Vec<Box<dyn ParserError>>>
fn parse_function_literal( &mut self, ) -> Result<FunctionLiteral, Vec<Box<dyn ParserError>>>
fn parse_function_parameters(&mut self) -> Result<Vec<Identifier>, ParseError>
fn parse_call_expression( &mut self, function: Expression, ) -> Result<CallExpression, Vec<Box<dyn ParserError>>>
fn parse_call_args( &mut self, ) -> Result<Vec<Expression>, Vec<Box<dyn ParserError>>>
fn parse_array_elements( &mut self, ) -> Result<Vec<Expression>, Vec<Box<dyn ParserError>>>
fn parse_prefix( &mut self, kind: &Kind, ) -> Result<Expression, Vec<Box<dyn ParserError>>>
fn parse_infix( &mut self, left: Expression, ) -> Result<Expression, Vec<Box<dyn ParserError>>>
fn parse_expression( &mut self, precedence: Precedence, ) -> Result<Expression, Vec<Box<dyn ParserError>>>
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
impl UnwindSafe for Parser
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