1# These are:
2#
3# (1) Tests of the match-limiting features. The results are different for
4# interpretive or JIT matching, so this test should not be run with JIT. The
5# same tests are run using JIT in test 17.
6
7# (2) Other tests that must not be run with JIT.
8
9/(a+)*zz/I
10Capture group count = 1
11Starting code units: a z
12Last code unit = 'z'
13Subject length lower bound = 2
14  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\=find_limits
15Minimum heap limit = 0
16Minimum match limit = 7
17Minimum depth limit = 7
18 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazz
19 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
20  aaaaaaaaaaaaaz\=find_limits
21Minimum heap limit = 0
22Minimum match limit = 20481
23Minimum depth limit = 30
24No match
25
26!((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I
27Capture group count = 1
28May match empty string
29Subject length lower bound = 0
30   /* this is a C style comment */\=find_limits
31Minimum heap limit = 0
32Minimum match limit = 64
33Minimum depth limit = 7
34 0: /* this is a C style comment */
35 1: /* this is a C style comment */
36
37/^(?>a)++/
38    aa\=find_limits
39Minimum heap limit = 0
40Minimum match limit = 5
41Minimum depth limit = 3
42 0: aa
43    aaaaaaaaa\=find_limits
44Minimum heap limit = 0
45Minimum match limit = 12
46Minimum depth limit = 3
47 0: aaaaaaaaa
48
49/(a)(?1)++/
50    aa\=find_limits
51Minimum heap limit = 0
52Minimum match limit = 7
53Minimum depth limit = 5
54 0: aa
55 1: a
56    aaaaaaaaa\=find_limits
57Minimum heap limit = 0
58Minimum match limit = 21
59Minimum depth limit = 5
60 0: aaaaaaaaa
61 1: a
62
63/a(?:.)*?a/ims
64    abbbbbbbbbbbbbbbbbbbbba\=find_limits
65Minimum heap limit = 0
66Minimum match limit = 24
67Minimum depth limit = 3
68 0: abbbbbbbbbbbbbbbbbbbbba
69
70/a(?:.(*THEN))*?a/ims
71    abbbbbbbbbbbbbbbbbbbbba\=find_limits
72Minimum heap limit = 0
73Minimum match limit = 66
74Minimum depth limit = 45
75 0: abbbbbbbbbbbbbbbbbbbbba
76
77/a(?:.(*THEN:ABC))*?a/ims
78    abbbbbbbbbbbbbbbbbbbbba\=find_limits
79Minimum heap limit = 0
80Minimum match limit = 66
81Minimum depth limit = 45
82 0: abbbbbbbbbbbbbbbbbbbbba
83
84/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/
85     aabbccddee\=find_limits
86Minimum heap limit = 0
87Minimum match limit = 7
88Minimum depth limit = 7
89 0: aabbccddee
90
91/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/
92     aabbccddee\=find_limits
93Minimum heap limit = 0
94Minimum match limit = 12
95Minimum depth limit = 12
96 0: aabbccddee
97 1: aa
98 2: bb
99 3: cc
100 4: dd
101 5: ee
102
103/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/
104     aabbccddee\=find_limits
105Minimum heap limit = 0
106Minimum match limit = 10
107Minimum depth limit = 10
108 0: aabbccddee
109 1: aa
110 2: cc
111 3: ee
112
113/(*LIMIT_MATCH=12bc)abc/
114Failed: error 160 at offset 17: (*VERB) not recognized or malformed
115
116/(*LIMIT_MATCH=4294967290)abc/
117Failed: error 160 at offset 24: (*VERB) not recognized or malformed
118
119/(*LIMIT_DEPTH=4294967280)abc/I
120Capture group count = 0
121Depth limit = 4294967280
122First code unit = 'a'
123Last code unit = 'c'
124Subject length lower bound = 3
125
126/(a+)*zz/
127\= Expect no match
128    aaaaaaaaaaaaaz
129No match
130\= Expect limit exceeded
131    aaaaaaaaaaaaaz\=match_limit=3000
132Failed: error -47: match limit exceeded
133
134/(a+)*zz/
135\= Expect limit exceeded
136    aaaaaaaaaaaaaz\=depth_limit=10
137Failed: error -53: matching depth limit exceeded
138
139/(*LIMIT_MATCH=3000)(a+)*zz/I
140Capture group count = 1
141Match limit = 3000
142Starting code units: a z
143Last code unit = 'z'
144Subject length lower bound = 2
145\= Expect limit exceeded
146    aaaaaaaaaaaaaz
147Failed: error -47: match limit exceeded
148\= Expect limit exceeded
149    aaaaaaaaaaaaaz\=match_limit=60000
150Failed: error -47: match limit exceeded
151
152/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
153Capture group count = 1
154Match limit = 3000
155Starting code units: a z
156Last code unit = 'z'
157Subject length lower bound = 2
158\= Expect limit exceeded
159    aaaaaaaaaaaaaz
160Failed: error -47: match limit exceeded
161
162/(*LIMIT_MATCH=60000)(a+)*zz/I
163Capture group count = 1
164Match limit = 60000
165Starting code units: a z
166Last code unit = 'z'
167Subject length lower bound = 2
168\= Expect no match
169    aaaaaaaaaaaaaz
170No match
171\= Expect limit exceeded
172    aaaaaaaaaaaaaz\=match_limit=3000
173Failed: error -47: match limit exceeded
174
175/(*LIMIT_DEPTH=10)(a+)*zz/I
176Capture group count = 1
177Depth limit = 10
178Starting code units: a z
179Last code unit = 'z'
180Subject length lower bound = 2
181\= Expect limit exceeded
182    aaaaaaaaaaaaaz
183Failed: error -53: matching depth limit exceeded
184\= Expect limit exceeded
185    aaaaaaaaaaaaaz\=depth_limit=1000
186Failed: error -53: matching depth limit exceeded
187
188/(*LIMIT_DEPTH=10)(*LIMIT_DEPTH=1000)(a+)*zz/I
189Capture group count = 1
190Depth limit = 1000
191Starting code units: a z
192Last code unit = 'z'
193Subject length lower bound = 2
194\= Expect no match
195    aaaaaaaaaaaaaz
196No match
197
198/(*LIMIT_DEPTH=1000)(a+)*zz/I
199Capture group count = 1
200Depth limit = 1000
201Starting code units: a z
202Last code unit = 'z'
203Subject length lower bound = 2
204\= Expect no match
205    aaaaaaaaaaaaaz
206No match
207\= Expect limit exceeded
208    aaaaaaaaaaaaaz\=depth_limit=10
209Failed: error -53: matching depth limit exceeded
210
211# These three have infinitely nested recursions.
212
213/((?2))((?1))/
214    abc
215Failed: error -52: nested recursion at the same subject position
216
217/((?(R2)a+|(?1)b))()/
218    aaaabcde
219Failed: error -52: nested recursion at the same subject position
220
221/(?(R)a*(?1)|((?R))b)/
222    aaaabcde
223Failed: error -52: nested recursion at the same subject position
224
225# The allusedtext modifier does not work with JIT, which does not maintain
226# the leftchar/rightchar data.
227
228/abc(?=xyz)/allusedtext
229    abcxyzpqr
230 0: abcxyz
231       >>>
232    abcxyzpqr\=aftertext
233 0: abcxyz
234       >>>
235 0+ xyzpqr
236
237/(?<=pqr)abc(?=xyz)/allusedtext
238    xyzpqrabcxyzpqr
239 0: pqrabcxyz
240    <<<   >>>
241    xyzpqrabcxyzpqr\=aftertext
242 0: pqrabcxyz
243    <<<   >>>
244 0+ xyzpqr
245
246/a\b/
247    a.\=allusedtext
248 0: a.
249     >
250    a\=allusedtext
251 0: a
252
253/abc\Kxyz/
254    abcxyz\=allusedtext
255 0: abcxyz
256    <<<
257
258/abc(?=xyz(*ACCEPT))/
259    abcxyz\=allusedtext
260 0: abcxyz
261       >>>
262
263/abc(?=abcde)(?=ab)/allusedtext
264    abcabcdefg
265 0: abcabcde
266       >>>>>
267
268#subject allusedtext
269
270/(?<=abc)123/
271    xyzabc123pqr
272 0: abc123
273    <<<
274    xyzabc12\=ps
275Partial match: abc12
276               <<<
277    xyzabc12\=ph
278Partial match: abc12
279               <<<
280
281/\babc\b/
282    +++abc+++
283 0: +abc+
284    <   >
285    +++ab\=ps
286Partial match: +ab
287               <
288    +++ab\=ph
289Partial match: +ab
290               <
291
292/(?<=abc)def/
293    abc\=ph
294Partial match: abc
295               <<<
296
297/(?<=123)(*MARK:xx)abc/mark
298    xxxx123a\=ph
299Partial match, mark=xx: 123a
300                        <<<
301    xxxx123a\=ps
302Partial match, mark=xx: 123a
303                        <<<
304
305/(?<=(?<=a)b)c.*/I
306Capture group count = 0
307Max lookbehind = 1
308First code unit = 'c'
309Subject length lower bound = 1
310    abc\=ph
311Partial match: abc
312               <<
313\= Expect no match
314    xbc\=ph
315No match
316
317/(?<=ab)c.*/I
318Capture group count = 0
319Max lookbehind = 2
320First code unit = 'c'
321Subject length lower bound = 1
322    abc\=ph
323Partial match: abc
324               <<
325\= Expect no match
326    xbc\=ph
327No match
328
329/abc(?<=bc)def/
330    xxxabcd\=ph
331Partial match: abcd
332
333/(?<=ab)cdef/
334    xxabcd\=ph
335Partial match: abcd
336               <<
337
338/(?<=(?<=(?<=a)b)c)./I
339Capture group count = 0
340Max lookbehind = 1
341Subject length lower bound = 1
342    123abcXYZ
343 0: abcX
344    <<<
345
346/(?<=ab(cd(?<=...)))./I
347Capture group count = 1
348Max lookbehind = 4
349Subject length lower bound = 1
350    abcdX
351 0: abcdX
352    <<<<
353 1: cd
354
355/(?<=ab((?<=...)cd))./I
356Capture group count = 1
357Max lookbehind = 4
358Subject length lower bound = 1
359    ZabcdX
360 0: ZabcdX
361    <<<<<
362 1: cd
363
364/(?<=((?<=(?<=ab).))(?1)(?1))./I
365Capture group count = 1
366Max lookbehind = 2
367Subject length lower bound = 1
368    abxZ
369 0: abxZ
370    <<<
371 1:
372
373#subject
374# -------------------------------------------------------------------
375
376# These tests provoke recursion loops, which give a different error message
377# when JIT is used.
378
379/(?R)/I
380Capture group count = 0
381May match empty string
382Subject length lower bound = 0
383    abcd
384Failed: error -52: nested recursion at the same subject position
385
386/(a|(?R))/I
387Capture group count = 1
388May match empty string
389Subject length lower bound = 0
390    abcd
391 0: a
392 1: a
393    defg
394Failed: error -52: nested recursion at the same subject position
395
396/(ab|(bc|(de|(?R))))/I
397Capture group count = 3
398May match empty string
399Subject length lower bound = 0
400    abcd
401 0: ab
402 1: ab
403    fghi
404Failed: error -52: nested recursion at the same subject position
405
406/(ab|(bc|(de|(?1))))/I
407Capture group count = 3
408May match empty string
409Subject length lower bound = 0
410    abcd
411 0: ab
412 1: ab
413    fghi
414Failed: error -52: nested recursion at the same subject position
415
416/x(ab|(bc|(de|(?1)x)x)x)/I
417Capture group count = 3
418First code unit = 'x'
419Subject length lower bound = 3
420    xab123
421 0: xab
422 1: ab
423    xfghi
424Failed: error -52: nested recursion at the same subject position
425
426/(?!\w)(?R)/
427    abcd
428Failed: error -52: nested recursion at the same subject position
429    =abc
430Failed: error -52: nested recursion at the same subject position
431
432/(?=\w)(?R)/
433    =abc
434Failed: error -52: nested recursion at the same subject position
435    abcd
436Failed: error -52: nested recursion at the same subject position
437
438/(?<!\w)(?R)/
439    abcd
440Failed: error -52: nested recursion at the same subject position
441
442/(?<=\w)(?R)/
443    abcd
444Failed: error -52: nested recursion at the same subject position
445
446/(a+|(?R)b)/
447    aaa
448 0: aaa
449 1: aaa
450    bbb
451Failed: error -52: nested recursion at the same subject position
452
453/[^\xff]((?1))/BI
454------------------------------------------------------------------
455        Bra
456        [^\x{ff}]
457        CBra 1
458        Recurse
459        Ket
460        Ket
461        End
462------------------------------------------------------------------
463Capture group count = 1
464Subject length lower bound = 1
465    abcd
466Failed: error -52: nested recursion at the same subject position
467
468# These tests don't behave the same with JIT
469
470/\w+(?C1)/BI,no_auto_possess
471------------------------------------------------------------------
472        Bra
473        \w+
474        Callout 1 8 0
475        Ket
476        End
477------------------------------------------------------------------
478Capture group count = 0
479Options: no_auto_possess
480Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
481  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
482Subject length lower bound = 1
483    abc\=callout_fail=1
484--->abc
485  1 ^  ^    End of pattern
486  1 ^ ^     End of pattern
487  1 ^^      End of pattern
488  1  ^ ^    End of pattern
489  1  ^^     End of pattern
490  1   ^^    End of pattern
491No match
492
493/(*NO_AUTO_POSSESS)\w+(?C1)/BI
494------------------------------------------------------------------
495        Bra
496        \w+
497        Callout 1 26 0
498        Ket
499        End
500------------------------------------------------------------------
501Capture group count = 0
502Compile options: <none>
503Overall options: no_auto_possess
504Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
505  Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
506Subject length lower bound = 1
507    abc\=callout_fail=1
508--->abc
509  1 ^  ^    End of pattern
510  1 ^ ^     End of pattern
511  1 ^^      End of pattern
512  1  ^ ^    End of pattern
513  1  ^^     End of pattern
514  1   ^^    End of pattern
515No match
516
517# This test breaks the JIT stack limit
518
519/(|]+){2,2452}/
520    (|]+){2,2452}
521 0:
522 1:
523
524/(*LIMIT_HEAP=21)\[(a)]{60}/expand
525    \[a]{60}
526Failed: error -63: heap limit exceeded
527
528/b(?<!ax)(?!cx)/allusedtext
529    abc
530 0: abc
531    < >
532    abcz
533 0: abcz
534    < >>
535
536# End of testinput15
537