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

ruby-changes:12174

From: usa <ko1@a...>
Date: Thu, 25 Jun 2009 13:10:39 +0900 (JST)
Subject: [ruby-changes:12174] Ruby:r23850 (trunk): * instruby.rb: '&' in sed s command's replacement is '\&' in ruby.

usa	2009-06-25 13:10:21 +0900 (Thu, 25 Jun 2009)

  New Revision: 23850

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

  Log:
    * instruby.rb: '&' in sed s command's replacement is '\&' in ruby.

  Modified files:
    trunk/ChangeLog
    trunk/tool/instruby.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23849)
+++ ChangeLog	(revision 23850)
@@ -1,3 +1,7 @@
+Thu Jun 25 13:04:58 2009  NAKAMURA Usaku  <usa@r...>
+
+	* instruby.rb: '&' in sed s command's replacement is '\&' in ruby.
+
 Thu Jun 25 06:50:23 2009  Yukihiro Matsumoto  <matz@r...>
 
 	* io.c (rb_io_each_codepoint): uninitialized local variable enc.
@@ -18,7 +22,7 @@
 
 Wed Jun 24 16:07:04 2009  NAKAMURA Usaku  <usa@r...>
 
-	* win32/mkexports.rb: rbconfig.rb exists on ".".
+	* win32/mkexports.rb: rbconfig.rb exists at ".".
 
 Wed Jun 24 15:02:29 2009  Nobuyoshi Nakada  <nobu@r...>
 
Index: tool/instruby.rb
===================================================================
--- tool/instruby.rb	(revision 23849)
+++ tool/instruby.rb	(revision 23850)
@@ -391,7 +391,7 @@
       when 's'
         next if pat == '^' and rep.empty?
         exp << [addr, (opt.include?('g') ? :gsub! : :sub!),
-                Regexp.new(pat, opt.include?('i')), rep]
+                Regexp.new(pat, opt.include?('i')), rep.gsub(/&/){'\&'}]
       when 'y'
         exp << [addr, :tr!, Regexp.quote(pat), rep]
       end

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

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