This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In pp_binmode, call mode_from_discipline() once and remember the result.
[perl5.git] / regnodes.h
1 /* -*- buffer-read-only: t -*-
2    !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
3    This file is built by regcomp.pl from regcomp.sym.
4    Any changes made here will be lost!
5 */
6
7 #define REGNODE_MAX             66
8 #define REGMATCH_STATE_MAX      91
9
10 #define END                     0       /* 0000 End of program. */
11 #define SUCCEED                 1       /* 0x01 Return from a subroutine, basically. */
12 #define BOL                     2       /* 0x02 Match "" at beginning of line. */
13 #define MBOL                    3       /* 0x03 Same, assuming multiline. */
14 #define SBOL                    4       /* 0x04 Same, assuming singleline. */
15 #define EOS                     5       /* 0x05 Match "" at end of string. */
16 #define EOL                     6       /* 0x06 Match "" at end of line. */
17 #define MEOL                    7       /* 0x07 Same, assuming multiline. */
18 #define SEOL                    8       /* 0x08 Same, assuming singleline. */
19 #define BOUND                   9       /* 0x09 Match "" at any word boundary */
20 #define BOUNDL                  10      /* 0x0a Match "" at any word boundary */
21 #define NBOUND                  11      /* 0x0b Match "" at any word non-boundary */
22 #define NBOUNDL                 12      /* 0x0c Match "" at any word non-boundary */
23 #define GPOS                    13      /* 0x0d Matches where last m//g left off. */
24 #define REG_ANY                 14      /* 0x0e Match any one character (except newline). */
25 #define SANY                    15      /* 0x0f Match any one character. */
26 #define CANY                    16      /* 0x10 Match any one byte. */
27 #define ANYOF                   17      /* 0x11 Match character in (or not in) this class. */
28 #define ALNUM                   18      /* 0x12 Match any alphanumeric character */
29 #define ALNUML                  19      /* 0x13 Match any alphanumeric char in locale */
30 #define NALNUM                  20      /* 0x14 Match any non-alphanumeric character */
31 #define NALNUML                 21      /* 0x15 Match any non-alphanumeric char in locale */
32 #define SPACE                   22      /* 0x16 Match any whitespace character */
33 #define SPACEL                  23      /* 0x17 Match any whitespace char in locale */
34 #define NSPACE                  24      /* 0x18 Match any non-whitespace character */
35 #define NSPACEL                 25      /* 0x19 Match any non-whitespace char in locale */
36 #define DIGIT                   26      /* 0x1a Match any numeric character */
37 #define DIGITL                  27      /* 0x1b Match any numeric character in locale */
38 #define NDIGIT                  28      /* 0x1c Match any non-numeric character */
39 #define NDIGITL                 29      /* 0x1d Match any non-numeric character in locale */
40 #define CLUMP                   30      /* 0x1e Match any combining character sequence */
41 #define BRANCH                  31      /* 0x1f Match this alternative, or the next... */
42 #define BACK                    32      /* 0x20 Match "", "next" ptr points backward. */
43 #define EXACT                   33      /* 0x21 Match this string (preceded by length). */
44 #define EXACTF                  34      /* 0x22 Match this string, folded (prec. by length). */
45 #define EXACTFL                 35      /* 0x23 Match this string, folded in locale (w/len). */
46 #define NOTHING                 36      /* 0x24 Match empty string. */
47 #define TAIL                    37      /* 0x25 Match empty string. Can jump here from outside. */
48 #define STAR                    38      /* 0x26 Match this (simple) thing 0 or more times. */
49 #define PLUS                    39      /* 0x27 Match this (simple) thing 1 or more times. */
50 #define CURLY                   40      /* 0x28 Match this simple thing {n,m} times. */
51 #define CURLYN                  41      /* 0x29 Match next-after-this simple thing */
52 #define CURLYM                  42      /* 0x2a Match this medium-complex thing {n,m} times. */
53 #define CURLYX                  43      /* 0x2b Match this complex thing {n,m} times. */
54 #define WHILEM                  44      /* 0x2c Do curly processing and see if rest matches. */
55 #define OPEN                    45      /* 0x2d Mark this point in input as start of */
56 #define CLOSE                   46      /* 0x2e Analogous to OPEN. */
57 #define REF                     47      /* 0x2f Match some already matched string */
58 #define REFF                    48      /* 0x30 Match already matched string, folded */
59 #define REFFL                   49      /* 0x31 Match already matched string, folded in loc. */
60 #define IFMATCH                 50      /* 0x32 Succeeds if the following matches. */
61 #define UNLESSM                 51      /* 0x33 Fails if the following matches. */
62 #define SUSPEND                 52      /* 0x34 "Independent" sub-RE. */
63 #define IFTHEN                  53      /* 0x35 Switch, should be preceeded by switcher . */
64 #define GROUPP                  54      /* 0x36 Whether the group matched. */
65 #define LONGJMP                 55      /* 0x37 Jump far away. */
66 #define BRANCHJ                 56      /* 0x38 BRANCH with long offset. */
67 #define EVAL                    57      /* 0x39 Execute some Perl code. */
68 #define MINMOD                  58      /* 0x3a Next operator is not greedy. */
69 #define LOGICAL                 59      /* 0x3b Next opcode should set the flag only. */
70 #define RENUM                   60      /* 0x3c Group with independently numbered parens. */
71 #define TRIE                    61      /* 0x3d Match many EXACT(FL?)? at once. flags==type */
72 #define TRIEC                   62      /* 0x3e Same as TRIE, but with embedded charclass data */
73 #define AHOCORASICK             63      /* 0x3f Aho Corasick stclass. flags==type */
74 #define AHOCORASICKC            64      /* 0x40 Same as AHOCORASICK, but with embedded charclass data */
75 #define OPTIMIZED               65      /* 0x41 Placeholder for dump. */
76 #define PSEUDO                  66      /* 0x42 Pseudo opcode for internal use. */
77
78         /* ------------ States ------------- */
79
80 #define TRIE_next               67      /* 0x43 Regmatch state for TRIE */
81 #define TRIE_next_fail          68      /* 0x44 Regmatch state for TRIE */
82 #define EVAL_AB                 69      /* 0x45 Regmatch state for EVAL */
83 #define EVAL_AB_fail            70      /* 0x46 Regmatch state for EVAL */
84 #define resume_CURLYX           71      /* 0x47 Regmatch state for CURLYX */
85 #define resume_WHILEM1          72      /* 0x48 Regmatch state for WHILEM */
86 #define resume_WHILEM2          73      /* 0x49 Regmatch state for WHILEM */
87 #define resume_WHILEM3          74      /* 0x4a Regmatch state for WHILEM */
88 #define resume_WHILEM4          75      /* 0x4b Regmatch state for WHILEM */
89 #define resume_WHILEM5          76      /* 0x4c Regmatch state for WHILEM */
90 #define resume_WHILEM6          77      /* 0x4d Regmatch state for WHILEM */
91 #define BRANCH_next             78      /* 0x4e Regmatch state for BRANCH */
92 #define BRANCH_next_fail        79      /* 0x4f Regmatch state for BRANCH */
93 #define CURLYM_A                80      /* 0x50 Regmatch state for CURLYM */
94 #define CURLYM_A_fail           81      /* 0x51 Regmatch state for CURLYM */
95 #define CURLYM_B                82      /* 0x52 Regmatch state for CURLYM */
96 #define CURLYM_B_fail           83      /* 0x53 Regmatch state for CURLYM */
97 #define IFMATCH_A               84      /* 0x54 Regmatch state for IFMATCH */
98 #define IFMATCH_A_fail          85      /* 0x55 Regmatch state for IFMATCH */
99 #define CURLY_B_min_known       86      /* 0x56 Regmatch state for CURLY */
100 #define CURLY_B_min_known_fail  87      /* 0x57 Regmatch state for CURLY */
101 #define CURLY_B_min             88      /* 0x58 Regmatch state for CURLY */
102 #define CURLY_B_min_fail        89      /* 0x59 Regmatch state for CURLY */
103 #define CURLY_B_max             90      /* 0x5a Regmatch state for CURLY */
104 #define CURLY_B_max_fail        91      /* 0x5b Regmatch state for CURLY */
105
106
107 #ifndef DOINIT
108 EXTCONST U8 PL_regkind[];
109 #else
110 EXTCONST U8 PL_regkind[] = {
111         END,            /* END                    */
112         END,            /* SUCCEED                */
113         BOL,            /* BOL                    */
114         BOL,            /* MBOL                   */
115         BOL,            /* SBOL                   */
116         EOL,            /* EOS                    */
117         EOL,            /* EOL                    */
118         EOL,            /* MEOL                   */
119         EOL,            /* SEOL                   */
120         BOUND,          /* BOUND                  */
121         BOUND,          /* BOUNDL                 */
122         NBOUND,         /* NBOUND                 */
123         NBOUND,         /* NBOUNDL                */
124         GPOS,           /* GPOS                   */
125         REG_ANY,        /* REG_ANY                */
126         REG_ANY,        /* SANY                   */
127         REG_ANY,        /* CANY                   */
128         ANYOF,          /* ANYOF                  */
129         ALNUM,          /* ALNUM                  */
130         ALNUM,          /* ALNUML                 */
131         NALNUM,         /* NALNUM                 */
132         NALNUM,         /* NALNUML                */
133         SPACE,          /* SPACE                  */
134         SPACE,          /* SPACEL                 */
135         NSPACE,         /* NSPACE                 */
136         NSPACE,         /* NSPACEL                */
137         DIGIT,          /* DIGIT                  */
138         DIGIT,          /* DIGITL                 */
139         NDIGIT,         /* NDIGIT                 */
140         NDIGIT,         /* NDIGITL                */
141         CLUMP,          /* CLUMP                  */
142         BRANCH,         /* BRANCH                 */
143         BACK,           /* BACK                   */
144         EXACT,          /* EXACT                  */
145         EXACT,          /* EXACTF                 */
146         EXACT,          /* EXACTFL                */
147         NOTHING,        /* NOTHING                */
148         NOTHING,        /* TAIL                   */
149         STAR,           /* STAR                   */
150         PLUS,           /* PLUS                   */
151         CURLY,          /* CURLY                  */
152         CURLY,          /* CURLYN                 */
153         CURLY,          /* CURLYM                 */
154         CURLY,          /* CURLYX                 */
155         WHILEM,         /* WHILEM                 */
156         OPEN,           /* OPEN                   */
157         CLOSE,          /* CLOSE                  */
158         REF,            /* REF                    */
159         REF,            /* REFF                   */
160         REF,            /* REFFL                  */
161         BRANCHJ,        /* IFMATCH                */
162         BRANCHJ,        /* UNLESSM                */
163         BRANCHJ,        /* SUSPEND                */
164         BRANCHJ,        /* IFTHEN                 */
165         GROUPP,         /* GROUPP                 */
166         LONGJMP,        /* LONGJMP                */
167         BRANCHJ,        /* BRANCHJ                */
168         EVAL,           /* EVAL                   */
169         MINMOD,         /* MINMOD                 */
170         LOGICAL,        /* LOGICAL                */
171         BRANCHJ,        /* RENUM                  */
172         TRIE,           /* TRIE                   */
173         TRIE,           /* TRIEC                  */
174         TRIE,           /* AHOCORASICK            */
175         TRIE,           /* AHOCORASICKC           */
176         NOTHING,        /* OPTIMIZED              */
177         PSEUDO,         /* PSEUDO                 */
178         /* ------------ States ------------- */
179         TRIE,           /* TRIE_next              */
180         TRIE,           /* TRIE_next_fail         */
181         EVAL,           /* EVAL_AB                */
182         EVAL,           /* EVAL_AB_fail           */
183         CURLYX,         /* resume_CURLYX          */
184         WHILEM,         /* resume_WHILEM1         */
185         WHILEM,         /* resume_WHILEM2         */
186         WHILEM,         /* resume_WHILEM3         */
187         WHILEM,         /* resume_WHILEM4         */
188         WHILEM,         /* resume_WHILEM5         */
189         WHILEM,         /* resume_WHILEM6         */
190         BRANCH,         /* BRANCH_next            */
191         BRANCH,         /* BRANCH_next_fail       */
192         CURLYM,         /* CURLYM_A               */
193         CURLYM,         /* CURLYM_A_fail          */
194         CURLYM,         /* CURLYM_B               */
195         CURLYM,         /* CURLYM_B_fail          */
196         IFMATCH,        /* IFMATCH_A              */
197         IFMATCH,        /* IFMATCH_A_fail         */
198         CURLY,          /* CURLY_B_min_known      */
199         CURLY,          /* CURLY_B_min_known_fail */
200         CURLY,          /* CURLY_B_min            */
201         CURLY,          /* CURLY_B_min_fail       */
202         CURLY,          /* CURLY_B_max            */
203         CURLY,          /* CURLY_B_max_fail       */
204 };
205 #endif
206
207
208 #ifdef REG_COMP_C
209 static const U8 regarglen[] = {
210         0,                                      /* END          */
211         0,                                      /* SUCCEED      */
212         0,                                      /* BOL          */
213         0,                                      /* MBOL         */
214         0,                                      /* SBOL         */
215         0,                                      /* EOS          */
216         0,                                      /* EOL          */
217         0,                                      /* MEOL         */
218         0,                                      /* SEOL         */
219         0,                                      /* BOUND        */
220         0,                                      /* BOUNDL       */
221         0,                                      /* NBOUND       */
222         0,                                      /* NBOUNDL      */
223         0,                                      /* GPOS         */
224         0,                                      /* REG_ANY      */
225         0,                                      /* SANY         */
226         0,                                      /* CANY         */
227         0,                                      /* ANYOF        */
228         0,                                      /* ALNUM        */
229         0,                                      /* ALNUML       */
230         0,                                      /* NALNUM       */
231         0,                                      /* NALNUML      */
232         0,                                      /* SPACE        */
233         0,                                      /* SPACEL       */
234         0,                                      /* NSPACE       */
235         0,                                      /* NSPACEL      */
236         0,                                      /* DIGIT        */
237         0,                                      /* DIGITL       */
238         0,                                      /* NDIGIT       */
239         0,                                      /* NDIGITL      */
240         0,                                      /* CLUMP        */
241         0,                                      /* BRANCH       */
242         0,                                      /* BACK         */
243         0,                                      /* EXACT        */
244         0,                                      /* EXACTF       */
245         0,                                      /* EXACTFL      */
246         0,                                      /* NOTHING      */
247         0,                                      /* TAIL         */
248         0,                                      /* STAR         */
249         0,                                      /* PLUS         */
250         EXTRA_SIZE(struct regnode_2),           /* CURLY        */
251         EXTRA_SIZE(struct regnode_2),           /* CURLYN       */
252         EXTRA_SIZE(struct regnode_2),           /* CURLYM       */
253         EXTRA_SIZE(struct regnode_2),           /* CURLYX       */
254         0,                                      /* WHILEM       */
255         EXTRA_SIZE(struct regnode_1),           /* OPEN         */
256         EXTRA_SIZE(struct regnode_1),           /* CLOSE        */
257         EXTRA_SIZE(struct regnode_1),           /* REF          */
258         EXTRA_SIZE(struct regnode_1),           /* REFF         */
259         EXTRA_SIZE(struct regnode_1),           /* REFFL        */
260         EXTRA_SIZE(struct regnode_1),           /* IFMATCH      */
261         EXTRA_SIZE(struct regnode_1),           /* UNLESSM      */
262         EXTRA_SIZE(struct regnode_1),           /* SUSPEND      */
263         EXTRA_SIZE(struct regnode_1),           /* IFTHEN       */
264         EXTRA_SIZE(struct regnode_1),           /* GROUPP       */
265         EXTRA_SIZE(struct regnode_1),           /* LONGJMP      */
266         EXTRA_SIZE(struct regnode_1),           /* BRANCHJ      */
267         EXTRA_SIZE(struct regnode_1),           /* EVAL         */
268         0,                                      /* MINMOD       */
269         0,                                      /* LOGICAL      */
270         EXTRA_SIZE(struct regnode_1),           /* RENUM        */
271         EXTRA_SIZE(struct regnode_1),           /* TRIE         */
272         EXTRA_SIZE(struct regnode_charclass),   /* TRIEC        */
273         EXTRA_SIZE(struct regnode_1),           /* AHOCORASICK  */
274         EXTRA_SIZE(struct regnode_charclass),   /* AHOCORASICKC */
275         0,                                      /* OPTIMIZED    */
276         0,                                      /* PSEUDO       */
277 };
278
279 static const char reg_off_by_arg[] = {
280         0,      /* END          */
281         0,      /* SUCCEED      */
282         0,      /* BOL          */
283         0,      /* MBOL         */
284         0,      /* SBOL         */
285         0,      /* EOS          */
286         0,      /* EOL          */
287         0,      /* MEOL         */
288         0,      /* SEOL         */
289         0,      /* BOUND        */
290         0,      /* BOUNDL       */
291         0,      /* NBOUND       */
292         0,      /* NBOUNDL      */
293         0,      /* GPOS         */
294         0,      /* REG_ANY      */
295         0,      /* SANY         */
296         0,      /* CANY         */
297         0,      /* ANYOF        */
298         0,      /* ALNUM        */
299         0,      /* ALNUML       */
300         0,      /* NALNUM       */
301         0,      /* NALNUML      */
302         0,      /* SPACE        */
303         0,      /* SPACEL       */
304         0,      /* NSPACE       */
305         0,      /* NSPACEL      */
306         0,      /* DIGIT        */
307         0,      /* DIGITL       */
308         0,      /* NDIGIT       */
309         0,      /* NDIGITL      */
310         0,      /* CLUMP        */
311         0,      /* BRANCH       */
312         0,      /* BACK         */
313         0,      /* EXACT        */
314         0,      /* EXACTF       */
315         0,      /* EXACTFL      */
316         0,      /* NOTHING      */
317         0,      /* TAIL         */
318         0,      /* STAR         */
319         0,      /* PLUS         */
320         0,      /* CURLY        */
321         0,      /* CURLYN       */
322         0,      /* CURLYM       */
323         0,      /* CURLYX       */
324         0,      /* WHILEM       */
325         0,      /* OPEN         */
326         0,      /* CLOSE        */
327         0,      /* REF          */
328         0,      /* REFF         */
329         0,      /* REFFL        */
330         2,      /* IFMATCH      */
331         2,      /* UNLESSM      */
332         1,      /* SUSPEND      */
333         1,      /* IFTHEN       */
334         0,      /* GROUPP       */
335         1,      /* LONGJMP      */
336         1,      /* BRANCHJ      */
337         0,      /* EVAL         */
338         0,      /* MINMOD       */
339         0,      /* LOGICAL      */
340         1,      /* RENUM        */
341         0,      /* TRIE         */
342         0,      /* TRIEC        */
343         0,      /* AHOCORASICK  */
344         0,      /* AHOCORASICKC */
345         0,      /* OPTIMIZED    */
346         0,      /* PSEUDO       */
347 };
348
349 #ifdef DEBUGGING
350 const char * const reg_name[] = {
351         "END",                          /* 0000 */
352         "SUCCEED",                      /* 0x01 */
353         "BOL",                          /* 0x02 */
354         "MBOL",                         /* 0x03 */
355         "SBOL",                         /* 0x04 */
356         "EOS",                          /* 0x05 */
357         "EOL",                          /* 0x06 */
358         "MEOL",                         /* 0x07 */
359         "SEOL",                         /* 0x08 */
360         "BOUND",                        /* 0x09 */
361         "BOUNDL",                       /* 0x0a */
362         "NBOUND",                       /* 0x0b */
363         "NBOUNDL",                      /* 0x0c */
364         "GPOS",                         /* 0x0d */
365         "REG_ANY",                      /* 0x0e */
366         "SANY",                         /* 0x0f */
367         "CANY",                         /* 0x10 */
368         "ANYOF",                        /* 0x11 */
369         "ALNUM",                        /* 0x12 */
370         "ALNUML",                       /* 0x13 */
371         "NALNUM",                       /* 0x14 */
372         "NALNUML",                      /* 0x15 */
373         "SPACE",                        /* 0x16 */
374         "SPACEL",                       /* 0x17 */
375         "NSPACE",                       /* 0x18 */
376         "NSPACEL",                      /* 0x19 */
377         "DIGIT",                        /* 0x1a */
378         "DIGITL",                       /* 0x1b */
379         "NDIGIT",                       /* 0x1c */
380         "NDIGITL",                      /* 0x1d */
381         "CLUMP",                        /* 0x1e */
382         "BRANCH",                       /* 0x1f */
383         "BACK",                         /* 0x20 */
384         "EXACT",                        /* 0x21 */
385         "EXACTF",                       /* 0x22 */
386         "EXACTFL",                      /* 0x23 */
387         "NOTHING",                      /* 0x24 */
388         "TAIL",                         /* 0x25 */
389         "STAR",                         /* 0x26 */
390         "PLUS",                         /* 0x27 */
391         "CURLY",                        /* 0x28 */
392         "CURLYN",                       /* 0x29 */
393         "CURLYM",                       /* 0x2a */
394         "CURLYX",                       /* 0x2b */
395         "WHILEM",                       /* 0x2c */
396         "OPEN",                         /* 0x2d */
397         "CLOSE",                        /* 0x2e */
398         "REF",                          /* 0x2f */
399         "REFF",                         /* 0x30 */
400         "REFFL",                        /* 0x31 */
401         "IFMATCH",                      /* 0x32 */
402         "UNLESSM",                      /* 0x33 */
403         "SUSPEND",                      /* 0x34 */
404         "IFTHEN",                       /* 0x35 */
405         "GROUPP",                       /* 0x36 */
406         "LONGJMP",                      /* 0x37 */
407         "BRANCHJ",                      /* 0x38 */
408         "EVAL",                         /* 0x39 */
409         "MINMOD",                       /* 0x3a */
410         "LOGICAL",                      /* 0x3b */
411         "RENUM",                        /* 0x3c */
412         "TRIE",                         /* 0x3d */
413         "TRIEC",                        /* 0x3e */
414         "AHOCORASICK",                  /* 0x3f */
415         "AHOCORASICKC",                 /* 0x40 */
416         "OPTIMIZED",                    /* 0x41 */
417         "PSEUDO",                       /* 0x42 */
418         /* ------------ States ------------- */
419         "TRIE_next",                    /* 0x43 */
420         "TRIE_next_fail",               /* 0x44 */
421         "EVAL_AB",                      /* 0x45 */
422         "EVAL_AB_fail",                 /* 0x46 */
423         "resume_CURLYX",                /* 0x47 */
424         "resume_WHILEM1",               /* 0x48 */
425         "resume_WHILEM2",               /* 0x49 */
426         "resume_WHILEM3",               /* 0x4a */
427         "resume_WHILEM4",               /* 0x4b */
428         "resume_WHILEM5",               /* 0x4c */
429         "resume_WHILEM6",               /* 0x4d */
430         "BRANCH_next",                  /* 0x4e */
431         "BRANCH_next_fail",             /* 0x4f */
432         "CURLYM_A",                     /* 0x50 */
433         "CURLYM_A_fail",                /* 0x51 */
434         "CURLYM_B",                     /* 0x52 */
435         "CURLYM_B_fail",                /* 0x53 */
436         "IFMATCH_A",                    /* 0x54 */
437         "IFMATCH_A_fail",               /* 0x55 */
438         "CURLY_B_min_known",            /* 0x56 */
439         "CURLY_B_min_known_fail",       /* 0x57 */
440         "CURLY_B_min",                  /* 0x58 */
441         "CURLY_B_min_fail",             /* 0x59 */
442         "CURLY_B_max",                  /* 0x5a */
443         "CURLY_B_max_fail",             /* 0x5b */
444 };
445 #endif /* DEBUGGING */
446 #else
447 #ifdef DEBUGGING
448 extern const char * const reg_name[];
449 #endif
450 #endif /* REG_COMP_C */
451
452 /* ex: set ro: */