Moves the parser to the next token.
(&mut self, kind: TokenKind)
| 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 { |
no test coverage detected