Browse Source

isalnum: use the Alphabetic derived core property to check that the character is in the alpha class.

master
Reece H. Dunn 8 years ago
parent
commit
6346ede604
2 changed files with 9 additions and 5 deletions
  1. 7
    3
      src/ctype.c
  2. 2
    2
      tools/printdata.py

+ 7
- 3
src/ctype.c View File

{ {
switch (ucd_lookup_category(c)) switch (ucd_lookup_category(c))
{ {
case UCD_CATEGORY_Lu:
case UCD_CATEGORY_Ll: case UCD_CATEGORY_Ll:
case UCD_CATEGORY_Lt:
case UCD_CATEGORY_Lm: case UCD_CATEGORY_Lm:
case UCD_CATEGORY_Lo: case UCD_CATEGORY_Lo:
case UCD_CATEGORY_Lt:
case UCD_CATEGORY_Lu:
case UCD_CATEGORY_Nd:
case UCD_CATEGORY_Nl: case UCD_CATEGORY_Nl:
case UCD_CATEGORY_Nd:
case UCD_CATEGORY_No: case UCD_CATEGORY_No:
return 1; return 1;
case UCD_CATEGORY_Mn:
case UCD_CATEGORY_Mc:
case UCD_CATEGORY_So:
return other_alphabetic_MnMcSo(c);
default: default:
return 0; return 0;
} }

+ 2
- 2
tools/printdata.py View File

return 0 return 0


def isalnum(data): def isalnum(data):
if data.get('GeneralCategory', 'Cn')[0] in 'LN':
if data.get('GeneralCategory', 'Cn')[0] in 'N':
return 1 return 1
else: else:
return 0
return data.get('Alphabetic', 0)


def isalpha(data): def isalpha(data):
return data.get('Alphabetic', 0) return data.get('Alphabetic', 0)

Loading…
Cancel
Save