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

Method parse_exit

core/src/parser.rs:711–727  ·  view source on GitHub ↗

Parses an `EXIT` statement.

(&mut self, pos: LineCol)

Source from the content-addressed store, hash-verified

709
710 /// Parses an `EXIT` statement.
711 fn parse_exit(&mut self, pos: LineCol) -> Result<Statement> {
712 let peeked = self.lexer.peek()?;
713 let stmt = match peeked.token {
714 Token::Do => Statement::ExitDo(ExitSpan { pos }),
715 Token::For => Statement::ExitFor(ExitSpan { pos }),
716 Token::Function => Statement::ExitFunction(ExitSpan { pos }),
717 Token::Sub => Statement::ExitSub(ExitSpan { pos }),
718 _ => {
719 return Err(Error::Bad(
720 peeked.pos,
721 "Expecting DO, FOR, FUNCTION or SUB after EXIT".to_owned(),
722 ));
723 }
724 };
725 self.lexer.consume_peeked();
726 Ok(stmt)
727 }
728
729 /// Parses a variable list of comma-separated expressions. The caller must have consumed the
730 /// open parenthesis and we stop processing when we encounter the terminating parenthesis (and

Callers 2

parse_unilineMethod · 0.80
parse_oneMethod · 0.80

Calls 2

consume_peekedMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected