Module: TreeSitter

Extended by:
Mixins::Language
Defined in:
lib/tree_sitter.rb,
lib/tree_sitter/node.rb,
lib/tree_sitter/error.rb,
lib/tree_sitter/query.rb,
lib/tree_sitter/version.rb,
lib/tree_sitter/query_match.rb,
lib/tree_sitter/query_cursor.rb,
lib/tree_sitter/query_matches.rb,
lib/tree_sitter/query_captures.rb,
lib/tree_sitter/mixins/language.rb,
lib/tree_sitter/query_predicate.rb,
lib/tree_sitter/text_predicate_capture.rb,
ext/tree_sitter/repo.rb,
ext/tree_sitter/tree_sitter.c

Overview

TreeSitter is a Ruby interface to the tree-sitter parsing library.

Defined Under Namespace

Modules: Encoding, Mixins, Quantifier, QueryError, SymbolType Classes: Input, InputEdit, Language, LanguageLoadError, Logger, Node, Parser, ParserNotFoundError, ParserVersionError, Point, Query, QueryCapture, QueryCaptures, QueryCreationError, QueryCursor, QueryMatch, QueryMatches, QueryPredicate, QueryPredicateStep, Range, Repo, SymbolNotFoundError, TextPredicateCapture, Tree, TreeCursor, TreeSitterError

Constant Summary collapse

TREESITTER_VERSION =

The version of the tree-sitter library.

'0.26.5'
VERSION =

The current version of the gem.

'2.1.1'
ENV_PARSERS =

A colon-separated list of paths pointing to directories that can contain parsers. Order matters. Takes precedence over default lookup paths.

ENV['TREE_SITTER_PARSERS']
&.split(':')
&.map { |v| Pathname(v) }
.freeze
LIBDIRS =

The default paths we use to lookup parsers. Order matters.

[
  '.vendor/parsers',
  '.vendor/tree-sitter-parsers',
  'vendor/parsers',
  'vendor/tree-sitter-parsers',
  'parsers',
  'tree-sitter-parsers',
  '.',
  '/opt/local/lib',
  '/opt/lib',
  '/usr/local/lib',
  '/usr/lib',
].map { |p| Pathname(p) }.freeze
LANGUAGE_VERSION =

The latest ABI version that is supported by the current version of the library. When Languages are generated by the Tree-sitter CLI, they are 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.

INT2NUM(TREE_SITTER_LANGUAGE_VERSION)
MIN_COMPATIBLE_LANGUAGE_VERSION =

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

TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION

Class Method Summary collapse

Methods included from Mixins::Language

ext, language

Class Method Details

.quantifier_name(quant) ⇒ Object



28
29
30
31
# File 'ext/tree_sitter/quantifier.c', line 28

static VALUE quantifier_name(VALUE self, VALUE quant) {
  int q = NUM2UINT(quant);
  return safe_str(quantifier_str(q));
}