package com.jetbrains.dokka import com.intellij.psi.PsiElement import kotlin.support.AbstractIterator 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!!) } } } }