private void insertLeaf(@NotNull IElementType type,
                            @NotNull PsiBuilderImpl builder,
                            int startLexemeIndex,
                            int endLexemeIndex,
                            boolean forceInsertion,
                            @NotNull StartMarker parent) {
      int start = builder.myLexStarts[startLexemeIndex];
      int end = builder.myLexStarts[endLexemeIndex];
      /* Corresponding code for heavy tree is located in `PsiBuilderImpl#insertLeaves` and is applied only to plain lexemes */
      if (start > end || !forceInsertion && start == end && !(type instanceof ILeafElementType)) {
        return;
      }

      Token lexeme;
      if (type instanceof ILightLazyParseableElementType) {
        int startInFile = start + builder.myOffset;
        LazyParseableToken token = builder.myChameleonCache.get(startInFile);
        if (token == null) {
          token = new LazyParseableToken(this, startLexemeIndex, endLexemeIndex);
          token.initToken(type, parent, start, end);
          builder.myChameleonCache.put(startInFile, token);
        }
        else if (token.getBuilder() != builder || token.myStartIndex != startLexemeIndex || token.myEndIndex != endLexemeIndex) {
          throw new AssertionError("Wrong chameleon cached");
        }
        lexeme = token;
      }
      else if (startLexemeIndex == endLexemeIndex - 1 && type == builder.myLexTypes[startLexemeIndex]) {
        SingleLexemeNode single = myLexemePool.alloc();
        single.myParentNode = parent;
        single.myLexemeIndex = startLexemeIndex;
        lexeme = single;
      }
      else {
        TokenRangeNode collapsed = myRangePool.alloc();
        collapsed.initToken(type, parent, start, end);
        lexeme = collapsed;
      }
      ensureCapacity();
      nodes[count++] = lexeme;
    }
private void insertLeaf(@NotNull IElementType type,
                            @NotNull PsiBuilderImpl builder,
                            int startLexemeIndex,
                            int endLexemeIndex,
                            boolean forceInsertion,
                            @NotNull StartMarker parent)