}
private String createResult(TokenSequence<?> ts) throws Exception {
StringBuilder result = new StringBuilder();
while (ts.moveNext()) {
TokenId tokenId = ts.token().id();
CharSequence text = ts.token().text();
result.append("token #");
result.append(ts.index());
result.append(" ");
result.append(tokenId.name());
String token = replaceLinesAndTabs(text.toString());
if (!token.isEmpty()) {
result.append(" ");
result.append("[");
result.append(token);