ruby_tree_sitter 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1b2cf41f13a89341d5baceb421b53cb7cdd849044bb703d74d139b29d7768da
4
- data.tar.gz: 15bad1e7513b73efe382ce880fe8e26af6b64707777dd47de39829559b290e9b
3
+ metadata.gz: 550b12aa9a45d1a5ea207bde42277aec34d79b2c766486b21f6c351bc7399f19
4
+ data.tar.gz: 723ccfe297603caf4eadba688ea9c952d48fe7b8a9dbbe061dc893dc8339fbe5
5
5
  SHA512:
6
- metadata.gz: 34388882b92dbf3dd48be897a57c841e837fabc044c0928782b3b03f424b29657bfc3a1d718a5677a5174187710b884952f07072fe79f73bb92cadcfdd84508a
7
- data.tar.gz: 1a0cf18288d39254beabea8f72522e349a127eab2c4baecd1ba709139fa90629f231760d2eb3f90adcda057f116044abc001fa47bd47d100f292f2d012829e47
6
+ metadata.gz: 425e2f54efc9312dec9e70aea9ae5ce6a1531bc2a1de1a4e8d49f5d0ef90255f9f7e64a8ac34a4810c60a74063dcda3f481939a1936df17b5dd60ebfaeab0e5c
7
+ data.tar.gz: a044a8b400406d875b40033e7f9070818c9505a3d7e5cdf86f07e78de03e6a5bd6bc2bdbe15c3fe8920c52cd0cc5fc33e65156432a3e15bdb3a5d67323833962
data/README.md CHANGED
@@ -25,6 +25,10 @@ require 'tree_sitter'
25
25
 
26
26
  parser = TreeSitter::Parser.new
27
27
  language = TreeSitter::Language.load('javascript', 'path/to/libtree-sitter-javascript.{so,dylib}')
28
+ # Or simply
29
+ language = TreeSitter.lang('javascript')
30
+ # Which will try to look in your local directory and the system for installed parsers.
31
+ # See TreeSitter::Mixin::Language#lib_dirs
28
32
 
29
33
  src = "[1, null]"
30
34
 
@@ -54,7 +54,7 @@ static VALUE language_load(VALUE self, VALUE name, VALUE path) {
54
54
  dlclose(lib);
55
55
  rb_raise(rb_eRuntimeError,
56
56
  "Could not load symbol `%s' from library `%s'.\nReason:%s",
57
- StringValueCStr(name), StringValueCStr(path), err);
57
+ StringValueCStr(name), path_cstr, err);
58
58
  }
59
59
 
60
60
  TSLanguage *lang = make_ts_language();
@@ -63,7 +63,7 @@ static VALUE language_load(VALUE self, VALUE name, VALUE path) {
63
63
  rb_raise(rb_eRuntimeError,
64
64
  "TSLanguage = NULL for language `%s' in library `%s'.\nCall your "
65
65
  "local TSLanguage supplier.",
66
- StringValueCStr(name), StringValueCStr(path));
66
+ StringValueCStr(name), path_cstr);
67
67
  }
68
68
 
69
69
  uint32_t version = ts_language_version(lang);
@@ -71,7 +71,7 @@ static VALUE language_load(VALUE self, VALUE name, VALUE path) {
71
71
  rb_raise(rb_eRuntimeError,
72
72
  "Language %s (v%d) from `%s' is old.\nMinimum supported ABI: "
73
73
  "v%d.\nCurrent ABI: v%d.",
74
- StringValueCStr(name), version, StringValueCStr(path),
74
+ StringValueCStr(name), version, path_cstr,
75
75
  TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION,
76
76
  TREE_SITTER_LANGUAGE_VERSION);
77
77
  }
@@ -19,6 +19,7 @@ module TreeSitter
19
19
  'vendor/tree-sitter-parsers',
20
20
  'parsers',
21
21
  'tree-sitter-parsers',
22
+ '.',
22
23
  '/opt/local/lib',
23
24
  '/opt/lib',
24
25
  '/usr/local/lib',
@@ -67,6 +68,9 @@ module TreeSitter
67
68
  # TreeStand.config.parser_path = '/my/path'
68
69
  # java = TreeStand::Parser.language('java')
69
70
  #
71
+ # @note the name is case sensitive, but library lookup is not: if your parser is defined as `COBOL`,
72
+ # then you have to call `language('COBOL')`, but the parser can be `cobol.so/COBOL.so/…`.
73
+ #
70
74
  # @param name [String] the name of the parser.
71
75
  # This name is used to load the symbol from the compiled parser, replacing `-` with `_`.
72
76
  #
@@ -120,11 +124,12 @@ module TreeSitter
120
124
  # If a {TreeStand::Config#parser_path} is `nil`, {LIBDIRS} is used.
121
125
  # If a {TreeStand::Config#parser_path} is a {::Pathname}, {LIBDIRS} is ignored.
122
126
  def search_for_lib(name)
123
- files = [
124
- name,
125
- "tree-sitter-#{name}",
126
- "libtree-sitter-#{name}",
127
- ].map { |v| "#{v}.#{ext}" }
127
+ files =
128
+ [name, name.upcase, name.downcase]
129
+ .flat_map do |n|
130
+ base = "#{n}.#{ext}"
131
+ [base, "tree-sitter-#{base}", "libtree-sitter-#{base}"]
132
+ end
128
133
 
129
134
  lib_dirs
130
135
  .product(files)
@@ -4,5 +4,5 @@ module TreeSitter
4
4
  # The version of the tree-sitter library.
5
5
  TREESITTER_VERSION = '0.22.6'
6
6
  # The current version of the gem.
7
- VERSION = '1.5.0'
7
+ VERSION = '1.5.1'
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_tree_sitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firas al-Khalil
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-04 00:00:00.000000000 Z
12
+ date: 2024-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sorbet-runtime