forked from rust-lang/regex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iter.toml
143 lines (122 loc) · 2.72 KB
/
iter.toml
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
[[test]]
name = "1"
regex = "a"
haystack = "aaa"
matches = [[0, 1], [1, 2], [2, 3]]
[[test]]
name = "2"
regex = "a"
haystack = "aba"
matches = [[0, 1], [2, 3]]
[[test]]
name = "empty1"
regex = ''
haystack = ''
matches = [[0, 0]]
[[test]]
name = "empty2"
regex = ''
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty3"
regex = '(?:)'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty4"
regex = '(?:)*'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty5"
regex = '(?:)+'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty6"
regex = '(?:)?'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty7"
regex = '(?:)(?:)'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty8"
regex = '(?:)+|z'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty9"
regex = 'z|(?:)+'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty10"
regex = '(?:)+|b'
haystack = 'abc'
matches = [[0, 0], [1, 1], [2, 2], [3, 3]]
[[test]]
name = "empty11"
regex = 'b|(?:)+'
haystack = 'abc'
matches = [[0, 0], [1, 2], [3, 3]]
[[test]]
name = "start1"
regex = "^a"
haystack = "a"
matches = [[0, 1]]
[[test]]
name = "start2"
regex = "^a"
haystack = "aa"
matches = [[0, 1]]
[[test]]
name = "anchored1"
regex = "a"
haystack = "a"
matches = [[0, 1]]
anchored = true
# This test is pretty subtle. It demonstrates the crucial difference between
# '^a' and 'a' compiled in 'anchored' mode. The former regex exclusively
# matches at the start of a haystack and nowhere else. The latter regex has
# no such restriction, but its automaton is constructed such that it lacks a
# `.*?` prefix. So it can actually produce matches at multiple locations.
# The anchored3 test drives this point home.
[[test]]
name = "anchored2"
regex = "a"
haystack = "aa"
matches = [[0, 1], [1, 2]]
anchored = true
# Unlikely anchored2, this test stops matching anything after it sees `b`
# since it lacks a `.*?` prefix. Since it is looking for 'a' but sees 'b', it
# determines that there are no remaining matches.
[[test]]
name = "anchored3"
regex = "a"
haystack = "aaba"
matches = [[0, 1], [1, 2]]
anchored = true
[[test]]
name = "nonempty-followedby-empty"
regex = 'abc|.*?'
haystack = "abczzz"
matches = [[0, 3], [4, 4], [5, 5], [6, 6]]
[[test]]
name = "nonempty-followedby-oneempty"
regex = 'abc|.*?'
haystack = "abcz"
matches = [[0, 3], [4, 4]]
[[test]]
name = "nonempty-followedby-onemixed"
regex = 'abc|.*?'
haystack = "abczabc"
matches = [[0, 3], [4, 7]]
[[test]]
name = "nonempty-followedby-twomixed"
regex = 'abc|.*?'
haystack = "abczzabc"
matches = [[0, 3], [4, 4], [5, 8]]