package tree-sitter
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/tree-sitter/Tree_sitter/index.html
Module Tree_sitterSource
OCaml bindings for Tree-sitter.
Tree-sitter is an incremental parsing library that builds concrete syntax trees for source code and efficiently updates them as the code changes.
The main workflow is:
- Obtain a
Language.tfrom a grammar package (e.g.Tree_sitter_jsonorTree_sitter_ocaml). - Create a
Parser.tand callParser.parse_string. - Walk the resulting
Tree.tviaNodeaccessors orTree_cursor. - Optionally, compile a
Query.tand run it with aQuery_cursorfor pattern matching.
Types
A position in source text. row and column are both zero-indexed. column is measured in bytes, not characters.
A contiguous range in source text, expressed as both byte offsets and row-column points.
The type of a grammar symbol.
Language grammars
Syntax tree nodes
Parsed syntax trees
Parsers
Pattern queries
Query cursors
Query cursors for iterating over query results.
Tree traversal cursors
Efficient tree traversal cursors.
Highlighting
highlight query tree is the list of (start_byte, end_byte, group_name) triples for all captures in tree. Captures whose name starts with _ are filtered out. Empty ranges (where start_byte >= end_byte) are also dropped.
The result is sorted by ascending start_byte.