247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
# File 'ext/encoding/character/utf-8/data/generate-unicode-data.rb', line 247
def process(data)
prev_code = -1
path = File.join(data.dir, 'LineBreak.txt')
File.process(path) do |line|
fields = line.chomp.sub(/\s*#.*/, '').split(/;/, -1)
fields.verify_size(2, path, BREAK_CODE)
if fields[BREAK_CODE] =~ /([0-9A-F]{4,6})\.\.([0-9A-F]{4,6})/
start_code, end_code = $1.to_i(16), $2.to_i(16)
else
start_code = end_code = fields[BREAK_CODE].to_i(16)
end
if start_code > prev_code + 1
process_gap(data, prev_code + 1, start_code - 1)
end
start_code.upto(end_code) do |i|
data.break_props[i] = fields[BREAK_PROPERTY]
end
prev_code = end_code
end
process_gap(data, prev_code + 1, 0x10ffff)
end
|