JRuby's Ripper omits the :paren s-expression on method definition #813

Closed
jimweirich opened this Issue Jun 20, 2013 · 1 comment

Projects

None yet

2 participants

@jimweirich

I see that RIpper implementation is not yet complete (looking at #789). Here's an incompatibility issues with JRuby's Ripper library. The missing :paren s-expression makes it difficult to round-trip source code in the Sorcerer library.

Using JRuby:

$ rvm jruby
$ ruby -v -rripper -rpp -e 'pp Ripper::SexpBuilder.new("def f(); end").parse'
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_45-b06-451-11M4406 [darwin-x86_64]
[:program,
 [:stmts_add,
  [:stmts_new],
  [:def,
   [:@ident, "f", [1, 4]],
   [:params, nil, nil, nil, nil, nil],
   [:bodystmt, [:stmts_add, [:stmts_new], [:void_stmt]], nil, nil, nil]]]]

Using MRI Ruby 2.0.0

$ rvm 2.0.0
$ ruby -v -rripper -rpp -e 'pp Ripper::SexpBuilder.new("def f(); end").parse'
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]
[:program,
 [:stmts_add,
  [:stmts_new],
  [:def,
   [:@ident, "f", [1, 4]],
   [:paren, [:params, nil, nil, nil, nil, nil, nil, nil]],
   [:bodystmt, [:stmts_add, [:stmts_new], [:void_stmt]], nil, nil, nil]]]]

Notice that the MRI version includes a :parens s-expression wrapping the :params s-expression (in the next to the last line of output). The JRuby version omits the :parens.

@enebo enebo was assigned Jun 20, 2013
@enebo
Member
enebo commented Jun 24, 2013

I just fixed 2 cases where on_paren was not getting called. Your case will work now. Now to finish this library :)

Fixed in commit [master e25db63]

@enebo enebo closed this Jun 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment