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