ruby_tree_sitter 1.4.2 → 1.5.1

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: dd66b66e4570a06af130b29b615aefb7a8214b7ec0078030c9b334cc6871fcf0
4
- data.tar.gz: aa7609949c9518b0fc552f014414241de80859ab256766a9397316eaf4482f8d
3
+ metadata.gz: 550b12aa9a45d1a5ea207bde42277aec34d79b2c766486b21f6c351bc7399f19
4
+ data.tar.gz: 723ccfe297603caf4eadba688ea9c952d48fe7b8a9dbbe061dc893dc8339fbe5
5
5
  SHA512:
6
- metadata.gz: b76c4aa92c08ff4b03eb7c8dd17e4d275685abfa80aa69d123db2e75296244167073567a95487f779759e456cbf198446d90d3a34b11eb739f937ccc513cf436
7
- data.tar.gz: '0389ee80e29d01d8d19391503d61922cd429f836d2fcbbdb6be4e8ea1370f22f2915cada6f84a532d12e4a506899f06aebec28f8953cbf176d58f57c47ce1b98'
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.4.2'
7
+ VERSION = '1.5.1'
8
8
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_tree_sitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firas al-Khalil
8
8
  - Derek Stride
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-03 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
@@ -39,7 +39,7 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
- description:
42
+ description:
43
43
  email:
44
44
  - firasalkhalil@gmail.com
45
45
  - derek@stride.host
@@ -108,7 +108,7 @@ metadata:
108
108
  source_code_uri: https://www.github.com/Faveod/ruby-tree-sitter
109
109
  changelog_uri: https://www.github.com/Faveod/ruby-tree-sitter
110
110
  documentation_uri: https://faveod.github.io/ruby-tree-sitter/
111
- post_install_message:
111
+ post_install_message:
112
112
  rdoc_options: []
113
113
  require_paths:
114
114
  - lib
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubygems_version: 3.5.11
127
- signing_key:
127
+ signing_key:
128
128
  specification_version: 4
129
129
  summary: Ruby bindings for Tree-Sitter
130
130
  test_files: []