Actions
Bug #20790
openSyntax acceptance of `*x = p rescue p 1` is different between parse.y and prism
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-10-09T03:27:05Z master ed11a244dd) +PRISM [x86_64-linux]
Description
*x = p rescue p 1 # syntax error in prism
*x = p 1 rescue p 1 # both syntax ok
x = p rescue p 1 # both syntax error
x = p 1 rescue p 1 # both syntax ok
Which is correct? If *x = p rescue p 1
is syntax valid, should x = p rescue p 1
also be syntax valid?
Updated by mame (Yusuke Endoh) 16 days ago
- Related to Bug #8279: Single-line rescue parsing added
Updated by mame (Yusuke Endoh) 16 days ago
Discussed at the dev meeting. Here is matz's preference.
# current parse.y behavior # matz's preference
*x = p rescue p 1 # (*x = p) rescue (p 1) # *x = (p rescue (p 1))
*x = p 1 rescue p 1 # (*x = p 1) rescue (p 1) # *x = ((p 1) rescue (p 1))
a, b = p rescue p # a, b = (p rescue p) # as is
x = p rescue p # x = (p rescue p) # as is
x = p rescue p 1 # x = (p rescue p) 1 (ERROR) # x = (p rescue p 1)
x = p 1 rescue p 1 # x = ((p 1) rescue (p 1)) # as is
@yui-knk (Kaneko Yuichiro) @kddnewton (Kevin Newton) What do you think?
Updated by kddnewton (Kevin Newton) 15 days ago
That makes sense to me, we can make that work.
Actions
Like0
Like0Like0Like0