-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathssre-tests.scm
More file actions
2852 lines (2832 loc) · 173 KB
/
ssre-tests.scm
File metadata and controls
2852 lines (2832 loc) · 173 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; SPDX-FileCopyrightText: 2025 Sergei Egorov
;;; SPDX-License-Identifier: MIT
(define *tests-run* 0)
(define *tests-passed* 0)
(define-syntax test
(syntax-rules ()
((test name expect expr)
(test expect expr))
((test expect expr)
(begin
(set! *tests-run* (+ *tests-run* 1))
(let ((display-str
(lambda ()
(write *tests-run*)
(display ". ")
(write 'expr)))
(res expr))
(display-str)
(write-char #\space)
(display (make-string 10 #\.))
(cond
((equal? res expect)
(set! *tests-passed* (+ *tests-passed* 1))
(display " [PASS]\n"))
(else
(display " [FAIL]\n")
(display "********** expected ") (write expect)
(display " but got ") (write res) (newline))))))))
(define-syntax test-assert
(syntax-rules ()
((test-assert expr) (test #f (not expr)))
((test-assert name expr) (test name #f (not expr)))))
(define-syntax test-equal
(syntax-rules ()
((test-equal res expr) (test res expr))
((test-equal = expr ...) (if (string? =) (test = #t (equal? expr ...)) (test #t (= expr ...))))))
(define-syntax test-error
(syntax-rules ()
((test-error name expr)
(test-error expr))
((test-error expr)
(guard (condition (else (set! *tests-run* (- *tests-run* 1)) (test 'expr 'expr)))
(test '<fail> expr)))))
(define (test-end . name)
(write *tests-passed*)
(display " out of ")
(write *tests-run*)
(display " passed (")
(if (> *tests-run* 0) (display (number->string (* (/ *tests-passed* *tests-run*) 100.0))))
(display "%)")
(newline))
(define-syntax test-ssre
(syntax-rules ()
((test-ssre pat res)
(test-equal 'res (ssre->sre 'pat)))))
(define-syntax test-sre
(syntax-rules ()
((test-sre sre ssre)
(test-equal 'ssre (sre->ssre 'sre)))))
; save default definitions
(define *ssre-definitions* (ssre-definitions))
; add some random definitions for the ssre tests
(ssre-definitions
(ssre-bind 'Any 'cset 'any
(ssre-bind 'Nd 'cset 'numeric
(ssre-bind 'vowel 'cset '(or #\a #\e #\i #\o #\u #\y #\w)
(ssre-bind 'Vowel 'cset '(or #\A #\E #\I #\O #\U #\Y #\W)
(ssre-bind 'L 'cset 'alpha
(ssre-bind 'Ll 'cset 'lower
(ssre-bind 'Lu 'cset 'upper
*ssre-definitions*))))))))
; NOTE: translations on the right are not the only correct ones; there can be equivalent translations, which are also correct
(test-ssre "the quick brown fox" (: #\t #\h #\e #\space #\q #\u #\i #\c #\k #\space #\b #\r #\o #\w #\n #\space #\f #\o #\x))
(test-ssre "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz" (: (* #\a) #\a #\b (? #\c) #\x #\y (+ #\z) #\p #\q (= 3 #\r) #\a (>= 2 #\b) #\x (** 4 5 #\y) #\p (** 0 6 #\q) #\A (>= 0 #\B) #\z #\z))
(test-ssre "^(abc){1,2}zz" (: bos (** 1 2 ($ (: #\a #\b #\c))) #\z #\z))
(test-ssre "^(b+?|a){1,2}?c" (: bos (**? 1 2 ($ (or (**? 1 #f #\b) #\a))) #\c))
(test-ssre "^(b+|a){1,2}c" (: bos (** 1 2 ($ (or (+ #\b) #\a))) #\c))
(test-ssre "^(ba|b*){1,2}?bc" (: bos (**? 1 2 ($ (or (: #\b #\a) (* #\b)))) #\b #\c))
(test-ssre "^[ab\\]cde]" (: bos (or #\a #\b #\] #\c #\d #\e)))
(test-ssre "^[]cde]" (: bos (or #\] #\c #\d #\e)))
(test-ssre "^[^ab\\]cde]" (: bos (~ (or #\a #\b #\] #\c #\d #\e))))
(test-ssre "^[^]cde]" (: bos (~ (or #\] #\c #\d #\e))))
(test-ssre "^@" (: bos #\@))
(test-ssre "^[0-9]+$" (: bos (+ (char-range #\0 #\9)) eos))
(test-ssre "^.*nter" (: bos (* nonl) #\n #\t #\e #\r))
(test-ssre "^xxx[0-9]+$" (: bos #\x #\x #\x (+ (char-range #\0 #\9)) eos))
(test-ssre "^.+[0-9][0-9][0-9]$" (: bos (+ nonl) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) eos))
(test-ssre "^.+?[0-9][0-9][0-9]$" (: bos (**? 1 #f nonl) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) eos))
(test-ssre "^([^!]+)!(.+)=apquxz\\.ixr\\.zzz\\.ac\\.uk$" (: bos ($ (+ (~ #\!))) #\! ($ (+ nonl)) #\= #\a #\p #\q #\u #\x #\z #\. #\i #\x #\r #\. #\z #\z #\z #\. #\a #\c #\. #\u #\k eos))
(test-ssre ":" #\:)
(test-ssre "([\\da-f:]+)$" (: ($ (+ (or numeric (char-range #\a #\f) #\:))) eos))
(test-ssre "^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$" (: bos (* nonl) #\. ($ (** 1 3 numeric)) #\. ($ (** 1 3 numeric)) #\. ($ (** 1 3 numeric)) eos))
(test-ssre "^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$" (: bos ($ (+ numeric)) (+ space) #\I #\N (+ space) #\S #\O #\A (+ space) ($ (+ (~ space))) (+ space) ($ (+ (~ space))) (* space) #\( (* space) eos))
(test-ssre "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-Z\\d\\-]*)*\\.$" (: bos (or (char-range #\a #\z) (char-range #\A #\Z) numeric) (* (or (char-range #\a #\z) (char-range #\A #\Z) numeric #\-)) (* ($ (: #\. (or (char-range #\a #\z) (char-range #\A #\Z) numeric) (* (or (char-range #\a #\z) (char-range #\A #\Z) numeric #\-))))) #\. eos))
(test-ssre "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$" (: bos #\* #\. (char-range #\a #\z) (? ($ (: (* (or (char-range #\a #\z) #\- numeric)) (+ (or (char-range #\a #\z) numeric))))) (* ($ (: #\. (char-range #\a #\z) (? ($ (: (* (or (char-range #\a #\z) #\- numeric)) (+ (or (char-range #\a #\z) numeric)))))))) eos))
(test-ssre "^(?=ab(de))(abd)(e)" (: bos (look-ahead (: #\a #\b ($ (: #\d #\e)))) ($ (: #\a #\b #\d)) ($ #\e)))
(test-ssre "^(?!(ab)de|x)(abd)(f)" (: bos (neg-look-ahead (or (: ($ (: #\a #\b)) #\d #\e) #\x)) ($ (: #\a #\b #\d)) ($ #\f)))
(test-ssre "^(?=(ab(cd)))(ab)" (: bos (look-ahead ($ (: #\a #\b ($ (: #\c #\d))))) ($ (: #\a #\b))))
(test-ssre "^[\\da-f](\\.[\\da-f])*$" (: bos (or numeric (char-range #\a #\f)) (* ($ (: #\. (or numeric (char-range #\a #\f))))) eos))
(test-ssre "^\".*\"\\s*(;.*)?$" (: bos #\" (* nonl) #\" (* space) (? ($ (: #\; (* nonl)))) eos))
(test-ssre "^$" (: bos eos))
(test-ssre "(?x)^ a\\ b[c ]d $" (: bos #\a #\space #\b (or #\c #\space) #\d eos))
(test-ssre "^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$" (: bos ($ (: #\a ($ (: #\b ($ #\c))))) ($ (: #\d ($ (: #\e ($ #\f))))) ($ (: #\h ($ (: #\i ($ #\j))))) ($ (: #\k ($ (: #\l ($ #\m))))) eos))
(test-ssre "^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$" (: bos (: #\a ($ (: #\b ($ #\c)))) (: #\d ($ (: #\e ($ #\f)))) (: #\h ($ (: #\i ($ #\j)))) (: #\k ($ (: #\l ($ #\m)))) eos))
(test-ssre "^[\\w][\\W][\\s][\\S][\\d][\\D]\\]" (: bos (or alnum #\_) (~ (or alnum #\_)) space (~ space) numeric (~ numeric) #\]))
(test-ssre "^[.^$|()*+?{,}]+" (: bos (+ (or #\. #\^ #\$ #\| #\( #\) #\* #\+ #\? #\{ #\, #\}))))
(test-ssre "^a*\\w" (: bos (* #\a) (or alnum #\_)))
(test-ssre "^a*?\\w" (: bos (*? #\a) (or alnum #\_)))
(test-ssre "^a+\\w" (: bos (+ #\a) (or alnum #\_)))
(test-ssre "^a+?\\w" (: bos (**? 1 #f #\a) (or alnum #\_)))
(test-ssre "^\\d{8}\\w{2,}" (: bos (= 8 numeric) (>= 2 (or alnum #\_))))
(test-ssre "^[aeiou\\d]{4,5}$" (: bos (** 4 5 (or #\a #\e #\i #\o #\u numeric)) eos))
(test-ssre "^[aeiou\\d]{4,5}?" (: bos (**? 4 5 (or #\a #\e #\i #\o #\u numeric))))
(test-ssre "^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]" (: bos #\F #\r #\o #\m (+ #\space) ($ (+ (~ #\space))) (+ #\space) (or (char-range #\a #\z) (char-range #\A #\Z)) (or (char-range #\a #\z) (char-range #\A #\Z)) (or (char-range #\a #\z) (char-range #\A #\Z)) (+ #\space) (or (char-range #\a #\z) (char-range #\A #\Z)) (or (char-range #\a #\z) (char-range #\A #\Z)) (or (char-range #\a #\z) (char-range #\A #\Z)) (+ #\space) (? (char-range #\0 #\9)) (char-range #\0 #\9) (+ #\space) (char-range #\0 #\9) (char-range #\0 #\9) #\: (char-range #\0 #\9) (char-range #\0 #\9)))
(test-ssre "^From\\s+\\S+\\s+([a-zA-Z]{3}\\s+){2}\\d{1,2}\\s+\\d\\d:\\d\\d" (: bos #\F #\r #\o #\m (+ space) (+ (~ space)) (+ space) (= 2 ($ (: (= 3 (or (char-range #\a #\z) (char-range #\A #\Z))) (+ space)))) (** 1 2 numeric) (+ space) numeric numeric #\: numeric numeric))
(test-ssre "^12.34" (: bos #\1 #\2 nonl #\3 #\4))
(test-ssre "foo(?!bar)(.*)" (: #\f #\o #\o (neg-look-ahead (: #\b #\a #\r)) ($ (* nonl))))
(test-ssre "(?:(?!foo)...|^.{0,2})bar(.*)" (: (or (: (neg-look-ahead (: #\f #\o #\o)) nonl nonl nonl) (: bos (** 0 2 nonl))) #\b #\a #\r ($ (* nonl))))
(test-ssre "^(\\D*)(?=\\d)(?!123)" (: bos ($ (* (~ numeric))) (look-ahead numeric) (neg-look-ahead (: #\1 #\2 #\3))))
(test-ssre "(?!^)abc" (: (neg-look-ahead bos) #\a #\b #\c))
(test-ssre "(?=^)abc" (: (look-ahead bos) #\a #\b #\c))
(test-ssre "^[ab]{1,3}(ab*|b)" (: bos (** 1 3 (or #\a #\b)) ($ (or (: #\a (* #\b)) #\b))))
(test-ssre "^[ab]{1,3}?(ab*|b)" (: bos (**? 1 3 (or #\a #\b)) ($ (or (: #\a (* #\b)) #\b))))
(test-ssre "^[ab]{1,3}?(ab*?|b)" (: bos (**? 1 3 (or #\a #\b)) ($ (or (: #\a (*? #\b)) #\b))))
(test-ssre "^[ab]{1,3}(ab*?|b)" (: bos (** 1 3 (or #\a #\b)) ($ (or (: #\a (*? #\b)) #\b))))
(test-ssre "ab{1,3}bc" (: #\a (** 1 3 #\b) #\b #\c))
(test-ssre "([^.]*)\\.([^:]*):[T ]+(.*)" (: ($ (* (~ #\.))) #\. ($ (* (~ #\:))) #\: (+ (or #\T #\space)) ($ (* nonl))))
(test-ssre "^[W-c]+$" (: bos (+ (char-range #\W #\c)) eos))
(test-ssre "^[?-_]+$" (: bos (+ (char-range #\? #\_)) eos))
(test-ssre "^abc$" (: bos #\a #\b #\c eos))
(test-ssre "\\Aabc\\z" (: bos #\a #\b #\c eos))
(test-ssre "\\A(.)*\\z" (: bos (* ($ nonl)) eos))
(test-ssre "(?:b)|(?::+)" (or #\b (+ #\:)))
(test-ssre "[-az]+" (+ (or #\- #\a #\z)))
(test-ssre "[az-]+" (+ (or #\a #\z #\-)))
(test-ssre "[a\\-z]+" (+ (or #\a #\- #\z)))
(test-ssre "[a-z]+" (+ (char-range #\a #\z)))
(test-ssre "[\\d-]+" (+ (or numeric #\-)))
(test-ssre "\\\\" #\\)
(test-ssre "a{0}bc" (: (= 0 #\a) #\b #\c))
(test-ssre "(a|(bc)){0,0}?xyz" (: (**? 0 0 ($ (or #\a ($ (: #\b #\c))))) #\x #\y #\z))
(test-ssre "^([^a])([^b])([^c]*)([^d]{3,4})" (: bos ($ (~ #\a)) ($ (~ #\b)) ($ (* (~ #\c))) ($ (** 3 4 (~ #\d)))))
(test-ssre "[^a]" (~ #\a))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "[^k]$" (: (~ #\k) eos))
(test-ssre "[^k]{2,3}$" (: (** 2 3 (~ #\k)) eos))
(test-ssre "^\\d{8,}@.+[^k]$" (: bos (>= 8 numeric) #\@ (+ nonl) (~ #\k) eos))
(test-ssre "[^a]" (~ #\a))
(test-ssre "[^az]" (~ (or #\a #\z)))
(test-ssre "P[^*]TAIRE[^*]{1,6}?LL" (: #\P (~ #\*) #\T #\A #\I #\R #\E (**? 1 6 (~ #\*)) #\L #\L))
(test-ssre "P[^*]TAIRE[^*]{1,}?LL" (: #\P (~ #\*) #\T #\A #\I #\R #\E (**? 1 #f (~ #\*)) #\L #\L))
(test-ssre "(\\.\\d\\d[1-9]?)\\d+" (: ($ (: #\. numeric numeric (? (char-range #\1 #\9)))) (+ numeric)))
(test-ssre "(\\.\\d\\d((?=0)|\\d(?=\\d)))" ($ (: #\. numeric numeric ($ (or (look-ahead #\0) (: numeric (look-ahead numeric)))))))
(test-ssre "\\b(foo)\\s+(\\w+)" (: (or bow eow) ($ (: #\f #\o #\o)) (+ space) ($ (+ (or alnum #\_)))))
(test-ssre "foo(.*)bar" (: #\f #\o #\o ($ (* nonl)) #\b #\a #\r))
(test-ssre "foo(.*?)bar" (: #\f #\o #\o ($ (*? nonl)) #\b #\a #\r))
(test-ssre "(.*)(\\d*)" (: ($ (* nonl)) ($ (* numeric))))
(test-ssre "(.*)(\\d+)" (: ($ (* nonl)) ($ (+ numeric))))
(test-ssre "(.*?)(\\d*)" (: ($ (*? nonl)) ($ (* numeric))))
(test-ssre "(.*?)(\\d+)" (: ($ (*? nonl)) ($ (+ numeric))))
(test-ssre "(.*)(\\d+)$" (: ($ (* nonl)) ($ (+ numeric)) eos))
(test-ssre "(.*?)(\\d+)$" (: ($ (*? nonl)) ($ (+ numeric)) eos))
(test-ssre "(.*)\\b(\\d+)$" (: ($ (* nonl)) (or bow eow) ($ (+ numeric)) eos))
(test-ssre "(.*\\D)(\\d+)$" (: ($ (: (* nonl) (~ numeric))) ($ (+ numeric)) eos))
(test-ssre "^\\D*(?!123)" (: bos (* (~ numeric)) (neg-look-ahead (: #\1 #\2 #\3))))
(test-ssre "^(\\D*)(?=\\d)(?!123)" (: bos ($ (* (~ numeric))) (look-ahead numeric) (neg-look-ahead (: #\1 #\2 #\3))))
(test-ssre "^[W-]46\\]" (: bos (or #\W #\-) #\4 #\6 #\]))
(test-ssre "^[W-\\]46]" (: bos (or (char-range #\W #\]) #\4 #\6)))
(test-ssre "word (?:[a-zA-Z0-9]+ ){0,10}otherword" (: #\w #\o #\r #\d #\space (** 0 10 (: (+ (or (char-range #\a #\z) (char-range #\A #\Z) (char-range #\0 #\9))) #\space)) #\o #\t #\h #\e #\r #\w #\o #\r #\d))
(test-ssre "word (?:[a-zA-Z0-9]+ ){0,300}otherword" (: #\w #\o #\r #\d #\space (** 0 300 (: (+ (or (char-range #\a #\z) (char-range #\A #\Z) (char-range #\0 #\9))) #\space)) #\o #\t #\h #\e #\r #\w #\o #\r #\d))
(test-ssre "^(a){0,0}" (: bos (= 0 ($ #\a))))
(test-ssre "^(a){0,1}" (: bos (** 0 1 ($ #\a))))
(test-ssre "^(a){0,2}" (: bos (** 0 2 ($ #\a))))
(test-ssre "^(a){0,3}" (: bos (** 0 3 ($ #\a))))
(test-ssre "^(a){0,}" (: bos (>= 0 ($ #\a))))
(test-ssre "^(a){1,1}" (: bos (= 1 ($ #\a))))
(test-ssre "^(a){1,2}" (: bos (** 1 2 ($ #\a))))
(test-ssre "^(a){1,3}" (: bos (** 1 3 ($ #\a))))
(test-ssre "^(a){1,}" (: bos (>= 1 ($ #\a))))
(test-ssre ".*\\.gif" (: (* nonl) #\. #\g #\i #\f))
(test-ssre ".{0,}\\.gif" (: (>= 0 nonl) #\. #\g #\i #\f))
(test-ssre ".*\\.gif" (: (* nonl) #\. #\g #\i #\f))
(test-ssre ".*\\.gif" (: (* nonl) #\. #\g #\i #\f))
(test-ssre ".*\\.gif" (: (* nonl) #\. #\g #\i #\f))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre ".*$" (: (* nonl) eos))
(test-ssre "(.*X|^B)" ($ (or (: (* nonl) #\X) (: bos #\B))))
(test-ssre "^.*B" (: bos (* nonl) #\B))
(test-ssre "(?m)^.*B" (: bol (* nonl) #\B))
(test-ssre "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" (: bos (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9)))
(test-ssre "^\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d" (: bos numeric numeric numeric numeric numeric numeric numeric numeric numeric numeric numeric numeric))
(test-ssre "^[\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d][\\d]" (: bos numeric numeric numeric numeric numeric numeric numeric numeric numeric numeric numeric numeric))
(test-ssre "^[abc]{12}" (: bos (= 12 (or #\a #\b #\c))))
(test-ssre "^[a-c]{12}" (: bos (= 12 (char-range #\a #\c))))
(test-ssre "^(a|b|c){12}" (: bos (= 12 ($ (or #\a #\b #\c)))))
(test-ssre "^[abcdefghijklmnopqrstuvwxy0123456789]" (: bos (or #\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 #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
(test-ssre "abcde{0,0}" (: #\a #\b #\c #\d (= 0 #\e)))
(test-ssre "ab[cd]{0,0}e" (: #\a #\b (= 0 (or #\c #\d)) #\e))
(test-ssre "ab(c){0,0}d" (: #\a #\b (= 0 ($ #\c)) #\d))
(test-ssre "a(b*)" (: #\a ($ (* #\b))))
(test-ssre "ab\\d{0}e" (: #\a #\b (= 0 numeric) #\e))
(test-ssre "\"([^\\\\\"]+|\\\\.)*\"" (: #\" (* ($ (or (+ (~ (or #\\ #\"))) (: #\\ nonl)))) #\"))
(test-ssre ".*?" (*? nonl))
(test-ssre "\\b" (or bow eow))
(test-ssre "\\b" (or bow eow))
(test-ssre "a[^a]b" (: #\a (~ #\a) #\b))
(test-ssre "a.b" (: #\a nonl #\b))
(test-ssre "a[^a]b" (: #\a (~ #\a) #\b))
(test-ssre "a.b" (: #\a nonl #\b))
(test-ssre "^(b+?|a){1,2}?c" (: bos (**? 1 2 ($ (or (**? 1 #f #\b) #\a))) #\c))
(test-ssre "^(b+|a){1,2}?c" (: bos (**? 1 2 ($ (or (+ #\b) #\a))) #\c))
(test-ssre "(?!\\A)x" (: (neg-look-ahead bos) #\x))
(test-ssre "(A|B)*?CD" (: (*? ($ (or #\A #\B))) #\C #\D))
(test-ssre "(A|B)*CD" (: (* ($ (or #\A #\B))) #\C #\D))
(test-ssre "(?<!bar)foo" (: (neg-look-behind (: #\b #\a #\r)) #\f #\o #\o))
(test-ssre "\\w{3}(?<!bar)foo" (: (= 3 (or alnum #\_)) (neg-look-behind (: #\b #\a #\r)) #\f #\o #\o))
(test-ssre "(?<=(foo)a)bar" (: (look-behind (: ($ (: #\f #\o #\o)) #\a)) #\b #\a #\r))
(test-ssre "\\Aabc\\z" (: bos #\a #\b #\c eos))
(test-ssre "(\\d+)(\\w)" (: ($ (+ numeric)) ($ (or alnum #\_))))
(test-ssre "a(?i:b)c" (: #\a (w/nocase #\b) #\c))
(test-ssre "a(?i:b)*c" (: #\a (* (w/nocase #\b)) #\c))
(test-ssre "([a]*?)*" (* ($ (*? #\a))))
(test-ssre "([ab]*?)*" (* ($ (*? (or #\a #\b)))))
(test-ssre "([^a]*?)*" (* ($ (*? (~ #\a)))))
(test-ssre "([^ab]*?)*" (* ($ (*? (~ (or #\a #\b))))))
(test-ssre "(?<=foo\n)^bar" (: (look-behind (: #\f #\o #\o #\newline)) bos #\b #\a #\r))
(test-ssre "(?<=(?<!foo)bar)baz" (: (look-behind (: (neg-look-behind (: #\f #\o #\o)) #\b #\a #\r)) #\b #\a #\z))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "ab*c" (: #\a (* #\b) #\c))
(test-ssre "ab*bc" (: #\a (* #\b) #\b #\c))
(test-ssre ".{1}" (= 1 nonl))
(test-ssre ".{3,4}" (** 3 4 nonl))
(test-ssre "ab{0,}bc" (: #\a (>= 0 #\b) #\b #\c))
(test-ssre "ab+bc" (: #\a (+ #\b) #\b #\c))
(test-ssre "ab{1,}bc" (: #\a (>= 1 #\b) #\b #\c))
(test-ssre "ab+bc" (: #\a (+ #\b) #\b #\c))
(test-ssre "ab{1,}bc" (: #\a (>= 1 #\b) #\b #\c))
(test-ssre "ab{1,3}bc" (: #\a (** 1 3 #\b) #\b #\c))
(test-ssre "ab{3,4}bc" (: #\a (** 3 4 #\b) #\b #\c))
(test-ssre "ab{4,5}bc" (: #\a (** 4 5 #\b) #\b #\c))
(test-ssre "ab?bc" (: #\a (? #\b) #\b #\c))
(test-ssre "ab{0,1}bc" (: #\a (** 0 1 #\b) #\b #\c))
(test-ssre "ab?bc" (: #\a (? #\b) #\b #\c))
(test-ssre "ab?c" (: #\a (? #\b) #\c))
(test-ssre "ab{0,1}c" (: #\a (** 0 1 #\b) #\c))
(test-ssre "^abc$" (: bos #\a #\b #\c eos))
(test-ssre "^abc" (: bos #\a #\b #\c))
(test-ssre "^abc$" (: bos #\a #\b #\c eos))
(test-ssre "abc$" (: #\a #\b #\c eos))
(test-ssre "^" bos)
(test-ssre "$" eos)
(test-ssre "a.c" (: #\a nonl #\c))
(test-ssre "a.*c" (: #\a (* nonl) #\c))
(test-ssre "a[bc]d" (: #\a (or #\b #\c) #\d))
(test-ssre "a[b-d]e" (: #\a (char-range #\b #\d) #\e))
(test-ssre "a[b-d]" (: #\a (char-range #\b #\d)))
(test-ssre "a[-b]" (: #\a (or #\- #\b)))
(test-ssre "a[b-]" (: #\a (or #\b #\-)))
(test-ssre "a\\]" (: #\a #\]))
(test-ssre "a[]]b" (: #\a #\] #\b))
(test-ssre "a[^bc]d" (: #\a (~ (or #\b #\c)) #\d))
(test-ssre "a[^-b]c" (: #\a (~ (or #\- #\b)) #\c))
(test-ssre "a[^]b]c" (: #\a (~ (or #\] #\b)) #\c))
(test-ssre "\\ba\\b" (: (or bow eow) #\a (or bow eow)))
(test-ssre "\\by\\b" (: (or bow eow) #\y (or bow eow)))
(test-ssre "\\Ba\\B" (: nwb #\a nwb))
(test-ssre "\\By\\b" (: nwb #\y (or bow eow)))
(test-ssre "\\by\\B" (: (or bow eow) #\y nwb))
(test-ssre "\\By\\B" (: nwb #\y nwb))
(test-ssre "\\w" (or alnum #\_))
(test-ssre "\\W" (~ (or alnum #\_)))
(test-ssre "a\\sb" (: #\a space #\b))
(test-ssre "a\\Sb" (: #\a (~ space) #\b))
(test-ssre "\\d" numeric)
(test-ssre "\\D" (~ numeric))
(test-ssre "ab|cd" (or (: #\a #\b) (: #\c #\d)))
(test-ssre "()ef" (: ($ (:)) #\e #\f))
(test-ssre "$b" (: eos #\b))
(test-ssre "a\\(b" (: #\a #\( #\b))
(test-ssre "a\\(*b" (: #\a (* #\() #\b))
(test-ssre "a\\\\b" (: #\a #\\ #\b))
(test-ssre "((a))" ($ ($ #\a)))
(test-ssre "(a)b(c)" (: ($ #\a) #\b ($ #\c)))
(test-ssre "a+b+c" (: (+ #\a) (+ #\b) #\c))
(test-ssre "a{1,}b{1,}c" (: (>= 1 #\a) (>= 1 #\b) #\c))
(test-ssre "a.+?c" (: #\a (**? 1 #f nonl) #\c))
(test-ssre "(a+|b)*" (* ($ (or (+ #\a) #\b))))
(test-ssre "(a+|b){0,}" (>= 0 ($ (or (+ #\a) #\b))))
(test-ssre "(a+|b)+" (+ ($ (or (+ #\a) #\b))))
(test-ssre "(a+|b){1,}" (>= 1 ($ (or (+ #\a) #\b))))
(test-ssre "(a+|b)?" (? ($ (or (+ #\a) #\b))))
(test-ssre "(a+|b){0,1}" (** 0 1 ($ (or (+ #\a) #\b))))
(test-ssre "[^ab]*" (* (~ (or #\a #\b))))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "a*" (* #\a))
(test-ssre "([abc])*d" (: (* ($ (or #\a #\b #\c))) #\d))
(test-ssre "([abc])*bcd" (: (* ($ (or #\a #\b #\c))) #\b #\c #\d))
(test-ssre "a|b|c|d|e" (or #\a #\b #\c #\d #\e))
(test-ssre "(a|b|c|d|e)f" (: ($ (or #\a #\b #\c #\d #\e)) #\f))
(test-ssre "abcd*efg" (: #\a #\b #\c (* #\d) #\e #\f #\g))
(test-ssre "ab*" (: #\a (* #\b)))
(test-ssre "(ab|cd)e" (: ($ (or (: #\a #\b) (: #\c #\d))) #\e))
(test-ssre "[abhgefdc]ij" (: (or #\a #\b #\h #\g #\e #\f #\d #\c) #\i #\j))
(test-ssre "^(ab|cd)e" (: bos ($ (or (: #\a #\b) (: #\c #\d))) #\e))
(test-ssre "(abc|)ef" (: ($ (or (: #\a #\b #\c) (:))) #\e #\f))
(test-ssre "(a|b)c*d" (: ($ (or #\a #\b)) (* #\c) #\d))
(test-ssre "(ab|ab*)bc" (: ($ (or (: #\a #\b) (: #\a (* #\b)))) #\b #\c))
(test-ssre "a([bc]*)c*" (: #\a ($ (* (or #\b #\c))) (* #\c)))
(test-ssre "a([bc]*)(c*d)" (: #\a ($ (* (or #\b #\c))) ($ (: (* #\c) #\d))))
(test-ssre "a([bc]+)(c*d)" (: #\a ($ (+ (or #\b #\c))) ($ (: (* #\c) #\d))))
(test-ssre "a([bc]*)(c+d)" (: #\a ($ (* (or #\b #\c))) ($ (: (+ #\c) #\d))))
(test-ssre "a[bcd]*dcdcde" (: #\a (* (or #\b #\c #\d)) #\d #\c #\d #\c #\d #\e))
(test-ssre "a[bcd]+dcdcde" (: #\a (+ (or #\b #\c #\d)) #\d #\c #\d #\c #\d #\e))
(test-ssre "(ab|a)b*c" (: ($ (or (: #\a #\b) #\a)) (* #\b) #\c))
(test-ssre "((a)(b)c)(d)" (: ($ (: ($ #\a) ($ #\b) #\c)) ($ #\d)))
(test-ssre "[a-zA-Z_][a-zA-Z0-9_]*" (: (or (char-range #\a #\z) (char-range #\A #\Z) #\_) (* (or (char-range #\a #\z) (char-range #\A #\Z) (char-range #\0 #\9) #\_))))
(test-ssre "^a(bc+|b[eh])g|.h$" (or (: bos #\a ($ (or (: #\b (+ #\c)) (: #\b (or #\e #\h)))) #\g) (: nonl #\h eos)))
(test-ssre "(bc+d$|ef*g.|h?i(j|k))" ($ (or (: #\b (+ #\c) #\d eos) (: #\e (* #\f) #\g nonl) (: (? #\h) #\i ($ (or #\j #\k))))))
(test-ssre "((((((((((a))))))))))" ($ ($ ($ ($ ($ ($ ($ ($ ($ ($ #\a)))))))))))
(test-ssre "(((((((((a)))))))))" ($ ($ ($ ($ ($ ($ ($ ($ ($ #\a))))))))))
(test-ssre "multiple words of text" (: #\m #\u #\l #\t #\i #\p #\l #\e #\space #\w #\o #\r #\d #\s #\space #\o #\f #\space #\t #\e #\x #\t))
(test-ssre "multiple words" (: #\m #\u #\l #\t #\i #\p #\l #\e #\space #\w #\o #\r #\d #\s))
(test-ssre "(.*)c(.*)" (: ($ (* nonl)) #\c ($ (* nonl))))
(test-ssre "\\((.*), (.*)\\)" (: #\( ($ (* nonl)) #\, #\space ($ (* nonl)) #\)))
(test-ssre "[k]" #\k)
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "a(bc)d" (: #\a ($ (: #\b #\c)) #\d))
(test-ssre "a[-]?c" (: #\a (? #\-) #\c))
(test-ssre "a(?!b)." (: #\a (neg-look-ahead #\b) nonl))
(test-ssre "a(?=d)." (: #\a (look-ahead #\d) nonl))
(test-ssre "a(?=c|d)." (: #\a (look-ahead (or #\c #\d)) nonl))
(test-ssre "a(?:b|c|d)(.)" (: #\a (or #\b #\c #\d) ($ nonl)))
(test-ssre "a(?:b|c|d)*(.)" (: #\a (* (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d)+?(.)" (: #\a (**? 1 #f (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d)+(.)" (: #\a (+ (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){2}(.)" (: #\a (= 2 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){4,5}(.)" (: #\a (** 4 5 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){4,5}?(.)" (: #\a (**? 4 5 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){6,7}(.)" (: #\a (** 6 7 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){6,7}?(.)" (: #\a (**? 6 7 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){5,6}(.)" (: #\a (** 5 6 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){5,6}?(.)" (: #\a (**? 5 6 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){5,7}(.)" (: #\a (** 5 7 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|c|d){5,7}?(.)" (: #\a (**? 5 7 (or #\b #\c #\d)) ($ nonl)))
(test-ssre "a(?:b|(c|e){1,2}?|d)+?(.)" (: #\a (**? 1 #f (or #\b (**? 1 2 ($ (or #\c #\e))) #\d)) ($ nonl)))
(test-ssre "^(.+)?B" (: bos (? ($ (+ nonl))) #\B))
(test-ssre "^([^a-z])|(\\^)$" (or (: bos ($ (~ (char-range #\a #\z)))) (: ($ #\^) eos)))
(test-ssre "^[<>]&" (: bos (or #\< #\>) #\&))
(test-ssre "(?<=a)b" (: (look-behind #\a) #\b))
(test-ssre "(?<!c)b" (: (neg-look-behind #\c) #\b))
(test-ssre "(?:..)*a" (: (* (: nonl nonl)) #\a))
(test-ssre "(?:..)*?a" (: (*? (: nonl nonl)) #\a))
(test-ssre "^(){3,5}" (: bos (** 3 5 ($ (:)))))
(test-ssre "(a|x)*ab" (: (* ($ (or #\a #\x))) #\a #\b))
(test-ssre "(a)*ab" (: (* ($ #\a)) #\a #\b))
(test-ssre "(?i:a)b" (: (w/nocase #\a) #\b))
(test-ssre "((?i:a))b" (: ($ (w/nocase #\a)) #\b))
(test-ssre "(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))" (: (or #\c #\d) (:) (: #\a (:) #\b (: #\b (:)) (: #\b (:) #\b))))
(test-ssre "(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))" (: (or #\c #\d) (:) (: #\a #\a #\a #\a #\a #\a #\a #\a (:) (: #\b #\b #\b #\b #\b #\b #\b #\b) (: #\b #\b #\b #\b #\b #\b #\b #\b (:)) (: #\b #\b #\b #\b #\b #\b #\b #\b (:) (: #\b #\b #\b #\b #\b #\b #\b #\b)))))
(test-ssre "foo\\w*\\d{4}baz" (: #\f #\o #\o (* (or alnum #\_)) (= 4 numeric) #\b #\a #\z))
(test-ssre "x(~~)*(?:(?:F)?)?" (: #\x (* ($ (: #\~ #\~))) (?? #\F)))
(test-ssre "(?<![cd])b" (: (neg-look-behind (or #\c #\d)) #\b))
(test-ssre "(?<![cd])[ab]" (: (neg-look-behind (or #\c #\d)) (or #\a #\b)))
(test-ssre "(?<!(c|d))b" (: (neg-look-behind ($ (or #\c #\d))) #\b))
(test-ssre "(?<!(c|d))[ab]" (: (neg-look-behind ($ (or #\c #\d))) (or #\a #\b)))
(test-ssre "(?<!cd)[ab]" (: (neg-look-behind (: #\c #\d)) (or #\a #\b)))
(test-ssre "(?m)^b" (: bol #\b))
(test-ssre "(?m)^(b)" (: bol ($ #\b)))
(test-ssre "^b" (: bos #\b))
(test-ssre "()^b" (: ($ (:)) bos #\b))
(test-ssre "(\\w+:)+" (+ ($ (: (+ (or alnum #\_)) #\:))))
(test-ssre "$(?<=^(a))" (: eos (look-behind (: bos ($ #\a)))))
(test-ssre "([\\w:]+::)?(\\w+)$" (: (? ($ (: (+ (or alnum #\_ #\:)) #\: #\:))) ($ (+ (or alnum #\_))) eos))
(test-ssre "^[^bcd]*(c+)" (: bos (* (~ (or #\b #\c #\d))) ($ (+ #\c))))
(test-ssre "(a*)b+" (: ($ (* #\a)) (+ #\b)))
(test-ssre "^[^bcd]*(c+)" (: bos (* (~ (or #\b #\c #\d))) ($ (+ #\c))))
(test-ssre "(>a+)ab" (: ($ (: #\> (+ #\a))) #\a #\b))
(test-ssre "b\\z" (: #\b eos))
(test-ssre "(?<=\\d{3}(?!999))foo" (: (look-behind (: (= 3 numeric) (neg-look-ahead (: #\9 #\9 #\9)))) #\f #\o #\o))
(test-ssre "(?<=(?!...999)\\d{3})foo" (: (look-behind (: (neg-look-ahead (: nonl nonl nonl #\9 #\9 #\9)) (= 3 numeric))) #\f #\o #\o))
(test-ssre "(?<=\\d{3}(?!999)...)foo" (: (look-behind (: (= 3 numeric) (neg-look-ahead (: #\9 #\9 #\9)) nonl nonl nonl)) #\f #\o #\o))
(test-ssre "(?<=\\d{3}...)(?<!999)foo" (: (look-behind (: (= 3 numeric) nonl nonl nonl)) (neg-look-behind (: #\9 #\9 #\9)) #\f #\o #\o))
(test-ssre "(Z()|A)*" (* ($ (or (: #\Z ($ (:))) #\A))))
(test-ssre "(Z(())|A)*" (* ($ (or (: #\Z ($ ($ (:)))) #\A))))
(test-ssre "a*" (* #\a))
(test-ssre "\\s+" (+ space))
(test-ssre "(?!\\A)x" (: (neg-look-ahead bos) #\x))
(test-ssre "(?!^)x" (: (neg-look-ahead bos) #\x))
(test-ssre "abc." (: #\a #\b #\c nonl))
(test-ssre "a(?x: b c )d" (: #\a (: #\b #\c) #\d))
(test-ssre "(?<=Z)X." (: (look-behind #\Z) #\X nonl))
(test-ssre "(?<![^f]oo)(bar)" (: (neg-look-behind (: (~ #\f) #\o #\o)) ($ (: #\b #\a #\r))))
(test-ssre "(?<![^f])X" (: (neg-look-behind (~ #\f)) #\X))
(test-ssre "(?<=[^f])X" (: (look-behind (~ #\f)) #\X))
(test-ssre "^" bos)
(test-ssre "(?x)(?-x: )" #\space)
(test-ssre "(?x)(?-x: \\s*#\\s*)" (: #\space (* space) #\# (* space)))
(test-ssre "a*b*\\w" (: (* #\a) (* #\b) (or alnum #\_)))
(test-ssre "a*b?\\w" (: (* #\a) (? #\b) (or alnum #\_)))
(test-ssre "a*b{0,4}\\w" (: (* #\a) (** 0 4 #\b) (or alnum #\_)))
(test-ssre "a*b{0,}\\w" (: (* #\a) (>= 0 #\b) (or alnum #\_)))
(test-ssre "a*\\d*\\w" (: (* #\a) (* numeric) (or alnum #\_)))
(test-ssre "(?x)a*b *\\w" (: (* #\a) (* #\b) (or alnum #\_)))
(test-ssre "(?x)a* b *\\w" (: (* #\a) (* #\b) (or alnum #\_)))
(test-ssre "\\z(?<!\n)" (: eos (neg-look-behind #\newline)))
(test-ssre ".*[op][xyz]" (: (* nonl) (or #\o #\p) (or #\x #\y #\z)))
(test-ssre "(a)b|(a)c" (or (: ($ #\a) #\b) (: ($ #\a) #\c)))
(test-ssre "(?:a+|ab)+c" (: (+ (or (+ #\a) (: #\a #\b))) #\c))
(test-ssre "^(?:a|ab)+c" (: bos (+ (or #\a (: #\a #\b))) #\c))
(test-ssre "(?=abc){3}abc" (: (= 3 (look-ahead (: #\a #\b #\c))) #\a #\b #\c))
(test-ssre "(?=abc){0}xyz" (: (= 0 (look-ahead (: #\a #\b #\c))) #\x #\y #\z))
(test-ssre "(?=abc){1}xyz" (: (= 1 (look-ahead (: #\a #\b #\c))) #\x #\y #\z))
(test-ssre "(?=(a))?." (: (? (look-ahead ($ #\a))) nonl))
(test-ssre "(?=(a))??." (: (?? (look-ahead ($ #\a))) nonl))
(test-ssre "^(?!a){0}\\w+" (: bos (= 0 (neg-look-ahead #\a)) (+ (or alnum #\_))))
(test-ssre "(?<=(abc))?xyz" (: (? (look-behind ($ (: #\a #\b #\c)))) #\x #\y #\z))
(test-ssre "^[:a[:digit:]]+" (: bos (+ (or #\: #\a numeric))))
(test-ssre "^[:a[:digit:]:b]+" (: bos (+ (or #\: #\a numeric #\: #\b))))
(test-ssre "[:a]xxx[b:]" (: (or #\: #\a) #\x #\x #\x (or #\b #\:)))
(test-ssre "(?<=[^a]{2})b" (: (look-behind (= 2 (~ #\a))) #\b))
(test-ssre "^(a{2,3}){2,}+a" (: bos (+ (>= 2 ($ (** 2 3 #\a)))) #\a))
(test-ssre "(?=C)" (look-ahead #\C))
(test-ssre "(?:a(?<quote> (?<apostrophe>')|(?<realquote>\")) |b(?<quote> (?<apostrophe>')|(?<realquote>\")) ) (\\k<quote>[a-z]+|[0-9]+)" (: (or (: #\a (-> quote (or (: #\space (-> apostrophe #\')) (-> realquote #\"))) #\space) (: #\b (-> quote (or (: #\space (-> apostrophe #\')) (-> realquote #\"))) #\space)) #\space ($ (or (: (backref quote) (+ (char-range #\a #\z))) (+ (char-range #\0 #\9))))))
(test-ssre "^(a){2,}+(\\w)" (: bos (+ (>= 2 ($ #\a))) ($ (or alnum #\_))))
(test-ssre "^(?:a){2,}+(\\w)" (: bos (+ (>= 2 #\a)) ($ (or alnum #\_))))
(test-ssre "\\A.*?(a|bc)" (: bos (*? nonl) ($ (or #\a (: #\b #\c)))))
(test-ssre "\\A.*?(?:a|bc|d)" (: bos (*? nonl) (or #\a (: #\b #\c) #\d)))
(test-ssre "(?:.*?a)(?<=ba)" (: (*? nonl) #\a (look-behind (: #\b #\a))))
(test-ssre "a(?=bc).|abd" (or (: #\a (look-ahead (: #\b #\c)) nonl) (: #\a #\b #\d)))
(test-ssre "\\A.*?(?:a|bc)" (: bos (*? nonl) (or #\a (: #\b #\c))))
(test-ssre "^\\d*\\w{4}" (: bos (* numeric) (= 4 (or alnum #\_))))
(test-ssre "^[^b]*\\w{4}" (: bos (* (~ #\b)) (= 4 (or alnum #\_))))
(test-ssre "^a*\\w{4}" (: bos (* #\a) (= 4 (or alnum #\_))))
(test-ssre "(?:(?<n>foo)|(?<n>bar))\\k<n>" (: (or (-> n (: #\f #\o #\o)) (-> n (: #\b #\a #\r))) (backref n)))
(test-ssre "(?<n>A)(?:(?<n>foo)|(?<n>bar))\\k<n>" (: (-> n #\A) (or (-> n (: #\f #\o #\o)) (-> n (: #\b #\a #\r))) (backref n)))
(test-ssre "^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$" (: bos ($ (+ numeric)) (+ space) #\I #\N (+ space) #\S #\O #\A (+ space) ($ (+ (~ space))) (+ space) ($ (+ (~ space))) (* space) #\( (* space) eos))
(test-ssre "(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc" (: (or #\x (or (+ ($ (or (: #\x #\x) (: #\y #\y)))) #\x #\x #\x #\x #\x) #\a #\a #\a) #\b #\c))
(test-ssre "\\sabc" (: space #\a #\b #\c))
(test-ssre "Z*(|d*){216}" (: (* #\Z) (= 216 ($ (or (:) (* #\d))))))
(test-ssre "(?<=a(B){0}c)X" (: (look-behind (: #\a (= 0 ($ #\B)) #\c)) #\X))
(test-ssre "a+(?:|b)a" (: (+ #\a) (or (:) #\b) #\a))
(test-ssre "X?(R||){3335}" (: (? #\X) (= 3335 ($ (or #\R (:) (:))))))
(test-ssre "(?!(b))c|b" (or (: (neg-look-ahead ($ #\b)) #\c) #\b))
(test-ssre "(?=(b))b|c" (or (: (look-ahead ($ #\b)) #\b) #\c))
(test-ssre "<(?x:[a b])>" (: #\< (or #\a #\space #\b) #\>))
(test-ssre "<(?:[a b])>" (: #\< (or #\a #\space #\b) #\>))
(test-ssre "<(?xxx:[a b])>" (: #\< (or #\a #\space #\b) #\>))
(test-ssre "<(?-x:[a b])>" (: #\< (or #\a #\space #\b) #\>))
(test-ssre "[[:digit:]-]+" (+ (or numeric #\-)))
(test-ssre "(?<=(?=.)?)" (look-behind (? (look-ahead nonl))))
(test-ssre "(?<=(?=.){4,5})" (look-behind (** 4 5 (look-ahead nonl))))
(test-ssre "(?<=(?=.){4,5}x)" (look-behind (: (** 4 5 (look-ahead nonl)) #\x)))
(test-ssre " (?<word> \\w+ )* \\. " (: #\space #\space #\space (* (-> word (: #\space (+ (or alnum #\_)) #\space))) #\space #\space #\space #\space #\. #\space #\space #\space))
(test-ssre "(?<=(?=.(?<=x)))" (look-behind (look-ahead (: nonl (look-behind #\x)))))
(test-ssre "(?<=(?=(?<=a)))b" (: (look-behind (look-ahead (look-behind #\a))) #\b))
(test-ssre "(?<=ab?c)..." (: (look-behind (: #\a (? #\b) #\c)) nonl nonl nonl))
(test-ssre "(?<=PQR|ab?c)..." (: (look-behind (or (: #\P #\Q #\R) (: #\a (? #\b) #\c))) nonl nonl nonl))
(test-ssre "(?<=ab?c|PQR)..." (: (look-behind (or (: #\a (? #\b) #\c) (: #\P #\Q #\R))) nonl nonl nonl))
(test-ssre "(?<=PQ|ab?c)..." (: (look-behind (or (: #\P #\Q) (: #\a (? #\b) #\c))) nonl nonl nonl))
(test-ssre "(?<=ab?c|PQ)..." (: (look-behind (or (: #\a (? #\b) #\c) (: #\P #\Q))) nonl nonl nonl))
(test-ssre "(?<=a(b?c|d?e?e)f)X." (: (look-behind (: #\a ($ (or (: (? #\b) #\c) (: (? #\d) (? #\e) #\e))) #\f)) #\X nonl))
(test-ssre "(?<!a(b?c|d?e?e)f)X." (: (neg-look-behind (: #\a ($ (or (: (? #\b) #\c) (: (? #\d) (? #\e) #\e))) #\f)) #\X nonl))
(test-ssre "(?<=\\d{2,3}|ABC)." (: (look-behind (or (** 2 3 numeric) (: #\A #\B #\C))) nonl))
(test-ssre "(?<=(\\d{1,255}))X" (: (look-behind ($ (** 1 255 numeric))) #\X))
(test-ssre "(?<=a(b?c){3}d)X" (: (look-behind (: #\a (= 3 ($ (: (? #\b) #\c))) #\d)) #\X))
(test-ssre "(?<=a(b?c){0}d)X" (: (look-behind (: #\a (= 0 ($ (: (? #\b) #\c))) #\d)) #\X))
(test-ssre "(?<=a?(b?c){0}d)X." (: (look-behind (: (? #\a) (= 0 ($ (: (? #\b) #\c))) #\d)) #\X nonl))
(test-ssre "(?<!a?)" (neg-look-behind (? #\a)))
(test-ssre "(?<=PQ|Pc.b?)(.?)(b?)" (: (look-behind (or (: #\P #\Q) (: #\P #\c nonl (? #\b)))) ($ (? nonl)) ($ (? #\b))))
(test-ssre "(?=a)b?a" (: (look-ahead #\a) (? #\b) #\a))
(test-ssre "(?=a)b?a." (: (look-ahead #\a) (? #\b) #\a nonl))
(test-ssre "65 00 64" (: #\6 #\5 #\space #\0 #\0 #\space #\6 #\4))
(test-ssre "^.{4}" (: bos (= 4 nonl)))
(test-ssre "^(.{3,6}!)+$" (: bos (+ ($ (: (** 3 6 nonl) #\!))) eos))
(test-ssre "[a-z]{5,}b|x" (or (: (>= 5 (char-range #\a #\z)) #\b) #\x))
(test-ssre "[a-z]{1,6}?s|x" (or (: (**? 1 6 (char-range #\a #\z)) #\s) #\x))
(test-ssre "[@]" #\@)
(test-ssre "@" #\@)
(test-ssre "@@@xxx" (: #\@ #\@ #\@ #\x #\x #\x))
(test-ssre "badutf" (: #\b #\a #\d #\u #\t #\f))
(test-ssre "badutf" (: #\b #\a #\d #\u #\t #\f))
(test-ssre "shortutf" (: #\s #\h #\o #\r #\t #\u #\t #\f))
(test-ssre "anything" (: #\a #\n #\y #\t #\h #\i #\n #\g))
(test-ssre "badutf" (: #\b #\a #\d #\u #\t #\f))
(test-ssre "(?<=x)badutf" (: (look-behind #\x) #\b #\a #\d #\u #\t #\f))
(test-ssre "(?<=xx)badutf" (: (look-behind (: #\x #\x)) #\b #\a #\d #\u #\t #\f))
(test-ssre "(?<=xxxx)badutf" (: (look-behind (: #\x #\x #\x #\x)) #\b #\a #\d #\u #\t #\f))
(test-ssre "X" #\X)
(test-ssre "a+" (+ #\a))
(test-ssre "A" #\A)
(test-ssre "x" #\x)
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "X" #\X)
(test-ssre "(?<=.)X" (: (look-behind nonl) #\X))
(test-ssre "a+" (+ #\a))
(test-ssre "a" #\a)
(test-ssre "." nonl)
(test-ssre "s" #\s)
(test-ssre "[^s]" (~ #\s))
(test-ssre "a(?:.)*?a" (: #\a (*? nonl) #\a))
(test-ssre "(?<=pqr)abc(?=xyz)" (: (look-behind (: #\p #\q #\r)) #\a #\b #\c (look-ahead (: #\x #\y #\z))))
(test-ssre "a\\b" (: #\a (or bow eow)))
(test-ssre "abc(?=abcde)(?=ab)" (: #\a #\b #\c (look-ahead (: #\a #\b #\c #\d #\e)) (look-ahead (: #\a #\b))))
(test-ssre "(?<=abc)123" (: (look-behind (: #\a #\b #\c)) #\1 #\2 #\3))
(test-ssre "\\babc\\b" (: (or bow eow) #\a #\b #\c (or bow eow)))
(test-ssre "(?<=abc)def" (: (look-behind (: #\a #\b #\c)) #\d #\e #\f))
(test-ssre "abc(?<=bc)def" (: #\a #\b #\c (look-behind (: #\b #\c)) #\d #\e #\f))
(test-ssre "(?<=ab)cdef" (: (look-behind (: #\a #\b)) #\c #\d #\e #\f))
(test-ssre "b(?<!ax)(?!cx)" (: #\b (neg-look-behind (: #\a #\x)) (neg-look-ahead (: #\c #\x))))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "^12345678abcd" (: bos #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\a #\b #\c #\d))
(test-ssre "a(?:.)*?a" (: #\a (*? nonl) #\a))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "[axm]{7}" (= 7 (or #\a #\x #\m)))
(test-ssre "(.|.)*?bx" (: (*? ($ (or nonl nonl))) #\b #\x))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "(...)-(...)" (: ($ (: nonl nonl nonl)) #\- ($ (: nonl nonl nonl))))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "^abc|def" (or (: bos #\a #\b #\c) (: #\d #\e #\f)))
(test-ssre ".*((abc)$|(def))" (: (* nonl) ($ (or (: ($ (: #\a #\b #\c)) eos) ($ (: #\d #\e #\f))))))
(test-ssre "the quick brown fox" (: #\t #\h #\e #\space #\q #\u #\i #\c #\k #\space #\b #\r #\o #\w #\n #\space #\f #\o #\x))
(test-ssre "a*(b+)(z)(z)" (: (* #\a) ($ (+ #\b)) ($ #\z) ($ #\z)))
(test-ssre "ab.cd" (: #\a #\b nonl #\c #\d))
(test-ssre "a?|b?" (or (? #\a) (? #\b)))
(test-ssre "\\w+A" (: (+ (or alnum #\_)) #\A))
(test-ssre "\\w+A" (: (+ (or alnum #\_)) #\A))
(test-ssre "^d(e)$" (: bos #\d ($ #\e) eos))
(test-ssre "((a)(b)?(c))" ($ (: ($ #\a) (? ($ #\b)) ($ #\c))))
(test-ssre "\\w" (or alnum #\_))
(test-ssre "x{5,4}" (** 5 4 #\x))
(test-ssre "z{65536}" (= 65536 #\z))
(test-ssre "abc(?<=a+)b" (: #\a #\b #\c (look-behind (+ #\a)) #\b))
(test-ssre "(?<=ab(c+)d)ef" (: (look-behind (: #\a #\b ($ (+ #\c)) #\d)) #\e #\f))
(test-ssre "(?<=ab(?<=c+)d)ef" (: (look-behind (: #\a #\b (look-behind (+ #\c)) #\d)) #\e #\f))
(test-ssre "The next three are in testinput2 because they have variable length branches" (: #\T #\h #\e #\space #\n #\e #\x #\t #\space #\t #\h #\r #\e #\e #\space #\a #\r #\e #\space #\i #\n #\space #\t #\e #\s #\t #\i #\n #\p #\u #\t #\2 #\space #\b #\e #\c #\a #\u #\s #\e #\space #\t #\h #\e #\y #\space #\h #\a #\v #\e #\space #\v #\a #\r #\i #\a #\b #\l #\e #\space #\l #\e #\n #\g #\t #\h #\space #\b #\r #\a #\n #\c #\h #\e #\s))
(test-ssre "(?<=x+)y" (: (look-behind (+ #\x)) #\y))
(test-ssre "a{37,17}" (** 37 17 #\a))
(test-ssre "a{1,3}b" (: (** 1 3 #\a) #\b))
(test-ssre ".+foo" (: (+ nonl) #\f #\o #\o))
(test-ssre ".+foo" (: (+ nonl) #\f #\o #\o))
(test-ssre "^X" (: bos #\X))
(test-ssre "(?<A>tom|bon)-\\k<A>" (: (-> A (or (: #\t #\o #\m) (: #\b #\o #\n))) #\- (backref A)))
(test-ssre "Xa{2,4}b" (: #\X (** 2 4 #\a) #\b))
(test-ssre "Xa{2,4}?b" (: #\X (**? 2 4 #\a) #\b))
(test-ssre "Xa{2,4}+b" (: #\X (+ (** 2 4 #\a)) #\b))
(test-ssre "X\\d{2,4}b" (: #\X (** 2 4 numeric) #\b))
(test-ssre "X\\d{2,4}?b" (: #\X (**? 2 4 numeric) #\b))
(test-ssre "X\\d{2,4}+b" (: #\X (+ (** 2 4 numeric)) #\b))
(test-ssre "X\\D{2,4}b" (: #\X (** 2 4 (~ numeric)) #\b))
(test-ssre "X\\D{2,4}?b" (: #\X (**? 2 4 (~ numeric)) #\b))
(test-ssre "X\\D{2,4}+b" (: #\X (+ (** 2 4 (~ numeric))) #\b))
(test-ssre "X[abc]{2,4}b" (: #\X (** 2 4 (or #\a #\b #\c)) #\b))
(test-ssre "X[abc]{2,4}?b" (: #\X (**? 2 4 (or #\a #\b #\c)) #\b))
(test-ssre "X[abc]{2,4}+b" (: #\X (+ (** 2 4 (or #\a #\b #\c))) #\b))
(test-ssre "X[^a]{2,4}b" (: #\X (** 2 4 (~ #\a)) #\b))
(test-ssre "X[^a]{2,4}?b" (: #\X (**? 2 4 (~ #\a)) #\b))
(test-ssre "X[^a]{2,4}+b" (: #\X (+ (** 2 4 (~ #\a))) #\b))
(test-ssre "Z(?!)" (: #\Z (neg-look-ahead (:))))
(test-ssre "dog(sbody)?" (: #\d #\o #\g (? ($ (: #\s #\b #\o #\d #\y)))))
(test-ssre "dog(sbody)??" (: #\d #\o #\g (?? ($ (: #\s #\b #\o #\d #\y)))))
(test-ssre "dog|dogsbody" (or (: #\d #\o #\g) (: #\d #\o #\g #\s #\b #\o #\d #\y)))
(test-ssre "dogsbody|dog" (or (: #\d #\o #\g #\s #\b #\o #\d #\y) (: #\d #\o #\g)))
(test-ssre "\\bthe cat\\b" (: (or bow eow) #\t #\h #\e #\space #\c #\a #\t (or bow eow)))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "(?<=abc)123" (: (look-behind (: #\a #\b #\c)) #\1 #\2 #\3))
(test-ssre "\\babc\\b" (: (or bow eow) #\a #\b #\c (or bow eow)))
(test-ssre "a?b?" (: (? #\a) (? #\b)))
(test-ssre "^a?b?" (: bos (? #\a) (? #\b)))
(test-ssre "abcd*" (: #\a #\b #\c (* #\d)))
(test-ssre "abc\\d*" (: #\a #\b #\c (* numeric)))
(test-ssre "abc[de]*" (: #\a #\b #\c (* (or #\d #\e))))
(test-ssre "(?<=abc)def" (: (look-behind (: #\a #\b #\c)) #\d #\e #\f))
(test-ssre "abc$" (: #\a #\b #\c eos))
(test-ssre "abc$" (: #\a #\b #\c eos))
(test-ssre "abc\\z" (: #\a #\b #\c eos))
(test-ssre "abc\\b" (: #\a #\b #\c (or bow eow)))
(test-ssre "abc\\B" (: #\a #\b #\c nwb))
(test-ssre ".+" (+ nonl))
(test-ssre "(?<=(abc)+)X" (: (look-behind (+ ($ (: #\a #\b #\c)))) #\X))
(test-ssre "(a)b|ac" (or (: ($ #\a) #\b) (: #\a #\c)))
(test-ssre "(a)(b)x|abc" (or (: ($ #\a) ($ #\b) #\x) (: #\a #\b #\c)))
(test-ssre "(?:(foo)|(bar)|(baz))X" (: (or ($ (: #\f #\o #\o)) ($ (: #\b #\a #\r)) ($ (: #\b #\a #\z))) #\X))
(test-ssre "(ab)x|ab" (or (: ($ (: #\a #\b)) #\x) (: #\a #\b)))
(test-ssre "(((((a)))))" ($ ($ ($ ($ ($ #\a))))))
(test-ssre "a*?b*?" (: (*? #\a) (*? #\b)))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "a(b)c" (: #\a ($ #\b) #\c))
(test-ssre "(a)(b)|(c)" (or (: ($ #\a) ($ #\b)) ($ #\c)))
(test-ssre "(?<A>a)|(?<A>b)" (or (-> A #\a) (-> A #\b)))
(test-ssre "a(b)c(d)" (: #\a ($ #\b) #\c ($ #\d)))
(test-ssre "^abc" (: bos #\a #\b #\c))
(test-ssre ".*\\d" (: (* nonl) numeric))
(test-ssre "(abc)*" (* ($ (: #\a #\b #\c))))
(test-ssre "^" bos)
(test-ssre "(?:ab)?(?:ab)(?:ab)" (: (? (: #\a #\b)) (: #\a #\b) (: #\a #\b)))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "(abcd)" ($ (: #\a #\b #\c #\d)))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "a(b)c" (: #\a ($ #\b) #\c))
(test-ssre "0b 28 3f 2d 78 29 3a" (: #\0 #\b #\space #\2 #\8 #\space #\3 #\f #\space #\2 #\d #\space #\7 #\8 #\space #\2 #\9 #\space #\3 #\a))
(test-ssre "a|(b)c" (or #\a (: ($ #\b) #\c)))
(test-ssre "efg" (: #\e #\f #\g))
(test-ssre "eff" (: #\e #\f #\f))
(test-ssre "effg" (: #\e #\f #\f #\g))
(test-ssre "aaa" (: #\a #\a #\a))
(test-ssre "(?<!|!(?<!))" (neg-look-behind (or (:) (: #\! (neg-look-behind (:))))))
(test-ssre "(?<!|!|!||||||(?<!)||(?<!)!|!||(?<!)!|!(?<!)!|!|!|!||||!!|<!)!|!||||!|" (or (: (neg-look-behind (or (:) #\! #\! (:) (:) (:) (:) (:) (neg-look-behind (:)) (:) (: (neg-look-behind (:)) #\!) #\! (:) (: (neg-look-behind (:)) #\!) (: #\! (neg-look-behind (:)) #\!) #\! #\! #\! (:) (:) (:) (: #\! #\!) (: #\< #\!))) #\!) #\! (:) (:) (:) #\! (:)))
(test-ssre "(R?){65}" (= 65 ($ (? #\R))))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "abc|bcd" (or (: #\a #\b #\c) (: #\b #\c #\d)))
(test-ssre "^(b+|a){1,2}?bc" (: bos (**? 1 2 ($ (or (+ #\b) #\a))) #\b #\c))
(test-ssre "^(b*|ba){1,2}?bc" (: bos (**? 1 2 ($ (or (* #\b) (: #\b #\a)))) #\b #\c))
(test-ssre "[abc]" (or #\a #\b #\c))
(test-ssre "a(b)c|xyz" (or (: #\a ($ #\b) #\c) (: #\x #\y #\z)))
(test-ssre "foobar" (: #\f #\o #\o #\b #\a #\r))
(test-ssre "\\[()\\]{65535}(?<A>)" (: #\[ ($ (:)) (= 65535 #\]) (-> A (:))))
(test-ssre "(?<=(?=.(?<=x)))" (look-behind (look-ahead (: nonl (look-behind #\x)))))
(test-ssre "\\z" eos)
(test-ssre "\\Z" (: (? #\newline) eos))
(test-ssre "(?![ab]).*" (: (neg-look-ahead (or #\a #\b)) (* nonl)))
(test-ssre "abcd" (: #\a #\b #\c #\d))
(test-ssre "12345(?<=\\d{1,256})X" (: #\1 #\2 #\3 #\4 #\5 (look-behind (** 1 256 numeric)) #\X))
(test-ssre "(?<!( {65054}){9,44965})" (neg-look-behind (** 9 44965 ($ (= 65054 #\space)))))
(test-ssre "(?<=(()()()()()()()()()()()()()(()()()()(())()()()()(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(())()()()()(()()()()()()(()()()()()()()()()()()()()()()()()()()()()(())()()()()(()()()()()()()()()()()()()(()()()()()()()()()()()()()(()())))))))))" (look-behind ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ ($ (:))) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ ($ (:))) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ ($ (:))) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (:)) ($ (: ($ (:)) ($ (:))))))))))))))))))))
(test-ssre "((foo)|(bar))*" (* ($ (or ($ (: #\f #\o #\o)) ($ (: #\b #\a #\r))))))
(test-ssre "(?:(f)(o)(o)|(b)(a)(r))*" (* (or (: ($ #\f) ($ #\o) ($ #\o)) (: ($ #\b) ($ #\a) ($ #\r)))))
(test-ssre "((Z)+|A)*" (* ($ (or (+ ($ #\Z)) #\A))))
(test-ssre "A +" (: #\A (+ #\space)))
(test-ssre "a\\z" (: #\a eos))
(test-ssre "[a[]" (or #\a #\[))
(test-ssre "[[:digit:] -Z]" (or numeric #\space #\space (char-range #\space #\Z)))
(test-ssre "[\\d -Z]" (or numeric #\space #\space (char-range #\space #\Z)))
(test-ssre "(?<=abc)(|DEF)" (: (look-behind (: #\a #\b #\c)) ($ (or (:) (: #\D #\E #\F)))))
(test-ssre "a(bb)c" (: #\a ($ (: #\b #\b)) #\c))
(test-ssre "a()c" (: #\a ($ (:)) #\c))
(test-ssre "(?:(?<n>foo)|(?<n>bar))\\k<n>" (: (or (-> n (: #\f #\o #\o)) (-> n (: #\b #\a #\r))) (backref n)))
(test-ssre "a?b[]xy]*c" (: (? #\a) #\b (* (or #\] #\x #\y)) #\c))
(test-ssre "f*" (* #\f))
(test-ssre "foo\\*" (: #\f #\o #\o #\*))
(test-ssre "foo\\*bar" (: #\f #\o #\o #\* #\b #\a #\r))
(test-ssre "f\\\\oo" (: #\f #\\ #\o #\o))
(test-ssre "[ten]" (or #\t #\e #\n))
(test-ssre "t[a-g]n" (: #\t (char-range #\a #\g) #\n))
(test-ssre "a[]]b" (: #\a #\] #\b))
(test-ssre "a[]a-]b" (: #\a (or #\] #\a #\-) #\b))
(test-ssre "a[]-]b" (: #\a (or #\] #\-) #\b))
(test-ssre "a[]a-z]b" (: #\a (or #\] (char-range #\a #\z)) #\b))
(test-ssre "\\]" #\])
(test-ssre "t[!a-g]n" (: #\t (or #\! (char-range #\a #\g)) #\n))
(test-ssre "A[+-0]B" (: #\A (char-range #\+ #\0) #\B))
(test-ssre "a[--0]z" (: #\a (char-range #\- #\0) #\z))
(test-ssre "a[[:digit:].]z" (: #\a (or numeric #\.) #\z))
(test-ssre "A\\B\\\\C\\D" (: #\A nwb #\\ #\C (~ numeric)))
(test-ssre "a*b" (: (* #\a) #\b))
(test-ssre "<[]bc]>" (: #\< (or #\] #\b #\c) #\>))
(test-ssre "<[^]bc]>" (: #\< (~ (or #\] #\b #\c)) #\>))
(test-ssre "a*b+c\\+[def](ab)\\(cd\\)" (: (* #\a) (+ #\b) #\c #\+ (or #\d #\e #\f) ($ (: #\a #\b)) #\( #\c #\d #\)))
(test-ssre "how.to how\\.to" (: #\h #\o #\w nonl #\t #\o #\space #\h #\o #\w #\. #\t #\o))
(test-ssre "^how to \\^how to" (: bos #\h #\o #\w #\space #\t #\o #\space #\^ #\h #\o #\w #\space #\t #\o))
(test-ssre "^b\\(c^d\\)\\(^e^f\\)" (: bos #\b #\( #\c bos #\d #\) #\( bos #\e bos #\f #\)))
(test-ssre "\\[()\\]{65535}()" (: #\[ ($ (:)) (= 65535 #\]) ($ (:))))
(test-ssre "^A" (: bos #\A))
(test-ssre "^\\w+" (: bos (+ (or alnum #\_))))
(test-ssre "(.+)\\b(.+)" (: ($ (+ nonl)) (or bow eow) ($ (+ nonl))))
(test-ssre "\\W+" (+ (~ (or alnum #\_))))
(test-ssre "\\w+" (+ (or alnum #\_)))
(test-ssre "a.b" (: #\a nonl #\b))
(test-ssre "a(.{3})b" (: #\a ($ (= 3 nonl)) #\b))
(test-ssre "a(.*?)(.)" (: #\a ($ (*? nonl)) ($ nonl)))
(test-ssre "a(.*?)(.)" (: #\a ($ (*? nonl)) ($ nonl)))
(test-ssre "a(.*)(.)" (: #\a ($ (* nonl)) ($ nonl)))
(test-ssre "a(.*)(.)" (: #\a ($ (* nonl)) ($ nonl)))
(test-ssre "a(.)(.)" (: #\a ($ nonl) ($ nonl)))
(test-ssre "a(.)(.)" (: #\a ($ nonl) ($ nonl)))
(test-ssre "a(.?)(.)" (: #\a ($ (? nonl)) ($ nonl)))
(test-ssre "a(.?)(.)" (: #\a ($ (? nonl)) ($ nonl)))
(test-ssre "a(.??)(.)" (: #\a ($ (?? nonl)) ($ nonl)))
(test-ssre "a(.??)(.)" (: #\a ($ (?? nonl)) ($ nonl)))
(test-ssre "a(.{3})b" (: #\a ($ (= 3 nonl)) #\b))
(test-ssre "a(.{3,})b" (: #\a ($ (>= 3 nonl)) #\b))
(test-ssre "a(.{3,}?)b" (: #\a ($ (**? 3 #f nonl)) #\b))
(test-ssre "a(.{3,5})b" (: #\a ($ (** 3 5 nonl)) #\b))
(test-ssre "a(.{3,5}?)b" (: #\a ($ (**? 3 5 nonl)) #\b))
(test-ssre "(?<=aXb)cd" (: (look-behind (: #\a #\X #\b)) #\c #\d))
(test-ssre "(?<=(.))X" (: (look-behind ($ nonl)) #\X))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "^[^a]{2}" (: bos (= 2 (~ #\a))))
(test-ssre "^[^a]{2,}" (: bos (>= 2 (~ #\a))))
(test-ssre "^[^a]{2,}?" (: bos (**? 2 #f (~ #\a))))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "^[^a]{2}" (: bos (= 2 (~ #\a))))
(test-ssre "^[^a]{2,}" (: bos (>= 2 (~ #\a))))
(test-ssre "^[^a]{2,}?" (: bos (**? 2 #f (~ #\a))))
(test-ssre "\\D*" (* (~ numeric)))
(test-ssre "\\D*" (* (~ numeric)))
(test-ssre "\\D" (~ numeric))
(test-ssre ">\\S" (: #\> (~ space)))
(test-ssre "\\d" numeric)
(test-ssre "\\s" space)
(test-ssre "\\D+" (+ (~ numeric)))
(test-ssre "\\D{2,3}" (** 2 3 (~ numeric)))
(test-ssre "\\D{2,3}?" (**? 2 3 (~ numeric)))
(test-ssre "\\d+" (+ numeric))
(test-ssre "\\d{2,3}" (** 2 3 numeric))
(test-ssre "\\d{2,3}?" (**? 2 3 numeric))
(test-ssre "\\S+" (+ (~ space)))
(test-ssre "\\S{2,3}" (** 2 3 (~ space)))
(test-ssre "\\S{2,3}?" (**? 2 3 (~ space)))
(test-ssre ">\\s+<" (: #\> (+ space) #\<))
(test-ssre ">\\s{2,3}<" (: #\> (** 2 3 space) #\<))
(test-ssre ">\\s{2,3}?<" (: #\> (**? 2 3 space) #\<))
(test-ssre "\\w+" (+ (or alnum #\_)))
(test-ssre "\\w{2,3}" (** 2 3 (or alnum #\_)))
(test-ssre "\\w{2,3}?" (**? 2 3 (or alnum #\_)))
(test-ssre "\\W+" (+ (~ (or alnum #\_))))
(test-ssre "\\W{2,3}" (** 2 3 (~ (or alnum #\_))))
(test-ssre "\\W{2,3}?" (**? 2 3 (~ (or alnum #\_))))
(test-ssre "^[ac]*b" (: bos (* (or #\a #\c)) #\b))
(test-ssre "^[^x]*b" (: bos (* (~ #\x)) #\b))
(test-ssre "^[^x]*b" (: bos (* (~ #\x)) #\b))
(test-ssre "^\\d*b" (: bos (* numeric) #\b))
(test-ssre "(|a)" ($ (or (:) #\a)))
(test-ssre "\\S\\S" (: (~ space) (~ space)))
(test-ssre "\\S{2}" (= 2 (~ space)))
(test-ssre "\\W\\W" (: (~ (or alnum #\_)) (~ (or alnum #\_))))
(test-ssre "\\W{2}" (= 2 (~ (or alnum #\_))))
(test-ssre "\\S" (~ space))
(test-ssre "\\D" (~ numeric))
(test-ssre "\\W" (~ (or alnum #\_)))
(test-ssre ".[^\\S\n]." (: nonl (~ (or (~ space) #\newline)) nonl))
(test-ssre "^[^d]*?$" (: bos (*? (~ #\d)) eos))
(test-ssre "^[^d]*?$" (: bos (*? (~ #\d)) eos))
(test-ssre "^[^d]*?$" (: bos (*? (~ #\d)) eos))
(test-ssre "A*" (* #\A))
(test-ssre "." nonl)
(test-ssre "^\\d*\\w{4}" (: bos (* numeric) (= 4 (or alnum #\_))))
(test-ssre "^[^b]*\\w{4}" (: bos (* (~ #\b)) (= 4 (or alnum #\_))))
(test-ssre "^[^b]*\\w{4}" (: bos (* (~ #\b)) (= 4 (or alnum #\_))))
(test-ssre "^.\\B.\\B." (: bos nonl nwb nonl nwb nonl))
(test-ssre "\\D+" (+ (~ numeric)))
(test-ssre "^\\w+" (: bos (+ (or alnum #\_))))
(test-ssre "^\\d+" (: bos (+ numeric)))
(test-ssre "^>\\s+" (: bos #\> (+ space)))
(test-ssre "^A\\s+Z" (: bos #\A (+ space) #\Z))
(test-ssre "[RST]+" (+ (or #\R #\S #\T)))
(test-ssre "[R-T]+" (+ (char-range #\R #\T)))
(test-ssre "[q-u]+" (+ (char-range #\q #\u)))
(test-ssre "^s?c" (: bos (? #\s) #\c))
(test-ssre "[A-`]" (char-range #\A #\`))
(test-ssre "\\w+" (+ (or alnum #\_)))
(test-ssre "\\b.+?\\b" (: (or bow eow) (**? 1 #f nonl) (or bow eow)))
(test-ssre "caf\\B.+?\\B" (: #\c #\a #\f nwb (**? 1 #f nonl) nwb))
(test-ssre "c3 b1" (: #\c #\3 #\space #\b #\1))
(test-ssre "^A\\s+Z" (: bos #\A (+ space) #\Z))
(test-ssre "\\W" (~ (or alnum #\_)))
(test-ssre "\\w" (or alnum #\_))
(test-ssre "Xa{2,4}b" (: #\X (** 2 4 #\a) #\b))
(test-ssre "Xa{2,4}?b" (: #\X (**? 2 4 #\a) #\b))
(test-ssre "Xa{2,4}+b" (: #\X (+ (** 2 4 #\a)) #\b))
(test-ssre "X\\d{2,4}b" (: #\X (** 2 4 numeric) #\b))
(test-ssre "X\\d{2,4}?b" (: #\X (**? 2 4 numeric) #\b))
(test-ssre "X\\d{2,4}+b" (: #\X (+ (** 2 4 numeric)) #\b))
(test-ssre "X\\D{2,4}b" (: #\X (** 2 4 (~ numeric)) #\b))
(test-ssre "X\\D{2,4}?b" (: #\X (**? 2 4 (~ numeric)) #\b))
(test-ssre "X\\D{2,4}+b" (: #\X (+ (** 2 4 (~ numeric))) #\b))
(test-ssre "X\\D{2,4}b" (: #\X (** 2 4 (~ numeric)) #\b))
(test-ssre "X\\D{2,4}?b" (: #\X (**? 2 4 (~ numeric)) #\b))
(test-ssre "X\\D{2,4}+b" (: #\X (+ (** 2 4 (~ numeric))) #\b))
(test-ssre "X[abc]{2,4}b" (: #\X (** 2 4 (or #\a #\b #\c)) #\b))
(test-ssre "X[abc]{2,4}?b" (: #\X (**? 2 4 (or #\a #\b #\c)) #\b))
(test-ssre "X[abc]{2,4}+b" (: #\X (+ (** 2 4 (or #\a #\b #\c))) #\b))
(test-ssre "X[^a]{2,4}b" (: #\X (** 2 4 (~ #\a)) #\b))
(test-ssre "X[^a]{2,4}?b" (: #\X (**? 2 4 (~ #\a)) #\b))
(test-ssre "X[^a]{2,4}+b" (: #\X (+ (** 2 4 (~ #\a))) #\b))
(test-ssre "X[^a]{2,4}b" (: #\X (** 2 4 (~ #\a)) #\b))
(test-ssre "X[^a]{2,4}?b" (: #\X (**? 2 4 (~ #\a)) #\b))
(test-ssre "X[^a]{2,4}+b" (: #\X (+ (** 2 4 (~ #\a))) #\b))
(test-ssre "\\bthe cat\\b" (: (or bow eow) #\t #\h #\e #\space #\c #\a #\t (or bow eow)))
(test-ssre "abcd*" (: #\a #\b #\c (* #\d)))
(test-ssre "abcd*" (: #\a #\b #\c (* #\d)))
(test-ssre "abc\\d*" (: #\a #\b #\c (* numeric)))
(test-ssre "abc[de]*" (: #\a #\b #\c (* (or #\d #\e))))
(test-ssre "X\\W{3}X" (: #\X (= 3 (~ (or alnum #\_))) #\X))
(test-ssre "f.*" (: #\f (* nonl)))
(test-ssre "f.*" (: #\f (* nonl)))
(test-ssre "f.*" (: #\f (* nonl)))
(test-ssre "f.*" (: #\f (* nonl)))
(test-ssre "(?<!^)ETA" (: (neg-look-behind bos) #\E #\T #\A))
(test-ssre "\\b...\\B" (: (or bow eow) nonl nonl nonl nwb))
(test-ssre "\\b...\\B" (: (or bow eow) nonl nonl nonl nwb))
(test-ssre "\\b...\\B" (: (or bow eow) nonl nonl nonl nwb))
(test-ssre "is+t" (: #\i (+ #\s) #\t))
(test-ssre "is+?t" (: #\i (**? 1 #f #\s) #\t))
(test-ssre "is?t" (: #\i (? #\s) #\t))
(test-ssre "is{2}t" (: #\i (= 2 #\s) #\t))
(test-ssre "a[[:punct:]b]" (: #\a (or punct #\b)))
(test-ssre "a[[:punct:]b]" (: #\a (or punct #\b)))
(test-ssre "a[b[:punct:]]" (: #\a (or #\b punct)))
(test-ssre "[\\D\\P{Nd}]" (or (~ numeric) (~ numeric)))
(test-ssre "[^\\D\\P{Nd}]" (~ (or (~ numeric) (~ numeric))))
(test-ssre "(|@)7" (: ($ (or (:) #\@)) #\7))
(test-ssre "AskZ" (: #\A #\s #\k #\Z))
(test-ssre "[AskZ]+" (+ (or #\A #\s #\k #\Z)))
(test-ssre "[^s]+" (+ (~ #\s)))
(test-ssre "[^s]+" (+ (~ #\s)))
(test-ssre "[^k]+" (+ (~ #\k)))
(test-ssre "[^k]+" (+ (~ #\k)))
(test-ssre "[^sk]+" (+ (~ (or #\s #\k))))
(test-ssre "[^sk]+" (+ (~ (or #\s #\k))))
(test-ssre "(?:(?<A>ss)|(?<A>kk)) \\k<A>" (: (or (-> A (: #\s #\s)) (-> A (: #\k #\k))) #\space (backref A)))
(test-ssre "(?:(?<A>s)|(?<A>k)) \\k<A>{3,}!" (: (or (-> A #\s) (-> A #\k)) #\space (>= 3 (backref A)) #\!))
(test-ssre "i" #\i)
(test-ssre "I" #\I)
(test-ssre "[i]" #\i)
(test-ssre "[^i]" (~ #\i))
(test-ssre "[zi]" (or #\z #\i))
(test-ssre "[iI]" (or #\i #\I))
(test-ssre "\\d+" (+ numeric))
(test-ssre "\\d+" (+ numeric))
(test-ssre ">\\s+<" (: #\> (+ space) #\<))
(test-ssre ">\\s+<" (: #\> (+ space) #\<))
(test-ssre "\\w+" (+ (or alnum #\_)))
(test-ssre "\\w+" (+ (or alnum #\_)))
(test-ssre "\\bABC\\b" (: (or bow eow) #\A #\B #\C (or bow eow)))
(test-ssre "\\bABC\\b" (: (or bow eow) #\A #\B #\C (or bow eow)))
(test-ssre "(?<!(|l ))" (neg-look-behind ($ (or (:) (: #\l #\space)))))
(test-ssre "abc" (: #\a #\b #\c))
(test-ssre "ab*c" (: #\a (* #\b) #\c))
(test-ssre "ab+c" (: #\a (+ #\b) #\c))
(test-ssre "(a|abcd|african)" ($ (or #\a (: #\a #\b #\c #\d) (: #\a #\f #\r #\i #\c #\a #\n))))
(test-ssre "^abc" (: bos #\a #\b #\c))
(test-ssre "^abc" (: bos #\a #\b #\c))
(test-ssre "\\Aabc" (: bos #\a #\b #\c))
(test-ssre "\\Aabc" (: bos #\a #\b #\c))
(test-ssre "x\\dy\\Dz" (: #\x numeric #\y (~ numeric) #\z))
(test-ssre "x\\sy\\Sz" (: #\x space #\y (~ space) #\z))
(test-ssre "x\\wy\\Wz" (: #\x (or alnum #\_) #\y (~ (or alnum #\_)) #\z))
(test-ssre "x.y" (: #\x nonl #\y))
(test-ssre "x.y" (: #\x nonl #\y))
(test-ssre "a\\d\\z" (: #\a numeric eos))
(test-ssre "a\\d\\z" (: #\a numeric eos))
(test-ssre "a\\d$" (: #\a numeric eos))
(test-ssre "a\\d$" (: #\a numeric eos))
(test-ssre "[^a]" (~ #\a))
(test-ssre "ab?\\w" (: #\a (? #\b) (or alnum #\_)))
(test-ssre "x{0,3}yz" (: (** 0 3 #\x) #\y #\z))
(test-ssre "x{3}yz" (: (= 3 #\x) #\y #\z))
(test-ssre "x{2,3}yz" (: (** 2 3 #\x) #\y #\z))
(test-ssre "\\d*" (* numeric))
(test-ssre "\\D*" (* (~ numeric)))
(test-ssre "\\d+" (+ numeric))
(test-ssre "\\D+" (+ (~ numeric)))
(test-ssre "\\d?A" (: (? numeric) #\A))
(test-ssre "\\D?A" (: (? (~ numeric)) #\A))
(test-ssre "a+" (+ #\a))
(test-ssre "^.*xyz" (: bos (* nonl) #\x #\y #\z))
(test-ssre "^.+xyz" (: bos (+ nonl) #\x #\y #\z))
(test-ssre "^.?xyz" (: bos (? nonl) #\x #\y #\z))
(test-ssre "^\\d{2,3}X" (: bos (** 2 3 numeric) #\X))
(test-ssre "^[abcd]\\d" (: bos (or #\a #\b #\c #\d) numeric))
(test-ssre "^[abcd]*\\d" (: bos (* (or #\a #\b #\c #\d)) numeric))
(test-ssre "^[abcd]+\\d" (: bos (+ (or #\a #\b #\c #\d)) numeric))
(test-ssre "^a+X" (: bos (+ #\a) #\X))
(test-ssre "^[abcd]?\\d" (: bos (? (or #\a #\b #\c #\d)) numeric))
(test-ssre "^[abcd]{2,3}\\d" (: bos (** 2 3 (or #\a #\b #\c #\d)) numeric))
(test-ssre "^(abc)*\\d" (: bos (* ($ (: #\a #\b #\c))) numeric))
(test-ssre "^(abc)+\\d" (: bos (+ ($ (: #\a #\b #\c))) numeric))
(test-ssre "^(abc)?\\d" (: bos (? ($ (: #\a #\b #\c))) numeric))
(test-ssre "^(abc){2,3}\\d" (: bos (** 2 3 ($ (: #\a #\b #\c))) numeric))
(test-ssre "^(a*\\w|ab)=(a*\\w|ab)" (: bos ($ (or (: (* #\a) (or alnum #\_)) (: #\a #\b))) #\= ($ (or (: (* #\a) (or alnum #\_)) (: #\a #\b)))))
(test-ssre "^(?=abc)\\w{5}:$" (: bos (look-ahead (: #\a #\b #\c)) (= 5 (or alnum #\_)) #\: eos))
(test-ssre "^(?!abc)\\d\\d$" (: bos (neg-look-ahead (: #\a #\b #\c)) numeric numeric eos))
(test-ssre "(?<=abc|xy)123" (: (look-behind (or (: #\a #\b #\c) (: #\x #\y))) #\1 #\2 #\3))
(test-ssre "(?<!abc|xy)123" (: (neg-look-behind (or (: #\a #\b #\c) (: #\x #\y))) #\1 #\2 #\3))
(test-ssre "^abc" (: bos #\a #\b #\c))
(test-ssre "^(a*|xyz)" (: bos ($ (or (* #\a) (: #\x #\y #\z)))))
(test-ssre "xyz$" (: #\x #\y #\z eos))
(test-ssre "xyz$" (: #\x #\y #\z eos))
(test-ssre "^abcdef" (: bos #\a #\b #\c #\d #\e #\f))
(test-ssre "^a{2,4}\\d+z" (: bos (** 2 4 #\a) (+ numeric) #\z))
(test-ssre "^abcdef" (: bos #\a #\b #\c #\d #\e #\f))
(test-ssre "(?<=foo)bar" (: (look-behind (: #\f #\o #\o)) #\b #\a #\r))
(test-ssre "(ab*(cd|ef))+X" (: (+ ($ (: #\a (* #\b) ($ (or (: #\c #\d) (: #\e #\f)))))) #\X))
(test-ssre "the quick brown fox" (: #\t #\h #\e #\space #\q #\u #\i #\c #\k #\space #\b #\r #\o #\w #\n #\space #\f #\o #\x))
(test-ssre "a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz" (: (* #\a) #\a #\b (? #\c) #\x #\y (+ #\z) #\p #\q (= 3 #\r) #\a (>= 2 #\b) #\x (** 4 5 #\y) #\p (** 0 6 #\q) #\A (>= 0 #\B) #\z #\z))
(test-ssre "^(abc){1,2}zz" (: bos (** 1 2 ($ (: #\a #\b #\c))) #\z #\z))
(test-ssre "^(b+?|a){1,2}?c" (: bos (**? 1 2 ($ (or (**? 1 #f #\b) #\a))) #\c))
(test-ssre "^(b+|a){1,2}c" (: bos (** 1 2 ($ (or (+ #\b) #\a))) #\c))
(test-ssre "^(b+|a){1,2}?bc" (: bos (**? 1 2 ($ (or (+ #\b) #\a))) #\b #\c))
(test-ssre "^(b*|ba){1,2}?bc" (: bos (**? 1 2 ($ (or (* #\b) (: #\b #\a)))) #\b #\c))
(test-ssre "^(ba|b*){1,2}?bc" (: bos (**? 1 2 ($ (or (: #\b #\a) (* #\b)))) #\b #\c))
(test-ssre "^[ab\\]cde]" (: bos (or #\a #\b #\] #\c #\d #\e)))
(test-ssre "^[]cde]" (: bos (or #\] #\c #\d #\e)))
(test-ssre "^[^ab\\]cde]" (: bos (~ (or #\a #\b #\] #\c #\d #\e))))
(test-ssre "^[^]cde]" (: bos (~ (or #\] #\c #\d #\e))))
(test-ssre "^@" (: bos #\@))
(test-ssre "^[0-9]+$" (: bos (+ (char-range #\0 #\9)) eos))
(test-ssre "^.*nter" (: bos (* nonl) #\n #\t #\e #\r))
(test-ssre "^xxx[0-9]+$" (: bos #\x #\x #\x (+ (char-range #\0 #\9)) eos))
(test-ssre "^.+[0-9][0-9][0-9]$" (: bos (+ nonl) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) eos))
(test-ssre "^.+?[0-9][0-9][0-9]$" (: bos (**? 1 #f nonl) (char-range #\0 #\9) (char-range #\0 #\9) (char-range #\0 #\9) eos))
(test-ssre "^([^!]+)!(.+)=apquxz\\.ixr\\.zzz\\.ac\\.uk$" (: bos ($ (+ (~ #\!))) #\! ($ (+ nonl)) #\= #\a #\p #\q #\u #\x #\z #\. #\i #\x #\r #\. #\z #\z #\z #\. #\a #\c #\. #\u #\k eos))
(test-ssre ":" #\:)
(test-ssre "^.*\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$" (: bos (* nonl) #\. ($ (** 1 3 numeric)) #\. ($ (** 1 3 numeric)) #\. ($ (** 1 3 numeric)) eos))
(test-ssre "^(\\d+)\\s+IN\\s+SOA\\s+(\\S+)\\s+(\\S+)\\s*\\(\\s*$" (: bos ($ (+ numeric)) (+ space) #\I #\N (+ space) #\S #\O #\A (+ space) ($ (+ (~ space))) (+ space) ($ (+ (~ space))) (* space) #\( (* space) eos))
(test-ssre "^[a-zA-Z\\d][a-zA-Z\\d\\-]*(\\.[a-zA-Z\\d][a-zA-Z\\d\\-]*)*\\.$" (: bos (or (char-range #\a #\z) (char-range #\A #\Z) numeric) (* (or (char-range #\a #\z) (char-range #\A #\Z) numeric #\-)) (* ($ (: #\. (or (char-range #\a #\z) (char-range #\A #\Z) numeric) (* (or (char-range #\a #\z) (char-range #\A #\Z) numeric #\-))))) #\. eos))
(test-ssre "^\\*\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?(\\.[a-z]([a-z\\-\\d]*[a-z\\d]+)?)*$" (: bos #\* #\. (char-range #\a #\z) (? ($ (: (* (or (char-range #\a #\z) #\- numeric)) (+ (or (char-range #\a #\z) numeric))))) (* ($ (: #\. (char-range #\a #\z) (? ($ (: (* (or (char-range #\a #\z) #\- numeric)) (+ (or (char-range #\a #\z) numeric)))))))) eos))
(test-ssre "^(?=ab(de))(abd)(e)" (: bos (look-ahead (: #\a #\b ($ (: #\d #\e)))) ($ (: #\a #\b #\d)) ($ #\e)))
(test-ssre "^(?!(ab)de|x)(abd)(f)" (: bos (neg-look-ahead (or (: ($ (: #\a #\b)) #\d #\e) #\x)) ($ (: #\a #\b #\d)) ($ #\f)))
(test-ssre "^(?=(ab(cd)))(ab)" (: bos (look-ahead ($ (: #\a #\b ($ (: #\c #\d))))) ($ (: #\a #\b))))
(test-ssre "^$" (: bos eos))
(test-ssre "(?x)^ a\\ b[c ]d $" (: bos #\a #\space #\b (or #\c #\space) #\d eos))
(test-ssre "^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$" (: bos ($ (: #\a ($ (: #\b ($ #\c))))) ($ (: #\d ($ (: #\e ($ #\f))))) ($ (: #\h ($ (: #\i ($ #\j))))) ($ (: #\k ($ (: #\l ($ #\m))))) eos))
(test-ssre "^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$" (: bos (: #\a ($ (: #\b ($ #\c)))) (: #\d ($ (: #\e ($ #\f)))) (: #\h ($ (: #\i ($ #\j)))) (: #\k ($ (: #\l ($ #\m)))) eos))
(test-ssre "^[.^$|()*+?{,}]+" (: bos (+ (or #\. #\^ #\$ #\| #\( #\) #\* #\+ #\? #\{ #\, #\}))))
(test-ssre "^a*\\w" (: bos (* #\a) (or alnum #\_)))
(test-ssre "^a*?\\w" (: bos (*? #\a) (or alnum #\_)))
(test-ssre "^a+\\w" (: bos (+ #\a) (or alnum #\_)))
(test-ssre "^a+?\\w" (: bos (**? 1 #f #\a) (or alnum #\_)))
(test-ssre "^\\d{8}\\w{2,}" (: bos (= 8 numeric) (>= 2 (or alnum #\_))))
(test-ssre "^[aeiou\\d]{4,5}$" (: bos (** 4 5 (or #\a #\e #\i #\o #\u numeric)) eos))
(test-ssre "^[aeiou\\d]{4,5}?" (: bos (**? 4 5 (or #\a #\e #\i #\o #\u numeric))))
(test-ssre "^12.34" (: bos #\1 #\2 nonl #\3 #\4))
(test-ssre "foo(?!bar)(.*)" (: #\f #\o #\o (neg-look-ahead (: #\b #\a #\r)) ($ (* nonl))))
(test-ssre "(?:(?!foo)...|^.{0,2})bar(.*)" (: (or (: (neg-look-ahead (: #\f #\o #\o)) nonl nonl nonl) (: bos (** 0 2 nonl))) #\b #\a #\r ($ (* nonl))))
(test-ssre "^(\\D*)(?=\\d)(?!123)" (: bos ($ (* (~ numeric))) (look-ahead numeric) (neg-look-ahead (: #\1 #\2 #\3))))
(test-ssre "(?!^)abc" (: (neg-look-ahead bos) #\a #\b #\c))
(test-ssre "(?=^)abc" (: (look-ahead bos) #\a #\b #\c))
(test-ssre "ab{1,3}bc" (: #\a (** 1 3 #\b) #\b #\c))
(test-ssre "([^.]*)\\.([^:]*):[T ]+(.*)" (: ($ (* (~ #\.))) #\. ($ (* (~ #\:))) #\: (+ (or #\T #\space)) ($ (* nonl))))
(test-ssre "^[W-c]+$" (: bos (+ (char-range #\W #\c)) eos))
(test-ssre "^abc$" (: bos #\a #\b #\c eos))
(test-ssre "^abc$" (: bos #\a #\b #\c eos))
(test-ssre "\\Aabc\\Z" (: bos #\a #\b #\c (: (? #\newline) eos)))
(test-ssre "\\A(.)*\\Z" (: bos (* ($ nonl)) (: (? #\newline) eos)))
(test-ssre "(?:b)|(?::+)" (or #\b (+ #\:)))
(test-ssre "[-az]+" (+ (or #\- #\a #\z)))
(test-ssre "[az-]+" (+ (or #\a #\z #\-)))
(test-ssre "[a\\-z]+" (+ (or #\a #\- #\z)))
(test-ssre "[a-z]+" (+ (char-range #\a #\z)))
(test-ssre "[\\d-]+" (+ (or numeric #\-)))
(test-ssre "abc$" (: #\a #\b #\c eos))
(test-ssre "a{0}bc" (: (= 0 #\a) #\b #\c))
(test-ssre "(a|(bc)){0,0}?xyz" (: (**? 0 0 ($ (or #\a ($ (: #\b #\c))))) #\x #\y #\z))
(test-ssre "[^a]" (~ #\a))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "[^a]+" (+ (~ #\a)))
(test-ssre "[^k]$" (: (~ #\k) eos))
(test-ssre "[^k]{2,3}$" (: (** 2 3 (~ #\k)) eos))
(test-ssre "^\\d{8,}@.+[^k]$" (: bos (>= 8 numeric) #\@ (+ nonl) (~ #\k) eos))
(test-ssre "[^a]" (~ #\a))
(test-ssre "[^az]" (~ (or #\a #\z)))
(test-ssre "P[^*]TAIRE[^*]{1,6}?LL" (: #\P (~ #\*) #\T #\A #\I #\R #\E (**? 1 6 (~ #\*)) #\L #\L))
(test-ssre "P[^*]TAIRE[^*]{1,}?LL" (: #\P (~ #\*) #\T #\A #\I #\R #\E (**? 1 #f (~ #\*)) #\L #\L))
(test-ssre "(\\.\\d\\d[1-9]?)\\d+" (: ($ (: #\. numeric numeric (? (char-range #\1 #\9)))) (+ numeric)))
(test-ssre "(\\.\\d\\d((?=0)|\\d(?=\\d)))" ($ (: #\. numeric numeric ($ (or (look-ahead #\0) (: numeric (look-ahead numeric)))))))
(test-ssre "foo(.*)bar" (: #\f #\o #\o ($ (* nonl)) #\b #\a #\r))
(test-ssre "foo(.*?)bar" (: #\f #\o #\o ($ (*? nonl)) #\b #\a #\r))
(test-ssre "(.*)(\\d+)" (: ($ (* nonl)) ($ (+ numeric))))
(test-ssre "(.*?)(\\d+)" (: ($ (*? nonl)) ($ (+ numeric))))
(test-ssre "(.*)(\\d+)$" (: ($ (* nonl)) ($ (+ numeric)) eos))
(test-ssre "(.*?)(\\d+)$" (: ($ (*? nonl)) ($ (+ numeric)) eos))
(test-ssre "(.*)\\b(\\d+)$" (: ($ (* nonl)) (or bow eow) ($ (+ numeric)) eos))
(test-ssre "(.*\\D)(\\d+)$" (: ($ (: (* nonl) (~ numeric))) ($ (+ numeric)) eos))
(test-ssre "^\\D*(?!123)" (: bos (* (~ numeric)) (neg-look-ahead (: #\1 #\2 #\3))))
(test-ssre "^(\\D*)(?=\\d)(?!123)" (: bos ($ (* (~ numeric))) (look-ahead numeric) (neg-look-ahead (: #\1 #\2 #\3))))
(test-ssre "^[W-\\]46]" (: bos (or (char-range #\W #\]) #\4 #\6)))
(test-ssre "word (?:[a-zA-Z0-9]+ ){0,10}otherword" (: #\w #\o #\r #\d #\space (** 0 10 (: (+ (or (char-range #\a #\z) (char-range #\A #\Z) (char-range #\0 #\9))) #\space)) #\o #\t #\h #\e #\r #\w #\o #\r #\d))
(test-ssre "word (?:[a-zA-Z0-9]+ ){0,300}otherword" (: #\w #\o #\r #\d #\space (** 0 300 (: (+ (or (char-range #\a #\z) (char-range #\A #\Z) (char-range #\0 #\9))) #\space)) #\o #\t #\h #\e #\r #\w #\o #\r #\d))
(test-ssre "^(a){0,0}" (: bos (= 0 ($ #\a))))
(test-ssre "^(a){0,1}" (: bos (** 0 1 ($ #\a))))
(test-ssre "^(a){0,2}" (: bos (** 0 2 ($ #\a))))
(test-ssre "^(a){0,3}" (: bos (** 0 3 ($ #\a))))
(test-ssre "^(a){0,}" (: bos (>= 0 ($ #\a))))