TokenIterator (int start) { return new TokenIterator() { @Override public int getStartOffset(int index) { return mySegments.getSegmentStart(index); } @Override public int getEndOffset(int index) { return mySegments.getSegmentEnd(index); } @Override public @NotNull IElementType getType(int index) { return mySegments.unpackTokenFromData(mySegments.getSegmentData(index)); } @Override public int getState(int index) { return mySegments.unpackStateFromData(mySegments.getSegmentData(index)); } @Override public int getTokenCount() { return mySegments.getSegmentCount(); } @Override public int initialTokenIndex() { return start; } }; }