1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Let fake.rb allow newlines in expanded strings

This commit is contained in:
Nobuyoshi Nakada 2017-08-30 22:49:53 +09:00
parent 576bdec03f
commit 2b967cd4b7
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -10,7 +10,9 @@ end
if inc = arg['i']
src = inc == '-' ? STDIN.read : File.read(inc)
def src.value(name)
eval(self[/\bruby_#{name}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
eval(self[/\bruby_#{name}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].
gsub(/#/, '\\#').
gsub(/((?:\G|[^\\])(?:\\\\)*)\n/, '\1'))
end
arg['versions'] = version = {}
File.read(File.join(arg['srcdir'], 'version.c')).