Bug #8279

Single-line rescue parsing

Added by David Unric about 1 year ago. Updated about 1 year ago.

[ruby-core:54338]
Status:Open
Priority:Normal
Assignee:Yukihiro Matsumoto
Category:syntax
Target version:-
ruby -v:2.0.0p0 Backport:

Description

Hi,

there seems to be a bug in parser for single-line rescue statement. It fails in case of multiple assignment statements, keeping operator precedence vs. simple assignment etc.

obj = expression rescue objval

parsed as

obj = (expression rescue objval)

obj1, obj2 = expression rescue [objval1, objval2]

parsed as

(obj1, obj2 = expression) rescue [objval1, objval2]

obj += expression rescue objval

parsed as

obj += (expression rescue objval)

obj = obj + expression rescue objval

parsed as

obj = (obj + expression) rescue objval

There is already a thread about this issue on ruby-forum.com, even Matz himself is aware and did gave a nod to this problem http://www.ruby-forum.com/topic/152260#671711 , though nothing was done to fix it yet.

I've tried to report about this problem once (http://bugs.ruby-lang.org/issues/8239) but it was ignored for no known reason.


Related issues

Duplicates ruby-trunk - Feature #8239: Inline rescue bug Open 04/09/2013

History

#1 Updated by Nobuyoshi Nakada about 1 year ago

  • Priority changed from High to Normal

Also available in: Atom PDF