Example how to access the AST?

Hi I just realized how easy it is to access the AST using rubinius:

def parser
Rubinius::Melbourne19
end

result = parser.parse_string(TestData.test_data)

It seems that this is possible in JRuby to. But all I have found are
some javadocs regarding the Parser class and the AST nodes.

Are there any examples available that show how to access the AST using
JRuby ?

Regards
Roger

You can use our builtin parser via jruby module:

require ‘jruby’

ast = JRuby.parse(input_stream)

I consider this an implementation detail of JRuby and not something
which can be depended on across releases (we expose it for internal
testing and jrubyc impl). If you want better access to source level
paring you can use our jruby-parser gem which provides a more robust
parser (good syntax location details and round-tripping between
source/ast).

-Tom

On Sat, Jul 21, 2012 at 5:59 AM, Roger G. [email protected] wrote:

Are there any examples available that show how to access the AST using JRuby ?

Regards
Roger

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


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

Thanks for your help.

I decide to use the gem.

Regards
Roger

Am 21.07.2012 um 15:21 schrieb Thomas E Enebo: