TreeElement (@NotNull TreeElement leaf, @NotNull TextRange rangeToRemove, @NotNull CharTable table) { CharSequence chars = leaf.getChars(); String res = rangeToRemove.replace(chars.toString(), ""); TreeElement newLeaf = leaf instanceof LeafElement ? ASTFactory.leaf(leaf.getElementType(), table.intern(res)) : newLazyParseable(leaf, res); leaf.rawInsertBeforeMe(newLeaf); leaf.rawRemove(); return newLeaf; }