Issue #4716 has been reported by Michael Edgar.

----------------------------------------
Bug #4716: Ripper orders rescue_mod subnodes inconsistently [PATCH]
http://redmine.ruby-lang.org/issues/4716

Author: Michael Edgar
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.2p188 (2011-03-28 revision 31204) [x86_64-darwin10.7.0]


Depending on whether a rescue_mod node is in an assignment context or not, the parse order differs:

pp Ripper.sexp("a rescue b")
[:program,
 [[:rescue_mod,
   [:var_ref, [:@ident, "b", [1, 9]]],
   [:var_ref, [:@ident, "a", [1, 0]]]]]]

pp Ripper.sexp("x = a rescue b")

[:program,
 [[:assign,
   [:var_field, [:@ident, "x", [1, 0]]],
   [:rescue_mod,
    [:var_ref, [:@ident, "a", [1, 4]]],
    [:var_ref, [:@ident, "b", [1, 13]]]]]]]

I've attached a patch that fixes the issue - a patch containing tests will soon follow.


-- 
http://redmine.ruby-lang.org