Split off the pack/unpack code, from Nicholas Clark.
[p5sagit/p5-mst-13.2.git] / lib / warnings / regcomp
1   regcomp.c     AOK
2
3   Quantifier unexpected on zero-length expression [S_study_chunk] 
4
5   (?p{}) is deprecated - use (??{})  [S_reg]
6     $a =~ /(?p{'x'})/ ;
7     
8
9   Useless (%s%c) - %suse /%c modifier [S_reg] 
10   Useless (%sc) - %suse /gc modifier [S_reg] 
11
12
13
14   Strange *+?{} on zero-length expression       [S_study_chunk]
15         /(?=a)?/
16
17   %.*s matches null string many times           [S_regpiece]
18         $a = "ABC123" ; $a =~ /(?=a)*/'
19
20   /%.127s/: Unrecognized escape \\%c passed through     [S_regatom] 
21         $x = '\m' ; /$x/
22
23   POSIX syntax [%c %c] is reserved for future extensions [S_checkposixcc] 
24
25
26   Character class [:%.*s:] unknown      [S_regpposixcc]
27
28   Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 
29   
30   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
31
32   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
33
34   /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass] 
35
36   /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8] 
37
38   False [] range \"%*.*s\" [S_regclass]
39
40 __END__
41 # regcomp.c [S_regpiece]
42 use warnings 'regexp' ;
43 my $a = "ABC123" ; 
44 $a =~ /(?=a)*/ ;
45 no warnings 'regexp' ;
46 $a =~ /(?=a)*/ ;
47 EXPECT
48 (?=a)* matches null string many times in regex; marked by <-- HERE in m/(?=a)* <-- HERE / at - line 4.
49 ########
50 # regcomp.c [S_study_chunk]
51 use warnings 'regexp' ;
52 $_ = "" ;
53 /(?=a)?/;
54 no warnings 'regexp' ;
55 /(?=a)?/;
56 EXPECT
57 Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in m/(?=a)? <-- HERE / at - line 4.
58 ########
59 # regcomp.c [S_regatom]
60 $x = '\m' ;
61 use warnings 'regexp' ;
62 $a =~ /a$x/ ;
63 no warnings 'regexp' ;
64 $a =~ /a$x/ ;
65 EXPECT
66 Unrecognized escape \m passed through in regex; marked by <-- HERE in m/a\m <-- HERE / at - line 4.
67 ########
68 # regcomp.c [S_regpposixcc S_checkposixcc]
69 #
70 use warnings 'regexp' ;
71 $_ = "" ;
72 /[:alpha:]/;
73 /[:zog:]/;
74 /[[:zog:]]/;
75 no warnings 'regexp' ;
76 /[:alpha:]/;
77 /[:zog:]/;
78 /[[:zog:]]/;
79 EXPECT
80 POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5.
81 POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6.
82 POSIX class [:zog:] unknown in regex; marked by <-- HERE in m/[[:zog:] <-- HERE ]/
83 ########
84 # regcomp.c [S_checkposixcc]
85 #
86 use warnings 'regexp' ;
87 $_ = "" ;
88 /[.zog.]/;
89 no warnings 'regexp' ;
90 /[.zog.]/;
91 EXPECT
92 POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
93 POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE /
94 ########
95 # regcomp.c [S_checkposixcc]
96 #
97 use warnings 'regexp' ;
98 $_ = "" ;
99 /[[.zog.]]/;
100 no warnings 'regexp' ;
101 /[[.zog.]]/;
102 EXPECT
103 POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[[.zog.] <-- HERE ]/
104 ########
105 # regcomp.c [S_regclass]
106 $_ = "";
107 use warnings 'regexp' ;
108 /[a-b]/;
109 /[a-\d]/;
110 /[\d-b]/;
111 /[\s-\d]/;
112 /[\d-\s]/;
113 /[a-[:digit:]]/;
114 /[[:digit:]-b]/;
115 /[[:alpha:]-[:digit:]]/;
116 /[[:digit:]-[:alpha:]]/;
117 no warnings 'regexp' ;
118 /[a-b]/;
119 /[a-\d]/;
120 /[\d-b]/;
121 /[\s-\d]/;
122 /[\d-\s]/;
123 /[a-[:digit:]]/;
124 /[[:digit:]-b]/;
125 /[[:alpha:]-[:digit:]]/;
126 /[[:digit:]-[:alpha:]]/;
127 EXPECT
128 False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5.
129 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6.
130 False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7.
131 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8.
132 False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9.
133 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10.
134 False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11.
135 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12.
136 ########
137 # regcomp.c [S_regclassutf8]
138 BEGIN {
139     if (ord("\t") == 5) {
140         print "SKIPPED\n# ebcdic regular expression ranges differ.";
141         exit 0;
142     }
143 }
144 use utf8;
145 $_ = "";
146 use warnings 'regexp' ;
147 /[a-b]/;
148 /[a-\d]/;
149 /[\d-b]/;
150 /[\s-\d]/;
151 /[\d-\s]/;
152 /[a-[:digit:]]/;
153 /[[:digit:]-b]/;
154 /[[:alpha:]-[:digit:]]/;
155 /[[:digit:]-[:alpha:]]/;
156 no warnings 'regexp' ;
157 /[a-b]/;
158 /[a-\d]/;
159 /[\d-b]/;
160 /[\s-\d]/;
161 /[\d-\s]/;
162 /[a-[:digit:]]/;
163 /[[:digit:]-b]/;
164 /[[:alpha:]-[:digit:]]/;
165 /[[:digit:]-[:alpha:]]/;
166 EXPECT
167 False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12.
168 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13.
169 False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14.
170 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15.
171 False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16.
172 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17.
173 False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18.
174 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19.
175 ########
176 # regcomp.c [S_regclass S_regclassutf8]
177 use warnings 'regexp' ;
178 $a =~ /[a\zb]/ ;
179 no warnings 'regexp' ;
180 $a =~ /[a\zb]/ ;
181 EXPECT
182 Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3.
183
184 ########
185 # regcomp.c [S_study_chunk]
186 use warnings 'deprecated' ;
187 $a = "xx" ;
188 $a =~ /(?p{'x'})/ ;
189 no warnings ;
190 use warnings 'regexp' ;
191 $a =~ /(?p{'x'})/ ;
192 use warnings;
193 no warnings 'deprecated' ;
194 no warnings 'regexp' ;
195 $a =~ /(?p{'x'})/ ;
196 EXPECT
197 (?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 4.
198 (?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 7.
199 ########
200 # regcomp.c [S_reg]
201 use warnings 'regexp' ;
202 $a = qr/(?c)/;
203 $a = qr/(?-c)/;
204 $a = qr/(?g)/;
205 $a = qr/(?-g)/;
206 $a = qr/(?o)/;
207 $a = qr/(?-o)/;
208 $a = qr/(?g-o)/;
209 $a = qr/(?g-c)/;
210 $a = qr/(?o-cg)/;  # (?c) means (?g) error won't be thrown
211 $a = qr/(?ogc)/;
212 no warnings 'regexp' ;
213 $a = qr/(?c)/;
214 $a = qr/(?-c)/;
215 $a = qr/(?g)/;
216 $a = qr/(?-g)/;
217 $a = qr/(?o)/;
218 $a = qr/(?-o)/;
219 $a = qr/(?g-o)/;
220 $a = qr/(?g-c)/;
221 $a = qr/(?o-cg)/;  # (?c) means (?g) error won't be thrown
222 $a = qr/(?ogc)/;
223 #EXPECT
224 EXPECT
225 Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3.
226 Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4.
227 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5.
228 Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6.
229 Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7.
230 Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8.
231 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9.
232 Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9.
233 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10.
234 Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10.
235 Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11.
236 Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11.
237 Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12.
238 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12.
239 Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12.