From 04a353fe023a7086f0bb8b68d38d2f267dbc21da Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 22 Sep 2018 20:39:35 +0000 Subject: [PATCH] tool/enc-unicode.rb: rewrote without flip-flop git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/enc-unicode.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb index d953014952..c5c593f617 100755 --- a/tool/enc-unicode.rb +++ b/tool/enc-unicode.rb @@ -535,6 +535,7 @@ if header IO.popen([*NAME2CTYPE, out: tmp], "w") {|f| output.show(f, *syms)} end while syms.pop fds.each(&:close) + ff = nil IO.popen(%W[diff -DUSE_UNICODE_AGE_PROPERTIES #{fds[1].path} #{fds[0].path}], "r") {|age| IO.popen(%W[diff -DUSE_UNICODE_PROPERTIES #{fds[2].path} -], "r", in: age) {|f| ansi = false @@ -545,7 +546,7 @@ if header line.sub!(/\/\*ANSI\*\//, '1') if ansi line.gsub!(/\(int\)\((?:long|size_t)\)&\(\(struct uniname2ctype_pool_t \*\)0\)->uniname2ctype_pool_(str\d+),\s+/, 'uniname2ctype_offset(\1), ') - if (/^(uniname2ctype_hash) /=~line)..(/^\}/=~line) + if ff = (!ff ? /^(uniname2ctype_hash) /=~line : /^\}/!~line) # no line can match both, exclusive flip-flop line.sub!(/^( *(?:register\s+)?(.*\S)\s+hval\s*=\s*)(?=len;)/, '\1(\2)') end puts line