Jruby parser location

Hello all.

I was trying to learn about jruby’s parser.
After googling, I found this:
http://kenai.com/projects/jruby-parser

Am I to presume that this is outdated and the “real” jruby parser is
contained within jruby core now?

Also does anybody know if such a thing as a jruby “unparser” exists or
what not (ruby → ruby, basically, but with jruby [though I suppose I
could use caleb’s redparse with jruby])?

Thanks!
-roger-

On Thu, May 26, 2011 at 10:03 AM, Roger P. [email protected]
wrote:

Hello all.

I was trying to learn about jruby’s parser.
After googling, I found this:
http://kenai.com/projects/jruby-parser

Am I to presume that this is outdated and the “real” jruby parser is
contained within jruby core now?

Actually, at one point we realized that the overhead of supporting the
parser in JRuby for both IDE uses and runtime uses was hurting
performance and overly complicating usage from within IDE’s. So we
extracted our parser source for core and created jruby-parser.

I very recently updated jruby-parser to be much closer in sync with
all the 1.9 parser fixes we made in the last year. If you are
interested in exact positioning of syntax then jruby-parser is for
you. If you want to hack on JRuby itself then perhaps hacking the
parser in our main source is what you want. I also changed the spec
format a bit and we needs lots of new specs written for syntax
positioning (wink wink - specs accepted).

The next release of community-ruby for NetBeans should be using
jruby-parser (still uses JRuby 1.5.1 for parsing atm).

Also does anybody know if such a thing as a jruby “unparser” exists or
what not (ruby → ruby, basically, but with jruby [though I suppose I
could use caleb’s redparse with jruby])?

jruby-parser has an experimental rewriter (RewriterVisitor). So in
theory, you can swap out AST elements and re-generate Ruby source.
That code was originally contributed by the Eclipse RDT folks, so it
probably works for all the common cases of 1.8 (1.9 is likely a little
broken).

-Tom


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]

The rewriter only works for the JRubyParser project. If you knew
file/line location from the regular runtime you could then load the
same file using JRubyParser and then rewrite, but for things like
generated eval code, this would not work. Perhaps, you could couple
it with SCRIPT_LINES in a novel way?

-Tom

On Tue, May 31, 2011 at 3:53 AM, Uwe K. [email protected] wrote:

With kind regards

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


blog: http://blog.enebo.com twitter: tom_enebo
mail: [email protected]

jruby-parser has an experimental rewriter (RewriterVisitor). So in
theory, you can swap out AST elements and re-generate Ruby source.
That code was originally contributed by the Eclipse RDT folks, so it
probably works for all the common cases of 1.8 (1.9 is likely a little
broken).

Does this mean I can get the source of a method in runtime?


With kind regards
Uwe K.
Kubosch Consulting
[email protected]

I very recently updated jruby-parser to be much closer in sync with
all the 1.9 parser fixes we made in the last year.

I think the confusion came from google pointing me mostly to
http://kenai.com/projects/jruby-parser
maybe it should be disabled or a “moved” message presented there?
Cheers!
-roger-