Parses a `WHILE` statement.
(&mut self, while_pos: LineCol)
| 1807 | |
| 1808 | /// Parses a `WHILE` statement. |
| 1809 | fn parse_while(&mut self, while_pos: LineCol) -> Result<Statement> { |
| 1810 | let expr = self.parse_required_expr("No expression in WHILE statement")?; |
| 1811 | self.expect_and_consume(Token::Eol, "Expecting newline after WHILE")?; |
| 1812 | |
| 1813 | let stmts = self.parse_until(Token::Wend)?; |
| 1814 | self.expect_and_consume_with_pos(Token::Wend, while_pos, "WHILE without WEND")?; |
| 1815 | |
| 1816 | Ok(Statement::While(WhileSpan { expr, body: stmts })) |
| 1817 | } |
| 1818 | |
| 1819 | /// Advances until the next statement after failing to parse a `WHILE` statement. |
| 1820 | fn reset_while(&mut self) -> Result<()> { |
no test coverage detected