aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-01 22:33:31 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-01 22:33:31 +0900
commitbe09c8370b8f332620592b1837e040ded583489f (patch)
treeac39d7f27fbfc7273572fd34cc1fa71cb5d9209c
parent50756a1f085e3dc12dab27b22cbf60d4cabb027c (diff)
downloadruby-be09c8370b8f332620592b1837e040ded583489f.tar.gz
tool/enc-unicode.rb: make the condition concice with flip-flop
And regexps are not necessary here.
-rwxr-xr-xtool/enc-unicode.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb
index 2224ce7149..39e18aedae 100755
--- a/tool/enc-unicode.rb
+++ b/tool/enc-unicode.rb
@@ -597,7 +597,6 @@ if header
IO.popen([*NAME2CTYPE, out: tmp], "w") {|f| output.show(f, *syms)}
end while syms.pop
fds.each(&:close)
- ff = nil
IO.popen(ifdef["USE_UNICODE_AGE_PROPERTIES", fds[1].path, fds[0].path], "r") {|age|
IO.popen(ifdef["USE_UNICODE_PROPERTIES", fds[2].path, "-"], "r", in: age) {|f|
ansi = false
@@ -608,7 +607,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 ff = (!ff ? /^(uniname2ctype_hash) /=~line : /^\}/!~line) # no line can match both, exclusive flip-flop
+ if line.start_with?("uniname2ctype_hash\s") ... line.start_with?("}")
line.sub!(/^( *(?:register\s+)?(.*\S)\s+hval\s*=\s*)(?=len;)/, '\1(\2)')
end
puts line