node_query 1.13.10 → 1.13.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +2 -2
- data/lib/node_query/helper.rb +14 -9
- data/lib/node_query/version.rb +1 -1
- data/lib/node_query_lexer.rex +1 -1
- data/lib/node_query_lexer.rex.rb +1 -1
- data/lib/node_query_parser.racc.rb +12 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdd226c05ade3d2dde453af11182b02cabe7111f27ab7eaa5677b5b48d3ac247
|
4
|
+
data.tar.gz: 06bde0578a6e5e113cd1675207f8bef58a77b07761e13bee0c9fdfc2d00cf8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f2cd0d797d7c212481a481754aca0a448e6bafbee7a4b93b53c6c17255a40e066df5368cdae8304a9da99f3059042ff5798916519aeb25fea1c06c84282c620
|
7
|
+
data.tar.gz: 7249a00c56a7d527dee321375d6b3f05115fe3666ea8a126b7994935974e7dd7ec1d767296e2cd43d2987189c8c964eec5b065c42d7c7dd27d92c83f3b5d1b29
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
node_query (1.13.
|
4
|
+
node_query (1.13.12)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -67,7 +67,7 @@ GEM
|
|
67
67
|
shellany (0.0.1)
|
68
68
|
syntax_tree (6.1.1)
|
69
69
|
prettier_print (>= 1.2.0)
|
70
|
-
syntax_tree_ext (0.6.
|
70
|
+
syntax_tree_ext (0.6.4)
|
71
71
|
syntax_tree
|
72
72
|
thor (1.2.1)
|
73
73
|
|
data/lib/node_query/helper.rb
CHANGED
@@ -33,15 +33,7 @@ class NodeQuery::Helper
|
|
33
33
|
# @yieldparam child [Node] child node
|
34
34
|
def handle_recursive_child(node, &block)
|
35
35
|
NodeQuery.adapter.get_children(node).each do |child|
|
36
|
-
|
37
|
-
block.call(child)
|
38
|
-
handle_recursive_child(child, &block)
|
39
|
-
elsif child.is_a?(Array)
|
40
|
-
child.each do |child_child|
|
41
|
-
block.call(child_child)
|
42
|
-
handle_recursive_child(child_child, &block)
|
43
|
-
end
|
44
|
-
end
|
36
|
+
handle_child(child, &block)
|
45
37
|
end
|
46
38
|
end
|
47
39
|
|
@@ -67,5 +59,18 @@ class NodeQuery::Helper
|
|
67
59
|
|
68
60
|
node.to_s
|
69
61
|
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def handle_child(node, &block)
|
66
|
+
if NodeQuery.adapter.is_node?(node)
|
67
|
+
block.call(node)
|
68
|
+
handle_recursive_child(node, &block)
|
69
|
+
elsif node.is_a?(Array)
|
70
|
+
node.each do |child_node|
|
71
|
+
handle_child(child_node, &block) unless child_node.nil?
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
70
75
|
end
|
71
76
|
end
|
data/lib/node_query/version.rb
CHANGED
data/lib/node_query_lexer.rex
CHANGED
@@ -7,7 +7,7 @@ macros
|
|
7
7
|
CLOSE_ARRAY /\)/
|
8
8
|
OPEN_SELECTOR /\(/
|
9
9
|
CLOSE_SELECTOR /\)/
|
10
|
-
NODE_TYPE /\.[a-zA-
|
10
|
+
NODE_TYPE /\.[a-zA-Z_]+/
|
11
11
|
IDENTIFIER /[@\*\-\.\w]*\w/
|
12
12
|
IDENTIFIER_VALUE /[@\.\w!&:\?<>=]+/
|
13
13
|
OPERATOR /(\^=|\$=|\*=|!=|=~|!~|>=|<=|>|<|=|not includes|includes|not in|in)/i
|
data/lib/node_query_lexer.rex.rb
CHANGED
@@ -20,7 +20,7 @@ class NodeQueryLexer
|
|
20
20
|
CLOSE_ARRAY = /\)/
|
21
21
|
OPEN_SELECTOR = /\(/
|
22
22
|
CLOSE_SELECTOR = /\)/
|
23
|
-
NODE_TYPE = /\.[a-zA-
|
23
|
+
NODE_TYPE = /\.[a-zA-Z_]+/
|
24
24
|
IDENTIFIER = /[@\*\-\.\w]*\w/
|
25
25
|
IDENTIFIER_VALUE = /[@\.\w!&:\?<>=]+/
|
26
26
|
OPERATOR = /(\^=|\$=|\*=|!=|=~|!~|>=|<=|>|<|=|not includes|includes|not in|in)/i
|
@@ -7,18 +7,18 @@
|
|
7
7
|
require 'racc/parser.rb'
|
8
8
|
class NodeQueryParser < Racc::Parser
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
10
|
+
def initialize
|
11
|
+
@lexer = NodeQueryLexer.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def parse string
|
15
|
+
@lexer.parse string
|
16
|
+
do_parse
|
17
|
+
end
|
18
|
+
|
19
|
+
def next_token
|
20
|
+
@lexer.next_token
|
21
|
+
end
|
22
22
|
##### State transition tables begin ###
|
23
23
|
|
24
24
|
racc_action_table = [
|
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.13.
|
4
|
+
version: 1.13.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ast node query language
|
14
14
|
email:
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
|
-
rubygems_version: 3.4.
|
81
|
+
rubygems_version: 3.4.18
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: ast node query language
|