parser_node_ext 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +2 -2
- data/lib/parser_node_ext/version.rb +1 -1
- data/lib/parser_node_ext.rb +9 -22
- 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: 07a901b2c76fb4f39403891f6191fcb865beeb0847108522765cde0fe06bc6cd
|
4
|
+
data.tar.gz: c4720a3f2df5c08ef3a6f3ef2f18c33a5cf02aac1ef94c351d5ac37eaa9f1af1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f10a88ff6c89658b50e6b2d36f433a88595816f0c36dabdf18f16c29c2096bbb5de80045791f436ac77d9d781baf5ed9e5205a5928fade062add8efc0c9a2fe1
|
7
|
+
data.tar.gz: 88bb4871e94a2d1c3924f3787108242d7c1ac7048c3820a751365bc0c4af7f02784262dc8c07bd3e26ed8a9cd95a1b2c095c046dfb4c48f262fb3ab226394c0a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
parser_node_ext (0.4.
|
4
|
+
parser_node_ext (0.4.1)
|
5
5
|
parser
|
6
6
|
|
7
7
|
GEM
|
@@ -9,7 +9,7 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
11
|
diff-lcs (1.5.0)
|
12
|
-
parser (3.1.2.
|
12
|
+
parser (3.1.2.1)
|
13
13
|
ast (~> 2.4.1)
|
14
14
|
rake (13.0.6)
|
15
15
|
rspec (3.11.0)
|
data/lib/parser_node_ext.rb
CHANGED
@@ -93,7 +93,7 @@ module ParserNodeExt
|
|
93
93
|
index = TYPE_CHILDREN[type]&.index(method_name)
|
94
94
|
return children[index] if index
|
95
95
|
|
96
|
-
raise MethodNotSupported, "#{method_name} is not
|
96
|
+
raise MethodNotSupported, "#{method_name} is not supported for #{self}"
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -110,7 +110,7 @@ module ParserNodeExt
|
|
110
110
|
index = TYPE_CHILDREN[type]&.index(:left_value)
|
111
111
|
return children[index] if index
|
112
112
|
|
113
|
-
raise MethodNotSupported, "#{left_value} is not
|
113
|
+
raise MethodNotSupported, "#{left_value} is not supported for #{self}"
|
114
114
|
end
|
115
115
|
|
116
116
|
# Get arguments of node.
|
@@ -131,7 +131,7 @@ module ParserNodeExt
|
|
131
131
|
when :defined?
|
132
132
|
children
|
133
133
|
else
|
134
|
-
raise MethodNotSupported, "arguments is not
|
134
|
+
raise MethodNotSupported, "arguments is not supported for #{self}"
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -155,7 +155,7 @@ module ParserNodeExt
|
|
155
155
|
|
156
156
|
:begin == children[3].type ? children[3].body : children[3..-1]
|
157
157
|
else
|
158
|
-
raise MethodNotSupported, "body is not
|
158
|
+
raise MethodNotSupported, "body is not supported for #{self}"
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -170,7 +170,7 @@ module ParserNodeExt
|
|
170
170
|
if :if == type
|
171
171
|
children[0]
|
172
172
|
else
|
173
|
-
raise MethodNotSupported, "condition is not
|
173
|
+
raise MethodNotSupported, "condition is not supported for #{self}"
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -184,7 +184,7 @@ module ParserNodeExt
|
|
184
184
|
if :hash == type
|
185
185
|
children.map { |child| child.children[0] }
|
186
186
|
else
|
187
|
-
raise MethodNotSupported, "keys is not
|
187
|
+
raise MethodNotSupported, "keys is not supported for #{self}"
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
@@ -198,7 +198,7 @@ module ParserNodeExt
|
|
198
198
|
if :hash == type
|
199
199
|
children.map { |child| child.children[1] }
|
200
200
|
else
|
201
|
-
raise MethodNotSupported, "keys is not
|
201
|
+
raise MethodNotSupported, "keys is not supported for #{self}"
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
@@ -213,7 +213,7 @@ module ParserNodeExt
|
|
213
213
|
if :hash == type
|
214
214
|
children.any? { |pair_node| pair_node.key.to_value == key }
|
215
215
|
else
|
216
|
-
raise MethodNotSupported, "key? is not
|
216
|
+
raise MethodNotSupported, "key? is not supported for #{self}"
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
@@ -229,7 +229,7 @@ module ParserNodeExt
|
|
229
229
|
value_node = children.find { |pair_node| pair_node.key.to_value == key }
|
230
230
|
value_node&.value
|
231
231
|
else
|
232
|
-
raise MethodNotSupported, "hash_value is not
|
232
|
+
raise MethodNotSupported, "hash_value is not supported for #{self}"
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
@@ -330,19 +330,6 @@ module ParserNodeExt
|
|
330
330
|
|
331
331
|
super
|
332
332
|
end
|
333
|
-
|
334
|
-
# Return the debug info.
|
335
|
-
#
|
336
|
-
# @return [String] file, line, source and node.
|
337
|
-
def debug_info
|
338
|
-
"\n" +
|
339
|
-
[
|
340
|
-
"file: #{loc.expression.source_buffer.name}",
|
341
|
-
"line: #{loc.expression.line}",
|
342
|
-
"source: #{to_source}",
|
343
|
-
"node: #{inspect}"
|
344
|
-
].join("\n")
|
345
|
-
end
|
346
333
|
end
|
347
334
|
end
|
348
335
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parser_node_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.3.
|
66
|
+
rubygems_version: 3.3.22
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: extend parser node
|