ruby_parser 3.18.0 → 3.19.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36780d9d3244dd62d13430987076d5e81ae2e536d6d2bfd259f8a612da3d94cc
4
- data.tar.gz: bec4b32e7f7a8d9ae8e3202f30230f351a2fedc6e2ac4e984260486dbb7529c6
3
+ metadata.gz: 2901404db3548ad6415060c14df20ae11431fff4a97420659187601a534eb256
4
+ data.tar.gz: 69705481ccbd6a8ffafbb81c25c40890a4683a19440196a19bbcc119f093612a
5
5
  SHA512:
6
- metadata.gz: f28d02d2b14687e365bab3a353348b93a9df993be2d1afd3f2783b5b97ca016a6ca2f834ef61ebb4a4eae3decc38e1351349679f951f901bef09c25f23d44322
7
- data.tar.gz: 276ecce4db1f72ed2ce0d276679e65419225a46b885d0050aa7ba6382b45033ccd24b5006a0d382f0aecdbb6c5a5fd93e3e826adeafccc3c47ee051b76772eee
6
+ metadata.gz: 1a5d89ba1fed1a0a49b5eb71eeb8cc6f80a396d6eaf49bec5742d62cd503916b90136ae689de4fa3a5de180544ba3ef6e8fca03e52bd8349b32c65dfa7962a28
7
+ data.tar.gz: c68ae86de3cbd9a1b86b6c5acbd0ecc8d809a30c42f7b50217d5038f262a6f61a3baa739332285d59158af9d3c9c3c8d8742e2eca499cf41536f14332e9f7eb9
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,43 @@
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
+
8
+ === 3.19.0 / 2022-03-29
9
+
10
+ * 1 major enhancement:
11
+
12
+ * Added tentative 3.1 support.
13
+
14
+ * 7 minor enhancements:
15
+
16
+ * 3.1: bare RHS assoc: { y: } => s(:hash, s(:lit, :y), nil)
17
+ * 3.1: calls w/ unnamed block args (bare &)
18
+ * 3.1: endless defn/defs w/ paren-less calls (aka commands)
19
+ * 3.1: pattern capture to nonlocal vars, eg: ^@a, ^$b, ^@@c
20
+ * 3.1: pattern: ^(expr) => expr
21
+ * Improved steps for adding new versions.
22
+ * Improved steps for running gauntlets.
23
+
24
+ * 2 bug fixes:
25
+
26
+ * Bumped 2.6+ cached versions for rake compare.
27
+ * Skip test_regexp_esc_C_slash on ruby 3.1.0 because of MRI bug.
28
+
29
+ === 3.18.1 / 2021-11-10
30
+
31
+ * 1 minor enhancement:
32
+
33
+ * All parser tests are now explicitly testing line numbers at every level.
34
+
35
+ * 3 bug fixes:
36
+
37
+ * Fixed endless method with noargs. (mitsuru)
38
+ * Fixed line numbers on some yield forms.
39
+ * Handle and clearly report if unifdef is missing.
40
+
1
41
  === 3.18.0 / 2021-10-27
2
42
 
3
43
  Holy crap... 58 commits! 2.7 and 3.0 are feature complete. Strings
data/Manifest.txt CHANGED
@@ -29,6 +29,8 @@ lib/ruby27_parser.rb
29
29
  lib/ruby27_parser.y
30
30
  lib/ruby30_parser.rb
31
31
  lib/ruby30_parser.y
32
+ lib/ruby31_parser.rb
33
+ lib/ruby31_parser.y
32
34
  lib/ruby3_parser.yy
33
35
  lib/ruby_lexer.rb
34
36
  lib/ruby_lexer.rex
data/README.rdoc CHANGED
@@ -33,6 +33,9 @@ Tested against 801,039 files from the latest of all rubygems (as of 2013-05):
33
33
  * 1.9 parser is at 99.9940% accuracy, 4.013 sigma
34
34
  * 2.0 parser is at 99.9939% accuracy, 4.008 sigma
35
35
  * 2.6 parser is at 99.9972% accuracy, 4.191 sigma
36
+ * 3.0 parser has a 100% parse rate.
37
+ * Tested against 2,672,412 unique ruby files across 167k gems.
38
+ * As do all the others now, basically.
36
39
 
