parser_node_ext 0.4.1 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -2
- data/lib/parser_node_ext/version.rb +1 -1
- data/lib/parser_node_ext.rb +17 -2
- 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: fc6fc830978807e48ef5cc142cf9dfa32829e835020e31d09252f29d96d13e42
|
4
|
+
data.tar.gz: 3e44eee2fb5e4dafdf6c2070c49d934cee5d0dc5e1c9d56e7146d37628bed239
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ae876214f7a2d73764d2a34c04eba1205917120d5133bee4c32ccd1219ba3de1b5e5be69d9deb11d6d53d1aa0e7e8015d4e47b74441c8926ee779d5bcb40db5
|
7
|
+
data.tar.gz: 7c588aa80f8a762b8402f173adc902aded19e37821bf91ad0fb7ac5ab7ebf392c7b47f4f12ab31aba09a9b307a629ad3a9e5859f5bcf84515db2e674a899d511
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
parser_node_ext (0.
|
4
|
+
parser_node_ext (0.5.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.
|
12
|
+
parser (3.1.3.0)
|
13
13
|
ast (~> 2.4.1)
|
14
14
|
rake (13.0.6)
|
15
15
|
rspec (3.11.0)
|
@@ -28,6 +28,7 @@ GEM
|
|
28
28
|
|
29
29
|
PLATFORMS
|
30
30
|
x86_64-darwin-21
|
31
|
+
x86_64-darwin-22
|
31
32
|
x86_64-linux
|
32
33
|
|
33
34
|
DEPENDENCIES
|
data/lib/parser_node_ext.rb
CHANGED
@@ -22,20 +22,27 @@ module ParserNodeExt
|
|
22
22
|
def: %i[name arguments body],
|
23
23
|
definded?: %i[arguments],
|
24
24
|
defs: %i[self name arguments body],
|
25
|
+
false: [],
|
26
|
+
float: [],
|
25
27
|
hash: %i[pairs],
|
28
|
+
int: [],
|
26
29
|
ivasgn: %i[left_value right_value],
|
27
30
|
ivar: %i[name],
|
28
31
|
lvar: %i[name],
|
29
32
|
lvasgn: %i[left_value right_value],
|
30
33
|
masgn: %i[left_value right_value],
|
31
34
|
module: %i[name body],
|
35
|
+
nil: [],
|
32
36
|
or: %i[left_value right_value],
|
33
37
|
or_asgn: %i[left_value right_value],
|
34
38
|
pair: %i[key value],
|
35
39
|
restarg: %i[name],
|
36
40
|
send: %i[receiver message arguments],
|
41
|
+
str: [],
|
37
42
|
super: %i[arguments],
|
38
|
-
|
43
|
+
sym: [],
|
44
|
+
true: [],
|
45
|
+
zsuper: []
|
39
46
|
}
|
40
47
|
|
41
48
|
def self.included(base)
|
@@ -174,6 +181,14 @@ module ParserNodeExt
|
|
174
181
|
end
|
175
182
|
end
|
176
183
|
|
184
|
+
def pairs
|
185
|
+
if :hash == type
|
186
|
+
children
|
187
|
+
else
|
188
|
+
raise MethodNotSupported, "pairs is not supported for #{self}"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
177
192
|
# Get keys of :hash node.
|
178
193
|
# @example
|
179
194
|
# node # s(:hash, s(:pair, s(:sym, :foo), s(:sym, :bar)), s(:pair, s(:str, "foo"), s(:str, "bar")))
|
@@ -360,7 +375,7 @@ end
|
|
360
375
|
# +type: 'send', receiver: { type: 'send', receiver: { type: 'send', message: 'config' }, message: 'active_record' }, message: 'identity_map='+
|
361
376
|
#
|
362
377
|
# Source Code to Ast Node
|
363
|
-
# {https://
|
378
|
+
# {https://playground.synvert.net/ruby}
|
364
379
|
class Parser::AST::Node
|
365
380
|
include ParserNodeExt
|
366
381
|
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
|
+
version: 0.5.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-12-26 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.26
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: extend parser node
|