sexp_processor 4.17.5 → 4.17.6

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: 2441d551c221cb6fcc415bb348cbfc7aeb37ead23e747fa061cfe09b72bf5666
4
- data.tar.gz: e8653fe553c3a3271a73aa85e646e2ee0961d97f66d5056c6d1ea48ab5b74c82
3
+ metadata.gz: c0529dac14d4e7c036927a03dd94c13292ee9164f79ed71feb08885aae10620b
4
+ data.tar.gz: b983642d3019a24ec0d49afd65290331de4703998507d8fe185c0583e4820a45
5
5
  SHA512:
6
- metadata.gz: 3457f325545dc6e549739d7b03aba6497953e82f16bde2d96ef02ee714e5a08a98a8a0ddfdc5202c71386528f7eb417931e3d5dde8d4f9e87e15010323a0f273
7
- data.tar.gz: 21b21ab7f5f7a3b2ec530deaf8a03092819334d278e86ac1cbb8d6edfbb562ca80356109ea0b797e2a04e8f2dd2fe3b79477e3a3d557372e93611c1556ba2aa3
6
+ metadata.gz: 89352cb2e01400cbdef0082441419eac1b3593986b91a18e6066306a7e14ecf518fa20dea4cc0feb4ca8d91f4788abd1e8003e506ca8ea445dd1cfd8a4cc2f2b
7
+ data.tar.gz: 2824574101c1ca17b682360c9e7cd6132002a0de13027c521a247eee937b8b997a48df2a0b3c62755015dcf46ffc8cc80add6fb25ce04281549fcc4002a789b4
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ === 4.17.6 / 2026-09-20
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Improved coverage to 100% for some modules. More to go. Fixed some minor problems.
6
+ * Minor cleanup in SexpProcessor.
7
+
1
8
  === 4.17.5 / 2025-12-24
2
9
 
3
10
  * 1 minor enhancement:
data/Rakefile CHANGED
@@ -5,6 +5,7 @@ require 'hoe'
5
5
 
6
6
  Hoe.plugin :seattlerb
7
7
  Hoe.plugin :rdoc
8
+ Hoe.plugin :cov
8
9
 
9
10
  Hoe.add_include_dirs("../../ruby_parser/dev/lib")
10
11
 
@@ -34,7 +34,7 @@ require "sexp"
34
34
  class SexpProcessor
35
35
 
36
36
  # duh
37
- VERSION = "4.17.5"
37
+ VERSION = "4.17.6"
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
@@ -218,7 +218,7 @@ class SexpProcessor
218
218
  return nil if exp.nil?
219
219
 
220
220
  unless Sexp === exp then
221
- raise SexpTypeError, "exp must be a Sexp, was #{exp.class}:#{exp.inspect}"
221
+ raise SexpTypeError, "exp must be a Sexp, was %s:%p" % [exp.class, exp]
222
222
  end
223
223
 
224
224
  if self.context.empty? then
@@ -296,7 +296,7 @@ class SexpProcessor
296
296
  end
297
297
  # result << sub_result
298
298
  result = result.class.new(*result, sub_result) # HACK
299
- end
299
+ end # until empty
300
300
 
301
301
  # NOTE: this is costly, but we are in the generic processor
302
302
  # so we shouldn't hit it too much with RubyToC stuff at least.
@@ -325,8 +325,8 @@ class SexpProcessor
325
325
  rescue StandardError => err
326
326
  return @exceptions[type].call self, exp, err if @exceptions.key? type
327
327
 
328
- warn "#{err.class} Exception thrown while processing #{type} for sexp #{exp.inspect} #{caller.inspect}" if
329
- $DEBUG
328
+ warn "%s Exception thrown while processing %s for sexp %p %p" % \
329
+ [err.class, type, exp, caller] if $DEBUG
330
330
 
331
331
  raise
332
332
  end
@@ -20,29 +20,30 @@ class FakeProcessor1 < SexpProcessor # ZenTest SKIP
20
20
  end
21
21
 
22
22
  class TestCompositeSexpProcessor < Minitest::Test
23
+ attr_accessor :p
23
24
 
24
25
  def setup
25
- @p = CompositeSexpProcessor.new
26
+ self.p = CompositeSexpProcessor.new
26
27
  end
27
28
 
28
29
  def test_process_default
29
30
  data = s(1, 2, 3)
30
- result = @p.process(data.dup)
31
+ result = p.process(data.dup)
31
32
  assert_equal(data.dup, result)
32
33
  end
33
34
 
34
35
  def test_process_fake1
35
36
  data = s(:x, 1, 2, 3)
36
- @p << FakeProcessor1.new
37
- result = @p.process(data.dup)
37
+ p << FakeProcessor1.new
38
+ result = p.process(data.dup)
38
39
  assert_equal [:x, "1 woot", "2 woot", "3 woot"], result
