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

Method peek2

crates/sith_python_parser/src/token_source.rs:108–114  ·  view source on GitHub ↗

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

(&mut self)

Source from the content-addressed store, hash-verified

106 ///
107 /// [`peek`]: TokenSource::peek
108 pub(crate) fn peek2(&mut self) -> (TokenKind, TokenKind) {
109 let checkpoint = self.lexer.checkpoint();
110 let first = self.next_non_trivia_token();
111 let second = self.next_non_trivia_token();
112 self.lexer.rewind(checkpoint);
113 (first, second)
114 }
115
116 /// Bumps the token source to the next non-trivia token.
117 ///

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