@@ -92,7 +92,12 @@ class CoodepointFlags (ctypes.Structure):
92
92
93
93
# Generate 'unicode-data.cpp'
94
94
95
- print ("""\
95
+
96
+ def out (line = "" ):
97
+ print (line , end = '\n ' ) # noqa
98
+
99
+
100
+ out ("""\
96
101
// generated with scripts/gen-unicode-data.py
97
102
98
103
#include "unicode-data.h"
@@ -103,27 +108,27 @@ class CoodepointFlags (ctypes.Structure):
103
108
#include <unordered_set>
104
109
""" )
105
110
106
- print ("const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // start, flags // last=next_start-1" )
111
+ out ("const std::vector<std::pair<uint32_t, uint16_t>> unicode_ranges_flags = { // start, flags // last=next_start-1" )
107
112
for codepoint , flags in ranges_flags :
108
113
flags = int .from_bytes (bytes (flags ), "little" )
109
- print ("{0x%06X, 0x%04X}," % (codepoint , flags ))
110
- print ("};\n " )
114
+ out ("{0x%06X, 0x%04X}," % (codepoint , flags ))
115
+ out ("};\n " )
111
116
112
- print ("const std::unordered_set<uint32_t> unicode_set_whitespace = {" )
113
- print (", " .join ("0x%06X" % cpt for cpt in table_whitespace ))
114
- print ("};\n " )
117
+ out ("const std::unordered_set<uint32_t> unicode_set_whitespace = {" )
118
+ out (", " .join ("0x%06X" % cpt for cpt in table_whitespace ))
119
+ out ("};\n " )
115
120
116
- print ("const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {" )
121
+ out ("const std::unordered_map<uint32_t, uint32_t> unicode_map_lowercase = {" )
117
122
for tuple in table_lowercase :
118
- print ("{0x%06X, 0x%06X}," % tuple )
119
- print ("};\n " )
123
+ out ("{0x%06X, 0x%06X}," % tuple )
124
+ out ("};\n " )
120
125
121
- print ("const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {" )
126
+ out ("const std::unordered_map<uint32_t, uint32_t> unicode_map_uppercase = {" )
122
127
for tuple in table_uppercase :
123
- print ("{0x%06X, 0x%06X}," % tuple )
124
- print ("};\n " )
128
+ out ("{0x%06X, 0x%06X}," % tuple )
129
+ out ("};\n " )
125
130
126
- print ("const std::vector<std::tuple<uint32_t, uint32_t, uint32_t>> unicode_ranges_nfd = { // start, last, nfd" )
131
+ out ("const std::vector<std::tuple<uint32_t, uint32_t, uint32_t>> unicode_ranges_nfd = { // start, last, nfd" )
127
132
for triple in ranges_nfd :
128
- print ("{0x%06X, 0x%06X, 0x%06X}," % triple )
129
- print ("};\n " )
133
+ out ("{0x%06X, 0x%06X, 0x%06X}," % triple )
134
+ out ("};\n " )
0 commit comments