summaryrefslogtreecommitdiff
path: root/Objects/unicodectype.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-08-14 22:37:03 +0000
committerMartin v. Löwis <martin@v.loewis.de>2007-08-14 22:37:03 +0000
commit13c3e380d1ff807b1a18934ac9aace037c66f2ac (patch)
tree2d8781b4eb3ba3fea04f133e7e512c50dafc8e82 /Objects/unicodectype.c
parentff398c6f957fcd0e55aa57c0eaa5c1d24c5bc2f1 (diff)
downloadcpython-git-13c3e380d1ff807b1a18934ac9aace037c66f2ac.tar.gz
Add XID_Start and XID_Continue properties to unicodectype.
Diffstat (limited to 'Objects/unicodectype.c')
-rw-r--r--Objects/unicodectype.c22
1 files changed, 22 insertions, 0 deletions
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. */