String (EditorHighlighter highlighter) { HighlighterIterator iterator = highlighter.createIterator(0); StringBuilder result = new StringBuilder(); int i = 0; while (!iterator.atEnd()) { result.append(i).append(": ").append(iterator.getTokenType()).append(" [").append(iterator.getStart()).append("-") .append(iterator.getEnd()).append("], "); iterator.advance(); } return result.toString(); }