MCPcopy Create free account
hub / github.com/astral-sh/ruff / rewind

Method rewind

crates/ruff_python_parser/src/parser/mod.rs:879–896  ·  view source on GitHub ↗

Restore the parser to the given checkpoint.

(&mut self, checkpoint: ParserCheckpoint)

Source from the content-addressed store, hash-verified

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
899fn strip_underscores(text: &str) -> Cow<'_, str> {

Calls 1

truncateMethod · 0.80

Tested by

no test coverage detected