From ff84d2e87b1f8e515144c61aeb1544d17f430900 Mon Sep 17 00:00:00 2001 From: "liubar.pa" Date: Fri, 5 May 2023 21:21:46 +0300 Subject: [PATCH] SNRK-71: buildDependencyNode is implemented --- .../src/main/kotlin/MdParser.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/snark-document-builder/src/main/kotlin/MdParser.kt b/snark-document-builder/src/main/kotlin/MdParser.kt index 8186b23..20243b0 100644 --- a/snark-document-builder/src/main/kotlin/MdParser.kt +++ b/snark-document-builder/src/main/kotlin/MdParser.kt @@ -14,5 +14,29 @@ public suspend fun parseMd(mdFile: ByteArray): MdAstRoot { } public suspend fun buildDependencyGraphNode(mdFile: ByteArray): DependencyGraphNode { + val treeRoot = parseMd(mdFile) + val dependencies = mutableListOf() + + fillDependencies(treeRoot, dependencies) + + return DependencyGraphNode(treeRoot, dependencies) +} + +private suspend fun fillDependencies( + currentNode: MdAstElement, + dependencies: MutableList) { + // when (currentNode) { + // is MdAstParent -> { + // val iterator = currentNode.children.listIterator() + + // while (iterator.hasNext()) { + + + // iterator.next() + // } + + // } + // else -> {} + // } TODO() } \ No newline at end of file