sexp_processor 4.12.0 → 4.12.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: a33c4da3c4f6c19506d4aee6f94e76dca65aa94a3af108f751bd916cfbd0cb8f
4
- data.tar.gz: de4b25babc82dc51481153180ae65a5d9ab54079c3d2b77519666ff8b537f3fa
3
+ metadata.gz: 2fe32dcd3e36da0a96d86a6a1a7fd60dd8cef96ebd1e0d1b0d87338e3d7fee85
4
+ data.tar.gz: d55a40a0ed66d6d84cf653efba498f01d64fba61e7fd4a9eb87caa04f8dcb396
5
5
  SHA512:
6
- metadata.gz: 34e1e1f066956df4c8b71e96a2183c62183c02628ef7e7193f0c7bd48897960e4c7a47a9e08e8e9dcd02b7d202f6f2a6072511cf8d231932bb3e12de9799feef
7
- data.tar.gz: 28d1ef553de797ccdb2f00fdd3b81b1c05d26dd7ce7b8e4fbb397e175fcb7d45d2647a684c1b3b6778f01df38ef6544e151ec3484f3349257ab7de3eb5f4a586
6
+ metadata.gz: 8574bf015b701313f58aa5650b963ab35f9119567826606190658640ee32c870ce957ad73e0b2e17b6350c9217fb691383f8794d91d152a4ff2c18873cb18d5b
7
+ data.tar.gz: 4a0a6754c29ac19d5654a3a8909a1fd233bfa1831fce155e9c4bee3e25143923693d84a2019079965f507fef34e0502ac412621a671076ba45ce42a312ccbac3
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 4.12.1 / 2019-06-03
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Sexp#line now raises if setting w/ non-integer (eg nil).
6
+
7
+ * 3 bug fixes:
8
+
9
+ * Fixed pt_testcase.rb for block args w/ trailing commas.
10
+ * Fixed pt_testcase.rb for stabby proc sexps.
11
+ * Simple fixes for STRICT_SEXP=1.
12
+
1
13
  === 4.12.0 / 2019-03-12
2
14
 
3
15
  * 3 bug fixes:
data/lib/pt_testcase.rb CHANGED
@@ -363,26 +363,26 @@ class ParseTreeTestCase < Minitest::Test
363
363
  ###
364
364
  # 1.9 specific tests
365
365
 
366
- add_19edgecases("lambda { || (x + 1) }",
366
+ add_19edgecases("-> () { (x + 1) }",
367
367
  s(:iter,
368
- s(:call, nil, :lambda),
368
+ s(:lambda),
369
369
  s(:args),
370
370
  s(:call, s(:call, nil, :x), :+, s(:lit, 1))),
371
371
  "stabby_args" => "->() { (x + 1) }",
372
372
  "stabby_args_doend" => "->() do (x + 1) end")
373
373
 
374
- add_19edgecases("lambda { (x + 1) }",
374
+ add_19edgecases("-> { (x + 1) }",
375
375
  s(:iter,
376
- s(:call, nil, :lambda),
376
+ s(:lambda),
377
377
  0,
378
378
  s(:call, s(:call, nil, :x), :+, s(:lit, 1))),
379
379
  "stabby_args_0_no_parens" => "-> { (x + 1) }",
380
380
  "stabby_args_0_no_parens_doend" => "-> do (x + 1) end",
381
381
  "stabby_args_0_spacebar_broken" => "->{x+1}") # I hate you
382
382
 
383
- add_19edgecases("lambda { |x, y| (x + y) }",
383
+ add_19edgecases("-> (x, y) { (x + y) }",
384
384
  s(:iter,
385
- s(:call, nil, :lambda),
385
+ s(:lambda),
386
386
  s(:args, :x, :y),
387
387
  s(:call, s(:lvar, :x), :+, s(:lvar, :y))),
388
388
  "stabby_args_2" => "->(x, y) { (x + y) }",
@@ -390,9 +390,9 @@ class ParseTreeTestCase < Minitest::Test
390
390
  "stabby_args_2_no_parens" => "-> x, y { (x + y) }",
391
391
  "stabby_args_2_no_parens_doend" => "-> x, y do (x + y) end")
392
392
 
393
- add_19edgecases("lambda { |x| (x + 1) }",
393
+ add_19edgecases("-> (x) { (x + 1) }",
394
394
  s(:iter,
395
- s(:call, nil, :lambda),
395
+ s(:lambda),
396
396
  s(:args, :x),
397
397
  s(:call, s(:lvar, :x), :+, s(:lit, 1))),
398
398
  "stabby_args_1" => "->(x) { (x + 1) }",
@@ -2080,17 +2080,15 @@ class ParseTreeTestCase < Minitest::Test
2080
2080
  "Ruby" => "lambda { |a,| a }",
2081
2081
  "ParseTree" => s(:iter,
2082
2082
  s(:call, nil, :lambda),
2083
- s(:args, :a),
2084
- s(:lvar, :a)),
2085
- "Ruby2Ruby" => "lambda { |a| a }")
2083
+ s(:args, :a, nil),
2084
+ s(:lvar, :a)))
2086
2085
 
2087
2086
  add_tests("lambda_args_norm_comma2",
2088
- "Ruby" => "lambda { |a,b,| a }",
2087
+ "Ruby" => "lambda { |a, b,| a }",
2089
2088
  "ParseTree" => s(:iter,
2090
2089
  s(:call, nil, :lambda),
2091
- s(:args, :a, :b),
2092
- s(:lvar, :a)),
2093
- "Ruby2Ruby" => "lambda { |a, b| a }")
2090
+ s(:args, :a, :b, nil),
2091
+ s(:lvar, :a)))
2094
2092
 
