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