[Python-checkins] CVS: python/dist/src/Modules _sre.c,2.28,2.29 sre.h,2.15,2.16 sre_constants.h,2.7,2.8

Fredrik Lundh python-dev@python.org
Tue, 1 Aug 2000 11:20:10 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv13106/Modules

Modified Files:
	_sre.c sre.h sre_constants.h 
Log Message:


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


Index: _sre.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v
retrieving revision 2.28
retrieving revision 2.29
diff -C2 -r2.28 -r2.29
*** _sre.c	2000/07/23 21:46:17	2.28
--- _sre.c	2000/08/01 18:20:07	2.29
***************
*** 6,22 ****
   * partial history:
   * 99-10-24 fl  created (based on existing template matcher code)
-  * 99-11-13 fl  added categories, branching, and more (0.2)
-  * 99-11-16 fl  some tweaks to compile on non-Windows platforms
-  * 99-12-18 fl  non-literals, generic maximizing repeat (0.3)
-  * 00-02-28 fl  tons of changes (not all to the better ;-) (0.4)
   * 00-03-06 fl  first alpha, sort of (0.5)
-  * 00-03-14 fl  removed most compatibility stuff (0.6)
-  * 00-05-10 fl  towards third alpha (0.8.2)
-  * 00-05-13 fl  added experimental scanner stuff (0.8.3)
[...1355 lines suppressed...]
      int status;
  
!     state_reset(state);
! 
      state->ptr = state->start;
  
***************
*** 2122,2126 ****
      int status;
  
!     state->lastindex = -1;
      state->ptr = state->start;
  
--- 1968,1973 ----
      int status;
  
!     state_reset(state);
! 
      state->ptr = state->start;
  

Index: sre.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/sre.h,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -r2.15 -r2.16
*** sre.h	2000/07/23 21:46:17	2.15
--- sre.h	2000/08/01 18:20:07	2.16
***************
*** 1,4 ****
  /*
-  *
   * Secret Labs' Regular Expression Engine
   *
--- 1,3 ----
***************
*** 45,60 ****
  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 {
      /* string pointers */
--- 44,56 ----
  typedef unsigned int (*SRE_TOLOWER_HOOK)(unsigned int ch);
  
  /* 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 */
***************
*** 72,79 ****
      int lastmark;
      void* mark[SRE_MARK_SIZE];
!     /* backtracking stack */
!     SRE_STACK* stack;
!     int stacksize;
!     int stackbase;
      /* hooks */
      SRE_TOLOWER_HOOK lower;
--- 68,76 ----
      int lastmark;
      void* mark[SRE_MARK_SIZE];
!     /* 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;
***************
*** 81,85 ****
  
  typedef struct {
-     /* scanner (internal helper object) */
      PyObject_HEAD
      PyObject* pattern;
--- 78,81 ----

Index: sre_constants.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/sre_constants.h,v
retrieving revision 2.7
retrieving revision 2.8
diff -C2 -r2.7 -r2.8
*** sre_constants.h	2000/07/02 17:33:27	2.7
--- sre_constants.h	2000/08/01 18:20:07	2.8
***************
*** 22,43 ****
  #define SRE_OP_CATEGORY 8
  #define SRE_OP_CHARSET 9
! #define SRE_OP_GROUP 10
! #define SRE_OP_GROUP_IGNORE 11
! #define SRE_OP_INDEX 12
! #define SRE_OP_IN 13
! #define SRE_OP_IN_IGNORE 14
! #define SRE_OP_INFO 15
! #define SRE_OP_JUMP 16
! #define SRE_OP_LITERAL 17
! #define SRE_OP_LITERAL_IGNORE 18
! #define SRE_OP_MARK 19
! #define SRE_OP_MAX_REPEAT 20
! #define SRE_OP_MAX_REPEAT_ONE 21
! #define SRE_OP_MIN_REPEAT 22
! #define SRE_OP_NOT_LITERAL 23
! #define SRE_OP_NOT_LITERAL_IGNORE 24
! #define SRE_OP_NEGATE 25
! #define SRE_OP_RANGE 26
! #define SRE_OP_REPEAT 27
  #define SRE_AT_BEGINNING 0
  #define SRE_AT_BEGINNING_LINE 1
--- 22,43 ----
  #define SRE_OP_CATEGORY 8
  #define SRE_OP_CHARSET 9
! #define SRE_OP_GROUPREF 10
! #define SRE_OP_GROUPREF_IGNORE 11
! #define SRE_OP_IN 12
! #define SRE_OP_IN_IGNORE 13
! #define SRE_OP_INFO 14
! #define SRE_OP_JUMP 15
! #define SRE_OP_LITERAL 16
! #define SRE_OP_LITERAL_IGNORE 17
! #define SRE_OP_MARK 18
! #define SRE_OP_MAX_UNTIL 19
! #define SRE_OP_MIN_UNTIL 20
! #define SRE_OP_NOT_LITERAL 21
! #define SRE_OP_NOT_LITERAL_IGNORE 22
! #define SRE_OP_NEGATE 23
! #define SRE_OP_RANGE 24
! #define SRE_OP_REPEAT 25
! #define SRE_OP_REPEAT_ONE 26
! #define SRE_OP_SUBPATTERN 27
  #define SRE_AT_BEGINNING 0
  #define SRE_AT_BEGINNING_LINE 1