re/anyof.t: Extract code into a function
[perl.git] / regnodes.h
1 /* -*- buffer-read-only: t -*-
2    !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
3    This file is built by regen/regcomp.pl from regcomp.sym.
4    Any changes made here will be lost!
5  */
6
7 /* Regops and State definitions */
8
9 #define REGNODE_MAX             104
10 #define REGMATCH_STATE_MAX      144
11
12 #define END                     0       /* 0000 End of program. */
13 #define SUCCEED                 1       /* 0x01 Return from a subroutine, basically. */
14 #define SBOL                    2       /* 0x02 Match "" at beginning of line: /^/, /\A/ */
15 #define BOL                     2       /* 0x02 type alias */
16 #define MBOL                    3       /* 0x03 Same, assuming multiline: /^/m */
17 #define SEOL                    4       /* 0x04 Match "" at end of line: /$/ */
18 #define EOL                     4       /* 0x04 type alias */
19 #define MEOL                    5       /* 0x05 Same, assuming multiline: /$/m */
20 #define EOS                     6       /* 0x06 Match "" at end of string: /\z/ */
21 #define GPOS                    7       /* 0x07 Matches where last m//g left off. */
22 #define BOUND                   8       /* 0x08 Like BOUNDA for non-utf8, otherwise match "" between any Unicode \w\W or \W\w */
23 #define BOUNDL                  9       /* 0x09 Like BOUND/BOUNDU, but \w and \W are defined by current locale */
24 #define BOUNDU                  10      /* 0x0a Match "" at any boundary of a given type using Unicode rules */
25 #define BOUNDA                  11      /* 0x0b Match "" at any boundary between \w\W or \W\w, where \w is [_a-zA-Z0-9] */
26 #define NBOUND                  12      /* 0x0c Like NBOUNDA for non-utf8, otherwise match "" between any Unicode \w\w or \W\W */
27 #define NBOUNDL                 13      /* 0x0d Like NBOUND/NBOUNDU, but \w and \W are defined by current locale */
28 #define NBOUNDU                 14      /* 0x0e Match "" at any non-boundary of a given type using using Unicode rules */
29 #define NBOUNDA                 15      /* 0x0f Match "" betweeen any \w\w or \W\W, where \w is [_a-zA-Z0-9] */
30 #define REG_ANY                 16      /* 0x10 Match any one character (except newline). */
31 #define SANY                    17      /* 0x11 Match any one character. */
32 #define ANYOF                   18      /* 0x12 Match character in (or not in) this class, single char match only */
33 #define ANYOFD                  19      /* 0x13 Like ANYOF, but /d is in effect */
34 #define ANYOFL                  20      /* 0x14 Like ANYOF, but /l is in effect */
35 #define ANYOFPOSIXL             21      /* 0x15 Like ANYOFL, but matches [[:posix:]] classes */
36 #define ANYOFM                  22      /* 0x16 Like ANYOF, but matches an invariant byte as determined by the mask and arg */
37 #define NANYOFM                 23      /* 0x17 complement of ANYOFM */
38 #define POSIXD                  24      /* 0x18 Some [[:class:]] under /d; the FLAGS field gives which one */
39 #define POSIXL                  25      /* 0x19 Some [[:class:]] under /l; the FLAGS field gives which one */
40 #define POSIXU                  26      /* 0x1a Some [[:class:]] under /u; the FLAGS field gives which one */
41 #define POSIXA                  27      /* 0x1b Some [[:class:]] under /a; the FLAGS field gives which one */
42 #define NPOSIXD                 28      /* 0x1c complement of POSIXD, [[:^class:]] */
43 #define NPOSIXL                 29      /* 0x1d complement of POSIXL, [[:^class:]] */
44 #define NPOSIXU                 30      /* 0x1e complement of POSIXU, [[:^class:]] */
45 #define NPOSIXA                 31      /* 0x1f complement of POSIXA, [[:^class:]] */
46 #define ASCII                   32      /* 0x20 [[:ascii:]] */
47 #define NASCII                  33      /* 0x21 [[:^ascii:]] */
48 #define CLUMP                   34      /* 0x22 Match any extended grapheme cluster sequence */
49 #define BRANCH                  35      /* 0x23 Match this alternative, or the next... */
50 #define EXACT                   36      /* 0x24 Match this string (preceded by length). */
51 #define EXACTL                  37      /* 0x25 Like EXACT, but /l is in effect (used so locale-related warnings can be checked for). */
52 #define EXACTF                  38      /* 0x26 Match this string using /id rules (w/len); (string not UTF-8, not guaranteed to be folded). */
53 #define EXACTFL                 39      /* 0x27 Match this string using /il rules (w/len); (string not guaranteed to be folded). */
54 #define EXACTFU                 40      /* 0x28 Match this string using /iu rules (w/len); (string folded iff in UTF-8; non-UTF8 folded length <= unfolded). */
55 #define EXACTFAA                41      /* 0x29 Match this string using /iaa rules (w/len) (string folded iff in UTF-8; non-UTF8 folded length <= unfolded). */
56 #define EXACTFU_SS              42      /* 0x2a Match this string using /iu rules (w/len); (string folded iff in UTF-8; non-UTF8 folded length > unfolded). */
57 #define EXACTFLU8               43      /* 0x2b Like EXACTFU, but use /il, UTF-8, folded, and everything in it is above 255. */
58 #define EXACTFAA_NO_TRIE        44      /* 0x2c Match this string using /iaa rules (w/len) (string not UTF-8, not guaranteed to be folded, not currently trie-able). */
59 #define EXACT_ONLY8             45      /* 0x2d Like EXACT, but only UTF-8 encoded targets can match */
60 #define EXACTFU_ONLY8           46      /* 0x2e Like EXACTFU, but only UTF-8 encoded targets can match */
61 #define EXACTFS_B_U             47      /* 0x2f EXACTFU but begins with [Ss]; (string not UTF-8; compile-time only). */
62 #define EXACTFS_E_U             48      /* 0x30 EXACTFU but ends with [Ss]; (string not UTF-8; compile-time only). */
63 #define EXACTFS_BE_U            49      /* 0x31 EXACTFU but begins and ends with [Ss]; (string not UTF-8; compile-time only). */
64 #define NOTHING                 50      /* 0x32 Match empty string. */
65 #define TAIL                    51      /* 0x33 Match empty string. Can jump here from outside. */
66 #define STAR                    52      /* 0x34 Match this (simple) thing 0 or more times. */
67 #define PLUS                    53      /* 0x35 Match this (simple) thing 1 or more times. */
68 #define CURLY                   54      /* 0x36 Match this simple thing {n,m} times. */
69 #define CURLYN                  55      /* 0x37 Capture next-after-this simple thing */
70 #define CURLYM                  56      /* 0x38 Capture this medium-complex thing {n,m} times. */
71 #define CURLYX                  57      /* 0x39 Match this complex thing {n,m} times. */
72 #define WHILEM                  58      /* 0x3a Do curly processing and see if rest matches. */
73 #define OPEN                    59      /* 0x3b Mark this point in input as start of #n. */
74 #define CLOSE                   60      /* 0x3c Close corresponding OPEN of #n. */
75 #define SROPEN                  61      /* 0x3d Same as OPEN, but for script run */
76 #define SRCLOSE                 62      /* 0x3e Close preceding SROPEN */
77 #define REF                     63      /* 0x3f Match some already matched string */
78 #define REFF                    64      /* 0x40 Match already matched string, folded using native charset rules for non-utf8 */
79 #define REFFL                   65      /* 0x41 Match already matched string, folded in loc. */
80 #define REFFU                   66      /* 0x42 Match already matched string, folded using unicode rules for non-utf8 */
81 #define REFFA                   67      /* 0x43 Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII */
82 #define NREF                    68      /* 0x44 Match some already matched string */
83 #define NREFF                   69      /* 0x45 Match already matched string, folded using native charset rules for non-utf8 */
84 #define NREFFL                  70      /* 0x46 Match already matched string, folded in loc. */
85 #define NREFFU                  71      /* 0x47 Match already matched string, folded using unicode rules for non-utf8 */
86 #define NREFFA                  72      /* 0x48 Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII */
87 #define LONGJMP                 73      /* 0x49 Jump far away. */
88 #define BRANCHJ                 74      /* 0x4a BRANCH with long offset. */
89 #define IFMATCH                 75      /* 0x4b Succeeds if the following matches. */
90 #define UNLESSM                 76      /* 0x4c Fails if the following matches. */
91 #define SUSPEND                 77      /* 0x4d "Independent" sub-RE. */
92 #define IFTHEN                  78      /* 0x4e Switch, should be preceded by switcher. */
93 #define GROUPP                  79      /* 0x4f Whether the group matched. */
94 #define EVAL                    80      /* 0x50 Execute some Perl code. */
95 #define MINMOD                  81      /* 0x51 Next operator is not greedy. */
96 #define LOGICAL                 82      /* 0x52 Next opcode should set the flag only. */
97 #define RENUM                   83      /* 0x53 Group with independently numbered parens. */
98 #define TRIE                    84      /* 0x54 Match many EXACT(F[ALU]?)? at once. flags==type */
99 #define TRIEC                   85      /* 0x55 Same as TRIE, but with embedded charclass data */
100 #define AHOCORASICK             86      /* 0x56 Aho Corasick stclass. flags==type */
101 #define AHOCORASICKC            87      /* 0x57 Same as AHOCORASICK, but with embedded charclass data */
102 #define GOSUB                   88      /* 0x58 recurse to paren arg1 at (signed) ofs arg2 */
103 #define NGROUPP                 89      /* 0x59 Whether the group matched. */
104 #define INSUBP                  90      /* 0x5a Whether we are in a specific recurse. */
105 #define DEFINEP                 91      /* 0x5b Never execute directly. */
106 #define ENDLIKE                 92      /* 0x5c Used only for the type field of verbs */
107 #define OPFAIL                  93      /* 0x5d Same as (?!), but with verb arg */
108 #define ACCEPT                  94      /* 0x5e Accepts the current matched string, with verbar */
109 #define VERB                    95      /* 0x5f Used only for the type field of verbs */
110 #define PRUNE                   96      /* 0x60 Pattern fails at this startpoint if no-backtracking through this */
111 #define MARKPOINT               97      /* 0x61 Push the current location for rollback by cut. */
112 #define SKIP                    98      /* 0x62 On failure skip forward (to the mark) before retrying */
113 #define COMMIT                  99      /* 0x63 Pattern fails outright if backtracking through this */
114 #define CUTGROUP                100     /* 0x64 On failure go to the next alternation in the group */
115 #define KEEPS                   101     /* 0x65 $& begins here. */
116 #define LNBREAK                 102     /* 0x66 generic newline pattern */
117 #define OPTIMIZED               103     /* 0x67 Placeholder for dump. */
118 #define PSEUDO                  104     /* 0x68 Pseudo opcode for internal use. */
119         /* ------------ States ------------- */
120 #define TRIE_next               (REGNODE_MAX + 1)       /* state for TRIE */
121 #define TRIE_next_fail          (REGNODE_MAX + 2)       /* state for TRIE */
122 #define EVAL_B                  (REGNODE_MAX + 3)       /* state for EVAL */
123 #define EVAL_B_fail             (REGNODE_MAX + 4)       /* state for EVAL */
124 #define EVAL_postponed_AB       (REGNODE_MAX + 5)       /* state for EVAL */
125 #define EVAL_postponed_AB_fail  (REGNODE_MAX + 6)       /* state for EVAL */
126 #define CURLYX_end              (REGNODE_MAX + 7)       /* state for CURLYX */
127 #define CURLYX_end_fail         (REGNODE_MAX + 8)       /* state for CURLYX */
128 #define WHILEM_A_pre            (REGNODE_MAX + 9)       /* state for WHILEM */
129 #define WHILEM_A_pre_fail       (REGNODE_MAX + 10)      /* state for WHILEM */
130 #define WHILEM_A_min            (REGNODE_MAX + 11)      /* state for WHILEM */
131 #define WHILEM_A_min_fail       (REGNODE_MAX + 12)      /* state for WHILEM */
132 #define WHILEM_A_max            (REGNODE_MAX + 13)      /* state for WHILEM */
133 #define WHILEM_A_max_fail       (REGNODE_MAX + 14)      /* state for WHILEM */
134 #define WHILEM_B_min            (REGNODE_MAX + 15)      /* state for WHILEM */
135 #define WHILEM_B_min_fail       (REGNODE_MAX + 16)      /* state for WHILEM */
136 #define WHILEM_B_max            (REGNODE_MAX + 17)      /* state for WHILEM */
137 #define WHILEM_B_max_fail       (REGNODE_MAX + 18)      /* state for WHILEM */
138 #define BRANCH_next             (REGNODE_MAX + 19)      /* state for BRANCH */
139 #define BRANCH_next_fail        (REGNODE_MAX + 20)      /* state for BRANCH */
140 #define CURLYM_A                (REGNODE_MAX + 21)      /* state for CURLYM */
141 #define CURLYM_A_fail           (REGNODE_MAX + 22)      /* state for CURLYM */
142 #define CURLYM_B                (REGNODE_MAX + 23)      /* state for CURLYM */
143 #define CURLYM_B_fail           (REGNODE_MAX + 24)      /* state for CURLYM */
144 #define IFMATCH_A               (REGNODE_MAX + 25)      /* state for IFMATCH */
145 #define IFMATCH_A_fail          (REGNODE_MAX + 26)      /* state for IFMATCH */
146 #define CURLY_B_min             (REGNODE_MAX + 27)      /* state for CURLY */
147 #define CURLY_B_min_fail        (REGNODE_MAX + 28)      /* state for CURLY */
148 #define CURLY_B_max             (REGNODE_MAX + 29)      /* state for CURLY */
149 #define CURLY_B_max_fail        (REGNODE_MAX + 30)      /* state for CURLY */
150 #define COMMIT_next             (REGNODE_MAX + 31)      /* state for COMMIT */
151 #define COMMIT_next_fail        (REGNODE_MAX + 32)      /* state for COMMIT */
152 #define MARKPOINT_next          (REGNODE_MAX + 33)      /* state for MARKPOINT */
153 #define MARKPOINT_next_fail     (REGNODE_MAX + 34)      /* state for MARKPOINT */
154 #define SKIP_next               (REGNODE_MAX + 35)      /* state for SKIP */
155 #define SKIP_next_fail          (REGNODE_MAX + 36)      /* state for SKIP */
156 #define CUTGROUP_next           (REGNODE_MAX + 37)      /* state for CUTGROUP */
157 #define CUTGROUP_next_fail      (REGNODE_MAX + 38)      /* state for CUTGROUP */
158 #define KEEPS_next              (REGNODE_MAX + 39)      /* state for KEEPS */
159 #define KEEPS_next_fail         (REGNODE_MAX + 40)      /* state for KEEPS */
160
161 /* PL_regkind[] What type of regop or state is this. */
162
163 #ifndef DOINIT
164 EXTCONST U8 PL_regkind[];
165 #else
166 EXTCONST U8 PL_regkind[] = {
167         END,            /* END                    */
168         END,            /* SUCCEED                */
169         BOL,            /* SBOL                   */
170         BOL,            /* MBOL                   */
171         EOL,            /* SEOL                   */
172         EOL,            /* MEOL                   */
173         EOL,            /* EOS                    */
174         GPOS,           /* GPOS                   */
175         BOUND,          /* BOUND                  */
176         BOUND,          /* BOUNDL                 */
177         BOUND,          /* BOUNDU                 */
178         BOUND,          /* BOUNDA                 */
179         NBOUND,         /* NBOUND                 */
180         NBOUND,         /* NBOUNDL                */
181         NBOUND,         /* NBOUNDU                */
182         NBOUND,         /* NBOUNDA                */
183         REG_ANY,        /* REG_ANY                */
184         REG_ANY,        /* SANY                   */
185         ANYOF,          /* ANYOF                  */
186         ANYOF,          /* ANYOFD                 */
187         ANYOF,          /* ANYOFL                 */
188         ANYOF,          /* ANYOFPOSIXL            */
189         ANYOFM,         /* ANYOFM                 */
190         ANYOFM,         /* NANYOFM                */
191         POSIXD,         /* POSIXD                 */
192         POSIXD,         /* POSIXL                 */
193         POSIXD,         /* POSIXU                 */
194         POSIXD,         /* POSIXA                 */
195         NPOSIXD,        /* NPOSIXD                */
196         NPOSIXD,        /* NPOSIXL                */
197         NPOSIXD,        /* NPOSIXU                */
198         NPOSIXD,        /* NPOSIXA                */
199         ASCII,          /* ASCII                  */
200         ASCII,          /* NASCII                 */
201         CLUMP,          /* CLUMP                  */
202         BRANCH,         /* BRANCH                 */
203         EXACT,          /* EXACT                  */
204         EXACT,          /* EXACTL                 */
205         EXACT,          /* EXACTF                 */
206         EXACT,          /* EXACTFL                */
207         EXACT,          /* EXACTFU                */
208         EXACT,          /* EXACTFAA               */
209         EXACT,          /* EXACTFU_SS             */
210         EXACT,          /* EXACTFLU8              */
211         EXACT,          /* EXACTFAA_NO_TRIE       */
212         EXACT,          /* EXACT_ONLY8            */
213         EXACT,          /* EXACTFU_ONLY8          */
214         EXACT,          /* EXACTFS_B_U            */
215         EXACT,          /* EXACTFS_E_U            */
216         EXACT,          /* EXACTFS_BE_U           */
217         NOTHING,        /* NOTHING                */
218         NOTHING,        /* TAIL                   */
219         STAR,           /* STAR                   */
220         PLUS,           /* PLUS                   */
221         CURLY,          /* CURLY                  */
222         CURLY,          /* CURLYN                 */
223         CURLY,          /* CURLYM                 */
224         CURLY,          /* CURLYX                 */
225         WHILEM,         /* WHILEM                 */
226         OPEN,           /* OPEN                   */
227         CLOSE,          /* CLOSE                  */
228         SROPEN,         /* SROPEN                 */
229         SRCLOSE,        /* SRCLOSE                */
230         REF,            /* REF                    */
231         REF,            /* REFF                   */
232         REF,            /* REFFL                  */
233         REF,            /* REFFU                  */
234         REF,            /* REFFA                  */
235         REF,            /* NREF                   */
236         REF,            /* NREFF                  */
237         REF,            /* NREFFL                 */
238         REF,            /* NREFFU                 */
239         REF,            /* NREFFA                 */
240         LONGJMP,        /* LONGJMP                */
241         BRANCHJ,        /* BRANCHJ                */
242         BRANCHJ,        /* IFMATCH                */
243         BRANCHJ,        /* UNLESSM                */
244         BRANCHJ,        /* SUSPEND                */
245         BRANCHJ,        /* IFTHEN                 */
246         GROUPP,         /* GROUPP                 */
247         EVAL,           /* EVAL                   */
248         MINMOD,         /* MINMOD                 */
249         LOGICAL,        /* LOGICAL                */
250         BRANCHJ,        /* RENUM                  */
251         TRIE,           /* TRIE                   */
252         TRIE,           /* TRIEC                  */
253         TRIE,           /* AHOCORASICK            */
254         TRIE,           /* AHOCORASICKC           */
255         GOSUB,          /* GOSUB                  */
256         NGROUPP,        /* NGROUPP                */
257         INSUBP,         /* INSUBP                 */
258         DEFINEP,        /* DEFINEP                */
259         ENDLIKE,        /* ENDLIKE                */
260         ENDLIKE,        /* OPFAIL                 */
261         ENDLIKE,        /* ACCEPT                 */
262         VERB,           /* VERB                   */
263         VERB,           /* PRUNE                  */
264         VERB,           /* MARKPOINT              */
265         VERB,           /* SKIP                   */
266         VERB,           /* COMMIT                 */
267         VERB,           /* CUTGROUP               */
268         KEEPS,          /* KEEPS                  */
269         LNBREAK,        /* LNBREAK                */
270         NOTHING,        /* OPTIMIZED              */
271         PSEUDO,         /* PSEUDO                 */
272         /* ------------ States ------------- */
273         TRIE,           /* TRIE_next              */
274         TRIE,           /* TRIE_next_fail         */
275         EVAL,           /* EVAL_B                 */
276         EVAL,           /* EVAL_B_fail            */
277         EVAL,           /* EVAL_postponed_AB      */
278         EVAL,           /* EVAL_postponed_AB_fail */
279         CURLYX,         /* CURLYX_end             */
280         CURLYX,         /* CURLYX_end_fail        */
281         WHILEM,         /* WHILEM_A_pre           */
282         WHILEM,         /* WHILEM_A_pre_fail      */
283         WHILEM,         /* WHILEM_A_min           */
284         WHILEM,         /* WHILEM_A_min_fail      */
285         WHILEM,         /* WHILEM_A_max           */
286         WHILEM,         /* WHILEM_A_max_fail      */
287         WHILEM,         /* WHILEM_B_min           */
288         WHILEM,         /* WHILEM_B_min_fail      */
289         WHILEM,         /* WHILEM_B_max           */
290         WHILEM,         /* WHILEM_B_max_fail      */
291         BRANCH,         /* BRANCH_next            */
292         BRANCH,         /* BRANCH_next_fail       */
293         CURLYM,         /* CURLYM_A               */
294         CURLYM,         /* CURLYM_A_fail          */
295         CURLYM,         /* CURLYM_B               */
296         CURLYM,         /* CURLYM_B_fail          */
297         IFMATCH,        /* IFMATCH_A              */
298         IFMATCH,        /* IFMATCH_A_fail         */
299         CURLY,          /* CURLY_B_min            */
300         CURLY,          /* CURLY_B_min_fail       */
301         CURLY,          /* CURLY_B_max            */
302         CURLY,          /* CURLY_B_max_fail       */
303         COMMIT,         /* COMMIT_next            */
304         COMMIT,         /* COMMIT_next_fail       */
305         MARKPOINT,      /* MARKPOINT_next         */
306         MARKPOINT,      /* MARKPOINT_next_fail    */
307         SKIP,           /* SKIP_next              */
308         SKIP,           /* SKIP_next_fail         */
309         CUTGROUP,       /* CUTGROUP_next          */
310         CUTGROUP,       /* CUTGROUP_next_fail     */
311         KEEPS,          /* KEEPS_next             */
312         KEEPS,          /* KEEPS_next_fail        */
313 };
314 #endif
315
316 #ifdef REG_COMP_C
317
318 /* regarglen[] - How large is the argument part of the node (in regnodes) */
319
320 static const U8 regarglen[] = {
321         0,                                      /* END          */
322         0,                                      /* SUCCEED      */
323         0,                                      /* SBOL         */
324         0,                                      /* MBOL         */
325         0,                                      /* SEOL         */
326         0,                                      /* MEOL         */
327         0,                                      /* EOS          */
328         0,                                      /* GPOS         */
329         0,                                      /* BOUND        */
330         0,                                      /* BOUNDL       */
331         0,                                      /* BOUNDU       */
332         0,                                      /* BOUNDA       */
333         0,                                      /* NBOUND       */
334         0,                                      /* NBOUNDL      */
335         0,                                      /* NBOUNDU      */
336         0,                                      /* NBOUNDA      */
337         0,                                      /* REG_ANY      */
338         0,                                      /* SANY         */
339         EXTRA_SIZE(struct regnode_charclass),   /* ANYOF        */
340         EXTRA_SIZE(struct regnode_charclass),   /* ANYOFD       */
341         EXTRA_SIZE(struct regnode_charclass),   /* ANYOFL       */
342         EXTRA_SIZE(struct regnode_charclass_posixl),    /* ANYOFPOSIXL  */
343         EXTRA_SIZE(struct regnode_1),           /* ANYOFM       */
344         EXTRA_SIZE(struct regnode_1),           /* NANYOFM      */
345         0,                                      /* POSIXD       */
346         0,                                      /* POSIXL       */
347         0,                                      /* POSIXU       */
348         0,                                      /* POSIXA       */
349         0,                                      /* NPOSIXD      */
350         0,                                      /* NPOSIXL      */
351         0,                                      /* NPOSIXU      */
352         0,                                      /* NPOSIXA      */
353         0,                                      /* ASCII        */
354         0,                                      /* NASCII       */
355         0,                                      /* CLUMP        */
356         0,                                      /* BRANCH       */
357         0,                                      /* EXACT        */
358         0,                                      /* EXACTL       */
359         0,                                      /* EXACTF       */
360         0,                                      /* EXACTFL      */
361         0,                                      /* EXACTFU      */
362         0,                                      /* EXACTFAA     */
363         0,                                      /* EXACTFU_SS   */
364         0,                                      /* EXACTFLU8    */
365         0,                                      /* EXACTFAA_NO_TRIE */
366         0,                                      /* EXACT_ONLY8  */
367         0,                                      /* EXACTFU_ONLY8 */
368         0,                                      /* EXACTFS_B_U  */
369         0,                                      /* EXACTFS_E_U  */
370         0,                                      /* EXACTFS_BE_U */
371         0,                                      /* NOTHING      */
372         0,                                      /* TAIL         */
373         0,                                      /* STAR         */
374         0,                                      /* PLUS         */
375         EXTRA_SIZE(struct regnode_2),           /* CURLY        */
376         EXTRA_SIZE(struct regnode_2),           /* CURLYN       */
377         EXTRA_SIZE(struct regnode_2),           /* CURLYM       */
378         EXTRA_SIZE(struct regnode_2),           /* CURLYX       */
379         0,                                      /* WHILEM       */
380         EXTRA_SIZE(struct regnode_1),           /* OPEN         */
381         EXTRA_SIZE(struct regnode_1),           /* CLOSE        */
382         0,                                      /* SROPEN       */
383         0,                                      /* SRCLOSE      */
384         EXTRA_SIZE(struct regnode_1),           /* REF          */
385         EXTRA_SIZE(struct regnode_1),           /* REFF         */
386         EXTRA_SIZE(struct regnode_1),           /* REFFL        */
387         EXTRA_SIZE(struct regnode_1),           /* REFFU        */
388         EXTRA_SIZE(struct regnode_1),           /* REFFA        */
389         EXTRA_SIZE(struct regnode_1),           /* NREF         */
390         EXTRA_SIZE(struct regnode_1),           /* NREFF        */
391         EXTRA_SIZE(struct regnode_1),           /* NREFFL       */
392         EXTRA_SIZE(struct regnode_1),           /* NREFFU       */
393         EXTRA_SIZE(struct regnode_1),           /* NREFFA       */
394         EXTRA_SIZE(struct regnode_1),           /* LONGJMP      */
395         EXTRA_SIZE(struct regnode_1),           /* BRANCHJ      */
396         EXTRA_SIZE(struct regnode_1),           /* IFMATCH      */
397         EXTRA_SIZE(struct regnode_1),           /* UNLESSM      */
398         EXTRA_SIZE(struct regnode_1),           /* SUSPEND      */
399         EXTRA_SIZE(struct regnode_1),           /* IFTHEN       */
400         EXTRA_SIZE(struct regnode_1),           /* GROUPP       */
401         EXTRA_SIZE(struct regnode_2L),          /* EVAL         */
402         0,                                      /* MINMOD       */
403         0,                                      /* LOGICAL      */
404         EXTRA_SIZE(struct regnode_1),           /* RENUM        */
405         EXTRA_SIZE(struct regnode_1),           /* TRIE         */
406         EXTRA_SIZE(struct regnode_charclass),   /* TRIEC        */
407         EXTRA_SIZE(struct regnode_1),           /* AHOCORASICK  */
408         EXTRA_SIZE(struct regnode_charclass),   /* AHOCORASICKC */
409         EXTRA_SIZE(struct regnode_2L),          /* GOSUB        */
410         EXTRA_SIZE(struct regnode_1),           /* NGROUPP      */
411         EXTRA_SIZE(struct regnode_1),           /* INSUBP       */
412         EXTRA_SIZE(struct regnode_1),           /* DEFINEP      */
413         0,                                      /* ENDLIKE      */
414         EXTRA_SIZE(struct regnode_1),           /* OPFAIL       */
415         EXTRA_SIZE(struct regnode_2L),          /* ACCEPT       */
416         EXTRA_SIZE(struct regnode_1),           /* VERB         */
417         EXTRA_SIZE(struct regnode_1),           /* PRUNE        */
418         EXTRA_SIZE(struct regnode_1),           /* MARKPOINT    */
419         EXTRA_SIZE(struct regnode_1),           /* SKIP         */
420         EXTRA_SIZE(struct regnode_1),           /* COMMIT       */
421         EXTRA_SIZE(struct regnode_1),           /* CUTGROUP     */
422         0,                                      /* KEEPS        */
423         0,                                      /* LNBREAK      */
424         0,                                      /* OPTIMIZED    */
425         0,                                      /* PSEUDO       */
426 };
427
428 /* reg_off_by_arg[] - Which argument holds the offset to the next node */
429
430 static const char reg_off_by_arg[] = {
431         0,      /* END          */
432         0,      /* SUCCEED      */
433         0,      /* SBOL         */
434         0,      /* MBOL         */
435         0,      /* SEOL         */
436         0,      /* MEOL         */
437         0,      /* EOS          */
438         0,      /* GPOS         */
439         0,      /* BOUND        */
440         0,      /* BOUNDL       */
441         0,      /* BOUNDU       */
442         0,      /* BOUNDA       */
443         0,      /* NBOUND       */
444         0,      /* NBOUNDL      */
445         0,      /* NBOUNDU      */
446         0,      /* NBOUNDA      */
447         0,      /* REG_ANY      */
448         0,      /* SANY         */
449         0,      /* ANYOF        */
450         0,      /* ANYOFD       */
451         0,      /* ANYOFL       */
452         0,      /* ANYOFPOSIXL  */
453         0,      /* ANYOFM       */
454         0,      /* NANYOFM      */
455         0,      /* POSIXD       */
456         0,      /* POSIXL       */
457         0,      /* POSIXU       */
458         0,      /* POSIXA       */
459         0,      /* NPOSIXD      */
460         0,      /* NPOSIXL      */
461         0,      /* NPOSIXU      */
462         0,      /* NPOSIXA      */
463         0,      /* ASCII        */
464         0,      /* NASCII       */
465         0,      /* CLUMP        */
466         0,      /* BRANCH       */
467         0,      /* EXACT        */
468         0,      /* EXACTL       */
469         0,      /* EXACTF       */
470         0,      /* EXACTFL      */
471         0,      /* EXACTFU      */
472         0,      /* EXACTFAA     */
473         0,      /* EXACTFU_SS   */
474         0,      /* EXACTFLU8    */
475         0,      /* EXACTFAA_NO_TRIE */
476         0,      /* EXACT_ONLY8  */
477         0,      /* EXACTFU_ONLY8 */
478         0,      /* EXACTFS_B_U  */
479         0,      /* EXACTFS_E_U  */
480         0,      /* EXACTFS_BE_U */
481         0,      /* NOTHING      */
482         0,      /* TAIL         */
483         0,      /* STAR         */
484         0,      /* PLUS         */
485         0,      /* CURLY        */
486         0,      /* CURLYN       */
487         0,      /* CURLYM       */
488         0,      /* CURLYX       */
489         0,      /* WHILEM       */
490         0,      /* OPEN         */
491         0,      /* CLOSE        */
492         0,      /* SROPEN       */
493         0,      /* SRCLOSE      */
494         0,      /* REF          */
495         0,      /* REFF         */
496         0,      /* REFFL        */
497         0,      /* REFFU        */
498         0,      /* REFFA        */
499         0,      /* NREF         */
500         0,      /* NREFF        */
501         0,      /* NREFFL       */
502         0,      /* NREFFU       */
503         0,      /* NREFFA       */
504         1,      /* LONGJMP      */
505         1,      /* BRANCHJ      */
506         1,      /* IFMATCH      */
507         1,      /* UNLESSM      */
508         1,      /* SUSPEND      */
509         1,      /* IFTHEN       */
510         0,      /* GROUPP       */
511         0,      /* EVAL         */
512         0,      /* MINMOD       */
513         0,      /* LOGICAL      */
514         1,      /* RENUM        */
515         0,      /* TRIE         */
516         0,      /* TRIEC        */
517         0,      /* AHOCORASICK  */
518         0,      /* AHOCORASICKC */
519         0,      /* GOSUB        */
520         0,      /* NGROUPP      */
521         0,      /* INSUBP       */
522         0,      /* DEFINEP      */
523         0,      /* ENDLIKE      */
524         0,      /* OPFAIL       */
525         0,      /* ACCEPT       */
526         0,      /* VERB         */
527         0,      /* PRUNE        */
528         0,      /* MARKPOINT    */
529         0,      /* SKIP         */
530         0,      /* COMMIT       */
531         0,      /* CUTGROUP     */
532         0,      /* KEEPS        */
533         0,      /* LNBREAK      */
534         0,      /* OPTIMIZED    */
535         0,      /* PSEUDO       */
536 };
537
538 #endif /* REG_COMP_C */
539
540
541 /* reg_name[] - Opcode/state names in string form, for debugging */
542
543 #ifndef DOINIT
544 EXTCONST char * PL_reg_name[];
545 #else
546 EXTCONST char * const PL_reg_name[] = {
547         "END",                          /* 0000 */
548         "SUCCEED",                      /* 0x01 */
549         "SBOL",                         /* 0x02 */
550         "MBOL",                         /* 0x03 */
551         "SEOL",                         /* 0x04 */
552         "MEOL",                         /* 0x05 */
553         "EOS",                          /* 0x06 */
554         "GPOS",                         /* 0x07 */
555         "BOUND",                        /* 0x08 */
556         "BOUNDL",                       /* 0x09 */
557         "BOUNDU",                       /* 0x0a */
558         "BOUNDA",                       /* 0x0b */
559         "NBOUND",                       /* 0x0c */
560         "NBOUNDL",                      /* 0x0d */
561         "NBOUNDU",                      /* 0x0e */
562         "NBOUNDA",                      /* 0x0f */
563         "REG_ANY",                      /* 0x10 */
564         "SANY",                         /* 0x11 */
565         "ANYOF",                        /* 0x12 */
566         "ANYOFD",                       /* 0x13 */
567         "ANYOFL",                       /* 0x14 */
568         "ANYOFPOSIXL",                  /* 0x15 */
569         "ANYOFM",                       /* 0x16 */
570         "NANYOFM",                      /* 0x17 */
571         "POSIXD",                       /* 0x18 */
572         "POSIXL",                       /* 0x19 */
573         "POSIXU",                       /* 0x1a */
574         "POSIXA",                       /* 0x1b */
575         "NPOSIXD",                      /* 0x1c */
576         "NPOSIXL",                      /* 0x1d */
577         "NPOSIXU",                      /* 0x1e */
578         "NPOSIXA",                      /* 0x1f */
579         "ASCII",                        /* 0x20 */
580         "NASCII",                       /* 0x21 */
581         "CLUMP",                        /* 0x22 */
582         "BRANCH",                       /* 0x23 */
583         "EXACT",                        /* 0x24 */
584         "EXACTL",                       /* 0x25 */
585         "EXACTF",                       /* 0x26 */
586         "EXACTFL",                      /* 0x27 */
587         "EXACTFU",                      /* 0x28 */
588         "EXACTFAA",                     /* 0x29 */
589         "EXACTFU_SS",                   /* 0x2a */
590         "EXACTFLU8",                    /* 0x2b */
591         "EXACTFAA_NO_TRIE",             /* 0x2c */
592         "EXACT_ONLY8",                  /* 0x2d */
593         "EXACTFU_ONLY8",                /* 0x2e */
594         "EXACTFS_B_U",                  /* 0x2f */
595         "EXACTFS_E_U",                  /* 0x30 */
596         "EXACTFS_BE_U",                 /* 0x31 */
597         "NOTHING",                      /* 0x32 */
598         "TAIL",                         /* 0x33 */
599         "STAR",                         /* 0x34 */
600         "PLUS",                         /* 0x35 */
601         "CURLY",                        /* 0x36 */
602         "CURLYN",                       /* 0x37 */
603         "CURLYM",                       /* 0x38 */
604         "CURLYX",                       /* 0x39 */
605         "WHILEM",                       /* 0x3a */
606         "OPEN",                         /* 0x3b */
607         "CLOSE",                        /* 0x3c */
608         "SROPEN",                       /* 0x3d */
609         "SRCLOSE",                      /* 0x3e */
610         "REF",                          /* 0x3f */
611         "REFF",                         /* 0x40 */
612         "REFFL",                        /* 0x41 */
613         "REFFU",                        /* 0x42 */
614         "REFFA",                        /* 0x43 */
615         "NREF",                         /* 0x44 */
616         "NREFF",                        /* 0x45 */
617         "NREFFL",                       /* 0x46 */
618         "NREFFU",                       /* 0x47 */
619         "NREFFA",                       /* 0x48 */
620         "LONGJMP",                      /* 0x49 */
621         "BRANCHJ",                      /* 0x4a */
622         "IFMATCH",                      /* 0x4b */
623         "UNLESSM",                      /* 0x4c */
624         "SUSPEND",                      /* 0x4d */
625         "IFTHEN",                       /* 0x4e */
626         "GROUPP",                       /* 0x4f */
627         "EVAL",                         /* 0x50 */
628         "MINMOD",                       /* 0x51 */
629         "LOGICAL",                      /* 0x52 */
630         "RENUM",                        /* 0x53 */
631         "TRIE",                         /* 0x54 */
632         "TRIEC",                        /* 0x55 */
633         "AHOCORASICK",                  /* 0x56 */
634         "AHOCORASICKC",                 /* 0x57 */
635         "GOSUB",                        /* 0x58 */
636         "NGROUPP",                      /* 0x59 */
637         "INSUBP",                       /* 0x5a */
638         "DEFINEP",                      /* 0x5b */
639         "ENDLIKE",                      /* 0x5c */
640         "OPFAIL",                       /* 0x5d */
641         "ACCEPT",                       /* 0x5e */
642         "VERB",                         /* 0x5f */
643         "PRUNE",                        /* 0x60 */
644         "MARKPOINT",                    /* 0x61 */
645         "SKIP",                         /* 0x62 */
646         "COMMIT",                       /* 0x63 */
647         "CUTGROUP",                     /* 0x64 */
648         "KEEPS",                        /* 0x65 */
649         "LNBREAK",                      /* 0x66 */
650         "OPTIMIZED",                    /* 0x67 */
651         "PSEUDO",                       /* 0x68 */
652         /* ------------ States ------------- */
653         "TRIE_next",                    /* REGNODE_MAX +0x01 */
654         "TRIE_next_fail",               /* REGNODE_MAX +0x02 */
655         "EVAL_B",                       /* REGNODE_MAX +0x03 */
656         "EVAL_B_fail",                  /* REGNODE_MAX +0x04 */
657         "EVAL_postponed_AB",            /* REGNODE_MAX +0x05 */
658         "EVAL_postponed_AB_fail",       /* REGNODE_MAX +0x06 */
659         "CURLYX_end",                   /* REGNODE_MAX +0x07 */
660         "CURLYX_end_fail",              /* REGNODE_MAX +0x08 */
661         "WHILEM_A_pre",                 /* REGNODE_MAX +0x09 */
662         "WHILEM_A_pre_fail",            /* REGNODE_MAX +0x0a */
663         "WHILEM_A_min",                 /* REGNODE_MAX +0x0b */
664         "WHILEM_A_min_fail",            /* REGNODE_MAX +0x0c */
665         "WHILEM_A_max",                 /* REGNODE_MAX +0x0d */
666         "WHILEM_A_max_fail",            /* REGNODE_MAX +0x0e */
667         "WHILEM_B_min",                 /* REGNODE_MAX +0x0f */
668         "WHILEM_B_min_fail",            /* REGNODE_MAX +0x10 */
669         "WHILEM_B_max",                 /* REGNODE_MAX +0x11 */
670         "WHILEM_B_max_fail",            /* REGNODE_MAX +0x12 */
671         "BRANCH_next",                  /* REGNODE_MAX +0x13 */
672         "BRANCH_next_fail",             /* REGNODE_MAX +0x14 */
673         "CURLYM_A",                     /* REGNODE_MAX +0x15 */
674         "CURLYM_A_fail",                /* REGNODE_MAX +0x16 */
675         "CURLYM_B",                     /* REGNODE_MAX +0x17 */
676         "CURLYM_B_fail",                /* REGNODE_MAX +0x18 */
677         "IFMATCH_A",                    /* REGNODE_MAX +0x19 */
678         "IFMATCH_A_fail",               /* REGNODE_MAX +0x1a */
679         "CURLY_B_min",                  /* REGNODE_MAX +0x1b */
680         "CURLY_B_min_fail",             /* REGNODE_MAX +0x1c */
681         "CURLY_B_max",                  /* REGNODE_MAX +0x1d */
682         "CURLY_B_max_fail",             /* REGNODE_MAX +0x1e */
683         "COMMIT_next",                  /* REGNODE_MAX +0x1f */
684         "COMMIT_next_fail",             /* REGNODE_MAX +0x20 */
685         "MARKPOINT_next",               /* REGNODE_MAX +0x21 */
686         "MARKPOINT_next_fail",          /* REGNODE_MAX +0x22 */
687         "SKIP_next",                    /* REGNODE_MAX +0x23 */
688         "SKIP_next_fail",               /* REGNODE_MAX +0x24 */
689         "CUTGROUP_next",                /* REGNODE_MAX +0x25 */
690         "CUTGROUP_next_fail",           /* REGNODE_MAX +0x26 */
691         "KEEPS_next",                   /* REGNODE_MAX +0x27 */
692         "KEEPS_next_fail",              /* REGNODE_MAX +0x28 */
693 };
694 #endif /* DOINIT */
695
696 /* PL_reg_extflags_name[] - Opcode/state names in string form, for debugging */
697
698 #ifndef DOINIT
699 EXTCONST char * PL_reg_extflags_name[];
700 #else
701 EXTCONST char * const PL_reg_extflags_name[] = {
702         /* Bits in extflags defined: 11111111111111110000111111111111 */
703         "MULTILINE",        /* 0x00000001 */
704         "SINGLELINE",       /* 0x00000002 */
705         "FOLD",             /* 0x00000004 */
706         "EXTENDED",         /* 0x00000008 */
707         "EXTENDED_MORE",    /* 0x00000010 */
708         "NOCAPTURE",        /* 0x00000020 */
709         "KEEPCOPY",         /* 0x00000040 */
710         "CHARSET0",         /* 0x00000080 : "CHARSET" - 0x00000380 */
711         "CHARSET1",         /* 0x00000100 : "CHARSET" - 0x00000380 */
712         "CHARSET2",         /* 0x00000200 : "CHARSET" - 0x00000380 */
713         "STRICT",           /* 0x00000400 */
714         "SPLIT",            /* 0x00000800 */
715         "UNUSED_BIT_12",    /* 0x00001000 */
716         "UNUSED_BIT_13",    /* 0x00002000 */
717         "UNUSED_BIT_14",    /* 0x00004000 */
718         "UNUSED_BIT_15",    /* 0x00008000 */
719         "NO_INPLACE_SUBST", /* 0x00010000 */
720         "EVAL_SEEN",        /* 0x00020000 */
721         "UNBOUNDED_QUANTIFIER_SEEN",/* 0x00040000 */
722         "CHECK_ALL",        /* 0x00080000 */
723         "MATCH_UTF8",       /* 0x00100000 */
724         "USE_INTUIT_NOML",  /* 0x00200000 */
725         "USE_INTUIT_ML",    /* 0x00400000 */
726         "INTUIT_TAIL",      /* 0x00800000 */
727         "IS_ANCHORED",      /* 0x01000000 */
728         "COPY_DONE",        /* 0x02000000 */
729         "TAINTED_SEEN",     /* 0x04000000 */
730         "TAINTED",          /* 0x08000000 */
731         "START_ONLY",       /* 0x10000000 */
732         "SKIPWHITE",        /* 0x20000000 */
733         "WHITE",            /* 0x40000000 */
734         "NULL",             /* 0x80000000 */
735 };
736 #endif /* DOINIT */
737
738 #ifdef DEBUGGING
739 #  define REG_EXTFLAGS_NAME_SIZE 32
740 #endif
741
742 /* PL_reg_intflags_name[] - Opcode/state names in string form, for debugging */
743
744 #ifndef DOINIT
745 EXTCONST char * PL_reg_intflags_name[];
746 #else
747 EXTCONST char * const PL_reg_intflags_name[] = {
748         "SKIP",                       /* 0x00000001 - PREGf_SKIP */
749         "IMPLICIT",                   /* 0x00000002 - PREGf_IMPLICIT -  Converted .* to ^.*  */
750         "NAUGHTY",                    /* 0x00000004 - PREGf_NAUGHTY -  how exponential is this pattern?  */
751         "VERBARG_SEEN",               /* 0x00000008 - PREGf_VERBARG_SEEN */
752         "CUTGROUP_SEEN",              /* 0x00000010 - PREGf_CUTGROUP_SEEN */
753         "USE_RE_EVAL",                /* 0x00000020 - PREGf_USE_RE_EVAL -  compiled with "use re 'eval'"  */
754         "NOSCAN",                     /* 0x00000040 - PREGf_NOSCAN */
755         "GPOS_SEEN",                  /* 0x00000100 - PREGf_GPOS_SEEN */
756         "GPOS_FLOAT",                 /* 0x00000200 - PREGf_GPOS_FLOAT */
757         "ANCH_MBOL",                  /* 0x00000400 - PREGf_ANCH_MBOL */
758         "ANCH_SBOL",                  /* 0x00000800 - PREGf_ANCH_SBOL */
759         "ANCH_GPOS",                  /* 0x00001000 - PREGf_ANCH_GPOS */
760         "RECURSE_SEEN",               /* 0x00002000 - PREGf_RECURSE_SEEN */
761 };
762 #endif /* DOINIT */
763
764 #ifdef DEBUGGING
765 #  define REG_INTFLAGS_NAME_SIZE 13
766 #endif
767
768 /* The following have no fixed length. U8 so we can do strchr() on it. */
769 #define REGNODE_VARIES(node) (PL_varies_bitmask[(node) >> 3] & (1 << ((node) & 7)))
770
771 #ifndef DOINIT
772 EXTCONST U8 PL_varies[] __attribute__deprecated__;
773 #else
774 EXTCONST U8 PL_varies[] __attribute__deprecated__ = {
775     CLUMP, BRANCH, STAR, PLUS, CURLY, CURLYN, CURLYM, CURLYX, WHILEM, REF,
776     REFF, REFFL, REFFU, REFFA, NREF, NREFF, NREFFL, NREFFU, NREFFA,
777     BRANCHJ, SUSPEND, IFTHEN,
778     0
779 };
780 #endif /* DOINIT */
781
782 #ifndef DOINIT
783 EXTCONST U8 PL_varies_bitmask[];
784 #else
785 EXTCONST U8 PL_varies_bitmask[] = {
786     0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0xF0, 0x87, 0xFF, 0x65, 0x00, 0x00, 0x00, 0x00
787 };
788 #endif /* DOINIT */
789
790 /* The following always have a length of 1. U8 we can do strchr() on it. */
791 /* (Note that length 1 means "one character" under UTF8, not "one octet".) */
792 #define REGNODE_SIMPLE(node) (PL_simple_bitmask[(node) >> 3] & (1 << ((node) & 7)))
793
794 #ifndef DOINIT
795 EXTCONST U8 PL_simple[] __attribute__deprecated__;
796 #else
797 EXTCONST U8 PL_simple[] __attribute__deprecated__ = {
798     REG_ANY, SANY, ANYOF, ANYOFD, ANYOFL, ANYOFPOSIXL, ANYOFM, NANYOFM,
799     POSIXD, POSIXL, POSIXU, POSIXA, NPOSIXD, NPOSIXL, NPOSIXU, NPOSIXA,
800     ASCII, NASCII,
801     0
802 };
803 #endif /* DOINIT */
804
805 #ifndef DOINIT
806 EXTCONST U8 PL_simple_bitmask[];
807 #else
808 EXTCONST U8 PL_simple_bitmask[] = {
809     0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
810 };
811 #endif /* DOINIT */
812
813 /* ex: set ro: */