Restore the parser to the given checkpoint.
(&mut self, checkpoint: ParserCheckpoint)
| 657 | |
| 658 | /// Restore the parser to the given checkpoint. |
| 659 | fn rewind(&mut self, checkpoint: ParserCheckpoint) { |
| 660 | let ParserCheckpoint { |
| 661 | tokens, |
| 662 | errors_position, |
| 663 | current_token_id, |
| 664 | prev_token_end, |
| 665 | recovery_context, |
| 666 | } = checkpoint; |
| 667 | |
| 668 | self.tokens.rewind(tokens); |
| 669 | self.errors.truncate(errors_position); |
| 670 | self.current_token_id = current_token_id; |
| 671 | self.prev_token_end = prev_token_end; |
| 672 | self.recovery_context = recovery_context; |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | struct ParserCheckpoint { |
no test coverage detected