Restore the token source to the given checkpoint.
(&mut self, checkpoint: TokenSourceCheckpoint)
| 200 | |
| 201 | /// Restore the token source to the given checkpoint. |
| 202 | pub(crate) fn rewind(&mut self, checkpoint: TokenSourceCheckpoint) { |
| 203 | let TokenSourceCheckpoint { |
| 204 | lexer_checkpoint, |
| 205 | tokens_position, |
| 206 | } = checkpoint; |
| 207 | |
| 208 | self.lexer.rewind(lexer_checkpoint); |
| 209 | self.tokens.truncate(tokens_position); |
| 210 | } |
| 211 | |
| 212 | /// Returns a slice of [`Token`] that are within the given `range`. |
| 213 | pub(crate) fn in_range(&self, range: TextRange) -> &[Token] { |