Parses a list of comprehension generators. These are the `for` and `async for` clauses in a comprehension, optionally followed by `if` clauses. See:
(&mut self)
| 2537 | /// |
| 2538 | /// See: <https://docs.python.org/3/reference/expressions.html#grammar-token-python-grammar-comp_for> |
| 2539 | fn parse_generators(&mut self) -> Vec<ast::Comprehension> { |
| 2540 | const GENERATOR_SET: TokenSet = TokenSet::new([TokenKind::For, TokenKind::Async]); |
| 2541 | |
| 2542 | let mut generators = Vec::with_capacity(1); |
| 2543 | let mut progress = ParserProgress::default(); |
| 2544 | |
| 2545 | while self.at_ts(GENERATOR_SET) { |
| 2546 | progress.assert_progressing(self); |
| 2547 | generators.push(self.parse_comprehension()); |
| 2548 | } |
| 2549 | |
| 2550 | generators.shrink_to_fit(); |
| 2551 | |
| 2552 | generators |
| 2553 | } |
| 2554 | |
| 2555 | /// Parses a comprehension. |
| 2556 | /// |
no test coverage detected