mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* include/ruby/oniguruma.h: Additional flag for characters that are titlecase.
* enc/unicode/case-folding.rb, casefold.h: Using above flag in data. * enc/unicode.c: Marking capitalized character as unmodified if it is already titlecase. * test/ruby/enc/test_case_mapping.rb: Tests for above functionality. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf99f85941
commit
2f455ceca4
6 changed files with 63 additions and 36 deletions
|
@ -158,6 +158,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
|
|||
#define ST ONIGENC_CASE_TITLECASE
|
||||
#define SU ONIGENC_CASE_UP_SPECIAL
|
||||
#define SL ONIGENC_CASE_DOWN_SPECIAL
|
||||
#define IT ONIGENC_CASE_IS_TITLECASE
|
||||
#define I(n) OnigSpecialIndexEncode(n)
|
||||
#define L(n) SpecialsLengthEncode(n)
|
||||
|
||||
|
@ -169,6 +170,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
|
|||
#undef ST
|
||||
#undef SU
|
||||
#undef SL
|
||||
#undef IT
|
||||
#undef I
|
||||
#undef L
|
||||
|
||||
|
@ -718,8 +720,11 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
|
|||
OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n);
|
||||
|
||||
if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) {
|
||||
if (flags&ONIGENC_CASE_TITLECASE)
|
||||
if (flags&ONIGENC_CASE_TITLECASE) {
|
||||
if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_IS_TITLECASE)
|
||||
flags ^= ONIGENC_CASE_MODIFIED;
|
||||
goto SpecialsCopy;
|
||||
}
|
||||
else
|
||||
SpecialsStart += SpecialsLengthExtract(*SpecialsStart);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue