fn stmt_after_type(&mut self) -> Result<Stmt> {
        let decl = self.decl()?;
        if let Some(tok) = self.lexer.next() {
            // Distinguish between declaration, initialization, and function declaration
            Ok(match tok? { 
                Token::Semi => Stmt::Decl(decl),
                Token::Assign => {
                    let expr = self.expr()?;
                    self.expect(Token::Semi)?;
                    Stmt::Init(decl, expr)
                }
                Token::LParen => {
                    let param_list = self.param_list()?;
                    self.expect(Token::RParen)?;
                    self.expect(Token::LBrace)?;
                    let body = self.block()?;
                    self.expect(Token::RBrace)?;
                    Stmt::Function(decl, param_list, body)
                }
                tok => return Err(eparse!(self, "expected `;`, `=`, or `(`, got `{}`", tok)),
            })
        } else {
            Err(eparse!(self, "expected `;`, `=`, or `(`"))
        }
    }
/// Parses a variable declaration, initialization, or function definition.
Parses a variable declaration, initialization, or function definition.
Parses a variable declaration initialization or function definition .
fn stmt_after_type(&mut self) -> Result<Stmt> {
        let decl = self.decl()?;
        if let Some(tok) = self.lexer.next() {
            // Distinguish between declaration, initialization, and function declaration
            Ok(match tok? { 
                Token::Semi => Stmt::Decl(decl),
                Token::Assign => {
                    let expr = self.expr()?;
                    self.expect(Token::Semi)?;
                    Stmt::Init(decl, expr)
                }
                Token::LParen => {
                    let param_list = self.param_list()?;
                    self.expect(Token::RParen)?;
                    self.expect(Token::LBrace)?;
                    let body = self.block()?;
                    self.expect(Token::RBrace)?;
                    Stmt::Function(decl, param_list, body)
                }
                tok => return Err(eparse!(self, "expected `;`, `=`, or `(`, got `{}`", tok)),
            })
        } else {
            Err(eparse!(self, "expected `;`, `=`, or `(`"))
        }
    }
fn stmt_after_type ( & mut self ) -> Result < Stmt > { let decl = self . decl ( ) ? ; if let Some ( tok ) = self . lexer . next ( ) { // Distinguish between declaration, initialization, and function declaration Ok ( match tok ? { Token :: Semi => Stmt :: Decl ( decl ) , Token :: Assign => { let expr = self . expr ( ) ? ; self . expect ( Token :: Semi ) ? ; Stmt :: Init ( decl , expr ) } Token :: LParen => { let param_list = self . param_list ( ) ? ; self . expect ( Token :: RParen ) ? ; self . expect ( Token :: LBrace ) ? ; let body = self . block ( ) ? ; self . expect ( Token :: RBrace ) ? ; Stmt :: Function ( decl , param_list , body ) } tok => return Err ( eparse ! ( self " " tok ) ) , } ) } else { Err ( eparse ! ( self " " ) ) } }
Parses a variable declaration, initialization, or function definition.
Parses a variable declaration initialization or function definition .
&mut self
&mut self