KTreeSitter

Kotlin bindings to the tree-sitter parsing library.

Supported platforms

  • ☑ JVM

  • ☑ Android

  • ☑ Native

  • ☐ WASI

JS and WasmJS will not be supported.

Installation

dependencies {
implementation("io.github.tree-sitter:ktreesitter") version "0.24.0"
}

repositories {
mavenCentral()
}

Basic usage

val language = Language(TreeSitterKotlin.language())
val parser = Parser(language)
val tree = parser.parse("fun main() {}")
val rootNode = tree.rootNode

assert(rootNode.type == "source_file")
assert(rootNode.startPoint.column == 0)
assert(rootNode.endPoint.column == 13)

Kotlin bindings to the tree-sitter parsing library.

Supported platforms

  • ☑ JVM

  • ☑ Android

  • ☑ Native

  • ☐ WASI

JS and WasmJS will not be supported.

Installation

dependencies {
implementation("io.github.tree-sitter:ktreesitter") version "0.24.0"
}

repositories {
mavenCentral()
}

Basic usage

val language = Language(TreeSitterKotlin.language())
val parser = Parser(language)
val tree = parser.parse("fun main() {}")
val rootNode = tree.rootNode

assert(rootNode.type == "source_file")
assert(rootNode.startPoint.column == 0)
assert(rootNode.endPoint.column == 13)

Kotlin bindings to the tree-sitter parsing library.

Supported platforms

  • ☑ JVM

  • ☑ Android

  • ☑ Native

  • ☐ WASI

JS and WasmJS will not be supported.

Installation

dependencies {
implementation("io.github.tree-sitter:ktreesitter") version "0.24.0"
}

repositories {
mavenCentral()
}

Basic usage

val language = Language(TreeSitterKotlin.language())
val parser = Parser(language)
val tree = parser.parse("fun main() {}")
val rootNode = tree.rootNode

assert(rootNode.type == "source_file")
assert(rootNode.startPoint.column == 0)
assert(rootNode.endPoint.column == 13)

Kotlin bindings to the tree-sitter parsing library.

Supported platforms

  • ☑ JVM

  • ☑ Android

  • ☑ Native

  • ☐ WASI

JS and WasmJS will not be supported.

Installation

dependencies {
implementation("io.github.tree-sitter:ktreesitter") version "0.24.0"
}

repositories {
mavenCentral()
}

Basic usage

val language = Language(TreeSitterKotlin.language())
val parser = Parser(language)
val tree = parser.parse("fun main() {}")
val rootNode = tree.rootNode

assert(rootNode.type == "source_file")
assert(rootNode.startPoint.column == 0)
assert(rootNode.endPoint.column == 13)

Packages

Link copied to clipboard
common
native