tool/unicode_norm_gen.rb: Adjusted directory paths.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a3a2a6c79c
commit
42b382841c
@ -1,3 +1,7 @@
|
|||||||
|
Mon Oct 6 10:57:57 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
|
* tool/unicode_norm_gen.rb: Adjusted directory paths.
|
||||||
|
|
||||||
Mon Oct 6 10:27:27 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
|
Mon Oct 6 10:27:27 2014 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
* tool/unicode_norm_gen.rb: Data generation script imported from
|
* tool/unicode_norm_gen.rb: Data generation script imported from
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
# available under the same licence as Ruby itself
|
# available under the same licence as Ruby itself
|
||||||
# (see http://www.ruby-lang.org/en/LICENSE.txt)
|
# (see http://www.ruby-lang.org/en/LICENSE.txt)
|
||||||
|
|
||||||
|
InputDataDir = '../enc/unicode/data'
|
||||||
|
OuputDataDir = '../lib/unicode_normalize'
|
||||||
|
|
||||||
class Integer
|
class Integer
|
||||||
def to_UTF8()
|
def to_UTF8()
|
||||||
if self>0xFFFF
|
if self>0xFFFF
|
||||||
@ -53,7 +56,7 @@ class Hash
|
|||||||
end
|
end
|
||||||
|
|
||||||
# read the file 'CompositionExclusions.txt'
|
# read the file 'CompositionExclusions.txt'
|
||||||
composition_exclusions = IO.readlines("../data/CompositionExclusions.txt")
|
composition_exclusions = IO.readlines("#{InputDataDir}/CompositionExclusions.txt")
|
||||||
.select { |line| line =~ /^[A-Z0-9]{4,5}/ }
|
.select { |line| line =~ /^[A-Z0-9]{4,5}/ }
|
||||||
.collect { |line| line.split(' ').first.hex }
|
.collect { |line| line.split(' ').first.hex }
|
||||||
|
|
||||||
@ -62,7 +65,7 @@ kompatible_table = {}
|
|||||||
CombiningClass = {} # constant to allow use in Integer#to_UTF8
|
CombiningClass = {} # constant to allow use in Integer#to_UTF8
|
||||||
|
|
||||||
# read the file 'UnicodeData.txt'
|
# read the file 'UnicodeData.txt'
|
||||||
IO.foreach("../data/UnicodeData.txt") do |line|
|
IO.foreach("#{InputDataDir}/UnicodeData.txt") do |line|
|
||||||
codepoint, name, _2, char_class, _4, decomposition, *_rest = line.split(";")
|
codepoint, name, _2, char_class, _4, decomposition, *_rest = line.split(";")
|
||||||
|
|
||||||
case decomposition
|
case decomposition
|
||||||
@ -129,7 +132,7 @@ class_table_str = CombiningClass.collect do |key, value|
|
|||||||
end.line_slice "\n "
|
end.line_slice "\n "
|
||||||
|
|
||||||
# generate normalization tables file
|
# generate normalization tables file
|
||||||
open("normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END
|
open("#{OuputDataDir}/normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
# automatically generated by generate.rb
|
# automatically generated by generate.rb
|
||||||
|
Loading…
x
Reference in New Issue
Block a user