Creates a checkpoint to which the token source can later return to using [`Self::rewind`].
(&self)
| 149 | |
| 150 | /// Creates a checkpoint to which the token source can later return to using [`Self::rewind`]. |
| 151 | pub(crate) fn checkpoint(&self) -> TokenSourceCheckpoint { |
| 152 | TokenSourceCheckpoint { |
| 153 | lexer_checkpoint: self.lexer.checkpoint(), |
| 154 | tokens_position: self.tokens.len(), |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /// Restore the token source to the given checkpoint. |
| 159 | pub(crate) fn rewind(&mut self, checkpoint: TokenSourceCheckpoint) { |