Browse Source

isupper: include the Other_Uppercase characters.

master
Reece H. Dunn 8 years ago
parent
commit
1fc20f39f5
2 changed files with 20 additions and 4 deletions
  1. 16
    2
      src/ctype.c
  2. 4
    2
      tools/printdata.py

+ 16
- 2
src/ctype.c View File



int ucd_isupper(codepoint_t c) int ucd_isupper(codepoint_t c)
{ {
return ucd_lookup_category(c) == UCD_CATEGORY_Lu
|| ucd_tolower(c) != c;
switch (ucd_lookup_category(c))
{
case UCD_CATEGORY_Lu:
return 1;
case UCD_CATEGORY_Lt:
return ucd_tolower(c) != c;
case UCD_CATEGORY_Nl:
return (c >= 0x002160 && c <= 0x00216F); // Other_Uppercase
case UCD_CATEGORY_So:
return (c >= 0x0024B6 && c <= 0x0024CF) // Other_Uppercase
|| (c >= 0x01F130 && c <= 0x01F149) // Other_Uppercase
|| (c >= 0x01F150 && c <= 0x01F169) // Other_Uppercase
|| (c >= 0x01F170 && c <= 0x01F189); // Other_Uppercase
default:
return 0;
}
} }


int ucd_isxdigit(codepoint_t c) int ucd_isxdigit(codepoint_t c)

+ 4
- 2
tools/printdata.py View File

return 0 return 0


def isupper(data): def isupper(data):
if data.get('LowerCase', null) != null:
if data.get('GeneralCategory', 'Cn') == 'Lu':
return 1 return 1
elif data.get('GeneralCategory', 'Cn') == 'Lu':
elif data.get('Other_Uppercase', 0):
return 1
elif data.get('LowerCase', null) != null: # Some Lt characters have lowercase forms.
return 1 return 1
else: else:
return 0 return 0

Loading…
Cancel
Save