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