37
40
  == FEATURES/PROBLEMS:
38
41
 
@@ -62,15 +65,14 @@ You can also use Ruby19Parser, Ruby18Parser, or RubyParser.for_current_ruby:
62
65
 
63
66
  To add a new version:
64
67
 
65
- * New parser should be generated from lib/ruby_parser.yy.
66
- * Extend lib/ruby_parser.yy with new class name.
67
- * Add new version number to V2 in Rakefile for rule creation.
68
+ * New parser should be generated from lib/ruby[3]_parser.yy.
69
+ * Extend lib/ruby[3]_parser.yy with new class name.
70
+ * Add new version number to V2/V3 in Rakefile for rule creation.
71
+ * Add new (full) version to `ruby_parse` section of Rakefile for rake compare
68
72
  * Require generated parser in lib/ruby_parser.rb.
69
73
  * Add empty TestRubyParserShared##Plus module and TestRubyParserV## to test/test_ruby_parser.rb.
70
74
  * Extend Manifest.txt with generated file names.
71
- * Extend sexp_processor's pt_testcase.rb to match version
72
- * add_19tests needs to have the version added
73
- * VER_RE needs to have the regexp expanded
75
+ * Add new version number to sexp_processor's pt_testcase.rb in all_versions
74
76
 
75
77
  Until all of these are done, you won't have a clean test run.
76
78
 
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ Hoe.add_include_dirs "../../minitest/dev/lib"
14
14
  Hoe.add_include_dirs "../../oedipus_lex/dev/lib"
15
15
 
16
16
  V2 = %w[20 21 22 23 24 25 26 27]
17
- V3 = %w[30]
17
+ V3 = %w[30 31]
18
18
 
19
19
  VERS = V2 + V3
20
20
 
@@ -75,8 +75,17 @@ def maybe_add_to_top path, string
75
75
  File.rename tmp_path, path
76
76
  end
77
77
 
78
+ def unifdef?
79
+ @unifdef ||= system("which unifdef") or abort <<~EOM
80
+ unifdef not found!
81
+
82
+ Please install 'unifdef' package on your system or `rake generate` on a mac.
83
+ EOM
84
+ end
85
+
78
86
  V2.each do |n|
79
87
  file "lib/ruby#{n}_parser.y" => "lib/ruby_parser.yy" do |t|
88
+ unifdef?
80
89
  cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name]
81
90
  sh cmd
82
91
  end
@@ -86,6 +95,7 @@ end
86
95
 
87
96
  V3.each do |n|
88
97
  file "lib/ruby#{n}_parser.y" => "lib/ruby3_parser.yy" do |t|
98
+ unifdef?
89
99
  cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name]
90
100
  sh cmd
91
101
  end
@@ -174,8 +184,8 @@ def ruby_parse version
174
184
 
175
185
  file c_parse_y => c_tarball do
176
186
  in_compare do
177
- extract_glob = case version
178
- when /2\.7|3\.0/
187
+ extract_glob = case
188
+ when version > "2.7" then
179
189
  "{id.h,parse.y,tool/{id2token.rb,lib/vpath.rb}}"
180
190
  else
181
191
  "{id.h,parse.y,tool/{id2token.rb,vpath.rb}}"
@@ -248,7 +258,7 @@ task :versions do
248
258
  require "net/http" # avoid require issues in threads
249
259
  require "net/https"
250
260
 
