From 13c3e380d1ff807b1a18934ac9aace037c66f2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Tue, 14 Aug 2007 22:37:03 +0000 Subject: Add XID_Start and XID_Continue properties to unicodectype. --- Objects/unicodectype.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Objects/unicodectype.c') diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c index 73def09dbb..911c53f65c 100644 --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -19,6 +19,8 @@ #define SPACE_MASK 0x20 #define TITLE_MASK 0x40 #define UPPER_MASK 0x80 +#define XID_START_MASK 0x100 +#define XID_CONTINUE_MASK 0x200 typedef struct { const Py_UNICODE upper; @@ -98,6 +100,26 @@ int _PyUnicode_IsTitlecase(Py_UNICODE ch) return (ctype->flags & TITLE_MASK) != 0; } +/* Returns 1 for Unicode characters having the XID_Start property, 0 + otherwise. */ + +int _PyUnicode_IsXidStart(Py_UNICODE ch) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + return (ctype->flags & XID_START_MASK) != 0; +} + +/* Returns 1 for Unicode characters having the XID_Continue property, + 0 otherwise. */ + +int _PyUnicode_IsXidContinue(Py_UNICODE ch) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + return (ctype->flags & XID_CONTINUE_MASK) != 0; +} + /* Returns the integer decimal (0-9) for Unicode characters having this property, -1 otherwise. */ -- cgit v1.2.1