@@ -2728,11 +2728,10 @@ extension RegexTests {
2728
2728
diagnosticTest ( #"(?^"# , . expected( " ) " ) )
2729
2729
diagnosticTest ( #"(?^i"# , . expected( " ) " ) )
2730
2730
2731
- // TODO: These errors could be better.
2732
- diagnosticTest ( #"(?y)"# , . expected( " { " ) , . expected( " g " ) , . expected( " } " ) , unsupported: true )
2733
- diagnosticTest ( #"(?y{)"# , . expected( " g " ) , . expected( " } " ) , unsupported: true )
2731
+ diagnosticTest ( #"(?y)"# , . expected( " { " ) , unsupported: true )
2732
+ diagnosticTest ( #"(?y{)"# , . unknownTextSegmentMatchingOption( " ) " ) , . expected( " } " ) , . expected( " ) " ) , unsupported: true )
2734
2733
diagnosticTest ( #"(?y{g)"# , . expected( " } " ) , unsupported: true )
2735
- diagnosticTest ( #"(?y{x})"# , . expected ( " g " ) , . expected ( " } " ) , . invalidMatchingOption ( " } " ) , unsupported: true )
2734
+ diagnosticTest ( #"(?y{x})"# , . unknownTextSegmentMatchingOption ( " x " ) , unsupported: true )
2736
2735
2737
2736
diagnosticTest ( #"(?P"# , . expected( " ) " ) )
2738
2737
diagnosticTest ( #"(?R"# , . expected( " ) " ) , unsupported: true )
@@ -2919,18 +2918,17 @@ extension RegexTests {
2919
2918
diagnosticTest ( #"(?k)"# , . unknownGroupKind( " ?k " ) )
2920
2919
diagnosticTest ( #"(?P#)"# , . invalidMatchingOption( " # " ) )
2921
2920
2922
- // TODO: We shouldn't emit the expected closing delimiter here and elsewhere.
2923
- diagnosticTest ( #"(?<#>)"# , . expected( " > " ) , . identifierMustBeAlphaNumeric( . groupName) )
2921
+ diagnosticTest ( #"(?<#>)"# , . identifierMustBeAlphaNumeric( . groupName) )
2924
2922
diagnosticTest ( #"(?'1A')"# , . identifierCannotStartWithNumber( . groupName) )
2925
2923
2926
2924
// TODO: It might be better if tried to consume up to the closing `'` and
2927
2925
// diagnosed an invalid group name based on that.
2928
2926
diagnosticTest ( #"(?'abc ')"# , . expected( " ' " ) )
2929
2927
2930
- diagnosticTest ( " (?'🔥') " , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) )
2928
+ diagnosticTest ( " (?'🔥') " , . identifierMustBeAlphaNumeric( . groupName) )
2931
2929
2932
2930
diagnosticTest ( #"(?'-')"# , . expectedIdentifier( . groupName) , unsupported: true )
2933
- diagnosticTest ( #"(?'--')"# , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) , unsupported: true )
2931
+ diagnosticTest ( #"(?'--')"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
2934
2932
diagnosticTest ( #"(?'a-b-c')"# , . expected( " ' " ) , unsupported: true )
2935
2933
2936
2934
diagnosticTest ( " (?x)(? : ) " , . unknownGroupKind( " ? " ) )
@@ -3006,12 +3004,12 @@ extension RegexTests {
3006
3004
diagnosticTest ( #"\g{0}"# , . cannotReferToWholePattern)
3007
3005
diagnosticTest ( #"(?(0))"# , . cannotReferToWholePattern, unsupported: true )
3008
3006
3009
- diagnosticTest ( #"(?&&)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3010
- diagnosticTest ( #"(?&-1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3011
- diagnosticTest ( #"(?P>+1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3012
- diagnosticTest ( #"(?P=+1)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3013
- diagnosticTest ( #"\k'#'"# , . identifierMustBeAlphaNumeric( . groupName) , . expected ( " ' " ) , unsupported: true )
3014
- diagnosticTest ( #"(?&#)"# , . identifierMustBeAlphaNumeric( . groupName) , . unbalancedEndOfGroup , . expected ( " ) " ) , unsupported: true )
3007
+ diagnosticTest ( #"(?&&)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3008
+ diagnosticTest ( #"(?&-1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3009
+ diagnosticTest ( #"(?P>+1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3010
+ diagnosticTest ( #"(?P=+1)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3011
+ diagnosticTest ( #"\k'#'"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3012
+ diagnosticTest ( #"(?&#)"# , . identifierMustBeAlphaNumeric( . groupName) , unsupported: true )
3015
3013
3016
3014
diagnosticTest ( #"(?P>1)"# , . identifierCannotStartWithNumber( . groupName) , unsupported: true )
3017
3015
diagnosticTest ( #"\k{1}"# , . identifierCannotStartWithNumber( . groupName) , . invalidNamedReference( " 1 " ) )
0 commit comments