251
- versions = %w[ 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 ]
261
+ versions = VERS.map { |s| s.split(//).join "." }
252
262
 
253
263
  base_url = "https://cache.ruby-lang.org/pub/ruby"
254
264
 
@@ -281,9 +291,10 @@ ruby_parse "2.2.10"
281
291
  ruby_parse "2.3.8"
282
292
  ruby_parse "2.4.10"
283
293
  ruby_parse "2.5.9"
284
- ruby_parse "2.6.8"
285
- ruby_parse "2.7.4"
286
- ruby_parse "3.0.2"
294
+ ruby_parse "2.6.9"
295
+ ruby_parse "2.7.5"
296
+ ruby_parse "3.0.3"
297
+ ruby_parse "3.1.1"
287
298
 
288
299
  task :debug => :isolate do
289
300
  ENV["V"] ||= VERS.last
data/gauntlet.md CHANGED
@@ -19,10 +19,10 @@ an external disk. Here is the config:
19
19
  And I update using rake:
20
20
 
21
21
  ```
22
- % cd ~/Work/git/rubygems/rubygems-mirror
22
+ % cd GIT/rubygems/rubygems-mirror
23
23
  % git down
24
24
  % rake mirror:latest
25
- % /Volumes/StuffA/gauntlet/bin/cleanup.rb
25
+ % /Volumes/StuffA/gauntlet/bin/cleanup.rb -y -v
26
26
  ```
27
27
 
28
28
  This rather quickly updates my mirror to the latest versions of
@@ -34,22 +34,23 @@ bit, but it is pretty minimal (currently ~20 bad gems).
34
34
  ## Curating an Archive of Ruby Files
35
35
 
36
36
  Next, I process the gem mirror into a much more digestable structure
37
- using `hash.rb` (TODO: needs a better name):
37
+ using `unpack_gems.rb`.
38
38
 
39
39
  ```
40
- % cd RP
41
- % /Volumes/StuffA/gauntlet/bin/unpack_gems.rb
40
+ % cd RP/gauntlet
41
+ % time caffeinate /Volumes/StuffA/gauntlet/bin/unpack_gems.rb -v [-a] ; say done
42
42
  ... waaaait ...
43
- % mv hashed.noindex gauntlet.$(today).noindex
44
- % lrztar gauntlet.$(today).noindex
45
- % mv gauntlet.$(today).noindex.lrz /Volumes/StuffA/gauntlet/
43
+ % DIR=gauntlet.$(today).(all|new).noindex
44
+ % mv hashed.noindex $DIR
45
+ % tar vc -T <(fd -tf . $DIR | sort) | zstd -5 -T0 --long > archives/$DIR.tar.zst ; say done
46
+ % ./bin/sync.sh
46
47
  ```
47
48
 
48
- This script filters all the newer gems (TODO: WHY?), unpacks them,
49
- finds all the files that look like they're valid ruby, ensures they're
50
- valid ruby (using the current version of ruby to compile them), and
51
- then moves them into a SHA dir structure that looks something like
52
- this:
49
+ This script filters all the newer (< 1 year old) gems (unless `-a` is
50
+ used), unpacks them, finds all the files that look like they're valid
51
+ ruby, ensures they're valid ruby (using the current version of ruby to
52
+ compile them), and then moves them into a SHA dir structure that looks
53
+ something like this:
53
54
 
54
55
  ```
55
56
  hashed.noindex/a/b/c/<full_file_sha>.rb
@@ -64,8 +65,8 @@ Unpacking, validating, SHA'ing everything is disk and CPU intensive.
64
65
  The `.noindex` extension stops spotlight from indexing the continous
65
66
  churn of files being unpacked and moved and saves time.
66
67
 
67
- Finally, I rename and archive it all up (currently using lrztar, but
68
- I'm not in love with it).
68
+ Finally, I rename and archive it all up (currently using zstd to
69
+ compress).
69
70
 
70
71
  ### Stats
71
72
 
@@ -73,7 +74,7 @@ I'm not in love with it).
73
74
  9696 % find gauntlet.$(today).noindex -type f | lc
74
75
  561270
75
76
  3.5G gauntlet.2021-08-06.noindex
76
- 239M gauntlet.2021-08-06.noindex.tar.lrz
77
+ 239M gauntlet.2021-08-06.noindex.tar.zst
77
78
  ```
78
79
 
79
80
  So I wind up with a little over half a million unique ruby files to
@@ -84,7 +85,7 @@ parse. It's about 3.5g but compresses very nicely down to 240m
84
85
  Assuming you're starting from scratch, unpack the archive once:
85
86
 
86
87
  ```
87
- % lrzuntar gauntlet.$(today).noindex.lrz
88
+ % zstdcat gauntlet.$(today).noindex.tar.zst | tar x
88
89
  ```
89
90
 
90
91
  Then, either run a single process (easier to read):
@@ -96,7 +97,7 @@ Then, either run a single process (easier to read):
96
97
  Or max out your machine using xargs (note the `-P 16` and choose accordingly):
97
98
 
98
99
  ```
99
- % 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
100
101
  ```
101
102
 
102
103
  In another terminal I usually monitor the progress like so: