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

Method peek

crates/sith_python_parser/src/token_source.rs:96–101  ·  view source on GitHub ↗

Returns the next non-trivia token without consuming it. Use [`peek2`] to get the next two tokens. [`peek2`]: TokenSource::peek2

(&mut self)

Source from the content-addressed store, hash-verified

94 ///
95 /// [`peek2`]: TokenSource::peek2
96 pub(crate) fn peek(&mut self) -> TokenKind {
97 let checkpoint = self.lexer.checkpoint();
98 let next = self.next_non_trivia_token();
99 self.lexer.rewind(checkpoint);
100 next
101 }
102
103 /// Returns the next two non-trivia tokens without consuming it.
104 ///

Callers

nothing calls this directly

Calls 3

next_non_trivia_tokenMethod · 0.80
checkpointMethod · 0.45
rewindMethod · 0.45

Tested by

no test coverage detected