py-tree-sitter#

Python bindings to the Tree-sitter parsing library.

Constants#

tree_sitter.LANGUAGE_VERSION = 14#

The latest ABI version that is supported by the current version of the library.

Note

When a Language is generated by the Tree-sitter CLI, it is assigned an ABI version number that corresponds to the current CLI version. The Tree-sitter library is generally backwards-compatible with languages generated using older CLI versions, but is not forwards-compatible.

Added in version 0.22.0.

tree_sitter.MIN_COMPATIBLE_LANGUAGE_VERSION = 13#

The earliest ABI version that is supported by the current version of the library.

Added in version 0.22.0.

Classes#

tree_sitter.Language

A class that defines how to parse a particular language.

tree_sitter.LookaheadIterator

A class that is used to look up symbols valid in a specific parse state.

tree_sitter.Node

A single node within a syntax Tree.

tree_sitter.Parser

A class that is used to produce a Tree based on some source code.

tree_sitter.Point

A position in a multi-line text document, in terms of rows and columns.

tree_sitter.Query

A set of patterns that match nodes in a syntax tree.

tree_sitter.Range

A range of positions in a multi-line text document, both in terms of bytes and of rows and columns.

tree_sitter.Tree

A tree that represents the syntactic structure of a source code file.

tree_sitter.TreeCursor

A class for walking a syntax Tree efficiently.