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

Method maybe_parse_end

core/src/parser.rs:689–700  ·  view source on GitHub ↗

Parses a potential `END` statement but, if this corresponds to a statement terminator such as `END IF`, returns the token that followed `END`.

(&mut self, pos: LineCol)

Source from the content-addressed store, hash-verified

687 /// Parses a potential `END` statement but, if this corresponds to a statement terminator such
688 /// as `END IF`, returns the token that followed `END`.
689 fn maybe_parse_end(&mut self, pos: LineCol) -> Result<std::result::Result<Statement, Token>> {
690 match self.lexer.peek()?.token {
691 Token::Function => Ok(Err(Token::Function)),
692 Token::If => Ok(Err(Token::If)),
693 Token::Select => Ok(Err(Token::Select)),
694 Token::Sub => Ok(Err(Token::Sub)),
695 _ => {
696 let code = self.parse_expr(None)?;
697 Ok(Ok(Statement::End(EndSpan { code, pos })))
698 }
699 }
700 }
701
702 /// Parses an `END` statement.
703 fn parse_end(&mut self, pos: LineCol) -> Result<Statement> {

Callers 4

parse_endMethod · 0.80
parse_if_multilineMethod · 0.80
parse_callable_bodyMethod · 0.80
parse_selectMethod · 0.80

Calls 2

parse_exprMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected