typedef I32 CHECKPOINT;
-/* Current curly descriptor */
-typedef struct curcur CURCUR;
-struct curcur {
- 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 */
- int minmod; /* whether to work our way up or down */
- regnode * scan; /* the thing to match */
- regnode * next; /* what has to match after it */
- char * lastloc; /* where we started matching this scan */
- CURCUR * oldcc; /* current curly before we started this one */
-};
-
typedef struct re_cc_state
{
I32 ss;
regnode *node;
struct re_cc_state *prev;
- CURCUR *cc;
+ struct regmatch_state *cc; /* state corresponding to the current curly */
regexp *re;
} re_cc_state;
-
typedef enum {
resume_TRIE1,
resume_TRIE2,
} regmatch_resume_states;
-typedef struct {
+typedef struct regmatch_state {
/* these vars contain state that needs to be maintained
* across the main while loop ... */
bool sw; /* the condition value in (?(cond)a|b) */
int logical;
I32 unwind; /* savestack index of current unwind block */
- CURCUR *cc; /* current innermost curly struct */
+ struct regmatch_state *cc; /* current innermost curly state */
char *locinput;
- /* ... while the rest of these are local to an individual branch;
- * thus they can be safely reused in other branches. */
+ /* ... while the rest of these are local to an individual branch */
I32 n; /* no or next */
I32 ln; /* len or last */
- I32 c1, c2, paren; /* case fold search, parenth */
- CHECKPOINT cp; /* remember current savestack indexes */
- CHECKPOINT lastcp;
- CURCUR *oldcc; /* tmp copy of cc */
- char *lastloc; /* Detection of 0-len. */
- I32 cache_offset;
- I32 cache_bit;
- I32 curlym_l;
- I32 matches;
- I32 maxwanted;
- char *e;
- char *old;
- int count;
- re_cc_state *cur_call_cc;
- regexp *end_re;
- reg_trie_accepted *accept_buff;
- U32 accepted; /* how many accepting states we have seen */
+
+ union {
+ struct {
+ reg_trie_accepted *accept_buff;
+ U32 accepted; /* how many accepting states we have seen */
+ } trie;
+
+ struct {
+ CHECKPOINT cp; /* remember current savestack indexes */
+ CHECKPOINT lastcp;
+ } eval;
+
+ struct {
+ 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 */
+ 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 */
+ } curlyx;
+
+ struct {
+ CHECKPOINT cp; /* remember current savestack indexes */
+ CHECKPOINT lastcp;
+ struct regmatch_state *savecc;
+ char *lastloc; /* Detection of 0-len. */
+ I32 cache_offset;
+ I32 cache_bit;
+ } whilem;
+
+ struct {
+ I32 paren;
+ I32 c1, c2; /* case fold search */
+ CHECKPOINT lastcp;
+ I32 l;
+ I32 matches;
+ I32 maxwanted;
+ } curlym;
+
+ struct {
+ I32 paren;
+ CHECKPOINT lastcp;
+ I32 c1, c2; /* case fold search */
+ char *e;
+ char *old;
+ int count;
+ } plus; /* and CURLYN/CURLY/STAR */
+
+ struct {
+ CHECKPOINT cp; /* remember current savestack indexes */
+ CHECKPOINT lastcp;
+ struct regmatch_state *savecc;
+ re_cc_state *cur_call_cc;
+ regexp *end_re;
+ } end;
+ } u;
re_cc_state *reg_call_cc; /* saved value of PL_reg_call_cc */
} regmatch_state;