From e6133fcafdf06d880bf06799432767f695ddfd69 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Fri, 21 Dec 2012 21:04:17 +0000 Subject: [PATCH] tools/ucd.py: fixup the codepoint ranges when processing the UnicodeData file. --- tools/ucd.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/ucd.py b/tools/ucd.py index 69a4189e..1ae4c98e 100755 --- a/tools/ucd.py +++ b/tools/ucd.py @@ -101,12 +101,22 @@ data_items = { } def parse_ucd_data(ucd_rootdir, dataset): - keys = data_items[dataset] + keys = data_items[dataset] + first = None with open(os.path.join(ucd_rootdir, '%s.txt' % dataset)) as f: for line in f: line = line.replace('\n', '').split('#')[0] linedata = [' '.join(x.split()) for x in line.split(';')] if len(linedata) == len(keys): + if linedata[1].endswith(', First>'): + first = linedata + continue + + if linedata[1].endswith(', Last>'): + linedata[0] = '%s..%s' % (first[0], linedata[0]) + linedata[1] = linedata[1].replace(', Last>', '').replace('<', '') + first = None + data = {} for keydata, value in zip(keys, linedata): key, typemap = keydata