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

Method do_bump

crates/sith_python_parser/src/parser/mod.rs:273–289  ·  view source on GitHub ↗

Moves the parser to the next token.

(&mut self, kind: TokenKind)

Source from the content-addressed store, hash-verified

271
272 /// Moves the parser to the next token.
273 fn do_bump(&mut self, kind: TokenKind) {
274 if !matches!(
275 self.current_token_kind(),
276 // TODO explore including everything up to the dedent as part of the body.
277 TokenKind::Dedent
278 // Don't include newlines in the body
279 | TokenKind::Newline
280 // TODO(micha): Including the semi feels more correct but it isn't compatible with lalrpop and breaks the
281 // formatters semicolon detection. Exclude it for now
282 | TokenKind::Semi
283 ) {
284 self.prev_token_end = self.current_token_range().end();
285 }
286
287 self.tokens.bump(kind);
288 self.current_token_id.increment();
289 }
290
291 /// Returns the next token kind without consuming it.
292 fn peek(&mut self) -> TokenKind {

Callers 5

bumpMethod · 0.45
bump_tsMethod · 0.45
bump_anyMethod · 0.45
eatMethod · 0.45

Calls 4

current_token_rangeMethod · 0.80
incrementMethod · 0.80
endMethod · 0.45
bumpMethod · 0.45

Tested by

no test coverage detected