Returns the next non-trivia token without consuming it. Use [`peek2`] to get the next two tokens. [`peek2`]: TokenSource::peek2
(&mut self)
| 137 | /// |
| 138 | /// [`peek2`]: TokenSource::peek2 |
| 139 | pub(crate) fn peek(&mut self) -> TokenKind { |
| 140 | let checkpoint = self.lexer.checkpoint(); |
| 141 | let next = self.next_non_trivia_token(); |
| 142 | self.lexer.rewind(checkpoint); |
| 143 | next |
| 144 | } |
| 145 | |
| 146 | /// Returns the next two non-trivia tokens without consuming it. |
| 147 | /// |