Project

General

Profile

Bug #8651

/[#$]/ causes syntax error

Added by Sakuro OZAWA over 2 years ago. Updated over 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
ruby -v:
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
Backport:
1.9.3: UNKNOWN, 2.0.0: UNKNOWN
[ruby-core:56069]

Description

=begin
On ruby 1.9.3-p448, a regular expression (({/[#$]/})) (character class which contains two characters, (({#})) and (({$}))) causes

syntax error, unexpected $undefined.

Ruby 2.0 accepts this and (({Regexp.new('[#$]')})) is OK on both versions.

=end

History

#1 [ruby-core:56284] Updated by Eric Hodel over 2 years ago

  • Status changed from Open to Rejected

=begin
This is consistent with (({"[#$]"})) in 1.9.3 so I will reject this issue.

In // and "" (({#$X})) interpolates global variable (({$X})). As (({$[})) is not a valid global variable you get an exception.
=end

#2 [ruby-core:56289] Updated by Sakuro OZAWA over 2 years ago

drbrain (Eric Hodel) wrote:

$[ is not a valid global variable you get an exception.

do you mean $], not $[ ?

#3 [ruby-core:56295] Updated by Sakuro OZAWA over 2 years ago

=begin
To people curious about why this does not cause error in 2.0, see #8651.
=end

#4 [ruby-core:56296] Updated by Sakuro OZAWA over 2 years ago

=begin
Bah,

To people curious about why this does not cause error in 2.0, see #8375.
=end

#5 [ruby-core:56310] Updated by Eric Hodel over 2 years ago

Yes, I meant $], it was a typo.

Also available in: Atom PDF