package org.jetbrains.dokka import com.intellij.psi.* import kotlin.support.* fun PsiElement.previousSiblings(): Stream { var element: PsiElement? = this return object : Stream { override fun iterator(): Iterator = object : AbstractIterator() { override fun computeNext() { element = element?.getPrevSibling() if (element == null) done() else setNext(element!!) } } } }