1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add some comments to enc/unicode/case-folding.rb [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2018-10-16 06:41:47 +00:00
parent dd8771abe6
commit 7223582866

View file

@ -270,11 +270,11 @@ class CaseMapping
when 'CaseFold_11' when 'CaseFold_11'
flags += '|F' flags += '|F'
if item if item
flags += '|U' if to==item.upper flags += '|U' if to==item.upper # ONIGENC_CASE_UPCASE
flags += '|D' if to==item.lower flags += '|D' if to==item.lower # ONIGENC_CASE_DOWNCASE
unless item.upper == item.title unless item.upper == item.title
if item.code == item.title if item.code == item.title
flags += '|IT' flags += '|IT' # ONIGENC_CASE_IS_TITLECASE
swap = case item.code swap = case item.code
when '01C5' then '0064 017D' when '01C5' then '0064 017D'
when '01C8' then '006C 004A' when '01C8' then '006C 004A'
@ -285,25 +285,25 @@ class CaseMapping
end end
specials << swap specials << swap
else else
flags += '|ST' flags += '|ST' # ONIGENC_CASE_TITLECASE
specials << item.title specials << item.title
end end
end end
unless item.lower.nil? or item.lower==from or item.lower==to unless item.lower.nil? or item.lower==from or item.lower==to
specials << item.lower specials << item.lower
flags += '|SL' flags += '|SL' # ONIGENC_CASE_DOWN_SPECIAL
end end
unless item.upper.nil? or item.upper==from or item.upper==to unless item.upper.nil? or item.upper==from or item.upper==to
specials << item.upper specials << item.upper
flags += '|SU' flags += '|SU' # ONIGENC_CASE_UP_SPECIAL
end end
end end
when 'CaseUnfold_11' when 'CaseUnfold_11'
to = to.split(/ /) to = to.split(/ /)
if item if item
case to.first case to.first
when item.upper then flags += '|U' when item.upper then flags += '|U' # ONIGENC_CASE_UPCASE
when item.lower then flags += '|D' when item.lower then flags += '|D' # ONIGENC_CASE_DOWNCASE
else else
raise "Unpredicted case 0 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." raise "Unpredicted case 0 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/."
end end
@ -311,7 +311,7 @@ class CaseMapping
if item.code == item.title if item.code == item.title
raise "Unpredicted case 1 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." raise "Unpredicted case 1 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/."
elsif item.title==to[1] elsif item.title==to[1]
flags += '|ST' flags += '|ST' # ONIGENC_CASE_TITLECASE
else else
raise "Unpredicted case 2 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." raise "Unpredicted case 2 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/."
end end