SYN SYN
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / regcomp
1   regcomp.c     AOK
2
3   Strange *+?{} on zero-length expression       [S_study_chunk]
4         /(?=a)?/
5
6   %.*s matches null string many times           [S_regpiece]
7         $a = "ABC123" ; $a =~ /(?=a)*/'
8
9   /%.127s/: Unrecognized escape \\%c passed through     [S_regatom] 
10         $x = '\m' ; /$x/
11
12   Character class [:%.*s:] unknown      [S_regpposixcc]
13
14   Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 
15   
16   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
17
18   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
19
20   /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass] 
21
22   /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8] 
23
24 __END__
25 # regcomp.c [S_regpiece]
26 use warnings 'regexp' ;
27 my $a = "ABC123" ; 
28 $a =~ /(?=a)*/ ;
29 no warnings 'regexp' ;
30 $a =~ /(?=a)*/ ;
31 EXPECT
32 (?=a)* matches null string many times before HERE mark in regex m/(?=a)* << HERE / at - line 4.
33 ########
34 # regcomp.c [S_study_chunk]
35 use warnings 'regexp' ;
36 $_ = "" ;
37 /(?=a)?/;
38 no warnings 'regexp' ;
39 /(?=a)?/;
40 EXPECT
41 Quantifier unexpected on zero-length expression before HERE mark in regex m/(?=a)? << HERE / at - line 4.
42 ########
43 # regcomp.c [S_regatom]
44 $x = '\m' ;
45 use warnings 'regexp' ;
46 $a =~ /a$x/ ;
47 no warnings 'regexp' ;
48 $a =~ /a$x/ ;
49 EXPECT
50 Unrecognized escape \m passed through before HERE mark in regex m/a\m << HERE / at - line 4.
51 ########
52 # regcomp.c [S_regpposixcc S_checkposixcc]
53 BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
54 use warnings 'regexp' ;
55 $_ = "" ;
56 /[:alpha:]/;
57 /[:zog:]/;
58 /[[:zog:]]/;
59 no warnings 'regexp' ;
60 /[:alpha:]/;
61 /[:zog:]/;
62 /[[:zog:]]/;
63 EXPECT
64 POSIX syntax [: :] belongs inside character classes before HERE mark in regex m/[:alpha:] << HERE / at - line 5.
65 POSIX syntax [: :] belongs inside character classes before HERE mark in regex m/[:zog:] << HERE / at - line 6.
66 POSIX class [:zog:] unknown before HERE mark in regex m/[[:zog:] << HERE ]/
67 ########
68 # regcomp.c [S_checkposixcc]
69 BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
70 use warnings 'regexp' ;
71 $_ = "" ;
72 /[.zog.]/;
73 no warnings 'regexp' ;
74 /[.zog.]/;
75 EXPECT
76 POSIX syntax [. .] belongs inside character classes before HERE mark in regex m/[.zog.] << HERE / at - line 5.
77 POSIX syntax [. .] is reserved for future extensions before HERE mark in regex m/[.zog.] << HERE /
78 ########
79 # regcomp.c [S_checkposixcc]
80 BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
81 use warnings 'regexp' ;
82 $_ = "" ;
83 /[[.zog.]]/;
84 no warnings 'regexp' ;
85 /[[.zog.]]/;
86 EXPECT
87 POSIX syntax [. .] is reserved for future extensions before HERE mark in regex m/[[.zog.] << HERE ]/
88 ########
89 # regcomp.c [S_regclass]
90 $_ = "";
91 use warnings 'regexp' ;
92 /[a-b]/;
93 /[a-\d]/;
94 /[\d-b]/;
95 /[\s-\d]/;
96 /[\d-\s]/;
97 /[a-[:digit:]]/;
98 /[[:digit:]-b]/;
99 /[[:alpha:]-[:digit:]]/;
100 /[[:digit:]-[:alpha:]]/;
101 no warnings 'regexp' ;
102 /[a-b]/;
103 /[a-\d]/;
104 /[\d-b]/;
105 /[\s-\d]/;
106 /[\d-\s]/;
107 /[a-[:digit:]]/;
108 /[[:digit:]-b]/;
109 /[[:alpha:]-[:digit:]]/;
110 /[[:digit:]-[:alpha:]]/;
111 EXPECT
112 False [] range "a-\d" before HERE mark in regex m/[a-\d << HERE ]/ at - line 5.
113 False [] range "\d-" before HERE mark in regex m/[\d- << HERE b]/ at - line 6.
114 False [] range "\s-" before HERE mark in regex m/[\s- << HERE \d]/ at - line 7.
115 False [] range "\d-" before HERE mark in regex m/[\d- << HERE \s]/ at - line 8.
116 False [] range "a-[:digit:]" before HERE mark in regex m/[a-[:digit:] << HERE ]/ at - line 9.
117 False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE b]/ at - line 10.
118 False [] range "[:alpha:]-" before HERE mark in regex m/[[:alpha:]- << HERE [:digit:]]/ at - line 11.
119 False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE [:alpha:]]/ at - line 12.
120 ########
121 # regcomp.c [S_regclassutf8]
122 BEGIN {
123     if (ord("\t") == 5) {
124         print "SKIPPED\n# ebcdic regular expression ranges differ.";
125         exit 0;
126     }
127 }
128 use utf8;
129 $_ = "";
130 use warnings 'regexp' ;
131 /[a-b]/;
132 /[a-\d]/;
133 /[\d-b]/;
134 /[\s-\d]/;
135 /[\d-\s]/;
136 /[a-[:digit:]]/;
137 /[[:digit:]-b]/;
138 /[[:alpha:]-[:digit:]]/;
139 /[[:digit:]-[:alpha:]]/;
140 no warnings 'regexp' ;
141 /[a-b]/;
142 /[a-\d]/;
143 /[\d-b]/;
144 /[\s-\d]/;
145 /[\d-\s]/;
146 /[a-[:digit:]]/;
147 /[[:digit:]-b]/;
148 /[[:alpha:]-[:digit:]]/;
149 /[[:digit:]-[:alpha:]]/;
150 EXPECT
151 False [] range "a-\d" before HERE mark in regex m/[a-\d << HERE ]/ at - line 12.
152 False [] range "\d-" before HERE mark in regex m/[\d- << HERE b]/ at - line 13.
153 False [] range "\s-" before HERE mark in regex m/[\s- << HERE \d]/ at - line 14.
154 False [] range "\d-" before HERE mark in regex m/[\d- << HERE \s]/ at - line 15.
155 False [] range "a-[:digit:]" before HERE mark in regex m/[a-[:digit:] << HERE ]/ at - line 16.
156 False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE b]/ at - line 17.
157 False [] range "[:alpha:]-" before HERE mark in regex m/[[:alpha:]- << HERE [:digit:]]/ at - line 18.
158 False [] range "[:digit:]-" before HERE mark in regex m/[[:digit:]- << HERE [:alpha:]]/ at - line 19.
159 ########
160 # regcomp.c [S_regclass S_regclassutf8]
161 use warnings 'regexp' ;
162 $a =~ /[a\zb]/ ;
163 no warnings 'regexp' ;
164 $a =~ /[a\zb]/ ;
165 EXPECT
166 Unrecognized escape \z in character class passed through before HERE mark in regex m/[a\z << HERE b]/ at - line 3.
167