39
40
  end
40
41
 
41
42
  def test_process_fake1_twice
42
43
  data = s(:x, 1, 2, 3)
43
- @p << FakeProcessor1.new
44
- @p << FakeProcessor1.new
45
- result = @p.process(data.dup)
44
+ p << FakeProcessor1.new
45
+ p << FakeProcessor1.new
46
+ result = p.process(data.dup)
46
47
  assert_equal [:x, "1 woot woot", "2 woot woot", "3 woot woot"], result
47
48
  end
48
49
 
@@ -52,15 +53,15 @@ class TestCompositeSexpProcessor < Minitest::Test
52
53
  end
53
54
 
54
55
  def test_append
55
- assert_equal([], @p.processors)
56
+ assert_equal([], p.processors)
56
57
 
57
58
  assert_raises(ArgumentError) do
58
- @p << 42
59
+ p << 42
59
60
  end
60
61
 
61
62
  fp1 = FakeProcessor1.new
62
- @p << fp1
63
- assert_equal([fp1], @p.processors)
63
+ p << fp1
64
+ assert_equal([fp1], p.processors)
64
65
  end
65
66
 
66
67
  end
data/test/test_sexp.rb CHANGED
@@ -1,14 +1,5 @@
1
1
  $TESTING = true
2
2
 
3
- if ENV["COV"]
4
- require "simplecov"
5
- SimpleCov.start do
6
- add_filter "lib/sexp_processor"
7
- add_filter "test"
8
- end
9
- warn "Running simplecov"
10
- end
11
-
12
3
  require "minitest/autorun"
13
4
  require "minitest/hell" # beat these up
14
5
  require "minitest/benchmark" if ENV["BENCH"]
@@ -159,6 +150,12 @@ class TestSexp < SexpTestCase # ZenTest FULL
159
150
  assert_equal exp, Sexp.from_array(input)
160
151
  end
161
152
 
153
+ def test_cls_s
154
+ assert_output "", /DEPRECATED/ do
155
+ assert_equal Sexp.q(42), Sexp.s(42)
156
+ end
157
+ end
158
+
162
159
  def test_class_from_array
163
160
  assert_from_array s(), []
164
161
  assert_from_array s(:s), [:s]
@@ -694,6 +691,16 @@ class TestSexp < SexpTestCase # ZenTest FULL
694
691
  skip "TODO?"
695
692
  assert_equal M::Not.new(s(:a)), !s(:a)
696
693
  end
694
+
695
+ def test_value
696
+ assert_equal 42, s(:lit, 42).value
697
+ end
698
+
699
+ def test_value__multi
700
+ assert_raises do
701
+ s(:whatevs, :nope, 42).value
702
+ end
703
+ end
697
704
  end # TestSexp
698
705
 
699
706
  class TestSexpMatcher < SexpTestCase
@@ -747,8 +754,13 @@ class TestSexpMatcher < SexpTestCase
747
754
  end
748
755
 
749
756
  def test_cls_k
750
- assert_equal M::Klass.new(Float), s{ k(Float) }
757
+ k = s { k(Float) }
758
+
759
+ assert_equal M::Klass.new(Float), k
751
760
  assert_operator M::Klass.new(Float), :===, 6.28
761
+
762
+ assert_equal "k(Float)", k.inspect
763
+ assert_equal "k(Float)", k.pretty_inspect.chomp
752
764
  end
753
765
 
754
766
  def test_amp
@@ -1267,16 +1279,22 @@ class TestSexpSearch < SexpTestCase
1267
1279
 
1268
1280
  def test_satisfy_eh_any_capture # TODO: remove
1269
1281
  sexp = s(:add, :a, :b)
1270
- assert_satisfy s{ any(q(:add, :a, :b), q(:sub, :a, :b)) }, sexp
1271
1282
 
1283
+ assert_satisfy s{ any(q(:add, :a, :b), q(:sub, :a, :b)) }, sexp
1272
1284
  assert_satisfy s{ any(q(atom, :a, :b), q(:sub, :a, :b)) }, sexp
1285
+
1286
+ assert_satisfy sexp, s{ any(q(:add, :a, :b), q(:sub, :a, :b)) }
1287
+ assert_satisfy sexp, s{ any(q(atom, :a, :b), q(:sub, :a, :b)) }
1273
1288
  end
1274
1289
 
1275
1290
  def test_satisfy_eh_all_capture # TODO: remove
1276
1291
  sexp = s(:add, :a, :b)
1277
- assert_satisfy s{ all(q(_, :a, :b), q(atom, :a, :b)) }, sexp
1278
1292
 
1279
1293
  assert_satisfy s{ all(q(_, :a, :b), q(atom, :a, :b)) }, sexp
