From 8f4d0c4526d38eac768c5d8517feb3a003b3d45c Mon Sep 17 00:00:00 2001 From: keiju Date: Thu, 27 Dec 2012 12:35:28 +0000 Subject: * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on irb[Bug #5648]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/irb/ruby-lex.rb | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 295dc9fa06..19b7b9198b 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -907,10 +907,25 @@ class RubyLex end @here_header = false - while l = gets - l = l.sub(/(:?\r)?\n\z/, '') - if (indent ? l.strip : l) == quoted - break +# while l = gets +# l = l.sub(/(:?\r)?\n\z/, '') +# if (indent ? l.strip : l) == quoted +# break +# end +# end + + line = "" + while ch = getc + if ch == "\n" + if line == quoted + break + end + line = "" + else + line.concat ch unless indent && line == "" && /\s/ =~ ch + if @ltype != "'" && ch == "#" && peek(0) == "{" + identify_string_dvar + end end end -- cgit v1.2.3