String (LexerEditorHighlighter highlighter, CharSequence text) { StringBuilder tokens = new StringBuilder(); HighlighterIterator iterator = highlighter.createIterator(0); while (!iterator.atEnd()) { tokens.append(iterator.getStart()).append(" ") .append(LexerTestCase.printSingleToken(text, iterator.getTokenType(), iterator.getStart(), iterator.getEnd())); iterator.advance(); } return tokens.toString(); }