code: public ParserToken lookAhead(int distance) {
        while (distance >= buffer.size() && tokenIterator.hasNext()) {
           buffer.addLast(tokenIterator.next());
        }
        return buffer.size() > distance ? buffer.getLast() : null;
     }
docs: Looks ahead in the token stream
  
  @param distance The number of tokens to look ahead
  @return The token a given distance from the current position in the stream or null if end of stream