@@ -2736,11 +2736,10 @@ extension RegexTests {
2736
2736
diagnosticTest ( #"(?^"# , . expected( " ) " ) )
2737
2737
diagnosticTest ( #"(?^i"# , . expected( " ) " ) )
2738
2738
2739
- // TODO: These errors could be better.
2740
- diagnosticTest ( #"(?y)"# , . expected( " { " ) , . expected( " g " ) , . expected( " } " ) , unsupported: true )
2741
- diagnosticTest ( #"(?y{)"# , . expected( " g " ) , . expected( " } " ) , unsupported: true )
2739
+ diagnosticTest ( #"(?y)"# , . expected( " { " ) , unsupported: true )
2740
+ diagnosticTest ( #"(?y{)"# , . unknownTextSegmentMatchingOption( " ) " ) , . expected( " } " ) , . expected( " ) " ) , unsupported: true )
2742
2741
diagnosticTest ( #"(?y{g)"# , . expected( " } " ) , unsupported: true )
2743
- diagnosticTest ( #"(?y{x})"# , . expected ( " g " ) , . expected ( " } " ) , . invalidMatchingOption ( " } " ) , unsupported: true )
2742
+ diagnosticTest ( #"(?y{x})"# , . unknownTextSegmentMatchingOption ( " x " ) , unsupported: true )
2744
2743
2745
2744
diagnosticTest ( #"(?P"# , . expected( " ) " ) )
2746
2745
diagnosticTest ( #"(?R"# , . expected( " ) " ) , unsupported: true )
@@ -2948,18 +2947,17 @@ extension RegexTests {
2948
2947
diagnosticTest ( #"(?k)"# , . unknownGroupKind( " ?k " ) )
2949
2948
diagnosticTest ( #"(?P#)"# , . invalidMatchingOption( " # " ) )
2950
2949
2951
- // TODO: We shouldn't emit the expected closing delimiter here and elsewhere.
2952
- diagnosticTest ( #"(?<#>)"# , . expected( " > " ) , . identifierMustBeAlphaNumeric( . groupName) )
2950
+ diagnosticTest ( #"(?<#>)"# , . identifierMustBeAlphaNumeric( . groupName) )
2953
2951
diagnosticTest ( #"(?'1A')"# , . identifierCannotStartWithNumber( . groupName) )
2954
2952
2955
2953
// TODO: It might be better if tried to consume up to the closing `'` and
2956
2954
// diagnosed an invalid group name based on that.
2957
2955
diagnosticTest ( #"(?'abc ')"# , . expected( " ' " ) )
2958
2956
2959
- diagnosticTest ( " (?'🔥') " , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) )
2957
+ diagnosticTest ( " (?'🔥') " , . identifierMustBeAlphaNumeric( . groupName) )
2960
2958
2961
2959
diagnosticTest ( #"(?'-')"# , . expectedIdentifier( . groupName) , unsupported: true )
2962
- diagnosticTest ( #"(?'--')"# , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) , unsupported: true )
2960
+ diagnosticTest ( #"(?'--')"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
2963
2961
diagnosticTest ( #"(?'a-b-c')"# , . expected( " ' " ) , unsupported: true )
2964
2962
2965
2963
diagnosticTest ( " (?x)(? : ) " , . unknownGroupKind( " ? " ) )
@@ -3035,12 +3033,12 @@ extension RegexTests {
3035
3033
diagnosticTest ( #"\g{0}"# , . cannotReferToWholePattern)
3036
3034
diagnosticTest ( #"(?(0))"# , . cannotReferToWholePattern, unsupported: true )
3037
3035
3038
- diagnosticTest ( #"(?&&)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3039
- diagnosticTest ( #"(?&-1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3040
- diagnosticTest ( #"(?P>+1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3041
- diagnosticTest ( #"(?P=+1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3042
- diagnosticTest ( #"\k'#'"# , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) , unsupported: true )
3043
- diagnosticTest ( #"(?&#)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3036
+ diagnosticTest ( #"(?&&)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3037
+ diagnosticTest ( #"(?&-1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3038
+ diagnosticTest ( #"(?P>+1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3039
+ diagnosticTest ( #"(?P=+1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3040
+ diagnosticTest ( #"\k'#'"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3041
+ diagnosticTest ( #"(?&#)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3044
3042
3045
3043
diagnosticTest ( #"(?P>1)"# , . identifierCannotStartWithNumber( . groupName) , unsupported: true )
3046
3044
diagnosticTest ( #"\k{1}"# , . identifierCannotStartWithNumber( . groupName) , . invalidNamedReference( " 1 " ) )
0 commit comments