{"repo":"tree-sitter/node-tree-sitter","free":true,"listed":false,"github":"https://github.com/tree-sitter/node-tree-sitter","clone":"git clone https://github.com/tree-sitter/node-tree-sitter.git","description":"Node.js bindings for tree-sitter","language":"JavaScript","stars":869,"topics":["tree-sitter","nodejs","binding","javascript"],"license":"MIT","category":"dev-tools","readme_excerpt":"Node Tree-sitter [![CI][ci]](https://github.com/tree-sitter/node-tree-sitter/actions/workflows/ci.yml) [![npm][npm]](https://npmjs.com/package/tree-sitter) [![docs][docs]](https://tree-sitter.github.io/node-tree-sitter) This module provides Node.js bindings to the [tree-sitter] parsing library. Installation Basic Usage Prerequisites First, you'll need a Tree-sitter grammar for the language you want to parse. There are many [existing grammars][grammars], such as [tree-sitter-javascript][javascript]. These grammars can typically be installed with a package manager like NPM, so long as the author has published them. You can also develop a new grammar by using the [Tree-sitter CLI][cli] and following the [docs][ts docs]. Parsing Source Code Once you've got your grammar, create a parser with that grammar. Then you can parse some source code, and inspect the syntax tree. If your source code changes , you can update the syntax tree. This is much faster than the first parse. Parsing Text From a Custom Data Structure If your text is stored in a data structure other than a single string, such as a rope or array, you can parse it by supplying a callback to parse instead of a string: Further Reading It's recommended that you read the [Tree-sitter documentation][usage docs] on using parsers to get a higher-level overview of the API. Once you're comfortable with the basics, you can explore the full API documentation, which should map closely to the C API, though there are some differences.","default_branch":null,"files":null,"tree":[],"storefront":"/r/tree-sitter","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/tree-sitter/node-tree-sitter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}