ParseTree 3.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +16 -0
- data/History.txt +400 -0
- data/Manifest.txt +21 -0
- data/README.txt +115 -0
- data/Rakefile +35 -0
- data/bin/parse_tree_abc +89 -0
- data/bin/parse_tree_audit +28 -0
- data/bin/parse_tree_deps +62 -0
- data/bin/parse_tree_show +60 -0
- data/demo/printer.rb +20 -0
- data/lib/inline/Inline_RawParseTree_fa12.so +0 -0
- data/lib/parse_tree.rb +1153 -0
- data/lib/parse_tree_extensions.rb +69 -0
- data/lib/unified_ruby.rb +315 -0
- data/lib/unique.rb +15 -0
- data/test/pt_testcase.rb +4312 -0
- data/test/something.rb +53 -0
- data/test/test_all.rb +13 -0
- data/test/test_parse_tree.rb +259 -0
- data/test/test_parse_tree_extensions.rb +39 -0
- data/test/test_unified_ruby.rb +315 -0
- data/validate.sh +31 -0
- metadata +111 -0
data/.autotest
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
Autotest.add_hook :initialize do |at|
|
6
|
+
at.libs << ":../../sexp_processor/dev/lib"
|
7
|
+
at.extra_files << "test/pt_testcase.rb"
|
8
|
+
|
9
|
+
%w(TestRawParseTree).each do |klass|
|
10
|
+
at.extra_class_map[klass] = "test/test_parse_tree.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
at.add_mapping(/pt_testcase/) do |f, _|
|
14
|
+
at.files_matching(/test_.*rb$/)
|
15
|
+
end
|
16
|
+
end
|
data/History.txt
ADDED
@@ -0,0 +1,400 @@
|
|
1
|
+
=== 3.0.1 / 2008-10-23
|
2
|
+
|
3
|
+
* 1 bug fix
|
4
|
+
|
5
|
+
* Fixed the dependency on sexp_processor (accidentally camelcased). thanks ez!
|
6
|
+
|
7
|
+
=== 3.0.0 / 2008-10-22
|
8
|
+
|
9
|
+
* 3 major enhancements:
|
10
|
+
|
11
|
+
* Split out sexp_processor project.
|
12
|
+
* ParseTree#process outputs a UnifiedRuby parse tree.
|
13
|
+
* Switched all ParseTree tests to RawParseTree tests.
|
14
|
+
* Added ParseTree tests.
|
15
|
+
* Added UnifiedRuby#process.
|
16
|
+
|
17
|
+
* 28 minor enhancements:
|
18
|
+
|
19
|
+
* PTTC: Added a comprehensive suite of tests for every combo of defn args.
|
20
|
+
* PTTC: Added a ton of new tests.
|
21
|
+
* PTTC: Added extra tests for mri verbose flag testing (horrid horrid bug imhfo)
|
22
|
+
* PTTC: Don't generate tests if class has "TestCase" in the class name.
|
23
|
+
* PTTC: Made self.previous more overridable.
|
24
|
+
* PTTC: Now all tests that have "mri_verbose_flag" activate $VERBOSE
|
25
|
+
* PTTC: Officially added clone_same phase to generate_tests
|
26
|
+
* PTTC: Refactored test generation to make subclasses more flexible.
|
27
|
+
* PTTC: Refactored to use new add_tests. Much much cleaner.
|
28
|
+
* PTTC: Removed Unique from PTTC... subclasses need to deal with this
|
29
|
+
* PTTC: Removed some stupid tests.
|
30
|
+
* PTTC: Renamed a bunch of tests to be more uniform.
|
31
|
+
* UR: Added rewrite_attrasgn to normalize arg array into arglist.
|
32
|
+
* UR: Added rewrite_op_asgn1 to ensure the arglist is an arglist.
|
33
|
+
* UR: Flattened resbodies in rescue node.
|
34
|
+
* UR: Flattened super and yield args yet, deal with array arg properly.
|
35
|
+
* UR: Handle yield(*ary) properly.
|
36
|
+
* UR: Nuked argspush.
|
37
|
+
* UR: Removed begin node from unified sexps.
|
38
|
+
* UR: Removed block from rewritten resbody if only 1 element.
|
39
|
+
* UR: Removed dasgn, dasgn_curr, and dvar nodes.
|
40
|
+
* UR: Removed s(:block_arg, :block) in favor of :"&block"
|
41
|
+
* UR: Rewrote argscat to be a splat inside an array.
|
42
|
+
* UR: Rewrote block_pass into arglist of inner call/super.
|
43
|
+
* UR: Rewrote call to ALWAYS have an argslist (no more splat as arglist).
|
44
|
+
* UR: Rewrote rewrite_resbody from scratch... MUUCH cleaner.
|
45
|
+
* UR: zarray -> array
|
46
|
+
* Used Hoe#add_include_dirs to clean up rakefile.
|
47
|
+
* Moved PT dependent code from ruby2ruby to here (eg Proc#to_sexp & friends).
|
48
|
+
|
49
|
+
* 2 bug fixes:
|
50
|
+
|
51
|
+
* UR: Fixed a bug with resbody that starts with an lasgn.
|
52
|
+
* UR: Fixed args for attrset
|
53
|
+
* Fixed export of symbols to work across platforms.
|
54
|
+
|
55
|
+
=== 2.2.0 / 2008-06-09
|
56
|
+
|
57
|
+
* 18 minor enhancements:
|
58
|
+
|
59
|
+
* Added 1.9 and rubinius to multiruby skip list.
|
60
|
+
* Added 1.9 fixes for SexpProcessor.
|
61
|
+
* Added compatibility changes for regexp option values.
|
62
|
+
* Added custom compact since Array#compact is hostile to subclasses.
|
63
|
+
* Added some tests for wonky index edge cases. some commented out.
|
64
|
+
* Added test changes for 1.9 and r2r changes. Esp fixed regexp differences.
|
65
|
+
* Added tests for dasgn, proc arities,
|
66
|
+
* Added/updated some tests for ruby_parser.
|
67
|
+
* Changed tests to default to nil for verbose.
|
68
|
+
* Fixed all assertions deprecated in miniunit.
|
69
|
+
* Raises LoadError if incompatible ruby, allows fallback to ruby_parser.
|
70
|
+
* Removed Unified's rewrite_fbody and moved up into defn... not sure about that.
|
71
|
+
* Removed argscat rewriter from unified_ruby.rb
|
72
|
+
* Renamed shadowed variable name.
|
73
|
+
* Reworked parse_tree_for_(method|string) to take optional verbose arg.
|
74
|
+
* Started removing ending newlines from pt_testcase.rb.
|
75
|
+
* Uncommented all commented out tests. ruby_parser must not be a pansy.
|
76
|
+
* Updated rakefile for new hoe abilities.
|
77
|
+
|
78
|
+
* 3 bug fixes:
|
79
|
+
|
80
|
+
* Fixed 1.8.[45] wrt dasgn_curr declaration removal.
|
81
|
+
* Fixed pt_testcase bug.
|
82
|
+
* Fixes for colon2/3 in class/module/cdecls.
|
83
|
+
|
84
|
+
=== 2.1.1 / 2007-12-22
|
85
|
+
|
86
|
+
* 1 bug fix:
|
87
|
+
|
88
|
+
* _sigh_ apparently I've been running w/o all my anal compiler flags on.
|
89
|
+
|
90
|
+
=== 2.1.0 / 2007-12-21
|
91
|
+
|
92
|
+
* 13 minor enhancements:
|
93
|
+
|
94
|
+
* Added (partial) regexp flag support, currently numerical. ugh.
|
95
|
+
* Added -a flag to parse_tree_show to turn on newline (all) nodes.
|
96
|
+
* Added -r to parse_tree_show for raw arrays instead of sexps.
|
97
|
+
* Added Unifier (SexpProcessor) class to unified_ruby.rb.
|
98
|
+
* Added a ton of tests while working on ruby_parser.
|
99
|
+
* Added ability to tell proc {} (nil arg slot) from proc {||} (0 arg slot)
|
100
|
+
* Added context tracking to rewriting phase... slightly broken.
|
101
|
+
* Added evstr support. (I hate evan)
|
102
|
+
* Added usage for parse_tree_show.
|
103
|
+
* Changed verbose to be true all the time in parse_tree_for_string.
|
104
|
+
* Removed process_level from SexpProcessor... just look at context size instead.
|
105
|
+
* Revamped ParseTree. No more passing around newline. Pass around self instead.
|
106
|
+
* I'm starting to dislike ruby's AST. It is REALLY inconsistent.
|
107
|
+
|
108
|
+
* 6 bug fix:
|
109
|
+
|
110
|
+
* SexpProcessor#assert_type now a bit safer with bad values.
|
111
|
+
* Uncovered a bug in ruby (AST changes when -v used), added handler code.
|
112
|
+
* Fixed NODE_BLOCK and massively simplified in the process.
|
113
|
+
* Fixed rewrite_defs to deal with non-block asts.
|
114
|
+
* Fixed test/unit hack so it does not die under miniunit.
|
115
|
+
* Found a bug in PT where parse_tree_for_string had some shadowed variables.
|
116
|
+
|
117
|
+
=== 2.0.2 / 2007-09-20
|
118
|
+
|
119
|
+
* 2 minor enhancements:
|
120
|
+
|
121
|
+
* Deactivated gcc-specific compiler flags unless ENV['ANAL'] or on my domain.
|
122
|
+
* Minor code cleanup - happier with -pedantic and the like.
|
123
|
+
|
124
|
+
* 1 bug fix:
|
125
|
+
|
126
|
+
* FINALLY conquered the splat args bug on certain platforms/versions.
|
127
|
+
Special Thanks to Jonas Pfenniger for debugging this and providing
|
128
|
+
a patch.
|
129
|
+
|
130
|
+
=== 2.0.1 / 2007-08-21
|
131
|
+
|
132
|
+
* 1 major enhancement:
|
133
|
+
|
134
|
+
* Rewrote parse_tree_show to use parse_tree_for_string.
|
135
|
+
* parse_tree_show adds -n=node filtering -u unifying, and -s structure-only.
|
136
|
+
* parse_tree_show no longer needs -f
|
137
|
+
|
138
|
+
* 4 minor enhancements:
|
139
|
+
|
140
|
+
* Added context stack to SexpProcessor! YAY!!!
|
141
|
+
* Enforce type to be symbol in SexpProcessor... just makes life easier.
|
142
|
+
* Processing style change mode to UnifiedRuby. Prefer no rescues.
|
143
|
+
* Sexp#structure is no longer destructive.
|
144
|
+
|
145
|
+
* 4 bug fixes:
|
146
|
+
|
147
|
+
* Added 1.8.4 compatibility fix.
|
148
|
+
* Added args lifting in :defs in UnifiedRuby.
|
149
|
+
* Fixed unifying argscat, splat, and a couple other oddities.
|
150
|
+
* Added process_call to UnifiedRuby *sigh* I'm a tard.
|
151
|
+
|
152
|
+
=== 2.0.0 / 2007-08-01
|
153
|
+
|
154
|
+
* 2 major enhancements:
|
155
|
+
|
156
|
+
* Rewrite methods completely rewritten. Rewriters:
|
157
|
+
* are no longer recursive.
|
158
|
+
* are no longer required to empty the sexp coming in.
|
159
|
+
* are depth first, so rewriter gets passed everything already normalized.
|
160
|
+
* keep rewriting until type doesn't change.
|
161
|
+
* are magical goodness.
|
162
|
+
* Added UnifiedRuby module to aid others in writing clean SexpProcessors:
|
163
|
+
* bmethod/dmethod/fbody unified with defn
|
164
|
+
* fcall/vcall unified with call
|
165
|
+
* resbody unified with itself (lots of different forms)
|
166
|
+
|
167
|
+
* 5 minor enhancements:
|
168
|
+
|
169
|
+
* Add #modules to Module.
|
170
|
+
* Add Sexp::for shortcut for Sexp.from_array ParseTree.translate(...).
|
171
|
+
* Add parens for :block nodes as appropriate. May be overzealous.
|
172
|
+
* Made add_to_parse_tree global for reuse by other C extensions.
|
173
|
+
* Made test_ruby2ruby MUCH more rigorous with circular testing.
|
174
|
+
|
175
|
+
* 6 bug fixes:
|
176
|
+
|
177
|
+
* Added $TESTING = true to pt_testcase.rb. OOPS!
|
178
|
+
* Fixed some circular bugs, mostly by hacking them out, wrt operator precidence.
|
179
|
+
* Fixed splat arg processing when arg has no name.
|
180
|
+
* Fixed trinary operator.
|
181
|
+
* Fixed BMETHOD with no arguments.
|
182
|
+
* Removed hacky "self." thing for defs at top level PT use.
|
183
|
+
|
184
|
+
=== 1.7.1 / 2007-06-05
|
185
|
+
|
186
|
+
* 3 minor enhancements:
|
187
|
+
* Added begin/rescue/ensure test.
|
188
|
+
* Added block_pass_args_and_splat.
|
189
|
+
* Allow methods to be pulled from unparsed files.
|
190
|
+
* 1 bug fix:
|
191
|
+
* Compatibility fixed across 1.8.
|
192
|
+
|
193
|
+
=== 1.7.0 / 2007-02-13
|
194
|
+
|
195
|
+
* 2 major enhancements:
|
196
|
+
* rewrite extracted and intended to be run before (or in front of) process.
|
197
|
+
* rewrite is now recursive as well, so children rewritings should be
|
198
|
+
done independently of their parents. This should make complex
|
199
|
+
rewriting layers much cleaner and allow me to eventually collect
|
200
|
+
and publish a single "standard" rewriting layer.
|
201
|
+
* 1 minor enhancement:
|
202
|
+
* Iters are now {} if short and one line. YAY!
|
203
|
+
* 1 bug fix:
|
204
|
+
* Added test cases brought out by ruby2ruby/heckle.
|
205
|
+
|
206
|
+
=== 1.6.4 / 2007-01-15
|
207
|
+
|
208
|
+
* 1 minor enhancement:
|
209
|
+
* Switched short if/unless to 1 line expressions.
|
210
|
+
* 2 bug fixes:
|
211
|
+
* Fixed the nested case/when bug. YAY!
|
212
|
+
* Added dasgn_curr and defn_rescue test cases.
|
213
|
+
|
214
|
+
=== 1.6.3 / 2006-12-20
|
215
|
+
|
216
|
+
* 1 bug fix:
|
217
|
+
* ParseTree::translate was trying to translate inherited class methods.
|
218
|
+
|
219
|
+
=== 1.6.2 / 2006-12-19
|
220
|
+
|
221
|
+
* 2 minor enhancements:
|
222
|
+
* ParseTree::translate can now take :"self.method".
|
223
|
+
* Improved PT tests for [], []=
|
224
|
+
* 1 bug fixes:
|
225
|
+
* Fixed a bug in ParseTree where cases w/o exprs were malformed.
|
226
|
+
|
227
|
+
=== 1.6.1 / 2006-11-11
|
228
|
+
|
229
|
+
* 2 minor enhancements:
|
230
|
+
* Have been going insane on the tests, expect more soon.
|
231
|
+
* Cleaned up using named nodes, now do: args = exp.scope.block.args(:delete).
|
232
|
+
* 2 bug fixes:
|
233
|
+
* Fixed #parse_tree to return superclass in :const node.
|
234
|
+
* Fixed while/until with no bodies (now nil).
|
235
|
+
|
236
|
+
=== 1.6.0 / 2006-10-11
|
237
|
+
|
238
|
+
* 2 major enhancements:
|
239
|
+
* PTTC just got a major enema. 2k lines o' diff.
|
240
|
+
* All in all, removed 829 lines of code and made it a lot more solid.
|
241
|
+
* 6 minor enhancements:
|
242
|
+
* Added sort rake task.
|
243
|
+
* Added a basic front-end method to ParseTree: translate, takes
|
244
|
+
string or Class and optional method name.
|
245
|
+
* Class now has nil for unspecified superclass. No way to tell if it
|
246
|
+
is being reopened.
|
247
|
+
* SexpProcessor's unsupported array now defaults to all the internal nodes.
|
248
|
+
* Added Unique from ruby2c project.
|
249
|
+
* something.rb got slimmed down to near nothing. About to be retired.
|
250
|
+
* 3 bug fixes:
|
251
|
+
* Added changeset to Hoe spec.
|
252
|
+
* Fixed up description to use paragraphs_of.
|
253
|
+
* Fixed op_asgn1, alias, undef, dsym, match.
|
254
|
+
|
255
|
+
=== 1.5.0 / 2006-09-24
|
256
|
+
|
257
|
+
* 5 minor enhancements:
|
258
|
+
* Added parse_tree_audit.
|
259
|
+
* Added reporting of unsupported nodes that have processors.
|
260
|
+
* YAY! class method support! generated as :"self.blah"
|
261
|
+
* Add parse_tree_for_string.
|
262
|
+
* Converted Rakefile+gemspec to Hoe-based Rakefile.
|
263
|
+
* 6 bug fixes:
|
264
|
+
* Did some preliminary work on 1.9 compatibility.
|
265
|
+
* Fixed tests for some changes/clarifications.
|
266
|
+
* Fixed resbody: should have nil exceptions list when no exception rescued.
|
267
|
+
* Fixed op_asgn1 and op_asgn2.
|
268
|
+
* Fixed incompatibility with new inline changes.
|
269
|
+
* Fixed VALUE decl in parse_tree.rb
|
270
|
+
|
271
|
+
=== 1.4.1 / 2006-04-10
|
272
|
+
|
273
|
+
* 4 minor enhancements:
|
274
|
+
* parse_tree_show -f output is much cleaner now.
|
275
|
+
* ParseTree does a much more elegant job of handling different versions.
|
276
|
+
* ParseTree now has all node names in ParseTree::NODE_NAMES.
|
277
|
+
* ParseTree now raises exceptions instead of freakin'.
|
278
|
+
* 3 bug fixes:
|
279
|
+
* Used multiruby to test against 1.8.2-4, 1.8 cvs, and 1.9 cvs.
|
280
|
+
* Fixed incompatibilites introduced in ruby 1.8.4.
|
281
|
+
* Fixed some incompatibilites introduced in ruby 1.9.x.
|
282
|
+
|
283
|
+
=== 1.4.0 / 2005-10-15
|
284
|
+
|
285
|
+
* 5 minor enhancements
|
286
|
+
* Improved Makefile's install rule, uninstall, and added FILTER to all.
|
287
|
+
* Fixed minor issues w/ Makefile.
|
288
|
+
* Added -I=loadpath to parse_tree_abc.
|
289
|
+
* Added *args support for methods.
|
290
|
+
* Split out sexp to its own file.
|
291
|
+
* 2 bug fixes
|
292
|
+
* Fixed weird bug in parse_tree_deps where sort was failing on deps.
|
293
|
+
* ! Fixed fatal bug in parse_tree.rb caused by safe_level fix in ruby 1.8.3.
|
294
|
+
|
295
|
+
=== 1.3.8 / 2005-09-27
|
296
|
+
|
297
|
+
* 1 bug fix:
|
298
|
+
* Our private version of struct METHOD went out of sync w/ latest ruby.
|
299
|
+
* Only use this if you are on 1.8.3+.
|
300
|
+
|
301
|
+
=== 1.3.7 / 2005-07-13
|
302
|
+
|
303
|
+
* 3 bug fixes:
|
304
|
+
* Fixed rubygem requires for non-gem systems.
|
305
|
+
* Renamed on to on_error_in to make more clear.
|
306
|
+
* Moved exceptions to their own tree to make catching cleaner.
|
307
|
+
|
308
|
+
=== 1.3.6 / 2005-05-19
|
309
|
+
|
310
|
+
* 2 minor enhancements:
|
311
|
+
* Improved debugging capability when $DEBUG.
|
312
|
+
* Allowed for selective debugging output by node type.
|
313
|
+
* 3 bug fixes:
|
314
|
+
* Minor fixes to Makefile and parse_tree_show.
|
315
|
+
* Improved error messages in parse_tree when newlines are included.
|
316
|
+
* Improved method coverage for parse_tree.
|
317
|
+
|
318
|
+
=== 1.3.5 / 2005-04-19
|
319
|
+
|
320
|
+
* 2 minor enhancement
|
321
|
+
* Added dynamic exception handling on a per node-type basis (BIG).
|
322
|
+
* Added -c=classname to parse_tree_show to help w/ core classes.
|
323
|
+
* 1 bug fix
|
324
|
+
* Fixed dependency specification error in gemspec.
|
325
|
+
|
326
|
+
=== 1.3.4 / 2005-02-09
|
327
|
+
|
328
|
+
* 2 bug fixes
|
329
|
+
* bug:1459: Cleaned up and corrected superclass naming code.
|
330
|
+
* bug:1458: Fixed while to support post-conditional while/until nodes.
|
331
|
+
|
332
|
+
=== 1.3.3 / 2005-02-01
|
333
|
+
|
334
|
+
* 3 minor enhancement
|
335
|
+
* Cleaned up parse_tree_abc output
|
336
|
+
* Patched up null class names (delegate classes are weird!)
|
337
|
+
* Added UnknownNodeError and switched SyntaxError over to it.
|
338
|
+
* 2 bug fixes
|
339
|
+
* Fixed BEGIN node handling to recurse instead of going flat.
|
340
|
+
* FINALLY fixed the weird compiler errors seen on some versions of
|
341
|
+
gcc 3.4.x related to type punned pointers.
|
342
|
+
|
343
|
+
=== 1.3.2 / 2005-01-04
|
344
|
+
|
345
|
+
* 1 minor enhancement
|
346
|
+
* Added total line to end of ABC metric report.
|
347
|
+
* 1 bug fix
|
348
|
+
* Updates for ruby 1.8.2 parse tree changes.
|
349
|
+
|
350
|
+
=== 1.3.1 / 2004-12-09
|
351
|
+
|
352
|
+
* 1 minor enhancement
|
353
|
+
* Added rewrite_<type> processing.
|
354
|
+
* 2 bug fixes
|
355
|
+
* Renamed SexpProcessor's #exclude to #unsupported.
|
356
|
+
* Fixed a bus error when an attrasgn uses self.
|
357
|
+
* Added support for cfunc now that we found a repro.
|
358
|
+
|
359
|
+
=== 1.3.0 / 2004-12-06
|
360
|
+
|
361
|
+
* 3 minor enhancements
|
362
|
+
* Finished supporting pretty much all nodes (that we can figger out).
|
363
|
+
* If $DEBUG, or true passed to new, then we now output the :newline nodes.
|
364
|
+
* We output much better extra debugging info if $DEBUG.
|
365
|
+
* 1 bug fixes
|
366
|
+
* Fixed README for new output style.
|
367
|
+
|
368
|
+
=== 1.2.0 / 2004-11-29
|
369
|
+
|
370
|
+
* 9 minor enhancements
|
371
|
+
* ParseTree now returns symbols for all data except in :str and :lit.
|
372
|
+
* This WILL break existing code! (as if any exists)
|
373
|
+
* ParseTree.parse_tree now takes a list of classes, no optional method.
|
374
|
+
* ParseTree.parse_tree_for_method(klass, method) added.
|
375
|
+
* ParseTree.parse_tree now returns a list of :class/:module nodes.
|
376
|
+
* Added -f to parse_tree_show for uber fast demos.
|
377
|
+
* Added -q to parse_tree_show to NOT use pp so it is mucho faster.
|
378
|
+
* running with $DEBUG will trace the methods and nodes as processed.
|
379
|
+
* Added rdoc to everything.
|
380
|
+
* Gemified
|
381
|
+
* 4 bug fixes
|
382
|
+
* Bus error in iter/for nodes where arg list is empty now fixed.
|
383
|
+
* Bus error when handling 'def method(*)' is now fixed.
|
384
|
+
* Unnamed classes and superclasses (ugh) are now handled.
|
385
|
+
* parse_tree_abc now enumerates actual types rather than every token.
|
386
|
+
|
387
|
+
=== 1.1.0 / 2004-11-12
|
388
|
+
|
389
|
+
* 2 minor enhancement
|
390
|
+
* Added SexpProcessor and CompositeSexpProcessor
|
391
|
+
* Allowed show.rb to read from standard input.
|
392
|
+
* 3 bug fixes
|
393
|
+
* Fixed makefile issues for BSD's make - so dumb.
|
394
|
+
* Added super as a call in abc.rb's metrics
|
395
|
+
* Commented out a compiler flag to work with GCC 2.95.
|
396
|
+
|
397
|
+
=== 1.0.0 / 2004-11-06
|
398
|
+
|
399
|
+
* 1 major enhancement
|
400
|
+
* Birthday!
|
data/Manifest.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
.autotest
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
bin/parse_tree_abc
|
7
|
+
bin/parse_tree_audit
|
8
|
+
bin/parse_tree_deps
|
9
|
+
bin/parse_tree_show
|
10
|
+
demo/printer.rb
|
11
|
+
lib/parse_tree.rb
|
12
|
+
lib/parse_tree_extensions.rb
|
13
|
+
lib/unified_ruby.rb
|
14
|
+
lib/unique.rb
|
15
|
+
test/pt_testcase.rb
|
16
|
+
test/something.rb
|
17
|
+
test/test_all.rb
|
18
|
+
test/test_parse_tree.rb
|
19
|
+
test/test_parse_tree_extensions.rb
|
20
|
+
test/test_unified_ruby.rb
|
21
|
+
validate.sh
|
data/README.txt
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
= ParseTree
|
2
|
+
|
3
|
+
* http://rubyforge.org/projects/parsetree/
|
4
|
+
* http://www.zenspider.com/ZSS/Products/ParseTree/
|
5
|
+
* ryand-ruby@zenspider.com
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
ParseTree is a C extension (using RubyInline) that extracts the parse
|
10
|
+
tree for an entire class or a specific method and returns it as a
|
11
|
+
s-expression (aka sexp) using ruby's arrays, strings, symbols, and
|
12
|
+
integers.
|
13
|
+
|
14
|
+
As an example:
|
15
|
+
|
16
|
+
def conditional1(arg1)
|
17
|
+
if arg1 == 0 then
|
18
|
+
return 1
|
19
|
+
end
|
20
|
+
return 0
|
21
|
+
end
|
22
|
+
|
23
|
+
becomes:
|
24
|
+
|
25
|
+
[:defn,
|
26
|
+
:conditional1,
|
27
|
+
[:scope,
|
28
|
+
[:block,
|
29
|
+
[:args, :arg1],
|
30
|
+
[:if,
|
31
|
+
[:call, [:lvar, :arg1], :==, [:array, [:lit, 0]]],
|
32
|
+
[:return, [:lit, 1]],
|
33
|
+
nil],
|
34
|
+
[:return, [:lit, 0]]]]]
|
35
|
+
|
36
|
+
== FEATURES/PROBLEMS:
|
37
|
+
|
38
|
+
* Uses RubyInline, so it just drops in.
|
39
|
+
* Includes SexpProcessor and CompositeSexpProcessor.
|
40
|
+
* Allows you to write very clean filters.
|
41
|
+
* Includes UnifiedRuby, allowing you to automatically rewrite ruby quirks.
|
42
|
+
* ParseTree#parse_tree_for_string lets you parse arbitrary strings of ruby.
|
43
|
+
* Includes parse_tree_show, which lets you quickly snoop code.
|
44
|
+
* echo "1+1" | parse_tree_show -f for quick snippet output.
|
45
|
+
* Includes parse_tree_abc, which lets you get abc metrics on code.
|
46
|
+
* abc metrics = numbers of assignments, branches, and calls.
|
47
|
+
* whitespace independent metric for method complexity.
|
48
|
+
* Includes parse_tree_deps, which shows you basic class level dependencies.
|
49
|
+
* Does not work on the core classes, as they are not ruby (yet).
|
50
|
+
|
51
|
+
== SYNOPSYS:
|
52
|
+
|
53
|
+
sexp_array = ParseTree.translate(klass)
|
54
|
+
sexp_array = ParseTree.translate(klass, :method)
|
55
|
+
sexp_array = ParseTree.translate("1+1")
|
56
|
+
|
57
|
+
or:
|
58
|
+
|
59
|
+
class MyProcessor < SexpProcessor
|
60
|
+
def initialize
|
61
|
+
super
|
62
|
+
self.strict = false
|
63
|
+
end
|
64
|
+
def process_lit(exp)
|
65
|
+
val = exp.shift
|
66
|
+
return val
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
or:
|
71
|
+
|
72
|
+
% ./parse_tree_show myfile.rb
|
73
|
+
|
74
|
+
or:
|
75
|
+
|
76
|
+
% echo "1+1" | ./parse_tree_show -f
|
77
|
+
|
78
|
+
or:
|
79
|
+
|
80
|
+
% ./parse_tree_abc myfile.rb
|
81
|
+
|
82
|
+
== REQUIREMENTS:
|
83
|
+
|
84
|
+
* RubyInline 3.6 or better.
|
85
|
+
|
86
|
+
== INSTALL:
|
87
|
+
|
88
|
+
* rake install_gem
|
89
|
+
* sudo rake install
|
90
|
+
* sudo gem install ParseTree
|
91
|
+
|
92
|
+
== LICENSE:
|
93
|
+
|
94
|
+
(The MIT License)
|
95
|
+
|
96
|
+
Copyright (c) 2001-2007 Ryan Davis, Zen Spider Software
|
97
|
+
|
98
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
99
|
+
a copy of this software and associated documentation files (the
|
100
|
+
"Software"), to deal in the Software without restriction, including
|
101
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
102
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
103
|
+
permit persons to whom the Software is furnished to do so, subject to
|
104
|
+
the following conditions:
|
105
|
+
|
106
|
+
The above copyright notice and this permission notice shall be
|
107
|
+
included in all copies or substantial portions of the Software.
|
108
|
+
|
109
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
110
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
111
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
112
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
113
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
114
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
115
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|