diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-27 12:35:28 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-27 12:35:28 +0000 |
commit | 8f4d0c4526d38eac768c5d8517feb3a003b3d45c (patch) | |
tree | 9ba31e62288f97682cb49a413c89f05b664c4e24 | |
parent | 89182621d9949b24e67d48b751a1997e9eeb06ec (diff) | |
download | ruby-8f4d0c4526d38eac768c5d8517feb3a003b3d45c.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/irb/ruby-lex.rb | 23 |
2 files changed, 24 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Thu Dec 27 21:30:21 2012 Keiju Ishitsuka <keiju@ishitsuka.com> + + * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on + irb[Bug #5648]. + Thu Dec 27 20:45:29 2012 Masaki Matsushita <glass.saga@gmail.com> * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError 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 |