summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-11 08:07:49 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-11 08:07:49 (GMT)
commit8ab36f0306a511881fb008bd1c60abd7918dae46 (patch)
treef320f2fcfd9e1e0f61fe4539a67cef259d5153ec /template
parent0991d0a8ee73977ab3e2aed2fbe361985f6f0d0d (diff)
fake.rb.in: scan version.c
* template/fake.rb.in: scan MKSTR and MKINT from version.c and then extract the value for them from version.i. * version.c (Init_version): use MKINT as the marker. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r--template/fake.rb.in6
1 files changed, 4 insertions, 2 deletions
diff --git a/template/fake.rb.in b/template/fake.rb.in
index 646a89f..fa7f1f7 100644
--- a/template/fake.rb.in
+++ b/template/fake.rb.in
@@ -8,8 +8,10 @@ end
if arg['i']
src = File.read(arg['i'])
arg['versions'] = version = {}
- src.scan(/rb_define_global_const\("(RUBY_\w+)",\s*(?:.*rb_\w*str_new\w*\s*\(\s*(\w+)|[\(\s]*\(\s*VALUE\s*\)\s*\((.+)\)\s*\)\s*<<\s?)/) do |n, s, i|
- version[n] = i ? i.gsub(/\s+/, '').to_i : src[/\b#{s}\[\]\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*);/m, 1].gsub(/\A"|"\s*\z|" *"/, '').gsub(/\\(.)/, '\1')
+ File.read(File.join(arg['srcdir'], 'version.c')).
+ scan(/rb_define_global_const\("(RUBY_\w+)",[^;]*?\bMK(?:INT|STR)\(([^()]*)\)/m) do |n, v|
+ version[n] =
+ eval(src[/\bruby_#{v}(?:\[\])?\s*=\s*((?:"(?:\\.|[^\"\\])*"\s*)*(?=;)|[^{};]+)/m, 1].gsub(/#/, '\\#'))
end
end
%>baseruby="<%=arg['BASERUBY']%>"