Bug #7610

Incompatible with percent literal regexp between 1.9.3 and 2.0.0

Added by Kenichi Murahashi over 1 year ago. Updated over 1 year ago.

[ruby-core:51088]
Status:Closed
Priority:Normal
Assignee:-
Category:-
Target version:-
ruby -v:ruby 2.0.0dev (2012-12-23 trunk 38571) [x86_64-darwin11.4.2] Backport:

Description

=begin
Percent literal regexp brings SyntaxError with parenthesis. If I use | as separator, then it works fine, but I use () as separator, then it does not work.

$ ruby -v
ruby 2.0.0dev (2012-12-23 trunk 38571) [x86_64-darwin11.4.2]
$ irb
irb(main):001:0> %r((555)555-5555)
SyntaxError: (irb):1: unmatched close parenthesis: /(555)555-5555<\/telephoneNumber>/
from /Users/sane/.rbenv/versions/2.0.0-dev/bin/irb:12:in `'
irb(main):003:0> %r|(555)555-5555|
=> /(555)555-5555<\/telephoneNumber>/

$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2]
$ irb
irb(main):001:0> %r((555)555-5555)
=> /(555)555-5555<\/telephoneNumber>/
irb(main):002:0> %r|(555)555-5555|
=> /(555)555-5555<\/telephoneNumber>/
=end


Related issues

Related to ruby-trunk - Bug #8133: Regexp macro %r{} is loosing backslash on "\}" Closed 03/21/2013

Associated revisions

Revision 38663
Added by Nobuyoshi Nakada over 1 year ago

parse.y: escaped closing parenthsis

  • parse.y (simpleremeta): escaped closing parenthsis has different meaning. [Bug #7610]

History

#1 Updated by Kenichi Murahashi over 1 year ago

Percent literal regexp brings SyntaxError with parenthesis. If I use | as separator, then it works fine, but I use () as separator, then it does not work.

$ ruby -v
ruby 2.0.0dev (2012-12-23 trunk 38571) [x86_64-darwin11.4.2]
$ irb
irb(main):001:0> %r((555)555-5555)
SyntaxError: (irb):1: unmatched close parenthesis: /(555)555-5555<\/telephoneNumber>/
from /Users/sane/.rbenv/versions/2.0.0-dev/bin/irb:12:in `'
irb(main):003:0> %r|(555)555-5555|
=> /(555)555-5555<\/telephoneNumber>/

$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2]
$ irb
irb(main):001:0> %r((555)555-5555)
=> /(555)555-5555<\/telephoneNumber>/
irb(main):002:0> %r|(555)555-5555|
=> /(555)555-5555<\/telephoneNumber>/

#2 Updated by Nobuyoshi Nakada over 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38663.
Kenichi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


parse.y: escaped closing parenthsis

  • parse.y (simpleremeta): escaped closing parenthsis has different meaning. [Bug #7610]

#3 Updated by Nobuyoshi Nakada over 1 year ago

  • Description updated (diff)

Also available in: Atom PDF