I reluctantly moved Roodi over to ParseTree recently because I figured that would make it more accessible to people. My reluctance came from the fact that I was going to lose the line number support the I had in JRuby. Happy days - it turns out I was wrong!
The following bit of code sets up ParseTree so you can parse some code:
parse_tree = ParseTree.newtree = parse_tree.parse_tree_for_string(ruby_code_as_text, filename)
It turns out that one very small tweak will give me line number support:
parse_tree = ParseTree.new(true)tree = parse_tree.parse_tree_for_string(ruby_code_as_text, filename)
The addition of that boolean means that ParseTree will now include newline nodes in the tree structure that it gives me. Every newline node includes the line number and the name of the file that it came from. That made the output from Roodi much more useful.