Return the next token that has not yet been processed, or None if reached end-of-file, and mark it as processed. OK to call repeatedly after reaching EOF.
(&mut self)
| 1783 | /// reached end-of-file, and mark it as processed. OK to call repeatedly |
| 1784 | /// after reaching EOF. |
| 1785 | fn next_token(&mut self) -> Option<Token> { |
| 1786 | let token = self.tokens.get(self.index).map(|token| token.kind.clone()); |
| 1787 | self.index += 1; |
| 1788 | token |
| 1789 | } |
| 1790 | |
| 1791 | /// Push back the last one non-whitespace token. Must be called after |
| 1792 | /// `next_token()`, otherwise might panic. OK to call after |
no test coverage detected