[前][次][番号順一覧][スレッド一覧]

ruby-changes:26580

From: keiju <ko1@a...>
Date: Thu, 27 Dec 2012 21:35:46 +0900 (JST)
Subject: [ruby-changes:26580] keiju:r38631 (trunk): * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on

keiju	2012-12-27 21:35:28 +0900 (Thu, 27 Dec 2012)

  New Revision: 38631

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38631

  Log:
    * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on
      irb[Bug #5648].

  Modified files:
    trunk/ChangeLog
    trunk/lib/irb/ruby-lex.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38630)
+++ ChangeLog	(revision 38631)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Dec 27 21:30:21 2012  Keiju Ishitsuka  <keiju@i...>
+
+	* 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@g...>
 
 	* ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
Index: lib/irb/ruby-lex.rb
===================================================================
--- lib/irb/ruby-lex.rb	(revision 38630)
+++ lib/irb/ruby-lex.rb	(revision 38631)
@@ -907,10 +907,25 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L907
     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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]