sexp_processor 4.16.0 → 4.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +19 -0
- data/Rakefile +1 -1
- data/lib/pt_testcase.rb +9 -5
- data/lib/sexp.rb +8 -2
- data/lib/sexp_processor.rb +1 -1
- data/lib/strict_sexp.rb +6 -5
- data.tar.gz.sig +1 -1
- metadata +14 -14
- 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: 8b30f507c9e1ef31db3410827bd5cfdd8046ff95c42587d0eed73aa6ee26fef8
|
4
|
+
data.tar.gz: 18fae0eec8a40801981cfc1054c8d894cc123458a5d21f47acb8f99cb4fa2882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2885be395e9829b320cd862d7a84db81356aa4fb19e65b13b47d885995af455c87419b937e6e9e3cf1777c0af7d9be927f62d6c642e853cc0f09bb68ab310089
|
7
|
+
data.tar.gz: 3a37439f48fb2c99f8c3ccf31702013e9be5bb133441094069e186aabd5b97565222187058d8dbfbbf4b40edef95d0328d7b8a56a31129e68916a8a17eef767d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
=== 4.17.0 / 2023-05-03
|
2
|
+
|
3
|
+
* 2 minor enhancements:
|
4
|
+
|
5
|
+
* Added Sexp#line_max=.
|
6
|
+
* Will load strict_sexp if $SP_DEBUG is set.
|
7
|
+
|
8
|
+
* 3 bug fixes:
|
9
|
+
|
10
|
+
* Sexp#line_max lazy accessor now compacts.
|
11
|
+
* Sexp#new copies line_max if defined.
|
12
|
+
* strict_sexp.rb: #first can take an int arg. Fixed mutator wrappers to pass args.
|
13
|
+
|
14
|
+
=== 4.16.1 / 2022-04-09
|
15
|
+
|
16
|
+
* 1 minor enhancement:
|
17
|
+
|
18
|
+
* Reworked ParseTreeTestCase's notion of versions to make it easier to extend.
|
19
|
+
|
1
20
|
=== 4.16.0 / 2021-10-27
|
2
21
|
|
3
22
|
* 4 minor enhancements:
|
data/Rakefile
CHANGED
data/lib/pt_testcase.rb
CHANGED
@@ -34,6 +34,12 @@ class Examples
|
|
34
34
|
end
|
35
35
|
|
36
36
|
class ParseTreeTestCase < Minitest::Test
|
37
|
+
all_versions = %w[18 19 20 21 22 23 24 25 26 27 30 31 32]
|
38
|
+
most_versions = all_versions.drop(1)
|
39
|
+
|
40
|
+
TEST_SUFFIX = "_#{most_versions.join "_"}"
|
41
|
+
VER_RE = /(#{Regexp.union(*all_versions)})/
|
42
|
+
|
37
43
|
attr_accessor :processor # to be defined by subclass
|
38
44
|
|
39
45
|
def setup
|
@@ -77,7 +83,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
77
83
|
end
|
78
84
|
|
79
85
|
def self.add_19tests name, hash
|
80
|
-
add_tests "#{name}
|
86
|
+
add_tests "#{name}_#{TEST_SUFFIX}", hash # HACK?
|
81
87
|
end
|
82
88
|
|
83
89
|
def self.add_19edgecases ruby, sexp, cases
|
@@ -102,8 +108,6 @@ class ParseTreeTestCase < Minitest::Test
|
|
102
108
|
testcases[verbose][klass] = testcases[nonverbose][klass]
|
103
109
|
end
|
104
110
|
|
105
|
-
VER_RE = "(1[89]|2[01234567]|3[0])"
|
106
|
-
|
107
111
|
def self.generate_test klass, node, data, input_name, output_name
|
108
112
|
klass.send :define_method, "test_#{node}" do
|
109
113
|
flunk "Processor is nil" if processor.nil?
|
@@ -1068,7 +1072,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
1068
1072
|
"Ruby2Ruby" => "-(2 ** 31)")
|
1069
1073
|
|
1070
1074
|
add_tests("case",
|
1071
|
-
"Ruby" => "var = 2\nresult = \"\"\ncase var\nwhen 1 then\n puts(\"something\")\n result = \"red\"\nwhen 2, 3 then\n result = \"yellow\"\nwhen 4 then\n # do nothing\nelse\n result = \"green\"\nend\ncase result\nwhen \"red\" then\n var = 1\nwhen \"yellow\" then\n var = 2\nwhen \"green\" then\n var = 3\
|
1075
|
+
"Ruby" => "var = 2\nresult = \"\"\ncase var\nwhen 1 then\n puts(\"something\")\n result = \"red\"\nwhen 2, 3 then\n result = \"yellow\"\nwhen 4 then\n # do nothing\nelse\n result = \"green\"\nend\ncase result\nwhen \"red\" then\n var = 1\nwhen \"yellow\" then\n var = 2\nwhen \"green\" then\n var = 3\nend\n",
|
1072
1076
|
"ParseTree" => s(:block,
|
1073
1077
|
s(:lasgn, :var, s(:lit, 2)),
|
1074
1078
|
s(:lasgn, :result, s(:str, "")),
|
@@ -1120,7 +1124,7 @@ class ParseTreeTestCase < Minitest::Test
|
|
1120
1124
|
s(:lasgn, :result, s(:lit, 7)))))
|
1121
1125
|
|
1122
1126
|
add_tests("case_nested_inner_no_expr",
|
1123
|
-
"Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n
|
1127
|
+
"Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n end\nend",
|
1124
1128
|
"ParseTree" => s(:case, s(:call, nil, :a),
|
1125
1129
|
s(:when,
|
1126
1130
|
s(:array, s(:call, nil, :b)),
|
data/lib/sexp.rb
CHANGED
@@ -12,6 +12,11 @@ class Sexp < Array # ZenTest FULL
|
|
12
12
|
|
13
13
|
attr_writer :line
|
14
14
|
|
15
|
+
##
|
16
|
+
# Set the maximum line number for this sexp. Often set by ruby_parser.
|
17
|
+
|
18
|
+
attr_writer :line_max
|
19
|
+
|
15
20
|
##
|
16
21
|
# Accessors for the file. Usually set by ruby_parser.
|
17
22
|
|
@@ -59,6 +64,7 @@ class Sexp < Array # ZenTest FULL
|
|
59
64
|
r = self.class.new._concat(body) # ensures a sexp from map
|
60
65
|
r.file = self.file if self.file
|
61
66
|
r.line = self.line if self.line
|
67
|
+
r.line_max = self.line_max if defined?(@line_max)
|
62
68
|
r.comments = self.comments if self.comments
|
63
69
|
r
|
64
70
|
end
|
@@ -233,7 +239,7 @@ class Sexp < Array # ZenTest FULL
|
|
233
239
|
# Returns the maximum line number of the children of self.
|
234
240
|
|
235
241
|
def line_max
|
236
|
-
@line_max ||= self.deep_each.map(&:line).max
|
242
|
+
@line_max ||= self.deep_each.map(&:line).compact.max
|
237
243
|
end
|
238
244
|
|
239
245
|
##
|
@@ -388,4 +394,4 @@ def s *args, &blk
|
|
388
394
|
end
|
389
395
|
|
390
396
|
require "sexp_matcher" unless defined? Sexp::Matcher
|
391
|
-
require "strict_sexp" if ENV["STRICT_SEXP"].to_i > 0
|
397
|
+
require "strict_sexp" if ENV["SP_DEBUG"] || ENV["STRICT_SEXP"].to_i > 0
|
data/lib/sexp_processor.rb
CHANGED
data/lib/strict_sexp.rb
CHANGED
@@ -83,8 +83,9 @@ class Sexp
|
|
83
83
|
self.safe_asgn i, v
|
84
84
|
end
|
85
85
|
|
86
|
-
def first
|
87
|
-
raise "use sexp_type"
|
86
|
+
def first(n = nil)
|
87
|
+
raise "use sexp_type" unless n
|
88
|
+
super
|
88
89
|
end
|
89
90
|
|
90
91
|
nuke_method :collect!, 4
|
@@ -136,10 +137,10 @@ if ENV["SP_DEBUG"] && !ENV["STRICT_SEXP"] then
|
|
136
137
|
]
|
137
138
|
|
138
139
|
mutators.each do |method|
|
139
|
-
define_method method do
|
140
|
+
define_method method do |*args|
|
140
141
|
warn "Sexp modified by %p at %s" % [__method__, caller.first] if
|
141
|
-
|
142
|
-
super
|
142
|
+
ENV["VERBOSE"] or (defined?(@hash) and @hash)
|
143
|
+
super(*args)
|
143
144
|
end
|
144
145
|
end
|
145
146
|
end
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
��<a|�pG�/������0�YZ裱�v��-�$`�+3�x7�p
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sexp_processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.17.0
|
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
|
+
MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
@@ -22,14 +22,14 @@ cert_chain:
|
|
22
22
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
23
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
24
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
AQAkg3y+PBnBAPWdxxITm5sPHqdWQgSyCpRA20o4LTuWr8BWhSXBkfQNa7cY6fOn
|
26
|
+
xyM34VPzBFbExv6XOGDfOMFBVaYTHuN9peC/5/umL7kLl+nflXzL2QA7K6LYj5Bg
|
27
|
+
sM574Onr0dZDM6Vn69bzQ7rBIFDfK/OhlPzqKZad4nsdcsVH8ODCiT+ATMIZyz5K
|
28
|
+
WCnNtqlyiWXI8tdTpahDgcUwfcN/oN7v4K8iU5IbLJX6HQ5DKgmKjfb6XyMth16k
|
29
|
+
ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
|
30
|
+
nsNBRuQJ1UfiCG97a6DNm+Fr
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2023-05-03 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '4.0'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '4.0'
|
68
68
|
description: |-
|
69
69
|
sexp_processor branches from ParseTree bringing all the generic sexp
|
70
70
|
processing tools with it. Sexp, SexpProcessor, Environment, etc... all
|
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '2.
|
111
|
+
version: '2.6'
|
112
112
|
- - "<"
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '4'
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.4.10
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: sexp_processor branches from ParseTree bringing all the generic sexp processing
|
metadata.gz.sig
CHANGED
Binary file
|