summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-07-02 16:58:38 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-07-02 16:58:38 (GMT)
commit19af43d78a8bd85dc39ea62cc4bc130778cfc643 (patch)
tree4fbc04abf1aad5dc594182739535acfbeb40ca63 /Modules/_sre.c
parent1fb5ce0323926406e6b3db6879152e0dcc40f5ec (diff)
downloadcpython-19af43d78a8bd85dc39ea62cc4bc130778cfc643.zip
cpython-19af43d78a8bd85dc39ea62cc4bc130778cfc643.tar.gz
cpython-19af43d78a8bd85dc39ea62cc4bc130778cfc643.tar.bz2
added martin's BIGCHARSET patch to SRE 2.1.1. martin reports 2x
speedups for certain unicode character ranges.
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r--Modules/_sre.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 3e2d907..51a747a 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -506,6 +506,19 @@ SRE_CHARSET(SRE_CODE* set, SRE_CODE ch)
set += 16;
break;
+ case SRE_OP_BIGCHARSET:
+ /* <BIGCHARSET> <blockcount> <256 blockindices> <blocks> */
+ {
+ int count, block;
+ count = *(set++);
+ block = ((unsigned char*)set)[ch >> 8];
+ set += 128;
+ if (set[block*16 + ((ch & 255)>>4)] & (1 << (ch & 15)))
+ return ok;
+ set += count*16;
+ break;
+ }
+
case SRE_OP_CATEGORY:
/* <CATEGORY> <code> */
if (sre_category(set[0], (int) ch))