Project

General

Profile

Actions

Bug #18988

open

Ripper cannot parse some code that has regexp named capture

Added by tompng (tomoya ishida) 3 months ago. Updated 3 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0dev (2022-08-29T15:47:09Z :detached: cd7506593a) [x86_64-linux]
[ruby-core:109798]

Description

Ripper does not seems to recognize regexp named capture defining new local variables, fails to parse some code.

requie 'ripper'

# expect syntax ok, got syntax error
Ripper.sexp("/(?<a>)/ =~ ''; x = a **a, a if false")

# expect syntax error, got syntax ok
Ripper.sexp("/(?<a>)/ =~ ''; x = a **a, **a if false")

# "exit" is a method call, got string_literal
Ripper.sexp("/(?<a>)/ =~ ''; a %(exit)")
Actions #1

Updated by tompng (tomoya ishida) 3 months ago

  • Subject changed from # Ripper cannot parse some code that has regexp named capture to Ripper cannot parse some code that has regexp named capture
Actions

Also available in: Atom PDF

Like0
Like0