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