Repository navigation
v0.24.1
Maintained fork of tree-sitter-ruby. Changes since 0.24.0:
Parsing
- Like Ruby,
x +1isx + 1whenxis a local variable, and the callx(+1)otherwise. The same goes for-,*,**,&,[,/,%and<<. The scanner tracks assignments, parameters,forandrescue =>variables, numbered parameters, and the scopes of blocks, lambdas, methods (endless ones too), classes and modules. Pattern-matching bindings are not tracked. def self(token): a method may be namedself.- Hash keys
defined?:,key?:andkey!:. - Symbols of special globals:
:$',:$:,:$;,:$-w. return[1],return-1,return*a,return - (x)andbreak[1]take an operand, as in Ruby.- Checked against Prism on stdlib, the installed gems and ruby/spec: 6685 of 6689 files agree, up from 6680 (the other 4 are UTF-16 fixtures and files Prism rejects).
Queries
locals.scm: a superclass (class A < base) and the object ofclass << objare read in the outer scope.
Build and CI
- tree-sitter CLI 0.27.2, still ABI 14 (the Python binding needs it).
TREE_SITTER_JS_RUNTIME=denogenerates the same parser as Node. deno lintinstead of ESLint; npm audit is clean.- Rust: tree-sitter 0.27.2,
rust-version = "1.90", tree-sitter-language 0.1.8 or newer. - Python: no
wheelbuild dependency (setuptools 71 or newer). - CI actions pinned to commits, read-only tokens, CodeQL on the scanner, Dependabot for every ecosystem, and the ruby/spec examples really parsed.
Performance
- Local-variable tracking costs about 7 % of parse time (46 MB of real Ruby: 4.70 s → 5.02 s, user CPU) and some memory per token (a method with 8 locals: +2 % peak RSS).
Not published on npm, crates.io or PyPI (those names belong to upstream). Use the source tarball or a git dependency on this repo.
NOTE: Download tree-sitter-ruby.tar.gz for the complete source code.