peek method

Token? peek()

Returns the next token without consuming it.

Implementation

Token? peek() {
  if (_streamEndProduced) return null;
  if (_tokens.isEmpty) _fetchNextToken();
  return _tokens.first;
}