summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-12 06:28:23 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-12 06:28:23 +0000
commita10ded3ba0f6da6b4f881cd23858aef3d9eb5f29 (patch)
tree463ad4ea26443ca63f2cb58844b03531b756282a
parent40d8d38909fe15a96887f4097d95d7323fc93fb7 (diff)
* bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,
instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb, mkconfig.rb, sample/test.rb, template/vm.inc.tmpl, test/ruby/test_stringchar.rb: fixes arround String#gsub. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--bootstraptest/runner.rb2
-rw-r--r--bootstraptest/test_method.rb2
-rw-r--r--enc/depend4
-rwxr-xr-xinstruby.rb2
-rw-r--r--lib/mkmf.rb12
-rw-r--r--lib/test/unit/util/procwrapper.rb2
-rwxr-xr-xmkconfig.rb5
-rw-r--r--sample/test.rb2
-rw-r--r--template/vm.inc.tmpl3
-rw-r--r--test/ruby/test_stringchar.rb2
11 files changed, 27 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 22abd0e..339b321 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Feb 12 15:27:19 2008 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,
+ instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
+ mkconfig.rb, sample/test.rb, template/vm.inc.tmpl,
+ test/ruby/test_stringchar.rb: fixes arround String#gsub.
+
+
Tue Feb 12 15:11:47 2008 NARUSE, Yui <naruse@ruby-lang.org>
* ext/json/lib/json/pure/generator.rb,
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 72840c4..b5237c2 100644
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -264,7 +264,7 @@ def adjust_indent(src)
end
def untabify(str)
- str.gsub(/^\t+/) {|tabs| ' ' * (8 * tabs.size) }
+ str.gsub(/^\t+/) {' ' * (8 * $&.size) }
end
def make_srcfile(src)
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index 8b5d584..2d194cd 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -657,7 +657,7 @@ C1.new.m(1,2,3,4,5,6,7,8,9)
tests.each{|setup, methods| setup = setup.dup; setup.strip!
- setup = BASE.gsub(/<TEST>/){setup}
+ setup = BASE.gsub(/<TEST>/, setup)
methods.split(/\n/).each{|m| m = m.dup; m.strip!
next if m.empty?
expr = "#{setup}; #{m}"
diff --git a/enc/depend b/enc/depend
index d97c905..3b2ef97 100644
--- a/enc/depend
+++ b/enc/depend
@@ -46,12 +46,12 @@ $(ENCSODIR)/<%=e%>.$(DLEXT): <%=obj%>
echo EXPORTS > <%=df%>
echo <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> >> <%=df%>
% end
- <%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%>
+ <%=link_so.sub(/\$\(OBJS\)/, obj).sub(/\$\(DEFFILE\)/, df.to_s).gsub(/-(?:implib|pdb):/, "\\1enc/#{e.sub(/[^\/]+\z/, '')}")%>
% end
% dependencies.each do |e|
enc/<%=e%>.$(OBJEXT): $(srcdir)/enc/<%=e%>.c
- <%=COMPILE_C.sub(/\$\(<(?:.*)\)/) {"$(srcdir)/enc/#{e}.c"}%>
+ <%=COMPILE_C.sub(/\$\(<(?:.*)\)/, "$(srcdir)/enc/#{e}.c")%>
% end
clean:
diff --git a/instruby.rb b/instruby.rb
index 9b07951..8380df4 100755
--- a/instruby.rb
+++ b/instruby.rb
@@ -275,7 +275,7 @@ install?(:local, :comm, :bin) do
shebang = f.gets
body = f.read
- if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang}
+ if shebang.sub!(/^\#!.*?ruby\b/, "#!" + ruby_shebang)
f.rewind
f.print shebang, body
f.truncate(f.pos)
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 45bf908..9629a64 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1512,10 +1512,10 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
f.gsub!("/", sep)
dir.gsub!("/", sep)
sep = ":/="+sep
- f.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
- f.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
- dir.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
- dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
+ f.gsub!(/(\$\(\w+)(\))/, "\\1#{sep}\\2")
+ f.gsub!(/(\$\{\w+)(\})/, "\\1#{sep}\\2")
+ dir.gsub!(/(\$\(\w+)(\))/, "\\1#{sep}\\2")
+ dir.gsub!(/(\$\{\w+)(\})/, "\\1#{sep}\\2")
end
mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n"
if defined?($installed_list)
@@ -1546,8 +1546,8 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
if sep
f = f.gsub("/", sep)
sep = ":/="+sep
- f = f.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
- f = f.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
+ f = f.gsub(/(\$\(\w+)(\))/, "\\1#{sep}\\2")
+ f = f.gsub(/(\$\{\w+)(\})/, "\\1#{sep}\\2")
else
sep = ""
end
diff --git a/lib/test/unit/util/procwrapper.rb b/lib/test/unit/util/procwrapper.rb
index 4d49a52..ad3b4d8 100644
--- a/lib/test/unit/util/procwrapper.rb
+++ b/lib/test/unit/util/procwrapper.rb
@@ -22,7 +22,7 @@ module Test
# Creates a new wrapper for a_proc.
def initialize(a_proc)
@a_proc = a_proc
- @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/){''}.sub(/(>)$/){''}.hex
+ @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/, '').sub(/(>)$/, '').hex
end
def hash # :nodoc:
diff --git a/mkconfig.rb b/mkconfig.rb
index 7815dd1..e39307b 100755
--- a/mkconfig.rb
+++ b/mkconfig.rb
@@ -150,7 +150,8 @@ print <<EOS
MAKEFILE_CONFIG = {}
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
def RbConfig::expand(val, config = CONFIG)
- val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do |var|
+ val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do
+ var = $&
if !(v = $1 || $2)
'$'
elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
@@ -158,7 +159,7 @@ print <<EOS
config[v] = false
RbConfig::expand(key, config)
config[v] = key
- key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
+ key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n, sub) if pat
key
else
var
diff --git a/sample/test.rb b/sample/test.rb
index 52898d5..532b485 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -1495,7 +1495,7 @@ $x = <<END;
ABCD
ABCD
END
-$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
+$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/, '\1\3')
test_ok($x == "AC\nAC\n")
test_ok("foobar" =~ /foo(?=(bar)|(baz))/)
diff --git a/template/vm.inc.tmpl b/template/vm.inc.tmpl
index f79de97..d152665 100644
--- a/template/vm.inc.tmpl
+++ b/template/vm.inc.tmpl
@@ -13,7 +13,8 @@
<%=
line = 15
-vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){|e|
+vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){
+ e = $&
case e
when '__CURRENT_LINE__'
line.to_s
diff --git a/test/ruby/test_stringchar.rb b/test/ruby/test_stringchar.rb
index c128181..184e221 100644
--- a/test/ruby/test_stringchar.rb
+++ b/test/ruby/test_stringchar.rb
@@ -34,7 +34,7 @@ class TestStringchar < Test::Unit::TestCase
ABCD
ABCD
END
- $x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
+ $x.gsub!(/((.|\n)*?)B((.|\n)*?)D/m ,'\1\3')
assert_equal("AC\nAC\n", $x)
assert("foobar" =~ /foo(?=(bar)|(baz))/)