10
10
//===----------------------------------------------------------------------===//
11
11
12
12
// A tree representing the type of some captures.
13
- public enum CaptureStructure : Equatable {
13
+ enum CaptureStructure : Equatable {
14
14
case atom( name: String ? = nil , type: AnyType ? = nil )
15
15
indirect case optional( CaptureStructure )
16
16
indirect case tuple( [ CaptureStructure ] )
17
17
18
- public static func tuple( _ children: CaptureStructure ... ) -> Self {
18
+ static func tuple( _ children: CaptureStructure ... ) -> Self {
19
19
tuple ( children)
20
20
}
21
21
22
- public static var empty : Self {
22
+ static var empty : Self {
23
23
. tuple( [ ] )
24
24
}
25
25
}
@@ -29,14 +29,14 @@ public enum CaptureStructure: Equatable {
29
29
extension CaptureStructure {
30
30
/// Returns a Boolean indicating whether the structure does not contain any
31
31
/// captures.
32
- public var isEmpty : Bool {
32
+ var isEmpty : Bool {
33
33
if case . tuple( let elements) = self , elements. isEmpty {
34
34
return true
35
35
}
36
36
return false
37
37
}
38
38
39
- public func type( withAtomType atomType: Any . Type ) -> Any . Type {
39
+ func type( withAtomType atomType: Any . Type ) -> Any . Type {
40
40
switch self {
41
41
case . atom( _, type: nil ) :
42
42
return atomType
@@ -51,13 +51,13 @@ extension CaptureStructure {
51
51
}
52
52
}
53
53
54
- public typealias DefaultAtomType = Substring
54
+ typealias DefaultAtomType = Substring
55
55
56
- public var type : Any . Type {
56
+ var type : Any . Type {
57
57
type ( withAtomType: DefaultAtomType . self)
58
58
}
59
59
60
- public var atomType : AnyType {
60
+ var atomType : AnyType {
61
61
switch self {
62
62
case . atom( _, type: nil ) :
63
63
return . init( Substring . self)
@@ -89,7 +89,7 @@ extension CaptureStructure {
89
89
private typealias SerializationVersion = UInt16
90
90
private static let currentSerializationVersion : SerializationVersion = 1
91
91
92
- public static func serializationBufferSize(
92
+ static func serializationBufferSize(
93
93
forInputUTF8CodeUnitCount inputUTF8CodeUnitCount: Int
94
94
) -> Int {
95
95
MemoryLayout < SerializationVersion > . stride + inputUTF8CodeUnitCount + 1
@@ -110,7 +110,7 @@ extension CaptureStructure {
110
110
///
111
111
/// - Parameter buffer: A buffer whose byte count is at least the byte count
112
112
/// of the regular expression string that produced this capture structure.
113
- public func encode( to buffer: UnsafeMutableRawBufferPointer ) {
113
+ func encode( to buffer: UnsafeMutableRawBufferPointer ) {
114
114
assert ( !buffer. isEmpty, " Buffer must not be empty " )
115
115
assert (
116
116
buffer. count >=
@@ -169,7 +169,7 @@ extension CaptureStructure {
169
169
170
170
/// Creates a capture structure by decoding a serialized representation from
171
171
/// the given buffer.
172
- public init ? ( decoding buffer: UnsafeRawBufferPointer ) {
172
+ init ? ( decoding buffer: UnsafeRawBufferPointer ) {
173
173
var scopes : [ [ CaptureStructure ] ] = [ [ ] ]
174
174
var currentScope : [ CaptureStructure ] {
175
175
get { scopes [ scopes. endIndex - 1 ] }
@@ -223,13 +223,13 @@ extension CaptureStructure {
223
223
}
224
224
225
225
extension CaptureStructure : CustomStringConvertible {
226
- public var description : String {
226
+ var description : String {
227
227
var printer = PrettyPrinter ( )
228
228
_print ( & printer)
229
229
return printer. finish ( )
230
230
}
231
231
232
- private func _print( _ printer: inout PrettyPrinter ) {
232
+ func _print( _ printer: inout PrettyPrinter ) {
233
233
switch self {
234
234
case let . atom( name, type) :
235
235
let name = name ?? " <unnamed> "
0 commit comments