summaryrefslogtreecommitdiff
path: root/regexp.h
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-06-16 23:25:51 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-06-16 23:25:51 +0000
commit40a824489101168f94fce98aa2824baf40bad402 (patch)
treec5d3ebdd2a3b693c44ef8712a9965a4fa38d0330 /regexp.h
parent0aec9d3674a357d2c5a029483ff5cdc65c715a57 (diff)
downloadperl-40a824489101168f94fce98aa2824baf40bad402.tar.gz
start turning regmatch() main loop into a FSM
also make BRANCH use the state stack rather than its own unwind struct p4raw-id: //depot/perl@28398
Diffstat (limited to 'regexp.h')
-rw-r--r--regexp.h42
1 files changed, 14 insertions, 28 deletions
diff --git a/regexp.h b/regexp.h
index 4ea7c694e9..c48574a43f 100644
--- a/regexp.h
+++ b/regexp.h
@@ -180,34 +180,12 @@ typedef struct {
typedef I32 CHECKPOINT;
-typedef enum {
- resume_TRIE1,
- resume_TRIE2,
- resume_EVAL,
- resume_CURLYX,
- resume_WHILEM1,
- resume_WHILEM2,
- resume_WHILEM3,
- resume_WHILEM4,
- resume_WHILEM5,
- resume_WHILEM6,
- resume_CURLYM1,
- resume_CURLYM2,
- resume_CURLYM3,
- resume_IFMATCH,
- resume_PLUS1,
- resume_PLUS2,
- resume_PLUS3,
- resume_PLUS4
-} regmatch_resume_states;
-
-
typedef struct regmatch_state {
/* these vars contain state that needs to be maintained
* across the main while loop ... */
- regmatch_resume_states resume_state; /* where to jump to on return */
+ 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}?" */
@@ -243,6 +221,7 @@ typedef struct regmatch_state {
int toggleutf;
CHECKPOINT cp; /* remember current savestack indexes */
CHECKPOINT lastcp;
+ regnode *B; /* the node following us */
} eval;
struct {
@@ -269,15 +248,21 @@ typedef struct regmatch_state {
} whilem;
struct {
+ I32 lastparen;
+ regnode *next_branch; /* next branch node */
+ CHECKPOINT cp;
+ } branch;
+
+ struct {
/* this first element must match u.yes */
struct regmatch_state *prev_yes_state;
- I32 paren;
I32 c1, c2; /* case fold search */
- CHECKPOINT lastcp;
- I32 l;
- I32 matches;
- I32 maxwanted;
+ CHECKPOINT cp;
+ I32 alen; /* length of first-matched A string */
+ I32 count;
bool minmod;
+ regnode *A, *B; /* the nodes corresponding to /A*B/ */
+ regnode *me; /* the curlym node */
} curlym;
struct {
@@ -293,6 +278,7 @@ typedef struct regmatch_state {
/* this first element must match u.yes */
struct regmatch_state *prev_yes_state;
I32 wanted;
+ regnode *me; /* the IFMATCH/SUSPEND/UNLESSM node */
} ifmatch; /* and SUSPEND/UNLESSM */
} u;
} regmatch_state;