Actions
Bug #4232
closedunexpected behavior of '#{}' in irb
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
Like0
Like0Like0Like0