@@ -2799,11 +2799,10 @@ extension RegexTests {
2799
2799
diagnosticTest ( #"(?^"# , . expected( " ) " ) )
2800
2800
diagnosticTest ( #"(?^i"# , . expected( " ) " ) )
2801
2801
2802
- // TODO: These errors could be better.
2803
- diagnosticTest ( #"(?y)"# , . expected( " { " ) , . expected( " g " ) , . expected( " } " ) , unsupported: true )
2804
- diagnosticTest ( #"(?y{)"# , . expected( " g " ) , . expected( " } " ) , unsupported: true )
2802
+ diagnosticTest ( #"(?y)"# , . expected( " { " ) , unsupported: true )
2803
+ diagnosticTest ( #"(?y{)"# , . unknownTextSegmentMatchingOption( " ) " ) , . expected( " } " ) , . expected( " ) " ) , unsupported: true )
2805
2804
diagnosticTest ( #"(?y{g)"# , . expected( " } " ) , unsupported: true )
2806
- diagnosticTest ( #"(?y{x})"# , . expected ( " g " ) , . expected ( " } " ) , . invalidMatchingOption ( " } " ) , unsupported: true )
2805
+ diagnosticTest ( #"(?y{x})"# , . unknownTextSegmentMatchingOption ( " x " ) , unsupported: true )
2807
2806
2808
2807
diagnosticTest ( #"(?P"# , . expected( " ) " ) )
2809
2808
diagnosticTest ( #"(?R"# , . expected( " ) " ) , unsupported: true )
@@ -3082,18 +3081,17 @@ extension RegexTests {
3082
3081
diagnosticTest ( #"(?k)"# , . unknownGroupKind( " ?k " ) )
3083
3082
diagnosticTest ( #"(?P#)"# , . invalidMatchingOption( " # " ) )
3084
3083
3085
- // TODO: We shouldn't emit the expected closing delimiter here and elsewhere.
3086
- diagnosticTest ( #"(?<#>)"# , . expected( " > " ) , . identifierMustBeAlphaNumeric( . groupName) )
3084
+ diagnosticTest ( #"(?<#>)"# , . identifierMustBeAlphaNumeric( . groupName) )
3087
3085
diagnosticTest ( #"(?'1A')"# , . identifierCannotStartWithNumber( . groupName) )
3088
3086
3089
3087
// TODO: It might be better if tried to consume up to the closing `'` and
3090
3088
// diagnosed an invalid group name based on that.
3091
3089
diagnosticTest ( #"(?'abc ')"# , . expected( " ' " ) )
3092
3090
3093
- diagnosticTest ( " (?'🔥') " , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) )
3091
+ diagnosticTest ( " (?'🔥') " , . identifierMustBeAlphaNumeric( . groupName) )
3094
3092
3095
3093
diagnosticTest ( #"(?'-')"# , . expectedIdentifier( . groupName) , unsupported: true )
3096
- diagnosticTest ( #"(?'--')"# , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) , unsupported: true )
3094
+ diagnosticTest ( #"(?'--')"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3097
3095
diagnosticTest ( #"(?'a-b-c')"# , . expected( " ' " ) , unsupported: true )
3098
3096
3099
3097
diagnosticTest ( " (?x)(? : ) " , . unknownGroupKind( " ? " ) )
@@ -3174,12 +3172,12 @@ extension RegexTests {
3174
3172
diagnosticTest ( #"\g{0}"# , . cannotReferToWholePattern)
3175
3173
diagnosticTest ( #"(?(0))"# , . cannotReferToWholePattern, unsupported: true )
3176
3174
3177
- diagnosticTest ( #"(?&&)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3178
- diagnosticTest ( #"(?&-1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3179
- diagnosticTest ( #"(?P>+1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3180
- diagnosticTest ( #"(?P=+1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3181
- diagnosticTest ( #"\k'#'"# , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) , unsupported: true )
3182
- diagnosticTest ( #"(?&#)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3175
+ diagnosticTest ( #"(?&&)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3176
+ diagnosticTest ( #"(?&-1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3177
+ diagnosticTest ( #"(?P>+1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3178
+ diagnosticTest ( #"(?P=+1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3179
+ diagnosticTest ( #"\k'#'"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3180
+ diagnosticTest ( #"(?&#)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3183
3181
3184
3182
diagnosticTest ( #"(?P>1)"# , . identifierCannotStartWithNumber( . groupName) , unsupported: true )
3185
3183
diagnosticTest ( #"\k{1}"# , . identifierCannotStartWithNumber( . groupName) , . invalidNamedReference( " 1 " ) )
0 commit comments