ruby_parser 3.19.0 → 3.19.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
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +7 -0
- data/gauntlet.md +6 -7
- data/lib/ruby_parser_extras.rb +10 -2
- data/test/test_ruby_parser.rb +47 -1
- data.tar.gz.sig +1 -6
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2901404db3548ad6415060c14df20ae11431fff4a97420659187601a534eb256
|
4
|
+
data.tar.gz: 69705481ccbd6a8ffafbb81c25c40890a4683a19440196a19bbcc119f093612a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a5d89ba1fed1a0a49b5eb71eeb8cc6f80a396d6eaf49bec5742d62cd503916b90136ae689de4fa3a5de180544ba3ef6e8fca03e52bd8349b32c65dfa7962a28
|
7
|
+
data.tar.gz: c68ae86de3cbd9a1b86b6c5acbd0ecc8d809a30c42f7b50217d5038f262a6f61a3baa739332285d59158af9d3c9c3c8d8742e2eca499cf41536f14332e9f7eb9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/gauntlet.md
CHANGED
@@ -42,8 +42,7 @@ using `unpack_gems.rb`.
|
|
42
42
|
... waaaait ...
|
43
43
|
% DIR=gauntlet.$(today).(all|new).noindex
|
44
44
|
% mv hashed.noindex $DIR
|
45
|
-
% tar
|
46
|
-
% tar vc -T <(fd . $DIR | sort) | zstd -5 -T0 --long > archives/$DIR.tar.zst
|
45
|
+
% tar vc -T <(fd -tf . $DIR | sort) | zstd -5 -T0 --long > archives/$DIR.tar.zst ; say done
|
47
46
|
% ./bin/sync.sh
|
48
47
|
```
|
49
48
|
|
@@ -66,8 +65,8 @@ Unpacking, validating, SHA'ing everything is disk and CPU intensive.
|
|
66
65
|
The `.noindex` extension stops spotlight from indexing the continous
|
67
66
|
churn of files being unpacked and moved and saves time.
|
68
67
|
|
69
|
-
Finally, I rename and archive it all up (currently using
|
70
|
-
|
68
|
+
Finally, I rename and archive it all up (currently using zstd to
|
69
|
+
compress).
|
71
70
|
|
72
71
|
### Stats
|
73
72
|
|
@@ -75,7 +74,7 @@ I'm not in love with it).
|
|
75
74
|
9696 % find gauntlet.$(today).noindex -type f | lc
|
76
75
|
561270
|
77
76
|
3.5G gauntlet.2021-08-06.noindex
|
78
|
-
239M gauntlet.2021-08-06.noindex.tar.
|
77
|
+
239M gauntlet.2021-08-06.noindex.tar.zst
|
79
78
|
```
|
80
79
|
|
81
80
|
So I wind up with a little over half a million unique ruby files to
|
@@ -86,7 +85,7 @@ parse. It's about 3.5g but compresses very nicely down to 240m
|
|
86
85
|
Assuming you're starting from scratch, unpack the archive once:
|
87
86
|
|
88
87
|
```
|
89
|
-
%
|
88
|
+
% zstdcat gauntlet.$(today).noindex.tar.zst | tar x
|
90
89
|
```
|
91
90
|
|
92
91
|
Then, either run a single process (easier to read):
|
@@ -98,7 +97,7 @@ Then, either run a single process (easier to read):
|
|
98
97
|
Or max out your machine using xargs (note the `-P 16` and choose accordingly):
|
99
98
|
|
100
99
|
```
|
101
|
-
% ls -d gauntlet/*.noindex/?/? | xargs -n 1 -P 16 ./gauntlet/bin/gauntlet.rb
|
100
|
+
% ls -d gauntlet/*.noindex/?/? | time xargs -n 1 -P 16 ./gauntlet/bin/gauntlet.rb
|
102
101
|
```
|
103
102
|
|
104
103
|
In another terminal I usually monitor the progress like so:
|
data/lib/ruby_parser_extras.rb
CHANGED
@@ -30,7 +30,7 @@ class Sexp
|
|
30
30
|
end
|
31
31
|
|
32
32
|
module RubyParserStuff
|
33
|
-
VERSION = "3.19.
|
33
|
+
VERSION = "3.19.1"
|
34
34
|
|
35
35
|
attr_accessor :lexer, :in_def, :in_single, :file
|
36
36
|
attr_accessor :in_kwarg
|
@@ -218,11 +218,15 @@ module RubyParserStuff
|
|
218
218
|
self.args args
|
219
219
|
end
|
220
220
|
|
221
|
+
def attrset_id? id
|
222
|
+
id =~ /^\[\]=$|^\w+=$/
|
223
|
+
end
|
224
|
+
|
221
225
|
def endless_method_name defn_or_defs
|
222
226
|
name = defn_or_defs[1]
|
223
227
|
name = defn_or_defs[2] unless Symbol === name
|
224
228
|
|
225
|
-
if
|
229
|
+
if attrset_id? name then
|
226
230
|
yyerror "setter method cannot be defined in an endless method definition"
|
227
231
|
end
|
228
232
|
|
@@ -994,6 +998,8 @@ module RubyParserStuff
|
|
994
998
|
local_pop in_def
|
995
999
|
endless_method_name result
|
996
1000
|
|
1001
|
+
result.comments = self.comments.pop
|
1002
|
+
|
997
1003
|
result
|
998
1004
|
end
|
999
1005
|
|
@@ -1014,6 +1020,8 @@ module RubyParserStuff
|
|
1014
1020
|
local_pop in_def
|
1015
1021
|
endless_method_name result
|
1016
1022
|
|
1023
|
+
result.comments = self.comments.pop
|
1024
|
+
|
1017
1025
|
result
|
1018
1026
|
end
|
1019
1027
|
|
data/test/test_ruby_parser.rb
CHANGED
@@ -5272,6 +5272,15 @@ module TestRubyParserShared30Plus
|
|
5272
5272
|
assert_parse rb, pt.deep_each { |s| s.line = 1 }
|
5273
5273
|
end
|
5274
5274
|
|
5275
|
+
def test_defn_oneliner_comment
|
5276
|
+
p = RubyParser.new
|
5277
|
+
rb = "# blah\ndef exec(cmd) = system(cmd)"
|
5278
|
+
sexp = p.parse rb
|
5279
|
+
|
5280
|
+
assert_equal :defn, sexp.sexp_type
|
5281
|
+
assert_equal "# blah\n", sexp.comments
|
5282
|
+
end
|
5283
|
+
|
5275
5284
|
def test_defs_oneliner
|
5276
5285
|
rb = "def self.exec(cmd) = system(cmd)"
|
5277
5286
|
pt = s(:defs, s(:self), :exec, s(:args, :cmd),
|
@@ -5295,17 +5304,54 @@ module TestRubyParserShared30Plus
|
|
5295
5304
|
assert_parse rb, pt.deep_each { |s| s.line = 1 }
|
5296
5305
|
end
|
5297
5306
|
|
5307
|
+
def test_defs_oneliner_comment
|
5308
|
+
p = RubyParser.new
|
5309
|
+
rb = "# blah\ndef self.exec(cmd) = system(cmd)"
|
5310
|
+
sexp = p.parse rb
|
5311
|
+
|
5312
|
+
assert_equal :defs, sexp.sexp_type
|
5313
|
+
assert_equal "# blah\n", sexp.comments
|
5314
|
+
end
|
5315
|
+
|
5298
5316
|
def test_defn_oneliner_setter
|
5299
5317
|
rb = "class X\n def x=(o) = 42\nend"
|
5300
5318
|
|
5301
5319
|
assert_syntax_error rb, /setter method cannot be defined/
|
5320
|
+
|
5321
|
+
rb = "class X\n def []=(k, v) = 42\nend"
|
5322
|
+
|
5323
|
+
assert_syntax_error rb, /setter method cannot be defined/
|
5302
5324
|
end
|
5303
5325
|
|
5304
5326
|
def test_defs_oneliner_setter
|
5305
|
-
rb = "class X\n def self.x= = 42\nend"
|
5327
|
+
rb = "class X\n def self.x=(o) = 42\nend"
|
5328
|
+
|
5329
|
+
assert_syntax_error rb, /setter method cannot be defined/
|
5330
|
+
|
5331
|
+
rb = "class X\n def self.[]=(k, v) = 42\nend"
|
5306
5332
|
|
5307
5333
|
assert_syntax_error rb, /setter method cannot be defined/
|
5308
5334
|
end
|
5335
|
+
|
5336
|
+
def test_defn_oneliner_eq2
|
5337
|
+
rb = "class X\n def ==(o) = 42\nend"
|
5338
|
+
pt = s(:class, :X, nil,
|
5339
|
+
s(:defn, :==, s(:args, :o).line(2),
|
5340
|
+
s(:lit, 42).line(2)).line(2)
|
5341
|
+
).line(1)
|
5342
|
+
|
5343
|
+
assert_parse rb, pt
|
5344
|
+
end
|
5345
|
+
|
5346
|
+
def test_defs_oneliner_eq2
|
5347
|
+
rb = "class X\n def self.==(o) = 42\nend"
|
5348
|
+
pt = s(:class, :X, nil,
|
5349
|
+
s(:defs, s(:self).line(2), :==, s(:args, :o).line(2),
|
5350
|
+
s(:lit, 42).line(2)).line(2)
|
5351
|
+
).line(1)
|
5352
|
+
|
5353
|
+
assert_parse rb, pt
|
5354
|
+
end
|
5309
5355
|
end
|
5310
5356
|
|
5311
5357
|
module TestRubyParserShared31Plus
|
data.tar.gz.sig
CHANGED
@@ -1,6 +1 @@
|
|
1
|
-
|
2
|
-
D+� Ps4��@VHXhoSv�|Ý[�=�����U�w�F�@Ju��%�GS=��@p�;
|
3
|
-
��*A05Yx�&�q� �.�QQ:a>�0mZ���� �w�j�b���sA���*b�d��?3��4��x�Qw!���
|
4
|
-
e�
|
5
|
-
��z*�������Pp��/���F~J{W:4
|
6
|
-
�U�/ѯ5�,u �#ɓ���-
|
1
|
+
��C-]̓�˺��)5J��������I�[���Y5��S�t?���e��z�1�Q����e��i��ł��^���BU4�'b�����o!_�ٝ:�Q�"l�l�$c��5n�V6L5{І��� 0�}���By�p3�^�H�{���5�����j�y���I�N^�6�����IZ�DQ݆M� 2w|(|x�uaP�F��L�i���6��M�>5s��@_�%�|�P����[��GP��i���
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.19.
|
4
|
+
version: 3.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
|
30
30
|
YsuyUzsMz6GQA4khyaMgKNSD
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2022-
|
32
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: sexp_processor
|
metadata.gz.sig
CHANGED
Binary file
|