ParseTree version 3.0.9 has been released!
Published 2012-05-01 @ 16:39
ParseTree is a C extension (using RubyInline) that extracts the parse tree for an entire class or a specific method and returns it as a s-expression (aka sexp) using ruby’s arrays, strings, symbols, and integers.
As an example:
def conditional1(arg1) if arg1 == 0 then return 1 end return 0 end
[:defn, :conditional1, [:scope, [:block, [:args, :arg1], [:if, [:call, [:lvar, :arg1], :==, [:array, [:lit, 0]]], [:return, [:lit, 1]], nil], [:return, [:lit, 0]]]]]
3.0.9 / 2012-05-01
6 minor enhancements:
- Added a bunch of new tests from PTTC.
- Added masgn handling inside block_pass
- Added rewrite_iter to unwrap masgns w/ only 1 arg.
- Handle rewriting block_pass in iter.
- Imported RawParseTree test data from PTTC.
- Removed rewrite_masgn requirement for 4 slots.
3 bug fixes:
- Fixed dependencies to ensure they’re not going to use ruby_parser 3 and friends.
- Fixed segv for NODE_BLOCK_PASS in iter (nd_iter == 1… go boom)
- Remove nil body in iter (I think this is wrong, but whatevs).
- home: https://github.com/seattlerb/parsetree
- rdoc: http://docs.seattlerb.org/ParseTree/