sexp_processor 3.1.0 → 3.2.0
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.
- data.tar.gz.sig +0 -0
- data/History.txt +15 -0
- data/lib/pt_testcase.rb +169 -1697
- data/lib/sexp_processor.rb +23 -8
- metadata +12 -12
- metadata.gz.sig +0 -0
data/lib/sexp_processor.rb
CHANGED
@@ -34,7 +34,7 @@ require 'sexp'
|
|
34
34
|
|
35
35
|
class SexpProcessor
|
36
36
|
|
37
|
-
VERSION = '3.
|
37
|
+
VERSION = '3.2.0'
|
38
38
|
|
39
39
|
##
|
40
40
|
# Automatically shifts off the Sexp type before handing the
|
@@ -139,6 +139,11 @@ class SexpProcessor
|
|
139
139
|
def rewrite(exp)
|
140
140
|
type = exp.first
|
141
141
|
|
142
|
+
if @debug.has_key? type then
|
143
|
+
str = exp.inspect
|
144
|
+
puts "// DEBUG (original ): #{str}" if str =~ @debug[type]
|
145
|
+
end
|
146
|
+
|
142
147
|
in_context type do
|
143
148
|
exp.map! { |sub| Array === sub ? rewrite(sub) : sub }
|
144
149
|
end
|
@@ -147,6 +152,12 @@ class SexpProcessor
|
|
147
152
|
meth = @rewriters[type]
|
148
153
|
exp = self.send(meth, exp) if meth
|
149
154
|
break unless Sexp === exp
|
155
|
+
|
156
|
+
if @debug.has_key? type then
|
157
|
+
str = exp.inspect
|
158
|
+
puts "// DEBUG (rewritten): #{str}" if str =~ @debug[type]
|
159
|
+
end
|
160
|
+
|
150
161
|
old_type, type = type, exp.first
|
151
162
|
end until old_type == type
|
152
163
|
|
@@ -160,7 +171,11 @@ class SexpProcessor
|
|
160
171
|
|
161
172
|
def process(exp)
|
162
173
|
return nil if exp.nil?
|
163
|
-
|
174
|
+
if self.context.empty? then
|
175
|
+
p :rewriting unless debug.empty?
|
176
|
+
exp = self.rewrite(exp)
|
177
|
+
p :done_rewriting unless debug.empty?
|
178
|
+
end
|
164
179
|
|
165
180
|
unless @unsupported_checked then
|
166
181
|
m = public_methods.grep(/^process_/) { |o| o.to_s.sub(/^process_/, '').to_sym }
|
@@ -180,7 +195,7 @@ class SexpProcessor
|
|
180
195
|
in_context type do
|
181
196
|
if @debug.has_key? type then
|
182
197
|
str = exp.inspect
|
183
|
-
puts "// DEBUG: #{str}" if str =~ @debug[type]
|
198
|
+
puts "// DEBUG:(original ): #{str}" if str =~ @debug[type]
|
184
199
|
end
|
185
200
|
|
186
201
|
exp_orig = nil
|
@@ -190,11 +205,6 @@ class SexpProcessor
|
|
190
205
|
raise UnsupportedNodeError, "'#{type}' is not a supported node type" if
|
191
206
|
@unsupported.include? type
|
192
207
|
|
193
|
-
if @debug.has_key? type then
|
194
|
-
str = exp.inspect
|
195
|
-
puts "// DEBUG (rewritten): #{str}" if str =~ @debug[type]
|
196
|
-
end
|
197
|
-
|
198
208
|
# now do a pass with the real processor (or generic)
|
199
209
|
meth = @processors[type] || @default_method
|
200
210
|
if meth then
|
@@ -209,6 +219,11 @@ class SexpProcessor
|
|
209
219
|
self.send(meth, exp)
|
210
220
|
end
|
211
221
|
|
222
|
+
if @debug.has_key? type then
|
223
|
+
str = exp.inspect
|
224
|
+
puts "// DEBUG (processed): #{str}" if str =~ @debug[type]
|
225
|
+
end
|
226
|
+
|
212
227
|
raise SexpTypeError, "Result must be a #{@expected}, was #{result.class}:#{result.inspect}" unless @expected === result
|
213
228
|
|
214
229
|
self.assert_empty(meth, exp, exp_orig) if @require_empty
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sexp_processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 3.
|
10
|
+
version: 3.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2012-
|
39
|
+
date: 2012-04-15 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
@@ -46,11 +46,11 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
hash:
|
49
|
+
hash: 27
|
50
50
|
segments:
|
51
51
|
- 2
|
52
|
-
-
|
53
|
-
version: "2.
|
52
|
+
- 12
|
53
|
+
version: "2.12"
|
54
54
|
type: :development
|
55
55
|
version_requirements: *id001
|
56
56
|
- !ruby/object:Gem::Dependency
|
@@ -76,11 +76,11 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
79
|
+
hash: 7
|
80
80
|
segments:
|
81
|
-
-
|
82
|
-
-
|
83
|
-
version: "
|
81
|
+
- 3
|
82
|
+
- 0
|
83
|
+
version: "3.0"
|
84
84
|
type: :development
|
85
85
|
version_requirements: *id003
|
86
86
|
description: |-
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements: []
|
143
143
|
|
144
144
|
rubyforge_project: parsetree
|
145
|
-
rubygems_version: 1.8.
|
145
|
+
rubygems_version: 1.8.17
|
146
146
|
signing_key:
|
147
147
|
specification_version: 3
|
148
148
|
summary: sexp_processor branches from ParseTree bringing all the generic sexp processing tools with it
|
metadata.gz.sig
CHANGED
Binary file
|