Creates a checkpoint to which the parser can later return to using [`Self::rewind`].
(&self)
| 646 | |
| 647 | /// Creates a checkpoint to which the parser can later return to using [`Self::rewind`]. |
| 648 | fn checkpoint(&self) -> ParserCheckpoint { |
| 649 | ParserCheckpoint { |
| 650 | tokens: self.tokens.checkpoint(), |
| 651 | errors_position: self.errors.len(), |
| 652 | current_token_id: self.current_token_id, |
| 653 | prev_token_end: self.prev_token_end, |
| 654 | recovery_context: self.recovery_context, |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | /// Restore the parser to the given checkpoint. |
| 659 | fn rewind(&mut self, checkpoint: ParserCheckpoint) { |
no test coverage detected