Parses an `EXIT` statement.
(&mut self, pos: LineCol)
| 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 |
no test coverage detected