summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorJanosch Müller <janosch84@gmail.com>2023-07-01 16:22:17 +0200
committerGitHub <noreply@github.com>2023-07-01 23:22:17 +0900
commit08b3fb11524e6cde453476f24ac80fd60457dfef (patch)
tree58390c5ff62bcd0116b6aa857c228818a5b465b4 /tool
parent3fd1968d6f10579a36f77eb3838f6c62a3e9f205 (diff)
[Bug #19728] Auto-generate unicode property docs
https://bugs.ruby-lang.org/issues/19728
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7944 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'tool')
-rwxr-xr-xtool/enc-unicode.rb15
1 files changed, 1 insertions, 14 deletions
diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb
index 3fdbe71634..2224ce7149 100755
--- a/tool/enc-unicode.rb
+++ b/tool/enc-unicode.rb
@@ -269,23 +269,12 @@ def parse_block(data)
blocks << constname
end
-# shim for Ruby 1.8
-unless {}.respond_to?(:key)
- class Hash
- alias key index
- end
-end
-
$const_cache = {}
# make_const(property, pairs, name): Prints a 'static const' structure for a
# given property, group of paired codepoints, and a human-friendly name for
# the group
def make_const(prop, data, name)
- if name.empty?
- puts "\n/* '#{prop}' */"
- else
- puts "\n/* '#{prop}': #{name} */"
- end
+ puts "\n/* '#{prop}': #{name} */" # comment used to generate documentation
if origprop = $const_cache.key(data)
puts "#define CR_#{prop} CR_#{origprop}"
else
@@ -437,8 +426,6 @@ define_posix_props(data)
POSIX_NAMES.each do |name|
if name == 'XPosixPunct'
make_const(name, data[name], "[[:Punct:]]")
- elsif name == 'Punct'
- make_const(name, data[name], "")
else
make_const(name, data[name], "[[:#{name}:]]")
end