sexp_processor 4.16.1 → 4.17.0

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: 2a80a0eb7b290d18550bcf6a37b99973960072d2f77725d73d7803bf396af750
4
- data.tar.gz: 4f10222a8cd7932a9409c48726ea540f65c357a31f1afb8886324b5c4f6900da
3
+ metadata.gz: 8b30f507c9e1ef31db3410827bd5cfdd8046ff95c42587d0eed73aa6ee26fef8
4
+ data.tar.gz: 18fae0eec8a40801981cfc1054c8d894cc123458a5d21f47acb8f99cb4fa2882
5
5
  SHA512:
6
- metadata.gz: 8cfc5c7d3b11934b973f570b17fc7c19ae9da846fe2781c805746a74d8a63f894863d6175aa50c8607ecab45ba672fc7274612a70b17f766d83ef67171f45f87
7
- data.tar.gz: c777e8572636582150b6409d5b5072236ebc9babd8720b06f8bfe24918d1fc694041f97e916d95b6f4959f48fe47473bad2c7f0caf70697f1d5f0dcd52b45a57
6
+ metadata.gz: 2885be395e9829b320cd862d7a84db81356aa4fb19e65b13b47d885995af455c87419b937e6e9e3cf1777c0af7d9be927f62d6c642e853cc0f09bb68ab310089
7
+ data.tar.gz: 3a37439f48fb2c99f8c3ccf31702013e9be5bb133441094069e186aabd5b97565222187058d8dbfbbf4b40edef95d0328d7b8a56a31129e68916a8a17eef767d
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,16 @@
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
+
1
14
  === 4.16.1 / 2022-04-09
2
15
 
3
16
  * 1 minor enhancement:
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ Hoe.add_include_dirs("../../ruby_parser/dev/lib")
11
11
  Hoe.spec 'sexp_processor' do
12
12
  developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
13
13
 
14
- require_ruby_version [">= 2.1", "< 4"]
14
+ require_ruby_version [">= 2.6", "< 4"]
15
15
 
16
16
  license "MIT"
17
17
  end
data/lib/pt_testcase.rb CHANGED
@@ -34,7 +34,7 @@ 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]
37
+ all_versions = %w[18 19 20 21 22 23 24 25 26 27 30 31 32]
38
38
  most_versions = all_versions.drop(1)
39
39
 
40
40
  TEST_SUFFIX = "_#{most_versions.join "_"}"
@@ -1072,7 +1072,7 @@ class ParseTreeTestCase < Minitest::Test
1072
1072
  "Ruby2Ruby" => "-(2 ** 31)")
1073
1073
 
1074
1074
  add_tests("case",
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\nelse\n # do nothing\nend\n",
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",
1076
1076
  "ParseTree" => s(:block,
1077
1077
  s(:lasgn, :var, s(:lit, 2)),
1078
1078
  s(:lasgn, :result, s(:str, "")),
@@ -1124,7 +1124,7 @@ class ParseTreeTestCase < Minitest::Test
1124
1124
  s(:lasgn, :result, s(:lit, 7)))))
1125
1125
 
1126
1126
  add_tests("case_nested_inner_no_expr",
1127
- "Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n else\n # do nothing\n end\nelse\n # do nothing\nend",
1127
+ "Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n end\nend",
1128
1128
  "ParseTree" => s(:case, s(:call, nil, :a),
1129
1129
  s(:when,
1130
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
@@ -34,7 +34,7 @@ require "sexp"
34
34
  class SexpProcessor
35
35
 
36
36
  # duh
37
- VERSION = "4.16.1"
37
+ VERSION = "4.17.0"
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
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
- $VERBOSE or (defined?(@hash) and @hash)
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
Binary file
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.16.1
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
- MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBBzANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTIzMDEwMTA3NTExN1oXDTI0MDEwMTA3NTExN1owRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1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Z
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: '3.23'
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: '3.23'
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.1'
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.3.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