Project

General

Profile

Actions

Bug #22596

open

parse.y splits regexp literal on #@, meaning named captures change

Bug #22596: parse.y splits regexp literal on #@, meaning named captures change

Added by kddnewton (Kevin Newton) about 6 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127564]

Description

/(?<captured>#@)/ =~ "#@"
defined?(captured)

The #@ changes this node to a dynamic regexp, which means named captures don't get added to the local table. But that's kind of a quirk of the lexer more than anything, since it's looking for an interpolated variable. Prism makes that a regexp node (as opposed to an interpolated regexp node) meaning the captured local gets defined.

No data to display

Actions

Also available in: PDF Atom