Project

General

Profile

Actions

Bug #19025

open

Ripper cannot parse syntax ok code that has numbered parameters

Added by tompng (tomoya ishida) 2 months ago.

Status:
Open
Priority:
Normal
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

No data to display

Actions

Also available in: Atom PDF

Like0