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

Method parse_until

core/src/parser.rs:303–319  ·  view source on GitHub ↗

Reads statements until the `delim` keyword is found. The delimiter is not consumed.

(&mut self, delim: Token)

Source from the content-addressed store, hash-verified

301
302 /// Reads statements until the `delim` keyword is found. The delimiter is not consumed.
303 fn parse_until(&mut self, delim: Token) -> Result<Vec<Statement>> {
304 let mut stmts = vec![];
305 loop {
306 let peeked = self.lexer.peek()?;
307 if peeked.token == delim {
308 break;
309 } else if peeked.token == Token::Eol {
310 self.lexer.consume_peeked();
311 continue;
312 }
313 match self.parse_one_safe()? {
314 Some(stmt) => stmts.push(stmt),
315 None => break,
316 }
317 }
318 Ok(stmts)
319 }
320
321 /// Parses an assignment for the variable reference `vref` already read.
322 fn parse_assignment(&mut self, vref: VarRef, vref_pos: LineCol) -> Result<Statement> {

Callers 3

parse_doMethod · 0.80
parse_forMethod · 0.80
parse_whileMethod · 0.80

Calls 4

consume_peekedMethod · 0.80
parse_one_safeMethod · 0.80
pushMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected