@@ -181,94 +181,94 @@ extension RegexTests {
181
181
}
182
182
}
183
183
184
- func testBitsetCompile( ) {
185
- expectProgram (
186
- for: " [abc] " ,
187
- contains: [ . matchBitset] ,
188
- doesNotContain: [ . consumeBy, . matchBitsetScalar] )
189
- expectProgram (
190
- for: " [abc] " ,
191
- semanticLevel: . unicodeScalar,
192
- contains: [ . matchBitsetScalar] ,
193
- doesNotContain: [ . matchBitset, . consumeBy] )
194
- }
195
-
196
- func testScalarOptimizeCompilation( ) {
197
- // all ascii quoted literal -> elide boundary checks
198
- expectProgram (
199
- for: " abcd " ,
200
- contains: [ . matchScalar, . matchScalarUnchecked] ,
201
- doesNotContain: [ . match, . matchSequence, . consumeBy] )
202
- // ascii character -> matchScalar with boundary check
203
- expectProgram (
204
- for: " a " ,
205
- contains: [ . matchScalar] ,
206
- doesNotContain: [ . match, . matchSequence, . consumeBy, . matchScalarUnchecked] )
207
- // quoted literal is not all ascii -> match scalar when possible, always do boundary checks
208
- expectProgram (
209
- for: " aaa \u{301} " ,
210
- contains: [ . match, . matchScalar] ,
211
- doesNotContain: [ . consumeBy, . matchScalarUnchecked] )
212
- // scalar mode -> always emit match scalar without boundary checks
213
- expectProgram (
214
- for: " abcd " ,
215
- semanticLevel: . unicodeScalar,
216
- contains: [ . matchScalarUnchecked] ,
217
- doesNotContain: [ . match, . matchSequence, . consumeBy, . matchScalar] )
218
- expectProgram (
219
- for: " a " ,
220
- semanticLevel: . unicodeScalar,
221
- contains: [ . matchScalarUnchecked] ,
222
- doesNotContain: [ . match, . matchSequence, . consumeBy, . matchScalar] )
223
- expectProgram (
224
- for: " aaa \u{301} " ,
225
- semanticLevel: . unicodeScalar,
226
- contains: [ . matchScalarUnchecked] ,
227
- doesNotContain: [ . match, . matchSequence, . consumeBy, . matchScalar] )
228
- }
229
-
230
- func testCaseInsensitivityCompilation( ) {
231
- // quoted literal is all ascii -> match scalar case insensitive and skip
232
- // boundary checks
233
- expectProgram (
234
- for: " (?i)abcd " ,
235
- contains: [ . matchScalarCaseInsensitiveUnchecked, . matchScalarCaseInsensitive] ,
236
- doesNotContain: [ . match, . matchCaseInsensitive, . matchScalar, . matchScalarUnchecked] )
237
- // quoted literal is all non-cased ascii -> emit match scalar instructions
238
- expectProgram (
239
- for: " (?i)&&&& " ,
240
- contains: [ . matchScalar, . matchScalarUnchecked] ,
241
- doesNotContain: [ . match, . matchCaseInsensitive,
242
- . matchScalarCaseInsensitive, . matchScalarCaseInsensitiveUnchecked] )
243
- // quoted literal is not all ascii -> match scalar case insensitive when
244
- // possible, match character case insensitive when needed, always perform
245
- // boundary check
246
- expectProgram (
247
- for: " (?i)abcd \u{301} " ,
248
- contains: [ . matchCaseInsensitive, . matchScalarCaseInsensitive] ,
249
- doesNotContain: [ . matchScalarCaseInsensitiveUnchecked, . match, . matchScalar] )
250
- // same as before but contains ascii non cased characters -> emit matchScalar for them
251
- expectProgram (
252
- for: " (?i)abcd \u{301} ;.'! " ,
253
- contains: [ . matchCaseInsensitive, . matchScalarCaseInsensitive, . matchScalar] ,
254
- doesNotContain: [ . matchScalarCaseInsensitiveUnchecked, . match] )
255
- // contains non-ascii non-cased characters -> emit match
256
- expectProgram (
257
- for: " (?i)abcd \u{301} ;.'!💖 " ,
258
- contains: [ . matchCaseInsensitive, . matchScalarCaseInsensitive, . matchScalar, . match] ,
259
- doesNotContain: [ . matchScalarCaseInsensitiveUnchecked] )
260
-
261
- // scalar mode -> emit unchecked scalar match only, emit case insensitive
262
- // only if the scalar is cased
263
- expectProgram (
264
- for: " (?i);.'!💖 " ,
265
- semanticLevel: . unicodeScalar,
266
- contains: [ . matchScalarUnchecked] ,
267
- doesNotContain: [ . matchScalarCaseInsensitiveUnchecked] )
268
- expectProgram (
269
- for: " (?i)abcdé " ,
270
- semanticLevel: . unicodeScalar,
271
- contains: [ . matchScalarCaseInsensitiveUnchecked] ,
272
- doesNotContain: [ . matchScalarUnchecked] )
273
- }
184
+ // func testBitsetCompile() {
185
+ // expectProgram(
186
+ // for: "[abc]",
187
+ // contains: [.matchBitset],
188
+ // doesNotContain: [.consumeBy, .matchBitsetScalar])
189
+ // expectProgram(
190
+ // for: "[abc]",
191
+ // semanticLevel: .unicodeScalar,
192
+ // contains: [.matchBitsetScalar],
193
+ // doesNotContain: [.matchBitset, .consumeBy])
194
+ // }
195
+ //
196
+ // func testScalarOptimizeCompilation() {
197
+ // // all ascii quoted literal -> elide boundary checks
198
+ // expectProgram(
199
+ // for: "abcd",
200
+ // contains: [.matchScalar, .matchScalarUnchecked],
201
+ // doesNotContain: [.match, .matchSequence, .consumeBy])
202
+ // // ascii character -> matchScalar with boundary check
203
+ // expectProgram(
204
+ // for: "a",
205
+ // contains: [.matchScalar],
206
+ // doesNotContain: [.match, .matchSequence, .consumeBy, .matchScalarUnchecked])
207
+ // // quoted literal is not all ascii -> match scalar when possible, always do boundary checks
208
+ // expectProgram(
209
+ // for: "aaa\u{301}",
210
+ // contains: [.match, .matchScalar],
211
+ // doesNotContain: [.consumeBy, .matchScalarUnchecked])
212
+ // // scalar mode -> always emit match scalar without boundary checks
213
+ // expectProgram(
214
+ // for: "abcd",
215
+ // semanticLevel: .unicodeScalar,
216
+ // contains: [.matchScalarUnchecked],
217
+ // doesNotContain: [.match, .matchSequence, .consumeBy, .matchScalar])
218
+ // expectProgram(
219
+ // for: "a",
220
+ // semanticLevel: .unicodeScalar,
221
+ // contains: [.matchScalarUnchecked],
222
+ // doesNotContain: [.match, .matchSequence, .consumeBy, .matchScalar])
223
+ // expectProgram(
224
+ // for: "aaa\u{301}",
225
+ // semanticLevel: .unicodeScalar,
226
+ // contains: [.matchScalarUnchecked],
227
+ // doesNotContain: [.match, .matchSequence, .consumeBy, .matchScalar])
228
+ // }
229
+ //
230
+ // func testCaseInsensitivityCompilation() {
231
+ // // quoted literal is all ascii -> match scalar case insensitive and skip
232
+ // // boundary checks
233
+ // expectProgram(
234
+ // for: "(?i)abcd",
235
+ // contains: [.matchScalarCaseInsensitiveUnchecked, .matchScalarCaseInsensitive],
236
+ // doesNotContain: [.match, .matchCaseInsensitive, .matchScalar, .matchScalarUnchecked])
237
+ // // quoted literal is all non-cased ascii -> emit match scalar instructions
238
+ // expectProgram(
239
+ // for: "(?i)&&&&",
240
+ // contains: [.matchScalar, .matchScalarUnchecked],
241
+ // doesNotContain: [.match, .matchCaseInsensitive,
242
+ // .matchScalarCaseInsensitive, .matchScalarCaseInsensitiveUnchecked])
243
+ // // quoted literal is not all ascii -> match scalar case insensitive when
244
+ // // possible, match character case insensitive when needed, always perform
245
+ // // boundary check
246
+ // expectProgram(
247
+ // for: "(?i)abcd\u{301}",
248
+ // contains: [.matchCaseInsensitive, .matchScalarCaseInsensitive],
249
+ // doesNotContain: [.matchScalarCaseInsensitiveUnchecked, .match, .matchScalar])
250
+ // // same as before but contains ascii non cased characters -> emit matchScalar for them
251
+ // expectProgram(
252
+ // for: "(?i)abcd\u{301};.'!",
253
+ // contains: [.matchCaseInsensitive, .matchScalarCaseInsensitive, .matchScalar],
254
+ // doesNotContain: [.matchScalarCaseInsensitiveUnchecked, .match])
255
+ // // contains non-ascii non-cased characters -> emit match
256
+ // expectProgram(
257
+ // for: "(?i)abcd\u{301};.'!💖",
258
+ // contains: [.matchCaseInsensitive, .matchScalarCaseInsensitive, .matchScalar, .match],
259
+ // doesNotContain: [.matchScalarCaseInsensitiveUnchecked])
260
+ //
261
+ // // scalar mode -> emit unchecked scalar match only, emit case insensitive
262
+ // // only if the scalar is cased
263
+ // expectProgram(
264
+ // for: "(?i);.'!💖",
265
+ // semanticLevel: .unicodeScalar,
266
+ // contains: [.matchScalarUnchecked],
267
+ // doesNotContain: [.matchScalarCaseInsensitiveUnchecked])
268
+ // expectProgram(
269
+ // for: "(?i)abcdé",
270
+ // semanticLevel: .unicodeScalar,
271
+ // contains: [.matchScalarCaseInsensitiveUnchecked],
272
+ // doesNotContain: [.matchScalarUnchecked])
273
+ // }
274
274
}
0 commit comments