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