Parses the `AS typename` clause of a `DIM` statement. The caller has already consumed the `AS` token.
(&mut self)
| 532 | /// Parses the `AS typename` clause of a `DIM` statement. The caller has already consumed the |
| 533 | /// `AS` token. |
| 534 | fn parse_dim_as(&mut self) -> Result<(ExprType, LineCol)> { |
| 535 | let peeked = self.lexer.peek()?; |
| 536 | let (vtype, vtype_pos) = match peeked.token { |
| 537 | Token::Eof | Token::Eol => (ExprType::Integer, peeked.pos), |
| 538 | Token::As => { |
| 539 | self.lexer.consume_peeked(); |
| 540 | self.parse_as_type()? |
| 541 | } |
| 542 | _ => return Err(Error::Bad(peeked.pos, "Expected AS or end of statement".to_owned())), |
| 543 | }; |
| 544 | |
| 545 | let next = self.lexer.peek()?; |
| 546 | match &next.token { |
| 547 | Token::Eof | Token::Eol => (), |
| 548 | t => return Err(Error::Bad(next.pos, format!("Unexpected {} in DIM statement", t))), |
| 549 | } |
| 550 | |
| 551 | Ok((vtype, vtype_pos)) |
| 552 | } |
| 553 | |
| 554 | /// Parses a `DIM` statement. |
| 555 | fn parse_dim(&mut self) -> Result<Statement> { |
no test coverage detected