(&mut self, f: F)
| 5538 | } |
| 5539 | |
| 5540 | fn parse_option_sequence<T, F>(&mut self, f: F) -> Result<Option<Vec<T>>, ParserError> |
| 5541 | where |
| 5542 | F: FnMut(&mut Self) -> Result<T, ParserError>, |
| 5543 | { |
| 5544 | Ok(if self.consume_token(&Token::LParen) { |
| 5545 | let options = if self.consume_token(&Token::RParen) { |
| 5546 | vec![] |
| 5547 | } else { |
| 5548 | let options = self.parse_comma_separated(f)?; |
| 5549 | self.expect_token(&Token::RParen)?; |
| 5550 | options |
| 5551 | }; |
| 5552 | |
| 5553 | Some(options) |
| 5554 | } else if self.consume_token(&Token::LBracket) { |
| 5555 | let options = if self.consume_token(&Token::RBracket) { |
| 5556 | vec![] |
| 5557 | } else { |
| 5558 | let options = self.parse_comma_separated(f)?; |
| 5559 | |
| 5560 | self.expect_token(&Token::RBracket)?; |
| 5561 | options |
| 5562 | }; |
| 5563 | |
| 5564 | Some(options) |
| 5565 | } else { |
| 5566 | None |
| 5567 | }) |
| 5568 | } |
| 5569 | |
| 5570 | fn parse_option_map( |
| 5571 | &mut self, |
no test coverage detected