node_query 1.15.1 → 1.15.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +5 -5
- data/README.md +10 -6
- data/lib/node_query/adapter/syntax_tree.rb +1 -1
- data/lib/node_query/node_rules.rb +1 -1
- data/lib/node_query/version.rb +1 -1
- data/node_query.gemspec +3 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 248ecdf537a77583086b3e03b2ad5235264898da63b1a1038af234be48404b95
|
4
|
+
data.tar.gz: 18ff554ae6c55f7e9eeba88cd48e1cc99deb50394d6a98bae5a6281d4b578dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9221cf053b6362069ccbe380a9d6f1803e779f9b89a029ec23d5d33fbdcc8e1ed704e6bb0561e58bfc6f94669b42f804e14c86aefa167f3f774a817fd1a46423
|
7
|
+
data.tar.gz: 90cf347b582004377dbf31dce64c8bca69e15d5e86c4cd397b8ba0aa4fbc06552261f5aa8b3aa4fe25d4e356bae32a2d4ab9806147cf1e0d32bf9b5decbf630f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.15.3 (2024-05-30)
|
4
|
+
|
5
|
+
* Fix actual value is nil
|
6
|
+
|
7
|
+
## 1.15.2 (2024-04-07)
|
8
|
+
|
9
|
+
* Update `prism_ext` to 0.3.0
|
10
|
+
* Update `syntax_tree_ext` to 0.8.1
|
11
|
+
* Update `parser_node_ext` to 1.3.0
|
12
|
+
* Require `parent_node_ext` only when necessary
|
13
|
+
|
3
14
|
## 1.15.1 (2024-02-16)
|
4
15
|
|
5
16
|
* Use `deconstruct_keys` to get prism children
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
node_query (1.15.
|
4
|
+
node_query (1.15.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -41,11 +41,11 @@ GEM
|
|
41
41
|
parser (3.3.0.5)
|
42
42
|
ast (~> 2.4.1)
|
43
43
|
racc
|
44
|
-
parser_node_ext (1.
|
44
|
+
parser_node_ext (1.3.0)
|
45
45
|
parser
|
46
46
|
prettier_print (1.2.1)
|
47
|
-
prism (0.
|
48
|
-
prism_ext (0.
|
47
|
+
prism (0.25.0)
|
48
|
+
prism_ext (0.3.0)
|
49
49
|
prism
|
50
50
|
pry (0.14.1)
|
51
51
|
coderay (~> 1.1)
|
@@ -71,7 +71,7 @@ GEM
|
|
71
71
|
shellany (0.0.1)
|
72
72
|
syntax_tree (6.2.0)
|
73
73
|
prettier_print (>= 1.2.0)
|
74
|
-
syntax_tree_ext (0.
|
74
|
+
syntax_tree_ext (0.8.1)
|
75
75
|
syntax_tree
|
76
76
|
thor (1.2.1)
|
77
77
|
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# NodeQuery
|
2
2
|
|
3
|
+
[![Build Status](https://github.com/synvert-hq/node-query-ruby/actions/workflows/main.yml/badge.svg)](https://github.com/synvert-hq/node-query-ruby/actions/workflows/main.yml)
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/node_query.svg)](https://rubygems.org/gems/node_query)
|
5
|
+
|
3
6
|
NodeQuery defines a NQL (node query language) and node rules to query AST nodes.
|
4
7
|
|
5
8
|
## Table of Contents
|
@@ -474,14 +477,15 @@ It matches def node whose arguments are id and name.
|
|
474
477
|
|
475
478
|
## Write Adapter
|
476
479
|
|
477
|
-
Different parser, like parser, syntax_tree, will generate different AST nodes, to make NodeQuery work for them all,
|
478
|
-
we define an [Adapter](https://github.com/
|
480
|
+
Different parser, like prism, parser, syntax_tree, will generate different AST nodes, to make NodeQuery work for them all,
|
481
|
+
we define an [Adapter](https://github.com/synvert-hq/node-query-ruby/blob/main/lib/node_query/adapter.rb) interface,
|
479
482
|
if you implement the Adapter interface, you can set it as NodeQuery's adapter.
|
480
483
|
|
481
|
-
It provides
|
484
|
+
It provides 3 adapters
|
482
485
|
|
483
|
-
1. `
|
484
|
-
2. `
|
486
|
+
1. `PrismAdapter`
|
487
|
+
2. `ParserAdapter`
|
488
|
+
3. `SyntaxTreeAdapter`
|
485
489
|
|
486
490
|
## Development
|
487
491
|
|
@@ -491,4 +495,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
491
495
|
|
492
496
|
## Contributing
|
493
497
|
|
494
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
498
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/synvert-hq/node-query-ruby.
|
@@ -22,7 +22,7 @@ class NodeQuery::SyntaxTreeAdapter
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def get_siblings(node)
|
25
|
-
child_nodes = node.parent_node
|
25
|
+
child_nodes = get_children(node.parent_node)
|
26
26
|
if child_nodes.is_a?(Array) && child_nodes.size == 1 && child_nodes.first.is_a?(Array)
|
27
27
|
index = child_nodes.first.index(node)
|
28
28
|
return child_nodes.first[index + 1...]
|
@@ -101,7 +101,7 @@ class NodeQuery::NodeRules
|
|
101
101
|
actual_source = @adapter.get_source(actual)
|
102
102
|
actual_source == ":#{expected}" || actual_source == expected.to_s
|
103
103
|
else
|
104
|
-
actual
|
104
|
+
actual&.to_sym == expected
|
105
105
|
end
|
106
106
|
when String
|
107
107
|
if @adapter.is_node?(actual)
|
data/lib/node_query/version.rb
CHANGED
data/node_query.gemspec
CHANGED
@@ -10,12 +10,12 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "ast node query language"
|
12
12
|
spec.description = "ast node query language"
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/synvert-hq/node-query-ruby"
|
14
14
|
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/
|
18
|
-
spec.metadata["changelog_uri"] = "https://github.com/
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/synvert-hq/node-query-ruby"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/synvert-hq/node-query-ruby/blob/master/CHANGELOG.md"
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: node_query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.15.
|
4
|
+
version: 1.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ast node query language
|
14
14
|
email:
|
@@ -58,12 +58,12 @@ files:
|
|
58
58
|
- node_query.gemspec
|
59
59
|
- sig/node_query.rbs
|
60
60
|
- sig/node_query/adapter.rbs
|
61
|
-
homepage: https://github.com/
|
61
|
+
homepage: https://github.com/synvert-hq/node-query-ruby
|
62
62
|
licenses: []
|
63
63
|
metadata:
|
64
|
-
homepage_uri: https://github.com/
|
65
|
-
source_code_uri: https://github.com/
|
66
|
-
changelog_uri: https://github.com/
|
64
|
+
homepage_uri: https://github.com/synvert-hq/node-query-ruby
|
65
|
+
source_code_uri: https://github.com/synvert-hq/node-query-ruby
|
66
|
+
changelog_uri: https://github.com/synvert-hq/node-query-ruby/blob/master/CHANGELOG.md
|
67
67
|
post_install_message:
|
68
68
|
rdoc_options: []
|
69
69
|
require_paths:
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.5.
|
82
|
+
rubygems_version: 3.5.9
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: ast node query language
|