Always defining PERLIO_TERM, even if it's empty, makes for a simpler
[p5sagit/p5-mst-13.2.git] / regexp.h
index 934580e..faed0ee 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -54,7 +54,8 @@ typedef struct regexp {
        U32 lastcloseparen;     /* last paren matched */
        U32 reganch;            /* Internal use only +
                                   Tainted information used by regexec? */
-        const struct regexp_engine* engine;
+       HV *paren_names;        /* Paren names */
+       const struct regexp_engine* engine;
        regnode program[1];     /* Unwarranted chumminess with compiler. */
 } regexp;
 
@@ -96,6 +97,7 @@ typedef struct regexp_engine {
 #define ROPT_CANY_SEEN         0x00000800
 #define ROPT_SANY_SEEN         ROPT_CANY_SEEN /* src bckwrd cmpt */
 #define ROPT_GPOS_CHECK         (ROPT_GPOS_SEEN|ROPT_ANCH_GPOS)
+#define ROPT_RECURSE_SEEN       0x00001000
 
 /* 0xf800 of reganch is used by PMf_COMPILETIME */
 
@@ -205,26 +207,13 @@ typedef struct {
 
 /* structures for holding and saving the state maintained by regmatch() */
 
+#define MAX_RECURSE_EVAL_NOCHANGE_DEPTH 50
+
 typedef I32 CHECKPOINT;
 
 typedef struct regmatch_state {
-
-    /* these vars contain state that needs to be maintained
-     * across the main while loop ... */
-
     int resume_state;          /* where to jump to on return */
-    regnode *scan;             /* Current node. */
-    regnode *next;             /* Next node. */
-    bool minmod;               /* the next "{n,m}" is a "{n,m}?" */
-    bool sw;                   /* the condition value in (?(cond)a|b) */
-    int logical;
-    I32 unwind;                        /* savestack index of current unwind block */
-    char *locinput;
-
-    /* ... while the rest of these are local to an individual branch */
-
-    I32 n;                     /* no or next */
-    I32 ln;                    /* len or last */
+    char *locinput;            /* where to backtrack in string on failure */
 
     union {
 
@@ -255,31 +244,34 @@ typedef struct regmatch_state {
            CHECKPOINT  cp;     /* remember current savestack indexes */
            CHECKPOINT  lastcp;
            regnode     *B;     /* the node following us  */
+           U32        close_paren; /* which close bracket is our end */
        } eval;
 
        struct {
+           /* this first element must match u.yes */
            struct regmatch_state *prev_yes_state;
-           CHECKPOINT cp;      /* remember current savestack indexes */
-           struct regmatch_state *outercc; /* outer CURLYX state if any */
-
-           /* these contain the current curly state, and are accessed
-            * by subsequent WHILEMs */
+           struct regmatch_state *prev_curlyx; /* previous cur_curlyx */
+           CHECKPOINT  cp;     /* remember current savestack index */
+           bool        minmod;
            int         parenfloor;/* how far back to strip paren data */
-           int         cur;    /* how many instances of scan we've matched */
-           int         min;    /* the minimal number of scans to match */
-           int         max;    /* the maximal number of scans to match */
-           regnode *   scan;   /* the thing to match */
-           char *      lastloc;/* where we started matching this scan */
+           int         min;    /* the minimal number of A's to match */
+           int         max;    /* the maximal number of A's to match */
+           regnode     *A, *B; /* the nodes corresponding to /A*B/  */
+
+           /* these two are modified by WHILEM */
+           int         count;  /* how many instances of A we've matched */
+           char        *lastloc;/* where previous A matched (0-len detect) */
        } curlyx;
 
        struct {
+           /* this first element must match u.yes */
            struct regmatch_state *prev_yes_state;
-           CHECKPOINT cp;      /* remember current savestack indexes */
-           CHECKPOINT lastcp;
-           struct regmatch_state *savecc;
-           char *lastloc;      /* Detection of 0-len. */
-           I32 cache_offset;
-           I32 cache_bit;
+           struct regmatch_state *save_curlyx;
+           CHECKPOINT  cp;     /* remember current savestack indexes */
+           CHECKPOINT  lastcp;
+           char        *save_lastloc;  /* previous curlyx.lastloc */
+           I32         cache_offset;
+           I32         cache_mask;
        } whilem;
 
        struct {
@@ -315,6 +307,7 @@ typedef struct regmatch_state {
            /* this first element must match u.yes */
            struct regmatch_state *prev_yes_state;
            I32 wanted;
+           I32 logical;        /* saved copy of 'logical' var */
            regnode  *me; /* the IFMATCH/SUSPEND/UNLESSM node  */
        } ifmatch; /* and SUSPEND/UNLESSM */
     } u;