MCPcopy Index your code
hub / github.com/endbasic/endbasic / parse_while

Method parse_while

core/src/parser.rs:1809–1817  ·  view source on GitHub ↗

Parses a `WHILE` statement.

(&mut self, while_pos: LineCol)

Source from the content-addressed store, hash-verified

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<()> {

Callers 1

parse_oneMethod · 0.80

Calls 4

parse_required_exprMethod · 0.80
expect_and_consumeMethod · 0.80
parse_untilMethod · 0.80

Tested by

no test coverage detected