Parses a `DECLARE` statement.
(&mut self)
| 1453 | |
| 1454 | /// Parses a `DECLARE` statement. |
| 1455 | fn parse_declare(&mut self) -> Result<Statement> { |
| 1456 | let token_span = self.lexer.read()?; |
| 1457 | let (name, name_pos, params) = match token_span.token { |
| 1458 | Token::Function => self.parse_callable_signature(true, true)?, |
| 1459 | |
| 1460 | Token::Sub => self.parse_callable_signature(true, false)?, |
| 1461 | |
| 1462 | _ => { |
| 1463 | return Err(Error::Bad( |
| 1464 | token_span.pos, |
| 1465 | "Expected FUNCTION or SUB after DECLARE".to_owned(), |
| 1466 | )); |
| 1467 | } |
| 1468 | }; |
| 1469 | Ok(Statement::Declare(DeclareSpan { name, name_pos, params })) |
| 1470 | } |
| 1471 | |
| 1472 | /// Parses the signature of a callable declaration or definition. |
| 1473 | fn parse_callable_signature( |
no test coverage detected