Browse Source

Remove the Zc class as it is not part of the UCD; special case Cc-based whitespace instead.

master
Reece H. Dunn 12 years ago
parent
commit
bc6a5c23cc
4 changed files with 16 additions and 11 deletions
  1. 1
    1
      src/categories.cpp
  2. 14
    8
      src/ctype.cpp
  3. 0
    1
      src/include/ucd/ucd.h
  4. 1
    1
      tools/categories.py

+ 1
- 1
src/categories.cpp View File

{ {
switch (lookup_category(c)) switch (lookup_category(c))
{ {
case Cc: case Cf: case Ci: case Cn: case Co: case Cs: case Zc:
case Cc: case Cf: case Ci: case Cn: case Co: case Cs:
return C; return C;
case Ll: case Lm: case Lo: case Lt: case Lu: case Ll: case Lm: case Lo: case Lt: case Lu:
return L; return L;

+ 14
- 8
src/ctype.cpp View File



int ucd::iscntrl(codepoint_t c) int ucd::iscntrl(codepoint_t c)
{ {
switch (lookup_category(c))
{
case Cc: case Zc:
return 1;
}
return 0;
return lookup_category(c) == Cc;
} }


int ucd::isdigit(codepoint_t c) int ucd::isdigit(codepoint_t c)
switch (lookup_category(c)) switch (lookup_category(c))
{ {
case Cc: case Cf: case Ci: case Cn: case Co: case Cs: case Cc: case Cf: case Ci: case Cn: case Co: case Cs:
case Zc: case Zl: case Zp: case Zs:
case Zl: case Zp: case Zs:
return 0; return 0;
} }
return 1; return 1;
{ {
switch (lookup_category(c)) switch (lookup_category(c))
{ {
case Zc: case Zl: case Zp: case Zs:
case Zl: case Zp: case Zs:
return 1; return 1;
case Cc:
switch (c) // Some control characters are also whitespace characters:
{
case 0x09: // U+0009 : CHARACTER TABULATION
case 0x0A: // U+000A : LINE FEED
case 0x0B: // U+000B : LINE TABULATION
case 0x0C: // U+000C : FORM FEED
case 0x0D: // U+000D : CARRIAGE RETURN
case 0x85: // U+0085 : NEXT LINE
return 1;
}
} }
return 0; return 0;
} }

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

Sm, /**< @brief Math Symbol */ Sm, /**< @brief Math Symbol */
So, /**< @brief Other Symbol */ So, /**< @brief Other Symbol */


Zc, /**< @brief Whitespace character in the Cc category */
Zl, /**< @brief Line Separator */ Zl, /**< @brief Line Separator */
Zp, /**< @brief Paragraph Separator */ Zp, /**< @brief Paragraph Separator */
Zs, /**< @brief Space Separator */ Zs, /**< @brief Space Separator */

+ 1
- 1
tools/categories.py View File

{ {
switch (lookup_category(c)) switch (lookup_category(c))
{ {
case Cc: case Cf: case Ci: case Cn: case Co: case Cs: case Zc:
case Cc: case Cf: case Ci: case Cn: case Co: case Cs:
return C; return C;
case Ll: case Lm: case Lo: case Lt: case Lu: case Ll: case Lm: case Lo: case Lt: case Lu:
return L; return L;

Loading…
Cancel
Save