Comma list with forward-progress guard.
(&mut self, is_end: impl Fn(TokenType) -> bool, mut elem: impl FnMut(&mut Self))
| 457 | |
| 458 | // Comma list with forward-progress guard. |
| 459 | pub(super) fn comma_list(&mut self, is_end: impl Fn(TokenType) -> bool, mut elem: impl FnMut(&mut Self)) { |
| 460 | while !matches!(self.peek(), Some(t) if is_end(t)) && self.peek().is_some() { |
| 461 | let progress = self.last_end; |
| 462 | elem(self); |
| 463 | self.eat_if(TokenType::Comma); |
| 464 | if self.last_end == progress { break; } |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | // Parser constructors and parse entry point. |
no test coverage detected