@@ -265,10 +265,6 @@ public protocol _UnicodeEncodingBase {
265
265
/// The replacement character U+FFFD as represented in this encoding
266
266
static var encodedReplacementCharacter : EncodedScalar { get }
267
267
268
- /// Returns true if `x` only appears in this encoding as the representation of
269
- /// a complete scalar value.
270
- static func _isScalar( _ x: CodeUnit ) -> Bool
271
-
272
268
/// Convert from encoded to encoding-independent representation
273
269
static func decode( _ content: Self . EncodedScalar ) -> UnicodeScalar
274
270
}
@@ -293,7 +289,7 @@ public protocol _UnicodeEncoding : _UnicodeEncodingBase {
293
289
// where ReverseDecoder.Encoding == Self
294
290
}
295
291
296
- protocol UnicodeEncoding : _UnicodeEncoding
292
+ public protocol UnicodeEncoding : _UnicodeEncoding
297
293
where ForwardDecoder. Encoding == Self , ReverseDecoder. Encoding == Self { }
298
294
299
295
extension UnicodeDecoder {
@@ -361,8 +357,7 @@ extension Unicode {
361
357
extension Unicode . DefaultScalarView : Sequence {
362
358
struct Iterator {
363
359
var parsing : Unicode . ParsingIterator <
364
- CodeUnits . Iterator , Encoding . ForwardDecoder
365
- >
360
+ CodeUnits . Iterator , Encoding . ForwardDecoder >
366
361
}
367
362
368
363
func makeIterator( ) -> Iterator {
@@ -515,11 +510,18 @@ extension Unicode.DefaultScalarView : BidirectionalCollection {
515
510
}
516
511
}
517
512
513
+ public protocol _UTFEncoding : UnicodeEncoding {
514
+ /// Returns true if `x` only appears in this encoding as the representation of
515
+ /// a complete scalar value.
516
+ static func _isScalar( _ x: CodeUnit ) -> Bool
517
+ }
518
+
518
519
public protocol _UTFDecoder : UnicodeDecoder
519
- where Encoding. EncodedScalar == _UIntBuffer < _UInt32 , Encoding . CodeUnit > ,
520
- _UInt32 == UInt32
521
- {
520
+ where Encoding : _UTFEncoding ,
521
+ Encoding . EncodedScalar == _UIntBuffer < _UInt32 , Encoding . CodeUnit > ,
522
+ _UInt32 == UInt32 {
522
523
associatedtype _UInt32 = UInt32
524
+
523
525
func _parseMultipleCodeUnits( ) -> ( isValid: Bool , bitCount: UInt8 )
524
526
var buffer : Encoding . EncodedScalar { get set }
525
527
func _bufferedScalar( bitCount: UInt8 ) -> Encoding . EncodedScalar
@@ -589,14 +591,16 @@ where Encoding.EncodedScalar == _UIntBuffer<UInt32, Encoding.CodeUnit> {
589
591
//===--- UTF8 Decoders ----------------------------------------------------===//
590
592
//===----------------------------------------------------------------------===//
591
593
592
- extension Unicode . UTF8 : UnicodeEncoding {
594
+ extension Unicode . UTF8 : _UTFEncoding {
593
595
public typealias EncodedScalar = _UIntBuffer < UInt32 , UInt8 >
594
596
595
597
public static var encodedReplacementCharacter : EncodedScalar {
596
598
return EncodedScalar ( _storage: 0xbdbfef , _bitCount: 24 )
597
599
}
598
600
599
- public static func _isScalar( _ x: CodeUnit ) -> Bool { return x & 0x80 == 0 }
601
+ public static func _isScalar( _ x: CodeUnit ) -> Bool {
602
+ return x & 0x80 == 0
603
+ }
600
604
601
605
public static func decode( _ source: EncodedScalar ) -> UnicodeScalar {
602
606
let bits = source. _storage
@@ -780,7 +784,7 @@ extension Unicode.UTF8.ForwardDecoder : _UTFDecoder {
780
784
//===--- UTF-16 Decoders --------------------------------------------------===//
781
785
//===----------------------------------------------------------------------===//
782
786
783
- extension Unicode . UTF16 : UnicodeEncoding {
787
+ extension Unicode . UTF16 : _UTFEncoding {
784
788
public typealias EncodedScalar = _UIntBuffer < UInt32 , UInt16 >
785
789
786
790
public static var encodedReplacementCharacter : EncodedScalar {
0 commit comments