summaryrefslogtreecommitdiff
path: root/t/lib/croak/regcomp
blob: 74e70ed36347bf0b69441467a864502acd97f68a (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
__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 is permitted after the lookahead GH#18123
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.