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