sexp_processor 4.7.0 → 4.8.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
  SHA1:
3
- metadata.gz: a8c330cf1162f2b13522bf591471d69bd2daac84
4
- data.tar.gz: 9f7001a49fb152b343544319f3de1c36f94a6b08
3
+ metadata.gz: 11e44f6312c253038fcf1ab9039d20f03e7703e0
4
+ data.tar.gz: 8fdd674b9c830e9436d27941d6c041fe3e3cb7eb
5
5
  SHA512:
6
- metadata.gz: 918c51196a0a5d9757b20215de228e73bb25e6df71e42aa8fa2bfcf4c3a058937ffd0bdd49e9fc9f6bbfba4d175aa935d946d8a911d91cbc6ed0a886922513ac
7
- data.tar.gz: b111b71bb1145d390125f6fa287a8b837916d92974a5665fcdda44b8427554306ceed81baa8625f292cae300267c4697f0aefdf20ec32450d5fb52fd06c95af2
6
+ metadata.gz: 6e012cc2080b582e0c34217331594f3d0442f259828e370164147bbcfd78347490e402b66db482ab3c1205a219b8b74043c34d9c4633de768afc9f1a5fbed402
7
+ data.tar.gz: 293726bd82c8cb6bdbd05efbcb4046889afa9284e805c481e8532f573d1aaadc8e9eec4dfecf7cea73a3e86193cf5e0237090caa1631607d1fa63c9ee121cd1a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,3 @@
1
- Z�O�2ߵ�kj��lz��,���J��� wJT%��)Q��%��QX}6[�-�ɵA|#�Cpˉ�R�����K^з+ R %~Srkk��)���CĖV���� b6,h8��
1
+ ����*����kֳ��0x0њz�����b�������SnYn-�(l��"�0��_���Y��
2
+ r�2�1N��v$K��Bb��j��S����&/�$PƟ%��s��
3
+ ��A���|��3'�5;�+Ү�e�z`��e
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ === 4.8.0 / 2017-02-01
2
+
3
+ * 2 minor enhancements:
4
+
5
+ * Added Sexp#line_max
6
+ * Extended MethodBasedSexpProcessor#in_method to take line_max and record span.
7
+
1
8
  === 4.7.0 / 2016-02-18
2
9
 
3
10
  * 2 minor enhancements:
data/lib/pt_testcase.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  $TESTING = true
4
4
 
5
- require 'minitest/unit'
5
+ require 'minitest/test'
6
6
  require 'sexp_processor' # for deep_clone
7
7
 
8
8
  # key:
@@ -111,6 +111,8 @@ class ParseTreeTestCase < Minitest::Test
111
111
  if tversions then
112
112
  cversion = self.class.name[/#{VER_RE}/]
113
113
 
114
+ assert true # shut up prove_it!
115
+
114
116
  # can't push this up because it may be generating into an
115
117
  # abstract test class and the actual subclass is versioned.
116
118
  return "version specific test" unless tversions.include? cversion if cversion
data/lib/sexp.rb CHANGED
@@ -199,6 +199,13 @@ class Sexp < Array # ZenTest FULL
199
199
  end
200
200
  end
201
201
 
202
+ ##
203
+ # Returns the maximum line number of the children of self.
204
+
205
+ def line_max
206
+ self.deep_each.map(&:line).max
207
+ end
208
+
202
209
  ##
203
210
  # Returns the size of the sexp, flattened.
204
211
 
@@ -33,7 +33,7 @@ require 'sexp'
33
33
 
34
34
  class SexpProcessor
35
35
 
36
- VERSION = "4.7.0"
36
+ VERSION = "4.8.0"
37
37
 
38
38
  ##
39
39
  # Automatically shifts off the Sexp type before handing the
@@ -488,10 +488,11 @@ class MethodBasedSexpProcessor < SexpProcessor
488
488
  ##
489
489
  # Adds name to the method stack, for the duration of the block
490
490
 
491
- def in_method(name, file, line)
491
+ def in_method name, file, line, line_max=nil
492
492
  method_name = Regexp === name ? name.inspect : name.to_s
493
493
  @method_stack.unshift method_name
494
- @method_locations[signature] = "#{file}:#{line}"
494
+ line_max = "-#{line_max}" if line_max
495
+ @method_locations[signature] = "#{file}:#{line}#{line_max}"
495
496
  yield
496
497
  ensure
497
498
  @method_stack.shift
@@ -562,7 +563,8 @@ class MethodBasedSexpProcessor < SexpProcessor
562
563
  def process_defn(exp)
563
564
  exp.shift unless auto_shift_type # node type
564
565
  name = @sclass.empty? ? exp.shift : "::#{exp.shift}"
565
- in_method name, exp.file, exp.line do
566
+
567
+ in_method name, exp.file, exp.line, exp.line_max do
566
568
  if block_given? then
567
569
  yield
568
570
  else
@@ -580,7 +582,7 @@ class MethodBasedSexpProcessor < SexpProcessor
580
582
  def process_defs(exp)
581
583
  exp.shift unless auto_shift_type # node type
582
584
  process exp.shift # recv
583
- in_method "::#{exp.shift}", exp.file, exp.line do
585
+ in_method "::#{exp.shift}", exp.file, exp.line, exp.line_max do
584
586
  if block_given? then
585
587
  yield
586
588
  else
data/test/test_sexp.rb CHANGED
@@ -48,8 +48,15 @@ class TestSexp < SexpTestCase # ZenTest FULL
48
48
  @sexp_class = Object.const_get(self.class.name[4..-1])
49
49
  @processor = SexpProcessor.new
50
50
  @sexp = @sexp_class.new(1, 2, 3)
51
- @basic_sexp = s(:lasgn, :var, s(:lit, 42))
52
- @complex_sexp = s(:block, s(:lasgn, :foo, s(:str, "foo")), s(:if, s(:and, s(:true), s(:lit, 1)), s(:if, s(:lvar, :foo), s(:str, "bar"), nil), s(:true)))
51
+ @basic_sexp = s(:lasgn, :var, s(:lit, 42).line(1)).line(1)
52
+ @complex_sexp = s(:block,
53
+ s(:lasgn, :foo, s(:str, "foo").line(1)).line(1),
54
+ s(:if, s(:and, s(:true).line(2), s(:lit, 1).line(2)).line(2),
55
+ s(:if, s(:lvar, :foo).line(3),
56
+ s(:str, "bar").line(3),
57
+ nil).line(3),
58
+ s(:true).line(5)).line(2)).line(1)
59
+
53
60
  @re = s(:lit, 42)
54
61
  @bad1 = s(:lit, 24)
55
62
  @bad1 = s(:blah, 42)
@@ -193,6 +200,18 @@ class TestSexp < SexpTestCase # ZenTest FULL
193
200
  k.new(:a, k.new(:b)).inspect)
194
201
  end
195
202
 
203
+ def test_line
204
+ assert_nil @sexp.line
205
+ assert_equal 1, @basic_sexp.line
206
+ assert_equal 1, @complex_sexp.line
207
+ end
208
+
209
+ def test_line_max
210
+ assert_nil @sexp.line_max
211
+ assert_equal 1, @basic_sexp.line_max
212
+ assert_equal 5, @complex_sexp.line_max
213
+ end
214
+
196
215
  def test_mass
197
216
  assert_equal 1, s(:a).mass
198
217
  assert_equal 3, s(:a, s(:b), s(:c)).mass
@@ -327,6 +327,19 @@ class TestMethodBasedSexpProcessor < Minitest::Test
327
327
  assert_equal expected, processor.method_locations
328
328
  end
329
329
 
330
+ def test_in_method_line_max
331
+ assert_empty processor.method_stack
332
+
333
+ processor.in_method "xxx", "file.rb", 42, 44 do
334
+ assert_equal ["xxx"], processor.method_stack
335
+ end
336
+
337
+ assert_empty processor.method_stack
338
+
339
+ expected = {"main#xxx" => "file.rb:42-44"}
340
+ assert_equal expected, processor.method_locations
341
+ end
342
+
330
343
  def test_klass_name
331
344
  assert_equal :main, processor.klass_name
332
345
 
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.7.0
4
+ version: 4.8.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
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC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CAQEAIGzgp0aZ2W9+v96ujmBcQHoC
27
+ buy0iU68MVj2VlxMyfr1KPZIh1OyhU4UO4zrkREcH8ML70v9cYHNvOd9oynRHnvC
28
+ l2tj/fD3YJ0AEkJxGrYwRWQmvMfC4bJ02bC1+rVOUIXXKp3+cUmiN4sTniof8VFo
29
+ bo/YYP4c7erpERa+9hrqygg6WQbJlk2YRlH3JXPFjmu869i2dcbR5ZLOAeEy+axH
30
+ E4oJcnPkJAr0rw504JGtlZtONZQblwmRJOIdXzolaE3NRGUzGVOUSptZppAKiavY
31
+ fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
31
32
  -----END CERTIFICATE-----
32
- date: 2016-02-19 00:00:00.000000000 Z
33
+ date: 2017-02-01 00:00:00.000000000 Z
33
34
  dependencies:
34
- - !ruby/object:Gem::Dependency
35
- name: minitest
36
- requirement: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '5.8'
41
- type: :development
42
- prerelease: false
43
- version_requirements: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: '5.8'
48
35
  - !ruby/object:Gem::Dependency
49
36
  name: rdoc
50
37
  requirement: !ruby/object:Gem::Requirement
51
38
  requirements:
52
- - - ~>
39
+ - - "~>"
53
40
  - !ruby/object:Gem::Version
54
41
  version: '4.0'
55
42
  type: :development
56
43
  prerelease: false
57
44
  version_requirements: !ruby/object:Gem::Requirement
58
45
  requirements:
59
- - - ~>
46
+ - - "~>"
60
47
  - !ruby/object:Gem::Version
61
48
  version: '4.0'
62
49
  - !ruby/object:Gem::Dependency
63
50
  name: hoe
64
51
  requirement: !ruby/object:Gem::Requirement
65
52
  requirements:
66
- - - ~>
53
+ - - "~>"
67
54
  - !ruby/object:Gem::Version
68
- version: '3.14'
55
+ version: '3.16'
69
56
  type: :development
70
57
  prerelease: false
71
58
  version_requirements: !ruby/object:Gem::Requirement
72
59
  requirements:
73
- - - ~>
60
+ - - "~>"
74
61
  - !ruby/object:Gem::Version
75
- version: '3.14'
62
+ version: '3.16'
76
63
  description: |-
77
64
  sexp_processor branches from ParseTree bringing all the generic sexp
78
65
  processing tools with it. Sexp, SexpProcessor, Environment, etc... all
@@ -105,23 +92,23 @@ licenses:
105
92
  metadata: {}
106
93
  post_install_message:
107
94
  rdoc_options:
108
- - --main
95
+ - "--main"
109
96
  - README.txt
110
97
  require_paths:
111
98
  - lib
112
99
  required_ruby_version: !ruby/object:Gem::Requirement
113
100
  requirements:
114
- - - '>='
101
+ - - ">="
115
102
  - !ruby/object:Gem::Version
116
103
  version: '0'
117
104
  required_rubygems_version: !ruby/object:Gem::Requirement
118
105
  requirements:
119
- - - '>='
106
+ - - ">="
120
107
  - !ruby/object:Gem::Version
121
108
  version: '0'
122
109
  requirements: []
123
110
  rubyforge_project:
124
- rubygems_version: 2.4.5
111
+ rubygems_version: 2.6.8
125
112
  signing_key:
126
113
  specification_version: 4
127
114
  summary: sexp_processor branches from ParseTree bringing all the generic sexp processing
metadata.gz.sig CHANGED
Binary file