MCPcopy Create free account
hub / github.com/LaBatata101/sith-language-server / checkpoint

Method checkpoint

crates/sith_python_parser/src/lexer.rs:1461–1475  ·  view source on GitHub ↗

Creates a checkpoint to which the lexer can later return to using [`Self::rewind`].

(&self)

Source from the content-addressed store, hash-verified

1459
1460 /// Creates a checkpoint to which the lexer can later return to using [`Self::rewind`].
1461 pub(crate) fn checkpoint(&self) -> LexerCheckpoint {
1462 LexerCheckpoint {
1463 value: self.current_value.clone(),
1464 current_kind: self.current_kind,
1465 current_range: self.current_range,
1466 current_flags: self.current_flags,
1467 cursor_offset: self.offset(),
1468 state: self.state,
1469 nesting: self.nesting,
1470 indentations_checkpoint: self.indentations.checkpoint(),
1471 pending_indentation: self.pending_indentation,
1472 fstrings_checkpoint: self.fstrings.checkpoint(),
1473 errors_position: self.errors.len(),
1474 }
1475 }
1476
1477 /// Restore the lexer to the given checkpoint.
1478 pub(crate) fn rewind(&mut self, checkpoint: LexerCheckpoint) {

Callers

nothing calls this directly

Calls 2

offsetMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected