Project

General

Profile

Actions

Bug #4232

closed

unexpected behavior of '#{}' in irb

Added by phasis68 (Heesob Park) about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2010-12-31 trunk 30439) [i386-mswin32_90]
Backport:
[ruby-core:34083]

Description

=begin
In Ruby 1.9.x,

C:\work>irb
irb(main):001:0> a = '#{%}'
irb(main):002:0"

C:\work>irb
irb(main):001:0> a = '#{#}'
irb(main):002:0>

In Ruby 1.8.6,

C:\work>irb
irb(main):001:0> a = '#{%}'
=> "#{%}"
irb(main):002:0>

C:\work>irb
irb(main):001:0> a = '#{#}'
=> "#{#}"
irb(main):002:0>

Here is a patch:

--- ruby-lex.rb 2011-01-05 15:05:31.000000000 +0900
+++ ruby-lex.rb.new 2011-01-05 15:05:08.000000000 +0900
@@ -1046,7 +1046,7 @@
while ch = getc
if @quoted == ch and nest == 0
break

  •   elsif ch == "#" and peek(0) == "{"
    
  •   elsif @ltype != "'" && ch == "#" and peek(0) == "{"
        identify_string_dvar
      elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
        subtype = true
    

=end

Actions #1

Updated by yugui (Yuki Sonoda) about 13 years ago

  • Assignee set to keiju (Keiju Ishitsuka)

=begin

=end

Actions #2

Updated by shyouhei (Shyouhei Urabe) about 13 years ago

  • Status changed from Open to Assigned
Actions #3

Updated by keiju (Keiju Ishitsuka) almost 13 years ago

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

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


  • lib/irb/ruby-lex.rb: fix [Bug #4232].
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0