Skip to content

v0.24.1

Choose a tag to compare

@github-actions github-actions released this 19 Nov 15:57
· 66 commits to master since this release

Maintained fork of tree-sitter-ruby. Changes since 0.24.0:

Parsing

  • Like Ruby, x +1 is x + 1 when x is a local variable, and the call x(+1) otherwise. The same goes for -, *, **, &, [, /, % and <<. The scanner tracks assignments, parameters, for and rescue => 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 named self.
  • Hash keys defined?:, key?: and key!:.
  • Symbols of special globals: :$', :$:, :$;, :$-w.
  • return[1], return-1, return*a, return - (x) and break[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 of class << obj are 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=deno generates the same parser as Node.
  • deno lint instead 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 wheel build 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.