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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e8b4b78bfb538253820b4ff34d49ebf7a91f9722c0ecfb63e3dadb3067530cb
4
- data.tar.gz: e8e6e9cc42513094304d79a10fb4802706b10cb147084683c5dd3315c2ecde9a
3
+ metadata.gz: 2901404db3548ad6415060c14df20ae11431fff4a97420659187601a534eb256
4
+ data.tar.gz: 69705481ccbd6a8ffafbb81c25c40890a4683a19440196a19bbcc119f093612a
5
5
  SHA512:
6
- metadata.gz: dd72b30995fbc5ad74f04dedc341572d03b73b962ddd2dd3ecd255c8d1babe1b4e190b780588b846f2c8b8942327ac4a50bda0e8401d02037299f9b16965e69b
7
- data.tar.gz: 5793d0f9bf5e11f56db8eb5b53fd4b603664e72818b4bc43a3bfb61cf3c4a0c61f9ecee3757350a684271ae9e0c434782ef739ef0f075b3897fa338bcd2680c5
6
+ metadata.gz: 1a5d89ba1fed1a0a49b5eb71eeb8cc6f80a396d6eaf49bec5742d62cd503916b90136ae689de4fa3a5de180544ba3ef6e8fca03e52bd8349b32c65dfa7962a28
7
+ data.tar.gz: c68ae86de3cbd9a1b86b6c5acbd0ecc8d809a30c42f7b50217d5038f262a6f61a3baa739332285d59158af9d3c9c3c8d8742e2eca499cf41536f14332e9f7eb9
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === 3.19.1 / 2022-04-05
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Added comments to endless defn and defs. (mvz)
6
+ * Fixed endless method bug handling attrset names.
7
+
1
8
  === 3.19.0 / 2022-03-29
2
9
 
3
10
  * 1 major enhancement:
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 c $DIR | zstd -5 -T0 --long > archives/$DIR.tar.zst
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 lrztar, but
70
- I'm not in love with it).
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.lrz
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
- % lrzuntar gauntlet.$(today).noindex.lrz
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:
@@ -30,7 +30,7 @@ class Sexp
30
30
  end
31
31
 
32
32
  module RubyParserStuff
33
- VERSION = "3.19.0"
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 name.end_with? "=" then
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
 
@@ -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.0
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-03-30 00:00:00.000000000 Z
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