Class: UnicodeData

Inherits:
Object
  • Object
show all
Defined in:
ext/encoding/character/utf-8/data/generate-unicode-data.rb

Instance Method Summary collapse

Instance Method Details

#process(data) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'ext/encoding/character/utf-8/data/generate-unicode-data.rb', line 172

def process(data)
  prev_code = -1
  path = File.join(data.dir, 'UnicodeData.txt')
  File.process(path) do |line|
    fields = line.chomp.split(/;/, -1)
    fields.verify_size(15, path, CODE)
    code = fields[CODE].to_i(16)

    if code >= 0xe0000 and prev_code < 0xe0000
	data.pages_before_e0000 = (prev_code >> 8) + 1
    end

    if code > prev_code + 1
	process_gap(data,
    prev_code + 1,
    code - 1,
    fields[NAME] =~ /Last>$/ ? fields : new_gap_fields)
    end
    process_one(data, code, fields)
    prev_code = code
  end
  process_gap(data, prev_code + 1, 0x10ffff, new_gap_fields)
end