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