@@ -550,28 +550,12 @@ extension Source {
550550 ) throws -> AST . Trivia ? {
551551 guard context. ignoreWhitespace else { return nil }
552552
553- func isWhitespace( _ c: Character ) -> Bool {
554- // This is a list of characters that PCRE treats as whitespace when
555- // compiled with Unicode support. It is a subset of the characters with
556- // the `.isWhitespace` property. ICU appears to also follow this list.
557- // Oniguruma and .NET follow a subset of this list.
558- //
559- // FIXME: PCRE only treats space and tab characters as whitespace when
560- // inside a custom character class (and only treats whitespace as
561- // non-semantic there for the extra-extended `(?xx)` mode). If we get a
562- // strict-PCRE mode, we'll need to add a case for that.
563- switch c {
564- case " " , " \u{9} " ... " \u{D} " , // space, \t, \n, vertical tab, \f, \r
565- " \u{85} " , " \u{200E} " , // next line, left-to-right mark
566- " \u{200F} " , " \u{2028} " , // right-to-left-mark, line separator
567- " \u{2029} " : // paragraph separator
568- return true
569- default :
570- return false
571- }
572- }
553+ // FIXME: PCRE only treats space and tab characters as whitespace when
554+ // inside a custom character class (and only treats whitespace as
555+ // non-semantic there for the extra-extended `(?xx)` mode). If we get a
556+ // strict-PCRE mode, we'll need to add a case for that.
573557 let trivia : Located < String > ? = recordLoc { src in
574- src. tryEatPrefix ( isWhitespace ) ? . string
558+ src. tryEatPrefix ( \ . isPatternWhitespace ) ? . string
575559 }
576560 guard let trivia = trivia else { return nil }
577561 return AST . Trivia ( trivia)
0 commit comments