ruby2ruby 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +7 -0
- data/lib/ruby2ruby.rb +43 -2
- data/test/test_ruby2ruby.rb +5 -4
- metadata +13 -14
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7086dd5ae0a401311ba0191c9558965765a208862def995221c1d5e065b7579b
|
4
|
+
data.tar.gz: e9a369ff76c740f0eafa6389a3e1ab5e03eebe435d16c0542853bdfcd0981eaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4195418b8035e9c5d01e2af6ba64ad3b4375706fc473f5b297867b5838ad17482e7ad91e30a70c08c78934695ac3893ca8bdee977ad109ae7e24e9f54e5ea93
|
7
|
+
data.tar.gz: 6c9e14a882ed557a6384b80e1bcb7aa546ee1745edfd11a548334c0d953abed4c7b90f18432ce156dd511b35edc5ac7196c1a966cbefbcf6f562a4d6303f574f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/lib/ruby2ruby.rb
CHANGED
@@ -31,13 +31,13 @@ end
|
|
31
31
|
# Generate ruby code from a sexp.
|
32
32
|
|
33
33
|
class Ruby2Ruby < SexpProcessor
|
34
|
-
VERSION = "2.4.
|
34
|
+
VERSION = "2.4.1" # :nodoc:
|
35
35
|
|
36
36
|
# cutoff for one-liners
|
37
37
|
LINE_LENGTH = 78
|
38
38
|
|
39
39
|
# binary operation messages
|
40
|
-
BINARY = [:<=>, :==, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :**, :'!=']
|
40
|
+
BINARY = [:<=>, :==, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :**, :'!=', :^, :|, :&]
|
41
41
|
|
42
42
|
##
|
43
43
|
# Nodes that represent assignment and probably need () around them.
|
@@ -1073,11 +1073,30 @@ class Ruby2Ruby < SexpProcessor
|
|
1073
1073
|
exp
|
1074
1074
|
end
|
1075
1075
|
|
1076
|
+
def rewrite_call exp # :nodoc:
|
1077
|
+
_, recv, msg, *args = exp
|
1078
|
+
|
1079
|
+
exp = s(:not, recv) if msg == :! && args.empty?
|
1080
|
+
|
1081
|
+
exp
|
1082
|
+
end
|
1083
|
+
|
1076
1084
|
def rewrite_ensure exp # :nodoc:
|
1077
1085
|
exp = s(:begin, exp) unless context.first == :begin
|
1078
1086
|
exp
|
1079
1087
|
end
|
1080
1088
|
|
1089
|
+
def rewrite_if exp # :nodoc:
|
1090
|
+
_, c, t, f = exp
|
1091
|
+
|
1092
|
+
if c.sexp_type == :not then
|
1093
|
+
_, nc = c
|
1094
|
+
exp = s(:if, nc, f, t)
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
exp
|
1098
|
+
end
|
1099
|
+
|
1081
1100
|
def rewrite_resbody exp # :nodoc:
|
1082
1101
|
_, args, *_rest = exp
|
1083
1102
|
raise "no exception list in #{exp.inspect}" unless exp.size > 2 && args
|
@@ -1114,6 +1133,28 @@ class Ruby2Ruby < SexpProcessor
|
|
1114
1133
|
end
|
1115
1134
|
end
|
1116
1135
|
|
1136
|
+
def rewrite_until exp # :nodoc:
|
1137
|
+
_, c, *body = exp
|
1138
|
+
|
1139
|
+
if c.sexp_type == :not then
|
1140
|
+
_, nc = c
|
1141
|
+
exp = s(:while, nc, *body)
|
1142
|
+
end
|
1143
|
+
|
1144
|
+
exp
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
def rewrite_while exp # :nodoc:
|
1148
|
+
_, c, *body = exp
|
1149
|
+
|
1150
|
+
if c.sexp_type == :not then
|
1151
|
+
_, nc = c
|
1152
|
+
exp = s(:until, nc, *body)
|
1153
|
+
end
|
1154
|
+
|
1155
|
+
exp
|
1156
|
+
end
|
1157
|
+
|
1117
1158
|
############################################################
|
1118
1159
|
# Utility Methods:
|
1119
1160
|
|
data/test/test_ruby2ruby.rb
CHANGED
@@ -19,8 +19,6 @@ class R2RTestCase < ParseTreeTestCase
|
|
19
19
|
def self.generate_test klass, node, data, input_name, output_name
|
20
20
|
output_name = data.has_key?('Ruby2Ruby') ? 'Ruby2Ruby' : 'Ruby'
|
21
21
|
|
22
|
-
return if node.to_s =~ /(str_question|not|bang).*_(19|20|21|22|23|24)$/
|
23
|
-
|
24
22
|
klass.class_eval <<-EOM
|
25
23
|
def test_#{node}
|
26
24
|
pt = #{data[input_name].inspect}
|
@@ -766,12 +764,15 @@ class TestRuby2Ruby < R2RTestCase
|
|
766
764
|
|
767
765
|
assert_parse Ruby18Parser.new.parse(rb1), rb1
|
768
766
|
assert_parse Ruby19Parser.new.parse(rb1), rb1
|
767
|
+
assert_parse Ruby25Parser.new.parse(rb1), rb1
|
769
768
|
|
770
769
|
assert_parse Ruby18Parser.new.parse(rb2), rb1
|
771
|
-
assert_parse Ruby19Parser.new.parse(rb2),
|
770
|
+
assert_parse Ruby19Parser.new.parse(rb2), rb1
|
771
|
+
assert_parse Ruby25Parser.new.parse(rb2), rb1
|
772
772
|
|
773
773
|
assert_parse Ruby18Parser.new.parse(rb3), rb1
|
774
|
-
assert_parse Ruby19Parser.new.parse(rb3),
|
774
|
+
assert_parse Ruby19Parser.new.parse(rb3), rb1
|
775
|
+
assert_parse Ruby25Parser.new.parse(rb3), rb1
|
775
776
|
end
|
776
777
|
|
777
778
|
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.
|
4
|
+
version: 2.4.1
|
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
|
-
|
13
|
+
MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTE3MTEyMTIxMTExMFoXDTE4MTEyMTIxMTExMFowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -20,17 +20,16 @@ cert_chain:
|
|
20
20
|
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
21
21
|
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
|
-
gBEfoTEGr7Zii72cx+
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
|
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
|
32
31
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
32
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
34
33
|
dependencies:
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
35
|
name: sexp_processor
|
@@ -132,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
131
|
version: '0'
|
133
132
|
requirements: []
|
134
133
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.7.3
|
136
135
|
signing_key:
|
137
136
|
specification_version: 4
|
138
137
|
summary: ruby2ruby provides a means of generating pure ruby code easily from RubyParser
|
metadata.gz.sig
CHANGED
Binary file
|