@@ -602,7 +602,7 @@ extension Source {
602
602
// Matching option changing group (?iJmnsUxxxDPSWy{..}-iJmnsUxxxDPSW:).
603
603
if let seq = try src. lexMatchingOptionSequence ( ) {
604
604
if src. tryEat ( " : " ) {
605
- return . changeMatchingOptions( seq, hasImplicitScope : false )
605
+ return . changeMatchingOptions( seq, isIsolated : false )
606
606
}
607
607
// If this isn't start of an explicit group, we should have an
608
608
// implicit group that covers the remaining elements of the current
@@ -611,7 +611,7 @@ extension Source {
611
611
// also does it across alternations, which will require additional
612
612
// handling.
613
613
try src. expect ( " ) " )
614
- return . changeMatchingOptions( seq, hasImplicitScope : true )
614
+ return . changeMatchingOptions( seq, isIsolated : true )
615
615
}
616
616
617
617
guard let next = src. peek ( ) else {
@@ -1026,14 +1026,19 @@ extension Source {
1026
1026
/// of a '-' character followed by an atom.
1027
1027
mutating func lexCustomCharClassRangeEnd(
1028
1028
priorGroupCount: Int
1029
- ) throws -> AST . Atom ? {
1029
+ ) throws -> ( dashLoc : SourceLocation , AST . Atom ) ? {
1030
1030
// Make sure we don't have a binary operator e.g '--', and the '-' is not
1031
1031
// ending the custom character class (in which case it is literal).
1032
+ let start = currentPosition
1032
1033
guard peekCCBinOp ( ) == nil && !starts( with: " -] " ) && tryEat ( " - " ) else {
1033
1034
return nil
1034
1035
}
1035
- return try lexAtom ( isInCustomCharacterClass: true ,
1036
- priorGroupCount: priorGroupCount)
1036
+ let dashLoc = Location ( start ..< currentPosition)
1037
+ guard let end = try lexAtom ( isInCustomCharacterClass: true ,
1038
+ priorGroupCount: priorGroupCount) else {
1039
+ return nil
1040
+ }
1041
+ return ( dashLoc, end)
1037
1042
}
1038
1043
}
1039
1044
0 commit comments