ruby2ruby 2.4.1 → 2.4.2

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: 7086dd5ae0a401311ba0191c9558965765a208862def995221c1d5e065b7579b
4
- data.tar.gz: e9a369ff76c740f0eafa6389a3e1ab5e03eebe435d16c0542853bdfcd0981eaa
3
+ metadata.gz: 831b366b64498b5f2783288fbccbf4feac9c87b80ab472f1d7561fb3c1a9a807
4
+ data.tar.gz: a0a44de2c917acb356f92b0fb81c9bb97b68f255810b91218fb4ef4a57f7bd8a
5
5
  SHA512:
6
- metadata.gz: b4195418b8035e9c5d01e2af6ba64ad3b4375706fc473f5b297867b5838ad17482e7ad91e30a70c08c78934695ac3893ca8bdee977ad109ae7e24e9f54e5ea93
7
- data.tar.gz: 6c9e14a882ed557a6384b80e1bcb7aa546ee1745edfd11a548334c0d953abed4c7b90f18432ce156dd511b35edc5ac7196c1a966cbefbcf6f562a4d6303f574f
6
+ metadata.gz: 766278dc4ca1886b5a9e5dca83f2d025d21d16ec100423d784ad7992dee41f0fd1573a82c2535ddd592e278b109099dcc44d9663a4e33d5a7116c6f7e9f4df04
7
+ data.tar.gz: 44875a9e97d38517f51adc6f16015d50f94d4daf854286f6ebc73b8f7dfb9fc446fb98408ac76680abfafe8746961177e47b1f16b794e59586d097ce137ef465
@@ -1,2 +1 @@
1
- ?^�E� �ZL�M2r�����殠+�
2
- P��7�7�����4�����#�fS���Y}f�{�p���܅��hh+��.9/s��� ��`M׭�t]^;�8=���^p�* �@ЦSo��I
1
+ �\��ܰ�|a�*�?���������h/%ݦ��:*yep��`��I3�9�����L�Xg�fb2�j���\�'�����Y��t��i!*�}��Ԩ��;񺂫���(��\^�U'0z=�3/|T]�}�Ya��� L��p̕��a�Q�����
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,11 @@
1
+ === 4.12.0 / 2019-03-12
2
+
3
+ * 3 bug fixes:
4
+
5
+ * Fixed sexp_body to return empty sexp instead of nil when using STRICT_SEXP.
6
+ * STRICT_SEXP=4+ fails w/ current use of concat. Removed concat from strictness for now.
7
+ * Use concat internally instead of splat. Some people have 20000 node sexps! (presidentbeef)
8
+
1
9
  === 2.4.1 / 2018-02-15
2
10
 
3
11
  * 2 minor enhancements:
data/Rakefile CHANGED
@@ -30,6 +30,8 @@ def process ruby, file="stdin"
30
30
  begin
31
31
  sexp = parser.process(ruby, file)
32
32
 
33
+ pp sexp if ENV["SEXP"]
34
+
33
35
  ruby2ruby.process(sexp)
34
36
  rescue Interrupt => e
35
37
  raise e
@@ -41,7 +43,7 @@ task :stress do
41
43
  $: << "../../ruby_parser/dev/lib"
42
44
  require "pp"
43
45
 
44
- files = Dir["../../*/dev/**/*.rb"]
46
+ files = Dir["../../*/dev/**/*.rb"].reject { |s| s =~ %r%/gems/% }
45
47
 
46
48
  warn "Stress testing against #{files.size} files"
47
49
 
@@ -65,15 +67,6 @@ end
65
67
  task :debug => :isolate do
66
68
  ENV["V"] ||= "18"
67
69
 
68
- $: << "lib"
69
- require 'ruby_parser'
70
-
71
- parser = if ENV["V"] == "18" then
72
- Ruby18Parser.new
73
- else
74
- Ruby19Parser.new
75
- end
76
-
77
70
  file = ENV["F"] || ENV["FILE"]
78
71
 
79
72
  ruby = if file then
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  ARGV.push "-" if ARGV.empty?
20
20
 
21
- parser = Ruby18Parser.new
21
+ parser = RubyParser.new
22
22
  ruby2ruby = Ruby2Ruby.new
23
23
 
24
24
  ARGV.each do |file|
@@ -30,4 +30,3 @@ ARGV.each do |file|
30
30
 
31
31
  puts ruby2ruby.process(sexp)
32
32
  end
33
-
@@ -31,7 +31,7 @@ end
31
31
  # Generate ruby code from a sexp.
32
32
 
33
33
  class Ruby2Ruby < SexpProcessor
34
- VERSION = "2.4.1" # :nodoc:
34
+ VERSION = "2.4.2" # :nodoc:
35
35
 
36
36
  # cutoff for one-liners
37
37
  LINE_LENGTH = 78
@@ -677,44 +677,42 @@ class Ruby2Ruby < SexpProcessor
677
677
  end
678
678
 
679
679
  def process_masgn(exp) # :nodoc:
680
- # s(:masgn, s(:array, s(:lasgn, :var), ...), s(:to_ary, <val>, ...))
681
- # s(:iter, <call>, s(:args, s(:masgn, :a, :b)), <body>)
682
-
683
- _, *exp = exp # HACK
684
-
685
- case exp.first
686
- when Sexp then
687
- lhs, rhs = exp
688
-
689
- case lhs.sexp_type
690
- when :array then
691
- _, *lhs = lhs # HACK
692
- lhs = lhs.map do |l|
693
- case l.sexp_type
694
- when :masgn then
695
- "(#{process(l)})"
696
- else
697
- process(l)
698
- end
699
- end
680
+ _, (type, *), * = exp # ugly, but STRICT_SEXP=1+ requires this
681
+
682
+ if type == :array then
683
+ _, lhs, rhs = exp
684
+
685
+ case exp.length
686
+ when 3 then # a, b = c, d
687
+ lhs = lhs.sexp_body.map { |e|
688
+ process e
689
+ }
690
+
691
+ rhs = case rhs && rhs.sexp_type
692
+ when :array then # a, b = [c, d]
693
+ process(rhs)[1..-2]
694
+ else # a, b = c
695
+ process rhs
696
+ end
697
+ "%s = %s" % [lhs.join(", "), rhs]
698
+ when 2 then # a, (b, c) = ...
699
+ "(%s)" % [process(lhs)[1..-2]]
700
700
  else
701
- raise "no clue: #{lhs.inspect}"
701
+ raise "unknown masgn length: %p" % [exp]
702
702
  end
703
+ else # a { |(b, c)| ... }
704
+ lhs = exp.sexp_body.map { |e|
705
+ case e
706
+ when Symbol then
707
+ e
708
+ when Sexp then
709
+ process e
710
+ else
711
+ raise "unknown masgn type: %p" % [e]
712
+ end
713
+ }
703
714
 
704
- if rhs then
705
- t = rhs.sexp_type
706
- rhs = process rhs
707
- rhs = rhs[1..-2] if t == :array # FIX: bad? I dunno
708
- return "#{lhs.join(", ")} = #{rhs}"
709
- else
710
- return lhs.join(", ")
711
- end
712
- when Symbol then # block arg list w/ masgn
713
- result = exp.join ", "
714
- exp.clear
715
- "(#{result})"
716
- else
717
- raise "unknown masgn: #{exp.inspect}"
715
+ "(%s)" % [lhs.join(", ")]
718
716
  end
719
717
  end
720
718
 
@@ -258,6 +258,29 @@ class TestRuby2Ruby < R2RTestCase
258
258
  assert_parse inn, out
259
259
  end
260
260
 
261
+ def assert_masgn exp, *args
262
+ inn = s(:iter, s(:call, nil, :a), s(:args, *args))
263
+ out = "a { |#{exp}| }"
264
+ assert_parse inn, out
265
+ end
266
+
267
+ def test_iter_masgn_double_bug
268
+ assert_masgn("b",
269
+ :b)
270
+ assert_masgn("b, c",
271
+ :b, :c)
272
+ assert_masgn("(b, c)",
273
+ s(:masgn, :b, :c))
274
+ assert_masgn("(b, c), d",
275
+ s(:masgn, :b, :c), :d)
276
+ assert_masgn("b, (c, d), e",
277
+ :b, s(:masgn, :c, :d), :e)
278
+ assert_masgn("(b, (c, d), e), f",
279
+ s(:masgn, :b, s(:masgn, :c, :d), :e), :f)
280
+ assert_masgn("(((b, c), d, e), f), g",
281
+ s(:masgn, s(:masgn, s(:masgn, :b, :c), :d, :e), :f), :g)
282
+ end
283
+
261
284
  def test_attr_writer_double
262
285
  inn = s(:defn, :same=, s(:args, :o),
263
286
  s(:iasgn, :@same, s(:lvar, :o)), s(:iasgn, :@diff, s(:lvar, :o)))
@@ -762,17 +785,11 @@ class TestRuby2Ruby < R2RTestCase
762
785
  rb2 = "a if (not b)"
763
786
  rb3 = "a if ! b"
764
787
 
765
- assert_parse Ruby18Parser.new.parse(rb1), rb1
766
- assert_parse Ruby19Parser.new.parse(rb1), rb1
767
- assert_parse Ruby25Parser.new.parse(rb1), rb1
788
+ assert_parse RubyParser.new.parse(rb1), rb1
768
789
 
769
- assert_parse Ruby18Parser.new.parse(rb2), rb1
770
- assert_parse Ruby19Parser.new.parse(rb2), rb1
771
- assert_parse Ruby25Parser.new.parse(rb2), rb1
790
+ assert_parse RubyParser.new.parse(rb2), rb1
772
791
 
773
- assert_parse Ruby18Parser.new.parse(rb3), rb1
774
- assert_parse Ruby19Parser.new.parse(rb3), rb1
775
- assert_parse Ruby25Parser.new.parse(rb3), rb1
792
+ assert_parse RubyParser.new.parse(rb3), rb1
776
793
  end
777
794
 
778
795
  def assert_parse sexp, expected_ruby, expected_eval = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE3MTEyMTIxMTExMFoXDTE4MTEyMTIxMTExMFowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE4MTIwNDIxMzAxNFoXDTE5MTIwNDIxMzAxNFowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -21,15 +21,15 @@ cert_chain:
21
21
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQAfAXSQpsW7YSxd1csRtA/M4Zt0AMXFMd76GJ8Lgtg8G0+VFbdChRyDuDb0kPlW
26
- h9QQX/YABfCW8vxmssbMGrP+VGBAn7BbdTcfTlgCWrvMX1uL5aRL74nA4urKXqdW
27
- a0nP70K4958P3GffBdtE3KGkU5xstFnXGajxuBRnL66E15KU0BNehVxdG258bdPu
28
- EKN6MqBPftFiev3tuwqDV11r2GquDpniYcT+Mi8/PgeAgVT/afBeVgbB3KaZeTRR
29
- AhXhF6Wi2GTMezlj5jlI5XV7WsJUSwTp/YiVvcmT74ZaCRvexm6EnNhkrvJJ1Xeu
30
- V+HB+LYYhXWitInO/eXxDrFB
24
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
+ AQCbJwLmpJR2PomLU+Zzw3KRzH/hbyUWc/ftru71AopZ1fy4iY9J/BW5QYKVYwbP
26
+ V0FSBWtvfI/RdwfKGtuGhPKECZgmLieGuZ3XCc09qPu1bdg7i/tu1p0t0c6163ku
27
+ nDMDIC/t/DAFK0TY9I3HswuyZGbLW7rgF0DmiuZdN/RPhHq2pOLMLXJmFclCb/im
28
+ 9yToml/06TJdUJ5p64mkBs0TzaK66DIB1Smd3PdtfZqoRV+EwaXMdx0Hb3zdR1JR
29
+ Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
30
+ UfBugfLD19bu3nvL+zTAGx/U
31
31
  -----END CERTIFICATE-----
32
- date: 2018-02-15 00:00:00.000000000 Z
32
+ date: 2019-03-13 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
@@ -63,30 +63,36 @@ dependencies:
63
63
  name: rdoc
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.0'
69
+ - - "<"
70
+ - !ruby/object:Gem::Version
71
+ version: '7'
69
72
  type: :development
70
73
  prerelease: false
71
74
  version_requirements: !ruby/object:Gem::Requirement
72
75
  requirements:
73
- - - "~>"
76
+ - - ">="
74
77
  - !ruby/object:Gem::Version
75
78
  version: '4.0'
79
+ - - "<"
80
+ - !ruby/object:Gem::Version
81
+ version: '7'
76
82
  - !ruby/object:Gem::Dependency
77
83
  name: hoe
78
84
  requirement: !ruby/object:Gem::Requirement
79
85
  requirements:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
- version: '3.16'
88
+ version: '3.17'
83
89
  type: :development
84
90
  prerelease: false
85
91
  version_requirements: !ruby/object:Gem::Requirement
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: '3.16'
95
+ version: '3.17'
90
96
  description: |-
91
97
  ruby2ruby provides a means of generating pure ruby code easily from
92
98
  RubyParser compatible Sexps. This makes making dynamic language
@@ -130,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
136
  - !ruby/object:Gem::Version
131
137
  version: '0'
132
138
  requirements: []
133
- rubyforge_project:
134
- rubygems_version: 2.7.3
139
+ rubygems_version: 3.0.2
135
140
  signing_key:
136
141
  specification_version: 4
137
142
  summary: ruby2ruby provides a means of generating pure ruby code easily from RubyParser
metadata.gz.sig CHANGED
Binary file