From 8b0926820ac918033a14efa2000ce825685d5508 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Tue, 20 Oct 2020 10:49:18 +0900 Subject: [PATCH] Update the generator script too --- bin/generate_east_asian_width | 8 ++++---- lib/reline/unicode/east_asian_width.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/generate_east_asian_width b/bin/generate_east_asian_width index ce3baf2ed2..6f8c368b9d 100755 --- a/bin/generate_east_asian_width +++ b/bin/generate_east_asian_width @@ -62,15 +62,15 @@ EOH when :A then 'Ambiguous' when :N then 'Neutral' end - output += " TYPE_%s = /^(\n" % type.upcase + output += " TYPE_%s = /^([\#{ %%W(\n" % type.upcase output += ranges.map { |range| if range.first == range.last ' \u{%04X}' % range.first else - ' [\u{%04X}-\u{%04X}]' % [range.first, range.last] + ' \u{%04X}-\u{%04X}' % [range.first, range.last] end - }.join(" |\n") - output += "\n )/x\n" + }.join("\n") + output += "\n ).join }])/\n" }.join("\n") puts 'end' end diff --git a/lib/reline/unicode/east_asian_width.rb b/lib/reline/unicode/east_asian_width.rb index b6e4f570e2..7483c78936 100644 --- a/lib/reline/unicode/east_asian_width.rb +++ b/lib/reline/unicode/east_asian_width.rb @@ -7,7 +7,7 @@ class Reline::Unicode::EastAsianWidth \u{3000} \u{FF01}-\u{FF60} \u{FFE0}-\u{FFE6} - ).join }])/x + ).join }])/ # Halfwidth TYPE_H = /^([#{ %W( @@ -18,7 +18,7 @@ class Reline::Unicode::EastAsianWidth \u{FFD2}-\u{FFD7} \u{FFDA}-\u{FFDC} \u{FFE8}-\u{FFEE} - ).join }])/x + ).join }])/ # Wide TYPE_W = /^([#{ %W( @@ -136,7 +136,7 @@ class Reline::Unicode::EastAsianWidth \u{1FAD0}-\u{1FAD6} \u{20000}-\u{2FFFD} \u{30000}-\u{3FFFD} - ).join }])/x + ).join }])/ # Narrow TYPE_NA = /^([#{ %W( @@ -147,7 +147,7 @@ class Reline::Unicode::EastAsianWidth \u{00AF} \u{27E6}-\u{27ED} \u{2985}-\u{2986} - ).join }])/x + ).join }])/ # Ambiguous TYPE_A = /^([#{ %W( @@ -330,7 +330,7 @@ class Reline::Unicode::EastAsianWidth \u{E0100}-\u{E01EF} \u{F0000}-\u{FFFFD} \u{100000}-\u{10FFFD} - ).join }])/x + ).join }])/ # Neutral TYPE_N = /^([#{ %W( @@ -1160,5 +1160,5 @@ class Reline::Unicode::EastAsianWidth \u{1FBF0}-\u{1FBF9} \u{E0001} \u{E0020}-\u{E007F} - ).join }])/x + ).join }])/ end