virtual_keywords 0.1.0 → 0.3.0

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