From 6346ede604270202b2aad8159cb914b7a2276c34 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 12 Feb 2017 21:22:01 +0000 Subject: [PATCH] isalnum: use the Alphabetic derived core property to check that the character is in the alpha class. --- src/ctype.c | 10 +++++++--- tools/printdata.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ctype.c b/src/ctype.c index 6cd20ff7..4632b55e 100644 --- a/src/ctype.c +++ b/src/ctype.c @@ -277,15 +277,19 @@ int ucd_isalnum(codepoint_t c) { switch (ucd_lookup_category(c)) { + case UCD_CATEGORY_Lu: case UCD_CATEGORY_Ll: + case UCD_CATEGORY_Lt: case UCD_CATEGORY_Lm: case UCD_CATEGORY_Lo: - case UCD_CATEGORY_Lt: - case UCD_CATEGORY_Lu: - case UCD_CATEGORY_Nd: case UCD_CATEGORY_Nl: + case UCD_CATEGORY_Nd: case UCD_CATEGORY_No: return 1; + case UCD_CATEGORY_Mn: + case UCD_CATEGORY_Mc: + case UCD_CATEGORY_So: + return other_alphabetic_MnMcSo(c); default: return 0; } diff --git a/tools/printdata.py b/tools/printdata.py index d25c3fd2..bc724de5 100755 --- a/tools/printdata.py +++ b/tools/printdata.py @@ -89,10 +89,10 @@ def isgraph(data): return 0 def isalnum(data): - if data.get('GeneralCategory', 'Cn')[0] in 'LN': + if data.get('GeneralCategory', 'Cn')[0] in 'N': return 1 else: - return 0 + return data.get('Alphabetic', 0) def isalpha(data): return data.get('Alphabetic', 0)