@Override
 public void onComment(String text) throws IOException {
   if (skipToNewline) {
     listener.onComment(text);
     skipToNewline = !text.contains("\n");
   } else {
     buffer.add(new Comment(text));
   }
 }
 private void flushBuffer() throws IOException {
   for (Text t : buffer) {
     if (t instanceof Comment) {
       listener.onComment(t.getText());
     } else if (t instanceof Whitespace) {
       listener.onWhitespace(t.getText());
     }
   }
   buffer.clear();
 }