Creates a checkpoint to which the token source can later return to using [`Self::rewind`].
(&self)
| 195 | |
| 196 | /// Creates a checkpoint to which the token source can later return to using [`Self::rewind`]. |
| 197 | pub(crate) fn checkpoint(&self) -> TokenSourceCheckpoint { |
| 198 | TokenSourceCheckpoint { |
| 199 | lexer_checkpoint: self.lexer.checkpoint(), |
| 200 | tokens_position: self.tokens.len(), |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /// Restore the token source to the given checkpoint. |
| 205 | pub(crate) fn rewind(&mut self, checkpoint: TokenSourceCheckpoint) { |