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