Project

General

Profile

Actions

Bug #19025

closed

Ripper cannot parse syntax ok code that has numbered parameters

Added by tompng (tomoya ishida) over 1 year ago. Updated 10 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0dev (2022-09-22T02:42:57Z :detached: 830b2e217b) [x86_64-linux]
[ruby-core:110114]

Description

Ruby says p { a = 0; [_1, _1 **2] } is syntax ok, Ripper says syntax error

code = 'p { a = 0; [_1, _1 **2] }'
eval(code) #=> nil (Syntax OK)
Ripper.sexp(code) #=> nil (Syntax Error)

Other similar codes. maybe not a bug

p { a = 0; [a **2] } # Syntax OK
p { a = 0; [_1 **2] } # Syntax Error
p { a = 0; [a, _1 **2] } # Syntax Error
p { a = 0; [_1, _1 **2] } # Syntax OK, Ripper.sexp says Syntax Error
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0