This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add hook for re_dup() into regex engine as reg_dupe (make re
[perl5.git] / regcomp.sym
CommitLineData
d09b2d29
IZ
1# Format:
2# NAME \t TYPE, arg-description [num-args] [longjump-len] \t DESCRIPTION
3
4# Empty rows and #-comment rows are ignored.
5
3dab1dad
YO
6# Note that the order in this file is important.
7#
8# Add new regops to the end, and do not re-order the existing ops.
9#
10
1de06328
YO
11#* Exit points (0,1)
12
d09b2d29
IZ
13END END, no End of program.
14SUCCEED END, no Return from a subroutine, basically.
15
1de06328
YO
16#* Anchors: (2..13)
17
d09b2d29
IZ
18BOL BOL, no Match "" at beginning of line.
19MBOL BOL, no Same, assuming multiline.
20SBOL BOL, no Same, assuming singleline.
b85d18e9 21EOS EOL, no Match "" at end of string.
d09b2d29
IZ
22EOL EOL, no Match "" at end of line.
23MEOL EOL, no Same, assuming multiline.
24SEOL EOL, no Same, assuming singleline.
25BOUND BOUND, no Match "" at any word boundary
26BOUNDL BOUND, no Match "" at any word boundary
27NBOUND NBOUND, no Match "" at any word non-boundary
28NBOUNDL NBOUND, no Match "" at any word non-boundary
29GPOS GPOS, no Matches where last m//g left off.
30
1de06328
YO
31#* [Special] alternatives: (14..30)
32
22c35a8c 33REG_ANY REG_ANY, no Match any one character (except newline).
22c35a8c 34SANY REG_ANY, no Match any one character.
f33976b4 35CANY REG_ANY, no Match any one byte.
d09b2d29
IZ
36ANYOF ANYOF, sv Match character in (or not in) this class.
37ALNUM ALNUM, no Match any alphanumeric character
38ALNUML ALNUM, no Match any alphanumeric char in locale
39NALNUM NALNUM, no Match any non-alphanumeric character
40NALNUML NALNUM, no Match any non-alphanumeric char in locale
41SPACE SPACE, no Match any whitespace character
42SPACEL SPACE, no Match any whitespace char in locale
43NSPACE NSPACE, no Match any non-whitespace character
44NSPACEL NSPACE, no Match any non-whitespace char in locale
45DIGIT DIGIT, no Match any numeric character
b8c5462f 46DIGITL DIGIT, no Match any numeric character in locale
d09b2d29 47NDIGIT NDIGIT, no Match any non-numeric character
b8c5462f 48NDIGITL NDIGIT, no Match any non-numeric character in locale
a0ed51b3 49CLUMP CLUMP, no Match any combining character sequence
d09b2d29 50
1de06328
YO
51#* Alternation (31)
52
53# BRANCH The set of branches constituting a single choice are hooked
d09b2d29
IZ
54# together with their "next" pointers, since precedence prevents
55# anything being concatenated to any individual branch. The
56# "next" pointer of the last BRANCH in a choice points to the
57# thing following the whole choice. This is also where the
58# final "next" pointer of each individual branch points; each
59# branch starts with the operand node of a BRANCH node.
60#
61BRANCH BRANCH, node Match this alternative, or the next...
62
1de06328
YO
63#*Back pointer (32)
64
d09b2d29
IZ
65# BACK Normal "next" pointers all implicitly point forward; BACK
66# exists to make loop structures possible.
67# not used
68BACK BACK, no Match "", "next" ptr points backward.
69
1de06328
YO
70#*Literals (33..35)
71
d09b2d29
IZ
72EXACT EXACT, sv Match this string (preceded by length).
73EXACTF EXACT, sv Match this string, folded (prec. by length).
74EXACTFL EXACT, sv Match this string, folded in locale (w/len).
75
1de06328
YO
76#*Do nothing types (36..37)
77
d09b2d29
IZ
78NOTHING NOTHING,no Match empty string.
79# A variant of above which delimits a group, thus stops optimizations
80TAIL NOTHING,no Match empty string. Can jump here from outside.
81
1de06328
YO
82#*Loops (38..44)
83
d09b2d29
IZ
84# STAR,PLUS '?', and complex '*' and '+', are implemented as circular
85# BRANCH structures using BACK. Simple cases (one character
86# per match) are implemented with STAR and PLUS for speed
87# and to minimize recursive plunges.
88#
89STAR STAR, node Match this (simple) thing 0 or more times.
90PLUS PLUS, node Match this (simple) thing 1 or more times.
91
92CURLY CURLY, sv 2 Match this simple thing {n,m} times.
93CURLYN CURLY, no 2 Match next-after-this simple thing
94# {n,m} times, set parenths.
95CURLYM CURLY, no 2 Match this medium-complex thing {n,m} times.
96CURLYX CURLY, sv 2 Match this complex thing {n,m} times.
97
98# This terminator creates a loop structure for CURLYX
99WHILEM WHILEM, no Do curly processing and see if rest matches.
100
1de06328
YO
101#*Buffer related (45..49)
102
d09b2d29
IZ
103# OPEN,CLOSE,GROUPP ...are numbered at compile time.
104OPEN OPEN, num 1 Mark this point in input as start of #n.
105CLOSE CLOSE, num 1 Analogous to OPEN.
106
107REF REF, num 1 Match some already matched string
108REFF REF, num 1 Match already matched string, folded
109REFFL REF, num 1 Match already matched string, folded in loc.
110
1de06328
YO
111#*Grouping assertions (50..54)
112
d09b2d29
IZ
113IFMATCH BRANCHJ,off 1 2 Succeeds if the following matches.
114UNLESSM BRANCHJ,off 1 2 Fails if the following matches.
115SUSPEND BRANCHJ,off 1 1 "Independent" sub-RE.
116IFTHEN BRANCHJ,off 1 1 Switch, should be preceeded by switcher .
117GROUPP GROUPP, num 1 Whether the group matched.
118
1de06328
YO
119#*Support for long RE (55..56)
120
d09b2d29
IZ
121LONGJMP LONGJMP,off 1 1 Jump far away.
122BRANCHJ BRANCHJ,off 1 1 BRANCH with long offset.
123
1de06328
YO
124#*The heavy worker (57..58)
125
d09b2d29
IZ
126EVAL EVAL, evl 1 Execute some Perl code.
127
1de06328
YO
128#*Modifiers (59..60)
129
d09b2d29
IZ
130MINMOD MINMOD, no Next operator is not greedy.
131LOGICAL LOGICAL,no Next opcode should set the flag only.
132
1de06328 133# This is not used yet (61)
d09b2d29
IZ
134RENUM BRANCHJ,off 1 1 Group with independently numbered parens.
135
1de06328
YO
136#*Trie Related (62..64)
137
138# Behave the same as A|LIST|OF|WORDS would. The '..C' variants have
139# inline charclass data (ascii only), the 'C' store it in the structure.
140# NOTE: the relative order of the TRIE-like regops is signifigant
ce5e9471 141
3dab1dad 142TRIE TRIE, trie 1 Match many EXACT(FL?)? at once. flags==type
786e8c11 143TRIEC TRIE, trie charclass Same as TRIE, but with embedded charclass data
3dab1dad 144
1de06328
YO
145# For start classes, contains an added fail table.
146AHOCORASICK TRIE, trie 1 Aho Corasick stclass. flags==type
147AHOCORASICKC TRIE, trie charclass Same as AHOCORASICK, but with embedded charclass data
148
149# NEW STUFF ABOVE THIS LINE -- Please update counts below.
150
151#*Special Nodes (65, 66)
152
153# This is not really a node, but an optimized away piece of a "long" node.
154# To simplify debugging output, we mark it as if it were a node
155OPTIMIZED NOTHING,off Placeholder for dump.
156
3dab1dad
YO
157# Special opcode with the property that no opcode in a compiled program
158# will ever be of this type. Thus it can be used as a flag value that
159# no other opcode has been seen. END is used similarly, in that an END
160# node cant be optimized. So END implies "unoptimizable" and PSEUDO mean
161# "not seen anything to optimize yet".
162PSEUDO PSEUDO,off Pseudo opcode for internal use.
1de06328 163
786e8c11 164# NOTHING BELOW HERE