(&mut self)
| 999 | } |
| 1000 | |
| 1001 | fn while_statement(&mut self) -> Result<Statement, ParseError> { |
| 1002 | let start_token = self.previous(); |
| 1003 | |
| 1004 | let condition = self.expression()?; |
| 1005 | self.expect_token( |
| 1006 | TokenKind::Punctuation(PunctuationKind::LeftBrace), |
| 1007 | "'{'", |
| 1008 | "'while' condition", |
| 1009 | )?; |
| 1010 | |
| 1011 | let body = self.parse_scope()?; |
| 1012 | let end_span = body.span(); |
| 1013 | |
| 1014 | Ok(Statement::While( |
| 1015 | condition, |
| 1016 | Box::new(body), |
| 1017 | start_token.span.merge(end_span), |
| 1018 | start_token.line, |
| 1019 | )) |
| 1020 | } |
| 1021 | |
| 1022 | fn if_statement(&mut self) -> Result<Statement, ParseError> { |
| 1023 | let keyword = self.previous(); |
no test coverage detected