int (@NotNull CompositeElement ast, @NotNull StartMarker startMarker) { int start = myLexStarts[startMarker.myLexemeIndex]; int end = myLexStarts[startMarker.getEndIndex()]; IElementType markerType = startMarker.myType; TreeElement leaf = createLeaf(markerType, start, end); if (shouldReuseCollapsedTokens(markerType) && startMarker.myLexemeIndex < startMarker.getEndIndex()) { int length = startMarker.getEndIndex() - startMarker.myLexemeIndex; int[] relativeStarts = new int[length + 1]; IElementType[] types = new IElementType[length + 1]; for (int i = startMarker.myLexemeIndex; i < startMarker.getEndIndex(); i++) { relativeStarts[i - startMarker.myLexemeIndex] = myLexStarts[i] - start; types[i - startMarker.myLexemeIndex] = myLexTypes[i]; } relativeStarts[length] = end - start; leaf.putUserData(LAZY_PARSEABLE_TOKENS, new TokenSequence(relativeStarts, types, length, leaf.getChars())); } ast.rawAddChildrenWithoutNotifications(leaf); return startMarker.getEndIndex(); }