Restore the parser to the given checkpoint.
(&mut self, checkpoint: ParserCheckpoint)
| 877 | |
| 878 | /// Restore the parser to the given checkpoint. |
| 879 | fn rewind(&mut self, checkpoint: ParserCheckpoint) { |
| 880 | let ParserCheckpoint { |
| 881 | tokens, |
| 882 | errors_position, |
| 883 | unsupported_syntax_errors_position, |
| 884 | current_token_id, |
| 885 | prev_token_end, |
| 886 | recovery_context, |
| 887 | } = checkpoint; |
| 888 | |
| 889 | self.tokens.rewind(tokens); |
| 890 | self.errors.truncate(errors_position); |
| 891 | self.unsupported_syntax_errors |
| 892 | .truncate(unsupported_syntax_errors_position); |
| 893 | self.current_token_id = current_token_id; |
| 894 | self.prev_token_end = prev_token_end; |
| 895 | self.recovery_context = recovery_context; |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | fn strip_underscores(text: &str) -> Cow<'_, str> { |
no test coverage detected