summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 06:09:13 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 06:09:13 +0000
commitbc70ea70cd455261d185ec386e4c04ce9ccabf62 (patch)
tree2abf5e35fed67c4cba083cb0ae0dc63a39ae56ac /tool
parenta436212282330a6b132e0a4174178a4ca253dea0 (diff)
* tool/compile_prelude.rb: too long string literal causes compile error
on some platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/compile_prelude.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb
index 48b9e2e1cf..88b7d69f11 100755
--- a/tool/compile_prelude.rb
+++ b/tool/compile_prelude.rb
@@ -51,17 +51,22 @@ lines_list = preludes.map {|filename|
"nil"
end
}
- line.gsub!(/require\s*(\(?)\s*(["'])(.*?)\2\s*\1/) {
+ if /require\s*(\(?)\s*(["'])(.*?)\2\s*\1/ =~ line
orig, path = $&, $3
srcdir = File.expand_path("../..", __FILE__)
path = File.expand_path(path, srcdir)
if File.exist?(path)
- "eval(%s, TOPLEVEL_BINDING, %s, %d)" % [ File.read(path).dump, prelude_name(filename, path).dump, 1]
+ lines << c_esc("eval(")
+ File.readlines(path).each do |line|
+ lines << c_esc(line.dump)
+ end
+ lines << c_esc(", TOPLEVEL_BINDING, %s, %d)" % [ prelude_name(filename, path).dump, 1])
else
- orig
+ lines << c_esc(orig)
end
- }
- lines << c_esc(line)
+ else
+ lines << c_esc(line)
+ end
}
setup_lines = []
if need_ruby_prefix