fn parse_block_expression_as_block(&mut self) -> ParseResult<BlockExpression> {
        let mut statements = Vec::new();

        // Consume the left brace
        self.next_token()?;

        while !self.current_token_is(Token::RightBrace) && !self.current_token_is(Token::Eof) {
            // TODO: Is throwing on Err the right approach?
            let stmt = self.parse_statement()?;
            statements.push(stmt);
            self.next_token()?;
        }

        // Expect a closing brace for the block (if we got EOF, this should result in a parse error)
        if !self.current_token_is(Token::RightBrace) {
            return Err(ParseError::Expected(
                "closing brace".to_string(),
                self.current_token.clone(),
            ));
        }

        Ok(BlockExpression { statements })
    }
/// Parse a block expresssion as a BlockExpression rather than a generic Expression
Parse a block expresssion as a BlockExpression rather than a generic Expression
Parse a block expresssion as a BlockExpression rather than a generic Expression
fn parse_block_expression_as_block(&mut self) -> ParseResult<BlockExpression> {
        let mut statements = Vec::new();
        // Consume the left brace
        self.next_token()?;
        while !self.current_token_is(Token::RightBrace) && !self.current_token_is(Token::Eof) {
            // TODO: Is throwing on Err the right approach?
            let stmt = self.parse_statement()?;
            statements.push(stmt);
            self.next_token()?;
        }
        // Expect a closing brace for the block (if we got EOF, this should result in a parse error)
        if !self.current_token_is(Token::RightBrace) {
            return Err(ParseError::Expected(
                "closing brace".to_string(),
                self.current_token.clone(),
            ));
        }
        Ok(BlockExpression { statements })
    }
fn parse_block_expression_as_block ( & mut self ) -> ParseResult < BlockExpression > { let mut statements = Vec :: new ( ) ; // Consume the left brace self . next_token ( ) ? ; while ! self . current_token_is ( Token :: RightBrace ) && ! self . current_token_is ( Token :: Eof ) { // TODO: Is throwing on Err the right approach? let stmt = self . parse_statement ( ) ? ; statements . push ( stmt ) ; self . next_token ( ) ? ; } // Expect a closing brace for the block (if we got EOF, this should result in a parse error) if ! self . current_token_is ( Token :: RightBrace ) { return Err ( ParseError :: Expected ( " " . to_string ( ) , self . current_token . clone ( ) , ) ) ; } Ok ( BlockExpression { statements } ) }
Parse a block expresssion as a BlockExpression rather than a generic Expression
Parse a block expresssion as a BlockExpression rather than a generic Expression
&mut self