Pit Capitain
4/19/2007 10:14:00 PM
Peter Szinek schrieb:
> Pit Capitain wrote:
>> Peter, I'm curious: could you tell me (only in a few words) how you
>> are using ParseTree and Ruby2Ruby?
>
> Well, I guess it's the best to illustrate it with an example:
> (...)
Thank you for the example. Lets see if I understand what you're doing:
you have a given Ruby code (the learning extractor) and need to
manipulate it according to certain rules to create a modified version of
the code (the generalized extractor).
> If you can tell me any other way to achieve this (originally I took the
> source code of the learning extractors and replaced the examples with
> XPaths and did any other modifications required - but it was a mess
> after some time) I would be really thankful.
Well, in your example it looks like you use nothing but the Scrubyt DSL.
In this case you could capture the calling sequence and the method
arguments when you execute the DSL. But if you want to allow normal Ruby
code in the #define block (loops, conditionals, etc), then I can't think
of other solutions.
> There is a disagreement in the development team about this, too - one
> viewpoint is that a dependency on parsetree and ruby2ruby costs us too
> much (mainly on windows), and the other is that this problem has to be
> solved then we can depend on these packages....
>
> What would you suggest?
If I really wanted to support Windows users, I'd try to compile
ParseTree with MinGW and/or convince the maintainers to provide a binary
version of the gem :-)
But my question wasn't meant as a recommendation not to use ParseTree.
I'm simply interested in use cases for working with the Ruby AST.
Regards,
Pit