@@ -2151,9 +2151,6 @@ extension RegexTests {
21512151 parseWithDelimitersTest ( " ##/a b/## " , concat ( " a " , " " , " b " ) )
21522152 parseWithDelimitersTest ( " #|a b|# " , concat ( " a " , " b " ) )
21532153
2154- parseWithDelimitersTest ( " re'a b' " , concat ( " a " , " " , " b " ) )
2155- parseWithDelimitersTest ( " rx'a b' " , concat ( " a " , " b " ) )
2156-
21572154 parseWithDelimitersTest ( " #|[a b]|# " , charClass ( " a " , " b " ) )
21582155 parseWithDelimitersTest (
21592156 " #|(?-x)[a b]|# " , concat (
@@ -2176,13 +2173,13 @@ extension RegexTests {
21762173 parseWithDelimitersTest ( " #||||# " , alt ( empty ( ) , empty ( ) , empty ( ) ) )
21772174 parseWithDelimitersTest ( " #|a||# " , alt ( " a " , empty ( ) ) )
21782175
2179- parseWithDelimitersTest ( " re'x*' " , zeroOrMore ( of: " x " ) )
2176+ parseWithDelimitersTest ( " /x*/ " , zeroOrMore ( of: " x " ) )
21802177
2181- parseWithDelimitersTest ( #"re' 🔥🇩🇰' "# , concat ( " 🔥 " , " 🇩🇰 " ) )
2182- parseWithDelimitersTest ( #"re'🔥✅' "# , concat ( " 🔥 " , " ✅ " ) )
2178+ parseWithDelimitersTest ( #"/ 🔥🇩🇰/ "# , concat ( " 🔥 " , " 🇩🇰 " ) )
2179+ parseWithDelimitersTest ( #"/🔥✅/ "# , concat ( " 🔥 " , " ✅ " ) )
21832180
21842181 // Printable ASCII characters.
2185- delimiterLexingTest ( ##"re' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~' "## )
2182+ delimiterLexingTest ( ##"#/ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~/# "## )
21862183
21872184 // Make sure we can handle a combining accent as first character.
21882185 parseWithDelimitersTest ( " / \u{301} / " , " \u{301} " )
@@ -2294,72 +2291,61 @@ extension RegexTests {
22942291 /#
22952292 """# , charClass ( range_m ( " a " , " b " ) ) )
22962293
2297-
2298- // MARK: Delimiter skipping: Make sure we can skip over the ending delimiter
2299- // if it's clear that it's part of the regex syntax.
2300-
23012294 parseWithDelimitersTest (
2302- #"re' (?'a_bcA0'\')' "# , namedCapture ( " a_bcA0 " , " ' " ) )
2295+ #"/ (?'a_bcA0'\')/ "# , namedCapture ( " a_bcA0 " , " ' " ) )
23032296 parseWithDelimitersTest (
2304- #"re' (?'a_bcA0-c1A'x*)' "# ,
2297+ #"/ (?'a_bcA0-c1A'x*)/ "# ,
23052298 balancedCapture ( name: " a_bcA0 " , priorName: " c1A " , zeroOrMore ( of: " x " ) ) ,
23062299 unsupported: true )
23072300
23082301 parseWithDelimitersTest (
2309- #"rx' (?'a_bcA0' a b)' "# , concat ( namedCapture ( " a_bcA0 " , concat ( " a " , " b " ) ) ) )
2302+ #"/ (?'a_bcA0' a b)/ "# , concat ( " " , namedCapture ( " a_bcA0 " , concat ( " " , " a " , " " , " b " ) ) ) )
23102303
23112304 parseWithDelimitersTest (
2312- #"re' (?('a_bcA0')x|y)' "# , conditional (
2305+ #"/ (?('a_bcA0')x|y)/ "# , conditional (
23132306 . groupMatched( ref ( " a_bcA0 " ) ) , trueBranch: " x " , falseBranch: " y " ) ,
23142307 unsupported: true
23152308 )
23162309 parseWithDelimitersTest (
2317- #"re' (?('+20')\')' "# , conditional (
2310+ #"/ (?('+20')\')/ "# , conditional (
23182311 . groupMatched( ref ( plus: 20 ) ) , trueBranch: " ' " , falseBranch: empty ( ) ) ,
23192312 unsupported: true
23202313 )
23212314 parseWithDelimitersTest (
2322- #"re' a\k'b0A'' "# , concat ( " a " , backreference ( . named( " b0A " ) ) ) , throwsError: . invalidNamedReference( " b0A " ) )
2315+ #"/ a\k'b0A'/ "# , concat ( " a " , backreference ( . named( " b0A " ) ) ) , throwsError: . invalidNamedReference( " b0A " ) )
23232316 parseWithDelimitersTest (
2324- #"re' \k'+2-1'' "# , backreference ( ref ( plus: 2 ) , recursionLevel: - 1 ) ,
2317+ #"/ \k'+2-1'/ "# , backreference ( ref ( plus: 2 ) , recursionLevel: - 1 ) ,
23252318 unsupported: true
23262319 )
23272320
23282321 parseWithDelimitersTest (
2329- #"re' a\g'b0A'' "# , concat ( " a " , subpattern ( . named( " b0A " ) ) ) , unsupported: true )
2322+ #"/ a\g'b0A'/ "# , concat ( " a " , subpattern ( . named( " b0A " ) ) ) , unsupported: true )
23302323 parseWithDelimitersTest (
2331- #"re' \g'-1'\'' "# , concat ( subpattern ( ref ( minus: 1 ) ) , " ' " ) , unsupported: true )
2324+ #"/ \g'-1'\'/ "# , concat ( subpattern ( ref ( minus: 1 ) ) , " ' " ) , unsupported: true )
23322325
23332326 parseWithDelimitersTest (
2334- #"re' (?C'a*b\c 🔥_ ;')' "# , pcreCallout ( string: #"a*b\c 🔥_ ;"# ) ,
2327+ #"/ (?C'a*b\c 🔥_ ;')/ "# , pcreCallout ( string: #"a*b\c 🔥_ ;"# ) ,
23352328 unsupported: true )
23362329
2337- // Fine, because we don't end up skipping.
2338- delimiterLexingTest ( #"re'(?'"# )
2339- delimiterLexingTest ( #"re'(?('"# )
2340- delimiterLexingTest ( #"re'\k'"# )
2341- delimiterLexingTest ( #"re'\g'"# )
2342- delimiterLexingTest ( #"re'(?C'"# )
2330+ delimiterLexingTest ( #"/(?/"# )
2331+ delimiterLexingTest ( #"/(?(/"# )
2332+ delimiterLexingTest ( #"/\k/"# )
2333+ delimiterLexingTest ( #"/\g/"# )
2334+ delimiterLexingTest ( #"/(?C/"# )
23432335
2344- // Not a valid group name, but we can still skip over it.
2345- delimiterLexingTest ( #"re'(?'🔥')'"# )
2336+ delimiterLexingTest ( #"/(?'🔥')/"# )
23462337
2347- // Escaped, so don't skip. These will ignore the ending `'` as we've already
2348- // closed the literal.
23492338 parseWithDelimitersTest (
2350- #"re'\(?''"# , zeroOrOne ( of: " ( " ) , ignoreTrailing: true
2351- )
2339+ #"/\(?/"# , zeroOrOne ( of: " ( " ) )
23522340 parseWithDelimitersTest (
2353- #"re'\\k''"# , concat ( " \\ " , " k " ) , ignoreTrailing: true
2354- )
2341+ #"/\\k/"# , concat ( " \\ " , " k " ) )
23552342 parseWithDelimitersTest (
2356- #"re'\\g''"# , concat ( " \\ " , " g " ) , ignoreTrailing: true
2357- )
2343+ #"/\\g/"# , concat ( " \\ " , " g " ) )
23582344 parseWithDelimitersTest (
2359- #"re' \(?C'' "# , concat ( zeroOrOne ( of: " ( " ) , " C " ) , ignoreTrailing : true
2360- )
2361- delimiterLexingTest ( #"re' (\?''"# , ignoreTrailing : true )
2362- delimiterLexingTest ( #"re' \(?(''"# , ignoreTrailing : true )
2345+ #"/ \(?C/ "# , concat ( zeroOrOne ( of: " ( " ) , " C " ) )
2346+
2347+ delimiterLexingTest ( #"/ (\?/"# )
2348+ delimiterLexingTest ( #"/ \(?(/"# )
23632349
23642350 // MARK: Parse not-equal
23652351
@@ -3322,31 +3308,24 @@ extension RegexTests {
33223308
33233309 // MARK: Printable ASCII
33243310
3325- delimiterLexingDiagnosticTest ( #"re'\\#n'"# , . unterminated)
33263311 for i : UInt8 in 0x1 ..< 0x20 where i != 0xA && i != 0xD { // U+A & U+D are \n and \r.
3327- delimiterLexingDiagnosticTest ( " re' \( UnicodeScalar ( i) ) ' " , . unprintableASCII)
3312+ delimiterLexingDiagnosticTest ( " / \( UnicodeScalar ( i) ) / " , . unprintableASCII)
33283313 }
3329- delimiterLexingDiagnosticTest ( " re' \n ' " , . unterminated)
3330- delimiterLexingDiagnosticTest ( " re' \r ' " , . unterminated)
3331- delimiterLexingDiagnosticTest ( " re' \u{7F} ' " , . unprintableASCII)
33323314
3333- // MARK: Delimiter skipping
3315+ // Can only be done if pound signs are used.
3316+ delimiterLexingDiagnosticTest ( " / \n / " , . unterminated)
3317+ delimiterLexingDiagnosticTest ( " / \r / " , . unterminated)
3318+ delimiterLexingDiagnosticTest ( " / \u{7F} / " , . unprintableASCII)
33343319
3335- delimiterLexingDiagnosticTest ( " re'(?'' " , . unterminated)
3336- delimiterLexingDiagnosticTest ( " re'(?'abc' " , . unterminated)
3337- delimiterLexingDiagnosticTest ( " re'(?('abc' " , . unterminated)
3338- delimiterLexingDiagnosticTest ( #"re'\k'ab_c0+-'"# , . unterminated)
3339- delimiterLexingDiagnosticTest ( #"re'\g'ab_c0+-'"# , . unterminated)
3320+ delimiterLexingDiagnosticTest ( " / " , . unterminated)
3321+ delimiterLexingDiagnosticTest ( " /x " , . unterminated)
33403322
33413323 // MARK: Unbalanced extended syntax
33423324 delimiterLexingDiagnosticTest ( " #/a/ " , . unterminated)
33433325 delimiterLexingDiagnosticTest ( " ##/a/# " , . unterminated)
33443326
33453327 // MARK: Multiline
33463328
3347- // Can only be done if pound signs are used.
3348- delimiterLexingDiagnosticTest ( " / \n / " , . unterminated)
3349-
33503329 // Opening and closing delimiters must be on a newline.
33513330 delimiterLexingDiagnosticTest ( " #/a \n /# " , . unterminated)
33523331 delimiterLexingDiagnosticTest ( " #/ \n a/# " , . multilineClosingNotOnNewline)
0 commit comments