ruby_tree_sitter 1.4.2 → 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 +4 -4
- data/README.md +4 -0
- data/ext/tree_sitter/language.c +3 -3
- data/lib/tree_sitter/mixins/language.rb +10 -5
- data/lib/tree_sitter/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 550b12aa9a45d1a5ea207bde42277aec34d79b2c766486b21f6c351bc7399f19
|
4
|
+
data.tar.gz: 723ccfe297603caf4eadba688ea9c952d48fe7b8a9dbbe061dc893dc8339fbe5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/ext/tree_sitter/language.c
CHANGED
@@ -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),
|
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),
|
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,
|
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
|
-
|
126
|
-
|
127
|
-
|
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)
|
data/lib/tree_sitter/version.rb
CHANGED
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
|
+
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-
|
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: []
|