From 628dfb8887a4dabfc0961c7cea0937ebcde25983 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 16 Apr 2017 09:43:03 +0100 Subject: [PATCH] Add Other_ID_Continue support from PropList.txt. --- src/include/ucd/ucd.h | 2 ++ src/proplist.c | 21 ++++++++++++++++++--- tools/printdata.py | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/include/ucd/ucd.h b/src/include/ucd/ucd.h index e6bd0ad1..aceb9f0f 100644 --- a/src/include/ucd/ucd.h +++ b/src/include/ucd/ucd.h @@ -357,6 +357,7 @@ enum UCD_PROPERTY_SOFT_DOTTED = 0x0000000001000000ull, /**< @brief Soft_Dotted */ UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION = 0x0000000002000000ull, /**< @brief Logical_Order_Exception */ UCD_PROPERTY_OTHER_ID_START = 0x0000000004000000ull, /**< @brief Other_ID_Start */ + UCD_PROPERTY_OTHER_ID_CONTINUE = 0x0000000008000000ull, /**< @brief Other_ID_Continue */ }; /** @brief Return the properties of the specified codepoint. @@ -844,6 +845,7 @@ namespace ucd Soft_Dotted = UCD_PROPERTY_SOFT_DOTTED, /**< @brief Soft_Dotted */ Logical_Order_Exception = UCD_PROPERTY_LOGICAL_ORDER_EXCEPTION, /**< @brief Logical_Order_Exception */ Other_ID_Start = UCD_PROPERTY_OTHER_ID_START, /**< @brief Other_ID_Start */ + Other_ID_Continue = UCD_PROPERTY_OTHER_ID_CONTINUE, /**< @brief Other_ID_Continue */ }; /** @brief Return the properties of the specified codepoint. diff --git a/src/proplist.c b/src/proplist.c index b8b9fdc0..10556e85 100644 --- a/src/proplist.c +++ b/src/proplist.c @@ -1131,6 +1131,20 @@ static int properties_Nl(codepoint_t c) return 0; } +static int properties_No(codepoint_t c) +{ + switch (c & 0xFFFFFF00) + { + case 0x1300: + if (c >= 0x1369 && c <= 0x1371) return UCD_PROPERTY_OTHER_ID_CONTINUE; + break; + case 0x1900: + if (c == 0x19DA) return UCD_PROPERTY_OTHER_ID_CONTINUE; + break; + } + return 0; +} + static int properties_Pc(codepoint_t c) { switch (c & 0xFFFFFF00) @@ -1254,11 +1268,11 @@ static int properties_Po(codepoint_t c) if (c == 0x002E) return UCD_PROPERTY_TERMINAL_PUNCTUATION; if (c >= 0x003A && c <= 0x003B) return UCD_PROPERTY_TERMINAL_PUNCTUATION; if (c == 0x003F) return UCD_PROPERTY_TERMINAL_PUNCTUATION; - if (c == 0x00B7) return UCD_PROPERTY_DIACRITIC | UCD_PROPERTY_EXTENDER; + if (c == 0x00B7) return UCD_PROPERTY_DIACRITIC | UCD_PROPERTY_EXTENDER | UCD_PROPERTY_OTHER_ID_CONTINUE; break; case 0x0300: if (c == 0x037E) return UCD_PROPERTY_TERMINAL_PUNCTUATION; - if (c == 0x0387) return UCD_PROPERTY_TERMINAL_PUNCTUATION; + if (c == 0x0387) return UCD_PROPERTY_TERMINAL_PUNCTUATION | UCD_PROPERTY_OTHER_ID_CONTINUE; break; case 0x0500: if (c == 0x0589) return UCD_PROPERTY_TERMINAL_PUNCTUATION; @@ -1649,6 +1663,7 @@ ucd_property ucd_properties(codepoint_t c, ucd_category category) case UCD_CATEGORY_Mn: return properties_Mn(c); case UCD_CATEGORY_Nd: return properties_Nd(c); case UCD_CATEGORY_Nl: return properties_Nl(c); + case UCD_CATEGORY_No: return properties_No(c); case UCD_CATEGORY_Pc: return properties_Pc(c); case UCD_CATEGORY_Pd: return properties_Pd(c); case UCD_CATEGORY_Pe: return properties_Pe(c); @@ -1662,6 +1677,6 @@ ucd_property ucd_properties(codepoint_t c, ucd_category category) case UCD_CATEGORY_Zl: return UCD_PROPERTY_WHITE_SPACE; case UCD_CATEGORY_Zp: return UCD_PROPERTY_WHITE_SPACE; case UCD_CATEGORY_Zs: return UCD_PROPERTY_WHITE_SPACE; - default: return 0; // Co Cs Ii Lt Me No Sc + default: return 0; // Co Cs Ii Lt Me Sc }; } diff --git a/tools/printdata.py b/tools/printdata.py index ff275e07..c8c6d7a3 100755 --- a/tools/printdata.py +++ b/tools/printdata.py @@ -148,6 +148,7 @@ def properties(data): props += (2 ** 24) * data.get('Soft_Dotted', 0) props += (2 ** 25) * data.get('Logical_Order_Exception', 0) props += (2 ** 26) * data.get('Other_ID_Start', 0) + props += (2 ** 27) * data.get('Other_ID_Continue', 0) return props if __name__ == '__main__':