summaryrefslogtreecommitdiff
path: root/regnodes.h
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-10-12 02:46:50 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-12 08:43:20 +0000
commit0a4db386e1881073eaec2c3026e38146ff1d6b18 (patch)
tree22dc82474a42a26c55deb83dfafc99ada28994c9 /regnodes.h
parent6980eebd7cd40424ba72081bd69d31d2b7576f4f (diff)
downloadperl-0a4db386e1881073eaec2c3026e38146ff1d6b18.tar.gz
Add Regex conditionals. Various bugfixes. More tests.
Message-ID: <9b18b3110610111546j74ca490dg21bd9fd1e7e10d42@mail.gmail.com> p4raw-id: //depot/perl@28998
Diffstat (limited to 'regnodes.h')
-rw-r--r--regnodes.h351
1 files changed, 183 insertions, 168 deletions
diff --git a/regnodes.h b/regnodes.h
index 3030e04684..f7ebda17df 100644
--- a/regnodes.h
+++ b/regnodes.h
@@ -6,8 +6,8 @@
/* Regops and State definitions */
-#define REGNODE_MAX 71
-#define REGMATCH_STATE_MAX 101
+#define REGNODE_MAX 74
+#define REGMATCH_STATE_MAX 104
#define END 0 /* 0000 End of program. */
#define SUCCEED 1 /* 0x01 Return from a subroutine, basically. */
@@ -79,41 +79,44 @@
#define NREF 67 /* 0x43 Match some already matched string */
#define NREFF 68 /* 0x44 Match already matched string, folded */
#define NREFFL 69 /* 0x45 Match already matched string, folded in loc. */
-#define OPTIMIZED 70 /* 0x46 Placeholder for dump. */
-#define PSEUDO 71 /* 0x47 Pseudo opcode for internal use. */
+#define NGROUPP 70 /* 0x46 Whether the group matched. */
+#define RECURSEP 71 /* 0x47 Whether we are in a specific recurse. */
+#define DEFINEP 72 /* 0x48 Never execute directly. */
+#define OPTIMIZED 73 /* 0x49 Placeholder for dump. */
+#define PSEUDO 74 /* 0x4a Pseudo opcode for internal use. */
/* ------------ States ------------- */
-#define TRIE_next 72 /* 0x48 Regmatch state for TRIE */
-#define TRIE_next_fail 73 /* 0x49 Regmatch state for TRIE */
-#define EVAL_AB 74 /* 0x4a Regmatch state for EVAL */
-#define EVAL_AB_fail 75 /* 0x4b Regmatch state for EVAL */
-#define CURLYX_end 76 /* 0x4c Regmatch state for CURLYX */
-#define CURLYX_end_fail 77 /* 0x4d Regmatch state for CURLYX */
-#define WHILEM_A_pre 78 /* 0x4e Regmatch state for WHILEM */
-#define WHILEM_A_pre_fail 79 /* 0x4f Regmatch state for WHILEM */
-#define WHILEM_A_min 80 /* 0x50 Regmatch state for WHILEM */
-#define WHILEM_A_min_fail 81 /* 0x51 Regmatch state for WHILEM */
-#define WHILEM_A_max 82 /* 0x52 Regmatch state for WHILEM */
-#define WHILEM_A_max_fail 83 /* 0x53 Regmatch state for WHILEM */
-#define WHILEM_B_min 84 /* 0x54 Regmatch state for WHILEM */
-#define WHILEM_B_min_fail 85 /* 0x55 Regmatch state for WHILEM */
-#define WHILEM_B_max 86 /* 0x56 Regmatch state for WHILEM */
-#define WHILEM_B_max_fail 87 /* 0x57 Regmatch state for WHILEM */
-#define BRANCH_next 88 /* 0x58 Regmatch state for BRANCH */
-#define BRANCH_next_fail 89 /* 0x59 Regmatch state for BRANCH */
-#define CURLYM_A 90 /* 0x5a Regmatch state for CURLYM */
-#define CURLYM_A_fail 91 /* 0x5b Regmatch state for CURLYM */
-#define CURLYM_B 92 /* 0x5c Regmatch state for CURLYM */
-#define CURLYM_B_fail 93 /* 0x5d Regmatch state for CURLYM */
-#define IFMATCH_A 94 /* 0x5e Regmatch state for IFMATCH */
-#define IFMATCH_A_fail 95 /* 0x5f Regmatch state for IFMATCH */
-#define CURLY_B_min_known 96 /* 0x60 Regmatch state for CURLY */
-#define CURLY_B_min_known_fail 97 /* 0x61 Regmatch state for CURLY */
-#define CURLY_B_min 98 /* 0x62 Regmatch state for CURLY */
-#define CURLY_B_min_fail 99 /* 0x63 Regmatch state for CURLY */
-#define CURLY_B_max 100 /* 0x64 Regmatch state for CURLY */
-#define CURLY_B_max_fail 101 /* 0x65 Regmatch state for CURLY */
+#define TRIE_next 75 /* 0x4b Regmatch state for TRIE */
+#define TRIE_next_fail 76 /* 0x4c Regmatch state for TRIE */
+#define EVAL_AB 77 /* 0x4d Regmatch state for EVAL */
+#define EVAL_AB_fail 78 /* 0x4e Regmatch state for EVAL */
+#define CURLYX_end 79 /* 0x4f Regmatch state for CURLYX */
+#define CURLYX_end_fail 80 /* 0x50 Regmatch state for CURLYX */
+#define WHILEM_A_pre 81 /* 0x51 Regmatch state for WHILEM */
+#define WHILEM_A_pre_fail 82 /* 0x52 Regmatch state for WHILEM */
+#define WHILEM_A_min 83 /* 0x53 Regmatch state for WHILEM */
+#define WHILEM_A_min_fail 84 /* 0x54 Regmatch state for WHILEM */
+#define WHILEM_A_max 85 /* 0x55 Regmatch state for WHILEM */
+#define WHILEM_A_max_fail 86 /* 0x56 Regmatch state for WHILEM */
+#define WHILEM_B_min 87 /* 0x57 Regmatch state for WHILEM */
+#define WHILEM_B_min_fail 88 /* 0x58 Regmatch state for WHILEM */
+#define WHILEM_B_max 89 /* 0x59 Regmatch state for WHILEM */
+#define WHILEM_B_max_fail 90 /* 0x5a Regmatch state for WHILEM */
+#define BRANCH_next 91 /* 0x5b Regmatch state for BRANCH */
+#define BRANCH_next_fail 92 /* 0x5c Regmatch state for BRANCH */
+#define CURLYM_A 93 /* 0x5d Regmatch state for CURLYM */
+#define CURLYM_A_fail 94 /* 0x5e Regmatch state for CURLYM */
+#define CURLYM_B 95 /* 0x5f Regmatch state for CURLYM */
+#define CURLYM_B_fail 96 /* 0x60 Regmatch state for CURLYM */
+#define IFMATCH_A 97 /* 0x61 Regmatch state for IFMATCH */
+#define IFMATCH_A_fail 98 /* 0x62 Regmatch state for IFMATCH */
+#define CURLY_B_min_known 99 /* 0x63 Regmatch state for CURLY */
+#define CURLY_B_min_known_fail 100 /* 0x64 Regmatch state for CURLY */
+#define CURLY_B_min 101 /* 0x65 Regmatch state for CURLY */
+#define CURLY_B_min_fail 102 /* 0x66 Regmatch state for CURLY */
+#define CURLY_B_max 103 /* 0x67 Regmatch state for CURLY */
+#define CURLY_B_max_fail 104 /* 0x68 Regmatch state for CURLY */
/* PL_regkind[] What type of regop or state is this. */
@@ -121,109 +124,112 @@
EXTCONST U8 PL_regkind[];
#else
EXTCONST U8 PL_regkind[] = {
- END, /* END */
- END, /* SUCCEED */
- BOL, /* BOL */
- BOL, /* MBOL */
- BOL, /* SBOL */
- EOL, /* EOS */
- EOL, /* EOL */
- EOL, /* MEOL */
- EOL, /* SEOL */
- BOUND, /* BOUND */
- BOUND, /* BOUNDL */
- NBOUND, /* NBOUND */
- NBOUND, /* NBOUNDL */
- GPOS, /* GPOS */
- REG_ANY, /* REG_ANY */
- REG_ANY, /* SANY */
- REG_ANY, /* CANY */
- ANYOF, /* ANYOF */
- ALNUM, /* ALNUM */
- ALNUM, /* ALNUML */
- NALNUM, /* NALNUM */
- NALNUM, /* NALNUML */
- SPACE, /* SPACE */
- SPACE, /* SPACEL */
- NSPACE, /* NSPACE */
- NSPACE, /* NSPACEL */
- DIGIT, /* DIGIT */
- DIGIT, /* DIGITL */
- NDIGIT, /* NDIGIT */
- NDIGIT, /* NDIGITL */
- CLUMP, /* CLUMP */
- BRANCH, /* BRANCH */
- BACK, /* BACK */
- EXACT, /* EXACT */
- EXACT, /* EXACTF */
- EXACT, /* EXACTFL */
- NOTHING, /* NOTHING */
- NOTHING, /* TAIL */
- STAR, /* STAR */
- PLUS, /* PLUS */
- CURLY, /* CURLY */
- CURLY, /* CURLYN */
- CURLY, /* CURLYM */
- CURLY, /* CURLYX */
- WHILEM, /* WHILEM */
- OPEN, /* OPEN */
- CLOSE, /* CLOSE */
- REF, /* REF */
- REF, /* REFF */
- REF, /* REFFL */
- BRANCHJ, /* IFMATCH */
- BRANCHJ, /* UNLESSM */
- BRANCHJ, /* SUSPEND */
- BRANCHJ, /* IFTHEN */
- GROUPP, /* GROUPP */
- LONGJMP, /* LONGJMP */
- BRANCHJ, /* BRANCHJ */
- EVAL, /* EVAL */
- MINMOD, /* MINMOD */
- LOGICAL, /* LOGICAL */
- BRANCHJ, /* RENUM */
- TRIE, /* TRIE */
- TRIE, /* TRIEC */
- TRIE, /* AHOCORASICK */
- TRIE, /* AHOCORASICKC */
- RECURSE, /* RECURSE */
- RECURSE, /* SRECURSE */
- NREF, /* NREF */
- NREF, /* NREFF */
- NREF, /* NREFFL */
- NOTHING, /* OPTIMIZED */
- PSEUDO, /* PSEUDO */
+ END, /* END */
+ END, /* SUCCEED */
+ BOL, /* BOL */
+ BOL, /* MBOL */
+ BOL, /* SBOL */
+ EOL, /* EOS */
+ EOL, /* EOL */
+ EOL, /* MEOL */
+ EOL, /* SEOL */
+ BOUND, /* BOUND */
+ BOUND, /* BOUNDL */
+ NBOUND, /* NBOUND */
+ NBOUND, /* NBOUNDL */
+ GPOS, /* GPOS */
+ REG_ANY, /* REG_ANY */
+ REG_ANY, /* SANY */
+ REG_ANY, /* CANY */
+ ANYOF, /* ANYOF */
+ ALNUM, /* ALNUM */
+ ALNUM, /* ALNUML */
+ NALNUM, /* NALNUM */
+ NALNUM, /* NALNUML */
+ SPACE, /* SPACE */
+ SPACE, /* SPACEL */
+ NSPACE, /* NSPACE */
+ NSPACE, /* NSPACEL */
+ DIGIT, /* DIGIT */
+ DIGIT, /* DIGITL */
+ NDIGIT, /* NDIGIT */
+ NDIGIT, /* NDIGITL */
+ CLUMP, /* CLUMP */
+ BRANCH, /* BRANCH */
+ BACK, /* BACK */
+ EXACT, /* EXACT */
+ EXACT, /* EXACTF */
+ EXACT, /* EXACTFL */
+ NOTHING, /* NOTHING */
+ NOTHING, /* TAIL */
+ STAR, /* STAR */
+ PLUS, /* PLUS */
+ CURLY, /* CURLY */
+ CURLY, /* CURLYN */
+ CURLY, /* CURLYM */
+ CURLY, /* CURLYX */
+ WHILEM, /* WHILEM */
+ OPEN, /* OPEN */
+ CLOSE, /* CLOSE */
+ REF, /* REF */
+ REF, /* REFF */
+ REF, /* REFFL */
+ BRANCHJ, /* IFMATCH */
+ BRANCHJ, /* UNLESSM */
+ BRANCHJ, /* SUSPEND */
+ BRANCHJ, /* IFTHEN */
+ GROUPP, /* GROUPP */
+ LONGJMP, /* LONGJMP */
+ BRANCHJ, /* BRANCHJ */
+ EVAL, /* EVAL */
+ MINMOD, /* MINMOD */
+ LOGICAL, /* LOGICAL */
+ BRANCHJ, /* RENUM */
+ TRIE, /* TRIE */
+ TRIE, /* TRIEC */
+ TRIE, /* AHOCORASICK */
+ TRIE, /* AHOCORASICKC */
+ RECURSE, /* RECURSE */
+ RECURSE, /* SRECURSE */
+ NREF, /* NREF */
+ NREF, /* NREFF */
+ NREF, /* NREFFL */
+ NGROUPP, /* NGROUPP */
+ RECURSEP, /* RECURSEP */
+ DEFINEP, /* DEFINEP */
+ NOTHING, /* OPTIMIZED */
+ PSEUDO, /* PSEUDO */
/* ------------ States ------------- */
- TRIE, /* TRIE_next */
- TRIE, /* TRIE_next_fail */
- EVAL, /* EVAL_AB */
- EVAL, /* EVAL_AB_fail */
- CURLYX, /* CURLYX_end */
- CURLYX, /* CURLYX_end_fail */
- WHILEM, /* WHILEM_A_pre */
- WHILEM, /* WHILEM_A_pre_fail */
- WHILEM, /* WHILEM_A_min */
- WHILEM, /* WHILEM_A_min_fail */
- WHILEM, /* WHILEM_A_max */
- WHILEM, /* WHILEM_A_max_fail */
- WHILEM, /* WHILEM_B_min */
- WHILEM, /* WHILEM_B_min_fail */
- WHILEM, /* WHILEM_B_max */
- WHILEM, /* WHILEM_B_max_fail */
- BRANCH, /* BRANCH_next */
- BRANCH, /* BRANCH_next_fail */
- CURLYM, /* CURLYM_A */
- CURLYM, /* CURLYM_A_fail */
- CURLYM, /* CURLYM_B */
- CURLYM, /* CURLYM_B_fail */
- IFMATCH, /* IFMATCH_A */
- IFMATCH, /* IFMATCH_A_fail */
- CURLY, /* CURLY_B_min_known */
- CURLY, /* CURLY_B_min_known_fail */
- CURLY, /* CURLY_B_min */
- CURLY, /* CURLY_B_min_fail */
- CURLY, /* CURLY_B_max */
- CURLY, /* CURLY_B_max_fail */
+ TRIE, /* TRIE_next */
+ TRIE, /* TRIE_next_fail */
+ EVAL, /* EVAL_AB */
+ EVAL, /* EVAL_AB_fail */
+ CURLYX, /* CURLYX_end */
+ CURLYX, /* CURLYX_end_fail */
+ WHILEM, /* WHILEM_A_pre */
+ WHILEM, /* WHILEM_A_pre_fail */
+ WHILEM, /* WHILEM_A_min */
+ WHILEM, /* WHILEM_A_min_fail */
+ WHILEM, /* WHILEM_A_max */
+ WHILEM, /* WHILEM_A_max_fail */
+ WHILEM, /* WHILEM_B_min */
+ WHILEM, /* WHILEM_B_min_fail */
+ WHILEM, /* WHILEM_B_max */
+ WHILEM, /* WHILEM_B_max_fail */
+ BRANCH, /* BRANCH_next */
+ BRANCH, /* BRANCH_next_fail */
+ CURLYM, /* CURLYM_A */
+ CURLYM, /* CURLYM_A_fail */
+ CURLYM, /* CURLYM_B */
+ CURLYM, /* CURLYM_B_fail */
+ IFMATCH, /* IFMATCH_A */
+ IFMATCH, /* IFMATCH_A_fail */
+ CURLY, /* CURLY_B_min_known */
+ CURLY, /* CURLY_B_min_known_fail */
+ CURLY, /* CURLY_B_min */
+ CURLY, /* CURLY_B_min_fail */
+ CURLY, /* CURLY_B_max */
+ CURLY, /* CURLY_B_max_fail */
};
#endif
@@ -301,6 +307,9 @@ static const U8 regarglen[] = {
EXTRA_SIZE(struct regnode_1), /* NREF */
EXTRA_SIZE(struct regnode_1), /* NREFF */
EXTRA_SIZE(struct regnode_1), /* NREFFL */
+ EXTRA_SIZE(struct regnode_1), /* NGROUPP */
+ EXTRA_SIZE(struct regnode_1), /* RECURSEP */
+ EXTRA_SIZE(struct regnode_1), /* DEFINEP */
0, /* OPTIMIZED */
0, /* PSEUDO */
};
@@ -378,6 +387,9 @@ static const char reg_off_by_arg[] = {
0, /* NREF */
0, /* NREFF */
0, /* NREFFL */
+ 0, /* NGROUPP */
+ 0, /* RECURSEP */
+ 0, /* DEFINEP */
0, /* OPTIMIZED */
0, /* PSEUDO */
};
@@ -456,39 +468,42 @@ const char * reg_name[] = {
"NREF", /* 0x43 */
"NREFF", /* 0x44 */
"NREFFL", /* 0x45 */
- "OPTIMIZED", /* 0x46 */
- "PSEUDO", /* 0x47 */
+ "NGROUPP", /* 0x46 */
+ "RECURSEP", /* 0x47 */
+ "DEFINEP", /* 0x48 */
+ "OPTIMIZED", /* 0x49 */
+ "PSEUDO", /* 0x4a */
/* ------------ States ------------- */
- "TRIE_next", /* 0x48 */
- "TRIE_next_fail", /* 0x49 */
- "EVAL_AB", /* 0x4a */
- "EVAL_AB_fail", /* 0x4b */
- "CURLYX_end", /* 0x4c */
- "CURLYX_end_fail", /* 0x4d */
- "WHILEM_A_pre", /* 0x4e */
- "WHILEM_A_pre_fail", /* 0x4f */
- "WHILEM_A_min", /* 0x50 */
- "WHILEM_A_min_fail", /* 0x51 */
- "WHILEM_A_max", /* 0x52 */
- "WHILEM_A_max_fail", /* 0x53 */
- "WHILEM_B_min", /* 0x54 */
- "WHILEM_B_min_fail", /* 0x55 */
- "WHILEM_B_max", /* 0x56 */
- "WHILEM_B_max_fail", /* 0x57 */
- "BRANCH_next", /* 0x58 */
- "BRANCH_next_fail", /* 0x59 */
- "CURLYM_A", /* 0x5a */
- "CURLYM_A_fail", /* 0x5b */
- "CURLYM_B", /* 0x5c */
- "CURLYM_B_fail", /* 0x5d */
- "IFMATCH_A", /* 0x5e */
- "IFMATCH_A_fail", /* 0x5f */
- "CURLY_B_min_known", /* 0x60 */
- "CURLY_B_min_known_fail", /* 0x61 */
- "CURLY_B_min", /* 0x62 */
- "CURLY_B_min_fail", /* 0x63 */
- "CURLY_B_max", /* 0x64 */
- "CURLY_B_max_fail", /* 0x65 */
+ "TRIE_next", /* 0x4b */
+ "TRIE_next_fail", /* 0x4c */
+ "EVAL_AB", /* 0x4d */
+ "EVAL_AB_fail", /* 0x4e */
+ "CURLYX_end", /* 0x4f */
+ "CURLYX_end_fail", /* 0x50 */
+ "WHILEM_A_pre", /* 0x51 */
+ "WHILEM_A_pre_fail", /* 0x52 */
+ "WHILEM_A_min", /* 0x53 */
+ "WHILEM_A_min_fail", /* 0x54 */
+ "WHILEM_A_max", /* 0x55 */
+ "WHILEM_A_max_fail", /* 0x56 */
+ "WHILEM_B_min", /* 0x57 */
+ "WHILEM_B_min_fail", /* 0x58 */
+ "WHILEM_B_max", /* 0x59 */
+ "WHILEM_B_max_fail", /* 0x5a */
+ "BRANCH_next", /* 0x5b */
+ "BRANCH_next_fail", /* 0x5c */
+ "CURLYM_A", /* 0x5d */
+ "CURLYM_A_fail", /* 0x5e */
+ "CURLYM_B", /* 0x5f */
+ "CURLYM_B_fail", /* 0x60 */
+ "IFMATCH_A", /* 0x61 */
+ "IFMATCH_A_fail", /* 0x62 */
+ "CURLY_B_min_known", /* 0x63 */
+ "CURLY_B_min_known_fail", /* 0x64 */
+ "CURLY_B_min", /* 0x65 */
+ "CURLY_B_min_fail", /* 0x66 */
+ "CURLY_B_max", /* 0x67 */
+ "CURLY_B_max_fail", /* 0x68 */
};
#endif /* DEBUGGING */
#else