Hi,
At Sat, 17 Jul 2004 09:05:08 +0900,
Alexey Verkhovsky wrote in [ruby-talk:106691]:
irb(main):001:0> s = "#{aaa}"
NameError: undefined local variable or method `aaa' for main:Object
from (irb):1
from :0
irb(main):002:0> s = %s{#{aaa}}
/usr/local/lib/ruby/1.9/irb/ruby-token.rb:101:in `Token': undefined
method `ancestors' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/1.9/irb/ruby-lex.rb:995:in
`identify_string'
Does this help?
Index: lib/irb/ruby-lex.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/irb/ruby-lex.rb,v
retrieving revision 1.22
diff -U2 -p -d -r1.22 ruby-lex.rb
--- lib/irb/ruby-lex.rb 4 Oct 2003 17:51:09 -0000 1.22
+++ lib/irb/ruby-lex.rb 17 Jul 2004 04:35:34 -0000
@@ -325,4 +325,5 @@ class RubyLex
"\`" => TkDXSTRING,
"\/" => TkDREGEXP,
+ ":" => TkDSYMBOL,
}
@@ -974,5 +975,5 @@ class RubyLex
if @quoted == ch and nest == 0
break
- elsif @ltype != "'" && @ltype != "]" and ch == "#"
+ elsif ! "']:".index(@ltype) and ch == "#"
subtype = true
elsif ch == '\\' #'
Index: lib/irb/ruby-token.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/irb/ruby-token.rb,v
retrieving revision 1.5
diff -U2 -p -d -r1.5 ruby-token.rb
--- lib/irb/ruby-token.rb 5 Aug 2003 03:08:16 -0000 1.5
+++ lib/irb/ruby-token.rb 17 Jul 2004 04:35:26 -0000
@@ -170,4 +170,5 @@ module RubyToken
[:TkDXSTRING, TkNode],
[:TkDREGEXP, TkNode],
+ [:TkDSYMBOL, TkNode],
[:TkNTH_REF, TkNode],
[:TkBACK_REF, TkNode],