aboutsummaryrefslogtreecommitdiff
path: root/src/Analysis/PsiAPI.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Analysis/PsiAPI.kt')
-rw-r--r--src/Analysis/PsiAPI.kt19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Analysis/PsiAPI.kt b/src/Analysis/PsiAPI.kt
new file mode 100644
index 00000000..2282cd1d
--- /dev/null
+++ b/src/Analysis/PsiAPI.kt
@@ -0,0 +1,19 @@
+package org.jetbrains.dokka
+
+import com.intellij.psi.*
+import kotlin.support.*
+
+fun PsiElement.previousSiblings(): Stream<PsiElement> {
+ var element: PsiElement? = this
+ return object : Stream<PsiElement> {
+ override fun iterator(): Iterator<PsiElement> = object : AbstractIterator<PsiElement>() {
+ override fun computeNext() {
+ element = element?.getPrevSibling()
+ if (element == null)
+ done()
+ else
+ setNext(element!!)
+ }
+ }
+ }
+}