2095
2093
  add_tests("lambda_args_norm_star",
2096
2094
  "Ruby" => "lambda { |a, *star| star }",
data/lib/sexp.rb CHANGED
@@ -202,13 +202,16 @@ class Sexp < Array # ZenTest FULL
202
202
  each_sexp.find_all { |sexp| sexp.sexp_type == name }
203
203
  end
204
204
 
205
+ UNASSIGNED = Object.new
206
+
205
207
  ##
206
208
  # If passed a line number, sets the line and returns self. Otherwise
207
209
  # returns the line number. This allows you to do message cascades
208
210
  # and still get the sexp back.
209
211
 
210
- def line n = nil
211
- if n then
212
+ def line n = UNASSIGNED
213
+ if n != UNASSIGNED then
214
+ raise ArgumentError, "setting %p.line %p" % [self, n] unless Integer === n
212
215
  @line = n
213
216
  self
214
217
  else
@@ -34,7 +34,7 @@ require "sexp"
34
34
  class SexpProcessor
35
35
 
36
36
  # duh
37
- VERSION = "4.12.0"
37
+ VERSION = "4.12.1"
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
@@ -317,7 +317,7 @@ class SexpProcessor
317
317
 
318
318
  def assert_type list, typ
319
319
  raise SexpTypeError, "Expected type #{typ.inspect} in #{list.inspect}" if
320
- not Array === list or list.first != typ
320
+ not Array === list or list.sexp_type != typ
321
321
  end
322
322
 
323
323
  def error_handler type, exp = nil # :nodoc:
@@ -247,12 +247,12 @@ class TestSexpProcessor < Minitest::Test
247
247
  end
248
248
 
249
249
  def test_assert_type_hit
250
- assert_nil @processor.assert_type([:blah, 1, 2, 3], :blah)
250
+ assert_nil @processor.assert_type(s(:blah, 1, 2, 3), :blah)
251
251
  end
252
252
 
253
253
  def test_assert_type_miss
254
254
  assert_raises SexpTypeError do
255
- @processor.assert_type([:thingy, 1, 2, 3], :blah)
255
+ @processor.assert_type(s(:thingy, 1, 2, 3), :blah)
256
256
  end
257
257
  end
258
258
 
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.12.0
4
+ version: 4.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
30
30
  UfBugfLD19bu3nvL+zTAGx/U
31
31
  -----END CERTIFICATE-----
32
- date: 2019-03-13 00:00:00.000000000 Z
32
+ date: 2019-06-04 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rdoc
metadata.gz.sig CHANGED
Binary file