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