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