Yes, you should use Transform. Transform allows you to define a set of transformation rules that would take elements or hashes from your parsed output and replace them with new objects. You can use this to build up your new structure from the leaves in.
Take a look at https://github.com/kschiess/parslet/blob/master/example/minilisp.rb : see how the transform takes values and transforms them into instances of Float and Integer classes. Hope this helps, Nigel Thorne --- "No man is an island... except Philip" On Tue, Jun 18, 2013 at 11:31 AM, Li Dong <[email protected]> wrote: > Hi all, > > I would like to turn the parsed tree into RubyTree structure for > convenient query operations, so what is the best practice to do that? > Should I use Parslet::Transform or just write my method. For > Parslet::Transform, it seems that the result is still in plain "hash > table". I have used Treetop to accomplish that, but I would like to turn to > Parslet. Thanks in advance. > > Cheers, > > Li >
