Exemplo n.º 1
0
 @Override
 public void onComment(String text) throws IOException {
   if (skipToNewline) {
     listener.onComment(text);
     skipToNewline = !text.contains("\n");
   } else {
     buffer.add(new Comment(text));
   }
 }
Exemplo n.º 2
0
 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();
 }