summaryrefslogtreecommitdiffstats
path: root/Modules/sre.h
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2000-08-01 18:20:07 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2000-08-01 18:20:07 (GMT)
commit29c4ba9ada44d62988c62c85c8046985f10a1c85 (patch)
tree89f38c5859e98069d05491dcd977e338477fd2d2 /Modules/sre.h
parent19c6afb42b12c3a50900b4157c8398e01acad91f (diff)
downloadcpython-29c4ba9ada44d62988c62c85c8046985f10a1c85.zip
cpython-29c4ba9ada44d62988c62c85c8046985f10a1c85.tar.gz
cpython-29c4ba9ada44d62988c62c85c8046985f10a1c85.tar.bz2
SRE 0.9.8: passes the entire test suite
-- reverted REPEAT operator to use "repeat context" strategy (from 0.8.X), but done right this time. -- got rid of backtracking stack; use nested SRE_MATCH calls instead (should probably put it back again in 0.9.9 ;-) -- properly reset state in scanner mode -- don't use aggressive inlining by default
Diffstat (limited to 'Modules/sre.h')
-rw-r--r--Modules/sre.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/Modules/sre.h b/Modules/sre.h
index a62b917..bf58eb5 100644
--- a/Modules/sre.h
+++ b/Modules/sre.h
@@ -1,5 +1,4 @@
/*
- *
* Secret Labs' Regular Expression Engine
*
* regular expression matching engine
@@ -44,18 +43,15 @@ typedef struct {
typedef unsigned int (*SRE_TOLOWER_HOOK)(unsigned int ch);
-typedef struct {
- /* stack elements */
- SRE_CODE* pattern;
- void* ptr;
- int mark;
- void* mark0;
- void* mark1;
-} SRE_STACK;
-
/* FIXME: <fl> shouldn't be a constant, really... */
#define SRE_MARK_SIZE 200
+typedef struct SRE_REPEAT_T {
+ int count;
+ SRE_CODE* pattern; /* points to REPEAT operator arguments */
+ struct SRE_REPEAT_T *prev; /* points to previous repeat context */
+} SRE_REPEAT;
+
typedef struct {
/* string pointers */
void* ptr; /* current position (also end of current slice) */
@@ -71,16 +67,16 @@ typedef struct {
int lastindex;
int lastmark;
void* mark[SRE_MARK_SIZE];
- /* backtracking stack */
- SRE_STACK* stack;
- int stacksize;
- int stackbase;
+ /* dynamically allocated stuff */
+ void** mark_stack;
+ int mark_stack_size;
+ int mark_stack_base;
+ SRE_REPEAT *repeat; /* current repeat context */
/* hooks */
SRE_TOLOWER_HOOK lower;
} SRE_STATE;
typedef struct {
- /* scanner (internal helper object) */
PyObject_HEAD
PyObject* pattern;
SRE_STATE state;