Browse Source

Add Other_ID_Continue support from PropList.txt.

master
Reece H. Dunn 8 years ago
parent
commit
628dfb8887
3 changed files with 21 additions and 3 deletions
  1. 2
    0
      src/include/ucd/ucd.h
  2. 18
    3
      src/proplist.c
  3. 1
    0
      tools/printdata.py

+ 2
- 0
src/include/ucd/ucd.h View File

@@ -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.

+ 18
- 3
src/proplist.c View File

@@ -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
};
}

+ 1
- 0
tools/printdata.py View File

@@ -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__':

Loading…
Cancel
Save