summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiahao Chen <jiahao@mit.edu>2014-07-18 09:16:23 -0400
committerJiahao Chen <jiahao@mit.edu>2014-07-18 10:46:11 -0400
commit7932385a6c008a9b89f7ae1917f2ffbea62eb33e (patch)
tree20e8f495d3794a1e07f7cd118f833d5163114053
parent5404ef8dc7a72a402312381c8c72f80363a7d8c0 (diff)
downloadlibutf8proc-7932385a6c008a9b89f7ae1917f2ffbea62eb33e.tar.gz
libutf8proc-7932385a6c008a9b89f7ae1917f2ffbea62eb33e.tar.bz2
Update data_generator so that it runs on ruby 2.2
-rw-r--r--data_generator.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/data_generator.rb b/data_generator.rb
index 7683339..51767b9 100644
--- a/data_generator.rb
+++ b/data_generator.rb
@@ -1,4 +1,4 @@
-#!/usr/pkg/bin/ruby
+#!/usr/bin/env ruby
# This file was used to generate the 'unicode_data.c' file by parsing the
# Unicode data file 'UnicodeData.txt' of the Unicode Character Database.
@@ -74,7 +74,7 @@ $ignorable_list = <<END_OF_LIST
END_OF_LIST
$ignorable = []
-$ignorable_list.each do |entry|
+$ignorable_list.each_line do |entry|
if entry =~ /^([0-9A-F]+)\.\.([0-9A-F]+)/
$1.hex.upto($2.hex) { |e2| $ignorable << e2 }
elsif entry =~ /^[0-9A-F]+/
@@ -90,7 +90,7 @@ $grapheme_extend_list = <<END_OF_LIST
END_OF_LIST
$grapheme_extend = []
-$grapheme_extend_list.each do |entry|
+$grapheme_extend_list.each_line do |entry|
if entry =~ /^([0-9A-F]+)\.\.([0-9A-F]+)/
$1.hex.upto($2.hex) { |e2| $grapheme_extend << e2 }
elsif entry =~ /^[0-9A-F]+/
@@ -234,8 +234,8 @@ comb2nd_indicies = {}
comb_array = []
chars.each do |char|
- if char.decomp_type.nil? and char.decomp_mapping and
- char.decomp_mapping.length == 2 and
+ if !char.nil? and char.decomp_type.nil? and char.decomp_mapping and
+ char.decomp_mapping.length == 2 and !char_hash[char.decomp_mapping[0]].nil? and
char_hash[char.decomp_mapping[0]].combining_class == 0 and
not $exclusions.include?(char.code)
unless comb1st_indicies[char.decomp_mapping[0]]