summaryrefslogtreecommitdiff
path: root/t/lib/croak/regcomp
blob: a203f136fd6dc2c2925af8b70bb90e0b559334ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
__END__
# NAME \N{U+too large} on 64-bit machine
# SKIP ? use Config; $Config{uvsize} < 8 && "Not 64 bit"
qr/\N{U+7FFFFFFFFFFFFFFF}/;
qr/\N{U+1_0000_0000_0000_0000}/;
EXPECT
Use of code point 0x1_0000_0000_0000_0000 is not allowed; the permissible max is 0x7FFFFFFFFFFFFFFF in regex; marked by <-- HERE in m/\N{U+1_0000_0000_0000_0000 <-- HERE }/ at - line 2.
########
# NAME \N{U+too large} on 32-bit machine
# SKIP ? use Config; $Config{uvsize} > 4 && "Not 32 bit"
qr/\N{U+7FFFFFFF}/;
qr/\N{U+1_0000_0000}/;
EXPECT
Use of code point 0x1_0000_0000 is not allowed; the permissible max is 0x7FFFFFFF in regex; marked by <-- HERE in m/\N{U+1_0000_0000 <-- HERE }/ at - line 2.
########
# NAME \N{U+100.too large} on 64-bit machine
# SKIP ? use Config; $Config{uvsize} < 8 && "Not 64 bit"
qr/\N{U+100.7FFFFFFFFFFFFFFF}/;
qr/\N{U+100.1_0000_0000_0000_0000}/;
EXPECT
Use of code point 0x1_0000_0000_0000_0000 is not allowed; the permissible max is 0x7FFFFFFFFFFFFFFF in regex; marked by <-- HERE in m/\N{U+100.1_0000_0000_0000_0000 <-- HERE }/ at - line 2.
########
# NAME \N{U+100.too large} on 32-bit machine
# SKIP ? use Config; $Config{uvsize} > 4 && "Not 32 bit"
qr/\N{U+100.7FFFFFFF}/;
qr/\N{U+100.1_0000_0000}/;
EXPECT
Use of code point 0x1_0000_0000 is not allowed; the permissible max is 0x7FFFFFFF in regex; marked by <-- HERE in m/\N{U+100.1_0000_0000 <-- HERE }/ at - line 2.
########
# NAME \N{U+.}
my $p00="\\N{U+.}"; qr/$p00/;
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/\N{U+. <-- HERE }/ at - line 1.
########
# NAME \N{U+100.}
my $p00="\\N{U+100.}"; qr/$p00/;
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/\N{U+100. <-- HERE }/ at - line 1.
########
# NAME \N{U+_100}
my $p00="\\N{U+_100}"; qr/$p00/;
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/\N{U+_ <-- HERE 100}/ at - line 1.
########
# NAME \N{U+100_}
my $p00="\\N{U+100_}"; qr/$p00/;
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/\N{U+100_ <-- HERE }/ at - line 1.
########
# NAME [\xDF\N{U+.}]
# SKIP ? ord("A") != 65 && "Test valid only on ASCII machines"
my $p00="[\\xDF\\N{U+.}]"; qr/$p00/ui;
# The sharp s under /i recodes the parse, and this was causing a segfault when
# the error message referred to the original pattern
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/[\xDF\N{U+. <-- HERE }]/ at - line 1.
########
# NAME [\x59\N{U+.}]
# SKIP ? ord("A") == 65 && "Test valid only on EBCDIC machines"
my $p00="[\\x59\\N{U+.}]"; qr/$p00/ui;
# The sharp s under /i recodes the parse, and this was causing a segfault when
# the error message referred to the original pattern
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/[\x59\N{U+. <-- HERE }]/ at - line 1.
########
# NAME \N{U+...} leading underscore not allowed, medial is allowed
my $p00='\N{U+FF_FF}'; qr/$p00/;
$p00='\N{U+_FF}'; qr/$p00/;
EXPECT
Invalid hexadecimal number in \N{U+...} in regex; marked by <-- HERE in m/\N{U+_ <-- HERE FF}/ at - line 2.
########
# NAME ${^RE_COMPILE_RECURSION_LIMIT} [perl #131551]
BEGIN { ${^RE_COMPILE_RECURSION_LIMIT} = ${^RE_COMPILE_RECURSION_LIMIT} = 2; }
qr/(a)/;
qr/((a))/;
EXPECT
Too many nested open parens in regex; marked by <-- HERE in m/(( <-- HERE a))/ at - line 3.
########
# NAME \K not permitted in lookahead
qr/(?=a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?=a\K <-- HERE a)a/ at - line 1.
########
# NAME \K not permitted in lookahead (alpha)
no warnings 'experimental::alpha_assertions';
qr/(*positive_lookahead:a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(*positive_lookahead:a\K <-- HERE a)a/ at - line 2.
########
# NAME \K not permitted in negative lookahead
qr/(?!a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?!a\K <-- HERE a)a/ at - line 1.
########
# NAME \K not permitted in negative lookahead (alpha)
no warnings 'experimental::alpha_assertions';
qr/(*negative_lookahead:a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(*negative_lookahead:a\K <-- HERE a)a/ at - line 2.
########
# NAME \K not permitted in lookbehind
qr/(?<=a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<=a\K <-- HERE a)a/ at - line 1.
########
# NAME \K not permitted in lookbehind (alpha)
no warnings 'experimental::alpha_assertions';
qr/(*positive_lookbehind:a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(*positive_lookbehind:a\K <-- HERE a)a/ at - line 2.
########
# NAME \K not permitted in negative lookbehind
qr/(?<!a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<!a\K <-- HERE a)a/ at - line 1.
########
# NAME \K not permitted in negative lookbehind (alpha)
no warnings 'experimental::alpha_assertions';
qr/(*negative_lookbehind:a\Ka)a/;
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(*negative_lookbehind:a\K <-- HERE a)a/ at - line 2.
########
# NAME \K nesting in lookahead after lookahead
qr{(?=(?=x)x\K)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?=(?=x)x\K <-- HERE )x/ at - line 1.
########
# NAME \K nesting in lookahead after negative lookahead
qr{(?=(?!y)x\K)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?=(?!y)x\K <-- HERE )x/ at - line 1.
########
# NAME \K nesting in lookahead in negative lookahead
qr{(?=(?!y\K)x)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?=(?!y\K <-- HERE )x)x/ at - line 1.
########
# NAME \K nesting in lookahead in lookahead
qr{(?=(?=x\K)x)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?=(?=x\K <-- HERE )x)x/ at - line 1.
########
# NAME \K nesting in lookbehind after lookbehind
qr{(?<=(?<=x)x\K)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<=(?<=x)x\K <-- HERE )x/ at - line 1.
########
# NAME \K nesting in lookahead after lookbehind
qr{(?=(?<=x)x\K)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?=(?<=x)x\K <-- HERE )x/ at - line 1.
########
# NAME \K nesting in lookbehind after lookahead
qr{(?<=(?=x)x\K)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<=(?=x)x\K <-- HERE )x/ at - line 1.
########
# NAME \K nesting in negative lookbehind after lookahead
qr{(?<!(?=x)x\K)x};
EXPECT
\K not permitted in lookahead/lookbehind in regex; marked by <-- HERE in m/(?<!(?=x)x\K <-- HERE )x/ at - line 1.
########
# NAME \K is permitted after the lookahead GH#18123
qr/(?=(?=x)x)\K/;
qr/(?!(?=x)x)\K/;
qr/(?=(?!x)x)\K/;
qr/(?!(?!x)x)\K/;
qr/(?<=(?=x)x)\K/;
qr/(?<!(?=x)x)\K/;
qr/(?<=(?!x)x)\K/;
qr/(?<!(?!x)x)\K/;
qr/(?=(?<=x)x)\K/;
qr/(?!(?<=x)x)\K/;
qr/(?=(?<!x)x)\K/;
qr/(?!(?<!x)x)\K/;
qr/(?<=(?<=x)x)\K/;
qr/(?<!(?<=x)x)\K/;
qr/(?<=(?<!x)x)\K/;
qr/(?<!(?<!x)x)\K/;
EXPECT
OPTIONS nonfatal
########
# NAME numeric parsing buffer overflow in numeric.c
0=~/\p{nV:-0}/
EXPECT
Can't find Unicode property definition "nV:-0" in regex; marked by <-- HERE in m/\p{nV:-0} <-- HERE / at - line 1.