Skip to content

Commit

Permalink
Update the generator script too
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Oct 20, 2020
1 parent 57c7955 commit 8b09268
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions bin/generate_east_asian_width
Expand Up @@ -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
12 changes: 6 additions & 6 deletions lib/reline/unicode/east_asian_width.rb
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -1160,5 +1160,5 @@ class Reline::Unicode::EastAsianWidth
\u{1FBF0}-\u{1FBF9}
\u{E0001}
\u{E0020}-\u{E007F}
).join }])/x
).join }])/
end

0 comments on commit 8b09268

Please sign in to comment.