Skip to main content

Crate tree_sitter_ruby_sqry

Crate tree_sitter_ruby_sqry 

Source
Expand description

Tree-sitter grammar for Ruby (vendored for sqry)

The Rust binding in this crate is first-party (maintained in the sqry repository). The grammar under grammar-src/ is vendored THIRD-PARTY code reproduced under its upstream license; the full license text and copyright notice ship next to the sources in grammar-src/LICENSE and are also recorded in the repository-root THIRD-PARTY-LICENSES file.

Source Grammar: https://github.com/tree-sitter/tree-sitter-ruby Base release: v0.23.1 (published crate tree-sitter-ruby 0.23.1) License: MIT

§Why this grammar is vendored

The published 0.23.1 external scanner overflows its serialization buffer on heredocs, which aborts the process through assert(size == length) in deserialize. Two defects combine: the bounds guard in serialize under-counts the bytes the loop body writes, and the heredoc identifier length is stored in a single byte, so an identifier longer than 255 characters wraps. The abort is reachable in ordinary release builds, so any indexed Ruby file of that shape terminates the CLI, the daemon, the LSP server or the MCP server.

Upstream fixed both in commit ad907a69da0c (“scanner: fix heredoc serialization buffer overflows”, 2026-03-10) by widening the length field to uint32_t on the write and read sides and correcting the guard. That commit has never been released: 0.23.1 (2024-11-11) is still the newest version on crates.io, and the repository has taken four commits in the twenty-two months since. A git dependency is not an option because this workspace publishes to crates.io, so the grammar is vendored with the upstream fix applied verbatim.

grammar-src/scanner.c is byte-identical to upstream master at ad907a69da0c (SHA-256 88c1c036d5af7c22a1bc9cc5e50411d414ac9624afed676d42957c566ac4083d). Every other file under grammar-src/ is unmodified from the published 0.23.1 crate.

§Retirement condition

Upstream issue #269 tracks the crash. When a release containing ad907a69da0c reaches crates.io, delete this crate and point sqry-lang-ruby back at the published tree-sitter-ruby.

Constants§

NODE_TYPES
The content of the node-types.json file for this grammar.

Functions§

language
Returns the tree-sitter Language for Ruby
try_language
Fallible alternative to language()