#incremental #parsing #kotlin

tree-sitter-kotlin

Kotlin grammar for the tree-sitter parsing library

4 releases

0.2.11 Oct 11, 2021
0.2.10 Oct 11, 2021
0.2.9 Oct 5, 2021
0.2.8 Sep 20, 2021

#109 in Parser tooling

MIT license

8MB
241K SLoC

C 241K SLoC JavaScript 807 SLoC // 0.1% comments Rust 31 SLoC // 0.5% comments

Kotlin Grammar for Tree-Sitter

This crate provides a Kotlin grammar for the tree-sitter parsing library. To use this crate, add it to the [dependencies] section of your Cargo.toml file:

tree-sitter = "0.20"
tree-sitter-kotlin = "0.2.11"

Typically, you will use the language function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
  data class Point(
    val x: Int,
    val y: Int
  )
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_kotlin::language()).expect("Error loading Kotlin grammar");
let parsed = parser.parse(code, None);

Dependencies

~1.4–2MB
~52K SLoC

da