Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
jimweirich opened this Issue · 1 comment

2 participants

Jim Weirich Thomas E Enebo
Jim Weirich

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.

Thomas E Enebo enebo was assigned
Thomas E Enebo
Owner

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]

Thomas E Enebo enebo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.