TokenSequence () { myLexer.start(myText); int i = 0; int offset = 0; while (true) { IElementType type = myLexer.getTokenType(); if (type == null) break; if (i % 20 == 0) ProgressIndicatorProvider.checkCanceled(); if (i >= myLexTypes.length - 1) { resizeLexemes(i * 3 / 2); } int tokenStart = myLexer.getTokenStart(); if (tokenStart < offset) { reportDescendingOffsets(i, offset, tokenStart); } myLexStarts[i] = offset = tokenStart; myLexTypes[i] = type; i++; myLexer.advance(); } myLexStarts[i] = myText.length(); return new TokenSequence(myLexStarts, myLexTypes, i, myText); }