Package io.github.treesitter.jtreesitter


package io.github.treesitter.jtreesitter
Java bindings to the tree-sitter parsing library.

Requirements

The shared libraries must be installed system-wide or in java.library.path

Basic Usage

 Language language = new Language(TreeSitterJava.language());
 try (Parser parser = new Parser(language)) {
     try (Tree tree = parser.parse("void main() {}", InputEncoding.UTF_8).orElseThrow()) {
         Node rootNode = tree.getRootNode();
         assert rootNode.getType().equals("program");
         assert rootNode.getStartPoint().column() == 0;
         assert rootNode.getEndPoint().column() == 14;
     }
 }
See Also: