ruby_tree_sitter 1.12.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4f46ae21826544872569187630ea9c0ea6657f1d7eb07bc69b75ec47d2ab29f
4
- data.tar.gz: 82d2ce50bb69c770e942749142b984eacd82eaccc75b487694639cd5d51a4742
3
+ metadata.gz: 30dc3b2523ef6112d6bcf56aedb81ad70a3a485a961c54a24c0430ccf6bcf05b
4
+ data.tar.gz: 9d7cb450a90f740e5bab7c096d530d90d38e5fdbe985d216250a9e94889ab9d8
5
5
  SHA512:
6
- metadata.gz: 1993a3b5bb9fb4be185d926d5970f8ee737dd592c929a36e3f13301865ce3912bf0e48a4224d6142bf3a5971acdfc4f58d2d597f93b62178f13a3252ebe4f3f2
7
- data.tar.gz: c2889dfe030ec02087c806d1832cae244b7ba7b10d41bc3e70be8c220b14470178016affa24dcb214175cf9e8a702941a0bb54d34c4ca8272ea0db74a23a0f6b
6
+ metadata.gz: f89af94fd8ae283a3af257aab4d668e791c92e98aea3a3e1437ca32adff8ece7d0ae02f8f80ed0a884da7e7adb0109d8a0967d8c3e60cda0b41c1936828d7da4
7
+ data.tar.gz: 45334066e3819cfee12a19babba2e0942bc8ac060bad17254251bd6a90a7437e26b7b9ca7302577338373be8452dbc8c3a4e8e2a7a7019e8c8e9f4131042acce
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # splits an array like [rust](https://doc.rust-lang.org/std/primitive.slice.html#method.split)
4
- def array_split_like_rust(array, &block)
4
+ def array_split_like_rust(array, &)
5
5
  return enum_for(__method__, array) if !block_given?
6
6
 
7
7
  return [] if array.empty?
@@ -72,7 +72,7 @@ module TreeSitter
72
72
  # @!visibility private
73
73
  #
74
74
  # Allows access to child_by_field_name without using [].
75
- def method_missing(method_name, *_args, &_block)
75
+ def method_missing(method_name, *_args, &)
76
76
  if fields.include?(method_name)
77
77
  child_by_field_name(method_name.to_s)
78
78
  else
@@ -89,7 +89,7 @@ module TreeSitter
89
89
  # Iterate over a node's children.
90
90
  #
91
91
  # @yieldparam child [Node] the child
92
- def each(&_block)
92
+ def each(&)
93
93
  return enum_for __method__ if !block_given?
94
94
 
95
95
  (0...child_count).each do |i|
@@ -192,9 +192,9 @@ module TreeSitter
192
192
  def sexpr(indent: 2, width: 120, source: nil, vertical: nil)
193
193
  res =
194
194
  sexpr_recur(
195
- indent: indent,
196
- width: width,
197
- source: source,
195
+ indent:,
196
+ width:,
197
+ source:,
198
198
  vertical: !source.nil? || !!vertical,
199
199
  ).output
200
200
  return res if source.nil?
@@ -208,9 +208,7 @@ module TreeSitter
208
208
  max_width = [max_width, base.length].max
209
209
  [base, extracted]
210
210
  }
211
- .map { |base, extracted|
212
- ("%-#{max_width}s | %s" % [base, extracted]).rstrip
213
- }
211
+ .map { |base, extracted| ("%-#{max_width}s | %s" % [base, extracted]).rstrip }
214
212
  .join("\n")
215
213
  end
216
214
 
@@ -218,8 +216,8 @@ module TreeSitter
218
216
  #
219
217
  # @!visibility private
220
218
  def sexpr_recur(indent: 2, width: 120, out: nil, source: nil, vertical: false)
221
- out ||= Oppen::Wadler.new(width: width)
222
- out.group(indent) {
219
+ out ||= Oppen::Wadler.new(width:)
220
+ out.group(indent:) {
223
221
  out.text "(#{type}"
224
222
  if source.is_a?(String) && child_count.zero?
225
223
  out.text "\0{#{source.byteslice(start_byte...end_byte)}\0}", width: 0
@@ -227,13 +225,14 @@ module TreeSitter
227
225
  brk(out, vertical) if child_count.positive?
228
226
  each.with_index do |child, index|
229
227
  if field_name = field_name_for_child(index)
230
- out.text "#{field_name}:"
231
- out.group(indent) {
232
- brk(out, vertical)
233
- child.sexpr_recur(indent: indent, width: width, out: out, vertical: vertical, source: source)
234
- }
228
+ out
229
+ .text("#{field_name}:")
230
+ .group(indent:) {
231
+ brk(out, vertical)
232
+ child.sexpr_recur(indent:, width:, out:, vertical:, source:)
233
+ }
235
234
  else
236
- child.sexpr_recur(indent: indent, width: width, out: out, vertical: vertical, source: source)
235
+ child.sexpr_recur(indent:, width:, out:, vertical:, source:)
237
236
  end
238
237
  brk(out, vertical) if index < child_count - 1
239
238
  end
@@ -15,7 +15,7 @@ module TreeSitter
15
15
  #
16
16
  # @yieldparam match [TreeSitter::QueryMatch]
17
17
  # @yieldparam capture_index [Integer]
18
- def each(&_block)
18
+ def each(&)
19
19
  return enum_for __method__ if !block_given?
20
20
 
21
21
  while (capture_index, match = @cursor.next_capture)
@@ -14,7 +14,7 @@ module TreeSitter
14
14
  # Iterator over matches.
15
15
  #
16
16
  # @yieldparam match [TreeSitter::QueryMatch]
17
- def each(&_block)
17
+ def each(&)
18
18
  return enum_for __method__ if !block_given?
19
19
 
20
20
  while match = @cursor.next_match
@@ -27,7 +27,7 @@ module TreeSitter
27
27
  # Iterate over all the results presented as hashes of `capture name => node`.
28
28
  #
29
29
  # @yieldparam match [Hash<String, TreeSitter::Node>]
30
- def each_capture_hash(&_block)
30
+ def each_capture_hash(&)
31
31
  # TODO: should we return [Array<Hash<Symbol, TreeSitter::Node]>>] instead?
32
32
  return enum_for __method__ if !block_given?
33
33
 
@@ -4,5 +4,5 @@ module TreeSitter
4
4
  # The version of the tree-sitter library.
5
5
  TREESITTER_VERSION = '0.24.7'
6
6
  # The current version of the gem.
7
- VERSION = '1.12.0'
7
+ VERSION = '2.0.0'
8
8
  end
data/tree_sitter.gemspec CHANGED
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)
6
6
  require 'tree_sitter/version'
7
7
 
8
8
  Gem::Specification.new do |spec|
9
- spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
9
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
10
10
 
11
11
  spec.authors = ['Firas al-Khalil', 'Derek Stride']
12
12
  spec.email = ['firasalkhalil@gmail.com', 'derek@stride.host']
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables << 'rbts' << 'print_matches'
32
32
  spec.require_paths = ['lib']
33
33
 
34
- spec.add_dependency 'oppen', '~> 0.9.8'
34
+ spec.add_dependency 'oppen', '~> 1.0'
35
35
  spec.add_dependency 'sorbet-runtime'
36
36
  spec.add_dependency 'zeitwerk'
37
37
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_tree_sitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firas al-Khalil
8
8
  - Derek Stride
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2025-01-15 00:00:00.000000000 Z
11
+ date: 2025-01-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: oppen
@@ -17,14 +16,14 @@ dependencies:
17
16
  requirements:
18
17
  - - "~>"
19
18
  - !ruby/object:Gem::Version
20
- version: 0.9.8
19
+ version: '1.0'
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - "~>"
26
25
  - !ruby/object:Gem::Version
27
- version: 0.9.8
26
+ version: '1.0'
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: sorbet-runtime
30
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +52,6 @@ dependencies:
53
52
  - - ">="
54
53
  - !ruby/object:Gem::Version
55
54
  version: '0'
56
- description:
57
55
  email:
58
56
  - firasalkhalil@gmail.com
59
57
  - derek@stride.host
@@ -127,7 +125,6 @@ metadata:
127
125
  source_code_uri: https://www.github.com/Faveod/ruby-tree-sitter
128
126
  changelog_uri: https://www.github.com/Faveod/ruby-tree-sitter
129
127
  documentation_uri: https://faveod.github.io/ruby-tree-sitter/
130
- post_install_message:
131
128
  rdoc_options: []
132
129
  require_paths:
133
130
  - lib
@@ -135,15 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
132
  requirements:
136
133
  - - ">="
137
134
  - !ruby/object:Gem::Version
138
- version: 3.0.0
135
+ version: 3.1.0
139
136
  required_rubygems_version: !ruby/object:Gem::Requirement
140
137
  requirements:
141
138
  - - ">="
142
139
  - !ruby/object:Gem::Version
143
140
  version: '0'
144
141
  requirements: []
145
- rubygems_version: 3.3.27
146
- signing_key:
142
+ rubygems_version: 3.6.2
147
143
  specification_version: 4
148
144
  summary: Ruby bindings for Tree-Sitter
149
145
  test_files: []