1294
+ assert_satisfy s{ all(q(_, :a, :b), q(atom, :a, :b)) }, sexp
1295
+
1296
+ assert_satisfy sexp, s{ all(q(_, :a, :b), q(atom, :a, :b)) }
1297
+ assert_satisfy sexp, s{ all(q(_, :a, :b), q(atom, :a, :b)) }
1280
1298
 
1281
1299
  assert_search 1, sexp, s{ all(q(_, :a, :b), q(atom, :a, :b)) }
1282
1300
  end
@@ -125,22 +125,38 @@ class TestSexpProcessor < Minitest::Test
125
125
  assert_equal(@processor.expected.new(42), @processor.process(a))
126
126
  end
127
127
 
128
- def test_process_not_sexp
128
+ def test_process__return_not_sexp
129
129
  @processor = TestProcessor.new
130
130
  @processor.warn_on_default = false
131
131
 
132
- assert_raises SexpTypeError do
132
+ e = assert_raises SexpTypeError do
133
133
  @processor.process(s(:broken, 1, 2, 3))
134
134
  end
135
+
136
+ assert_equal "Result of broken must be a Sexp, was Array:[:broken, 1, 2, 3]", e.message
137
+ end
138
+
139
+ def test_process__input_not_sexp
140
+ @processor = TestProcessor.new
141
+ @processor.warn_on_default = false
142
+
143
+ e = assert_raises SexpTypeError do
144
+ @processor.process(42)
145
+ end
146
+
147
+ assert_equal "exp must be a Sexp, was Integer:42", e.message
135
148
  end
136
149
 
150
+
137
151
  def test_process_unsupported_wrong
138
152
  @processor = TestProcessor.new
139
153
  @processor.unsupported << :strip
140
154
 
141
- assert_raises UnsupportedNodeError do
155
+ e = assert_raises UnsupportedNodeError do
142
156
  @processor.process(s(:whatever))
143
157
  end
158
+
159
+ assert_equal "[:strip] shouldn't be in @unsupported", e.message
144
160
  end
145
161
 
146
162
  def test_unsupported_equal
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.17.5
4
+ version: 4.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,9 +9,9 @@ bindir: bin
9
9
  cert_chain:
10
10
  - |
11
11
  -----BEGIN CERTIFICATE-----
12
- MIIDPjCCAiagAwIBAgIBCTAN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KsLjJly/Theak+euNTxvHsB+
29
- al9oSgPPHICMEX65qvLywitx
24
+ AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
25
+ 2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
26
+ rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
27
+ xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
28
+ 6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
29
+ snGe1hrppvBRdcyEzvhfIPjI
30
30
  -----END CERTIFICATE-----
31
31
  date: 1980-01-02 00:00:00.000000000 Z
32
32
  dependencies:
@@ -36,45 +36,72 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '4.0'
39
+ version: '7.0'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '7'
42
+ version: '9'
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '4.0'
49
+ version: '7.0'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '7'
52
+ version: '9'
53
+ - !ruby/object:Gem::Dependency
54
+ name: simplecov
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.21'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.21'
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: hoe
55
69
  requirement: !ruby/object:Gem::Requirement
56
70
  requirements:
57
71
  - - "~>"
58
72
  - !ruby/object:Gem::Version
59
- version: '4.3'
73
+ version: '4.7'
60
74
  type: :development
61
75
  prerelease: false
62
76
  version_requirements: !ruby/object:Gem::Requirement
63
77
  requirements:
64
78
  - - "~>"
65
79
  - !ruby/object:Gem::Version
66
- version: '4.3'
80
+ version: '4.7'
67
81
  description: |-
68
82
  sexp_processor branches from ParseTree bringing all the generic sexp
69
83
  processing tools with it. Sexp, SexpProcessor, Environment, etc... all
70
84
  for your language processing pleasure.
85
+
86
+ == Features/Problems:
87
+
88
+ * Includes SexpProcessor and CompositeSexpProcessor.
89
+
90
+ * Allows you to write very clean filters.
91
+
92
+ * Includes MethodBasedSexpProcessor
93
+
94
+ * Makes writing language processors even easier!
95
+
96
+ * Sexp provides a simple and clean interface to creating and manipulating ASTs.
97
+
98
+ * Includes new pattern matching system.
71
99
  email:
72
100
  - ryand-ruby@zenspider.com
73
101
  executables: []
74
102
  extensions: []
75
103
  extra_rdoc_files:
76
104
  - History.rdoc
77
- - Manifest.txt
78
105
  - README.rdoc
79
106
  files:
80
107
  - History.rdoc
@@ -97,6 +124,7 @@ licenses:
97
124
  - MIT
98
125
  metadata:
99
126
  homepage_uri: https://github.com/seattlerb/sexp_processor
127
+ documentation_uri: http://docs.seattlerb.org/sexp_processor
100
128
  rdoc_options:
101
129
  - "--main"
102
130
  - README.rdoc
metadata.gz.sig CHANGED
Binary file