From: Eric Hodel Date: 2008-04-06T11:26:17+09:00 Subject: Re: rubynode for 1.9? On Apr 5, 2008, at 17:08 PM, Phlip wrote: > Rubies: > > I attempted to port rubynode to 1.9, and the effort got non-trivial. > > (For the curious, I got as far as these lines: > > ruby_nerrs = 0; > ruby_in_eval++; > node = rb_compile_string(StringValuePtr(file_name), src, > NUM2INT(line)); > ruby_in_eval--; > rb_thread_critical = critical; > if (ruby_nerrs > 0) {... > > The ripper.c (?) stuff no longer supports ruby_nerrs, and my feeb > attempt to dig nerr out of the Parser object [instantiated inside > rb_compilestring] failed.) > > So, before we roll up our sleeves, the general question here how > Ruby and ripper can grow to make this kind of reflection easier. Any > ideas? If you want the sexp of an String, that's built-in. require 'ripper' Ripper.sexp "3 + 4 == 7" # => [:program, [[:binary, [:binary, [:@int, "3", [1, 0]], :+, [:@int, "4", [1, 4]]], :==, [:@int, "7", [1, 9]]]]]