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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -1
- data/History.txt +7 -0
- data/lib/pt_testcase.rb +3 -1
- data/lib/sexp.rb +7 -0
- data/lib/sexp_processor.rb +7 -5
- data/test/test_sexp.rb +21 -2
- data/test/test_sexp_processor.rb +13 -0
- metadata +23 -36
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e44f6312c253038fcf1ab9039d20f03e7703e0
|
4
|
+
data.tar.gz: 8fdd674b9c830e9436d27941d6c041fe3e3cb7eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e012cc2080b582e0c34217331594f3d0442f259828e370164147bbcfd78347490e402b66db482ab3c1205a219b8b74043c34d9c4633de768afc9f1a5fbed402
|
7
|
+
data.tar.gz: 293726bd82c8cb6bdbd05efbcb4046889afa9284e805c481e8532f573d1aaadc8e9eec4dfecf7cea73a3e86193cf5e0237090caa1631607d1fa63c9ee121cd1a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
data/History.txt
CHANGED
data/lib/pt_testcase.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
$TESTING = true
|
4
4
|
|
5
|
-
require 'minitest/
|
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
|
|
data/lib/sexp_processor.rb
CHANGED
@@ -33,7 +33,7 @@ require 'sexp'
|
|
33
33
|
|
34
34
|
class SexpProcessor
|
35
35
|
|
36
|
-
VERSION = "4.
|
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
|
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
|
-
|
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
|
-
|
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,
|
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
|
data/test/test_sexp_processor.rb
CHANGED
@@ -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.
|
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
|
-
|
13
|
+
MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
18
|
b9DCgK+627gPJkB6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
date:
|
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.
|
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.
|
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.
|
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
|