Skips Newline/Nl/Comment; maps Endmarker->None; latches saw_newline for ternary detection. */
(&mut self)
| 355 | |
| 356 | /* Skips Newline/Nl/Comment; maps Endmarker->None; latches saw_newline for ternary detection. */ |
| 357 | pub(super) fn peek(&mut self) -> Option<TokenType> { |
| 358 | loop { |
| 359 | match self.tokens.peek().map(|t| t.kind) { |
| 360 | Some(TokenType::Newline) => { |
| 361 | self.saw_newline = true; |
| 362 | self.tokens.next(); |
| 363 | } |
| 364 | Some(TokenType::Nl | TokenType::Comment) => { self.tokens.next(); } |
| 365 | Some(TokenType::Endmarker) | None => return None, |
| 366 | Some(k) => return Some(k), |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | /* Like `peek` but stops at the logical-line boundary: a `Newline` yields `None` (unconsumed) so postfix trailers don't bind across statements. `Nl`/`Comment` (bracket-internal) still skip, so multiline `()`/`[]`/`{}` are unaffected. */ |
| 372 | pub(super) fn peek_same_line(&mut self) -> Option<TokenType> { |
no test coverage detected