0001    //
0002    //  SwiftDocKey.swift
0003    //  SourceKitten
0004    //
0005    //  Created by JP Simard on 2015-01-05.
0006    //  Copyright (c) 2015 SourceKitten. All rights reserved.
0007    //
0008    
0009    import Foundation
0010    
0011    /// SourceKit response dictionary keys.
0012    internal enum SwiftDocKey
File.swift:65
        return SwiftDocKey.getOffset(dictionary).flatMap { start in
File.swift:66
            let end = SwiftDocKey.getBodyOffset(dictionary).map { Int($0) }
File.swift:85
        return SwiftDocKey.getOffset(dictionary).flatMap { start in
File.swift:87
            let end = SwiftDocKey.getBodyOffset(dictionary).flatMap { bodyOffset in
File.swift:88
                return SwiftDocKey.getBodyLength(dictionary).map { bodyLength in
File.swift:105
        precondition(SwiftDocKey.getKind(dictionary)! == SyntaxKind.CommentMark.rawValue)
File.swift:106
        let offset = Int(SwiftDocKey.getOffset(dictionary)!)
File.swift:107
        let length = Int(SwiftDocKey.getLength(dictionary)!)
File.swift:134
            dictionary[SwiftDocKey.ParsedDeclaration.rawValue] = parsedDeclaration
File.swift:139
            dictionary[SwiftDocKey.ParsedScopeStart.rawValue] = Int64(parsedScopeRange.start)
File.swift:140
            dictionary[SwiftDocKey.ParsedScopeEnd.rawValue] = Int64(parsedScopeRange.end)
File.swift:144
        if let parsedXMLDocs = (SwiftDocKey.getFullXMLDocs(dictionary).flatMap(parseFullXMLDocs)) {
File.swift:149
                dictionary[SwiftDocKey.DocumentationComment.rawValue] = commentBody
File.swift:155
            dictionary[SwiftDocKey.Substructure.rawValue] = substructure
File.swift:173
                kind = SwiftDocKey.getKind(response),
File.swift:195
        return SwiftDocKey.getSubstructure(dictionary)?
File.swift:210
        if let kind = SwiftDocKey.getKind(dictionary) {
File.swift:215
                    return [SwiftDocKey.Name.rawValue: markName]
File.swift:220
                    atOffset: SwiftDocKey.getNameOffset(dictionary)!) ?? [String: SourceKitRepresentable]()
File.swift:223
                updateDict.removeValueForKey(SwiftDocKey.Kind.rawValue)
File.swift:239
        return SwiftDocKey.getSubstructure(parent) != nil &&
File.swift:241
            (shouldTreatAsSameFile(parent) && SwiftDocKey.getOffset(parent) == offset))
File.swift:258
            var substructure = SwiftDocKey.getSubstructure(parent)!
File.swift:261
                if SwiftDocKey.getOffset(structure as! [String: SourceKitRepresentable])! < offset {
File.swift:267
            parent[SwiftDocKey.Substructure.rawValue] = substructure
File.swift:292
        return path == SwiftDocKey.getFilePath(dictionary)
File.swift:302
        let hasTypeName             = SwiftDocKey.getTypeName(dictionary) != nil
File.swift:303
        let hasAnnotatedDeclaration = SwiftDocKey.getAnnotatedDeclaration(dictionary) != nil
File.swift:304
        let hasOffset               = SwiftDocKey.getOffset(dictionary) != nil
File.swift:305
        let isntExtension           = SwiftDocKey.getKind(dictionary) != SwiftDeclarationKind.Extension.rawValue
File.swift:319
        return SwiftDocKey.getOffset(dictionary).flatMap { offset in
File.swift:340
    if let kind = SwiftDocKey.getKind(dictionary) {
JSONOutput.swift:66
    func set(key: SwiftDocKey, _ value: AnyObject?) {
JSONOutput.swift:71
    func setA(key: SwiftDocKey, _ value: [AnyObject]?) {
OffsetMap.swift:52
        if let rangeStart = SwiftDocKey.getNameOffset(dictionary),
OffsetMap.swift:53
            rangeLength = SwiftDocKey.getNameLength(dictionary) where
OffsetMap.swift:55
            let bodyLength = SwiftDocKey.getBodyLength(dictionary) ?? 0
OffsetMap.swift:66
        if let substructure = SwiftDocKey.getSubstructure(dictionary) {
Request.swift:147
    return SwiftDocKey(rawValue: uidString)?.rawValue ??
Request.swift:252
        sourcekitd_request_dictionary_set_int64(request, sourcekitd_uid_get_from_cstr(SwiftDocKey.Offset.rawValue), offset)
Structure.swift:23
        _ = sourceKitResponse.removeValueForKey(SwiftDocKey.SyntaxMap.rawValue)
SwiftDocKey.swift:88
    private static func get<T>(key: SwiftDocKey, _ dictionary: [String: SourceKitRepresentable]) -> T? {
SwiftDocs.swift:53
        let syntaxMapData = dictionary.removeValueForKey(SwiftDocKey.SyntaxMap.rawValue) as! [SourceKitRepresentable]
SyntaxMap.swift:43
        self.init(data: SwiftDocKey.getSyntaxMap(sourceKitResponse)!)
: String { 0013 // MARK: SourceKit Keys 0014 0015 /// Annotated declaration (String). 0016 case AnnotatedDeclaration
SwiftDocKey.swift:155
        return get(.AnnotatedDeclaration, dictionary)
= "key.annotated_decl" 0017 /// Body length (Int64). 0018 case BodyLength
SwiftDocKey.swift:210
        return get(.BodyLength, dictionary)
= "key.bodylength" 0019 /// Body offset (Int64). 0020 case BodyOffset
SwiftDocKey.swift:199
        return get(.BodyOffset, dictionary)
= "key.bodyoffset" 0021 /// Diagnostic stage (String). 0022 case DiagnosticStage = "key.diagnostic_stage" 0023 /// File path (String). 0024 case FilePath
JSONOutput.swift:78
    set(.FilePath, decl.location.file)
SwiftDocKey.swift:221
        return get(.FilePath, dictionary)
= "key.filepath" 0025 /// Full XML docs (String). 0026 case FullXMLDocs
JSONOutput.swift:94
        set(.FullXMLDocs, "")
SwiftDocKey.swift:232
        return get(.FullXMLDocs, dictionary)
= "key.doc.full_as_xml" 0027 /// Kind (String). 0028 case Kind
File.swift:223
                updateDict.removeValueForKey(SwiftDocKey.Kind.rawValue)
JSONOutput.swift:77
    set(.Kind, decl.type.rawValue)
SwiftDocKey.swift:100
        return get(.Kind, dictionary)
= "key.kind" 0029 /// Length (Int64). 0030 case Length
SwiftDocKey.swift:133
        return get(.Length, dictionary)
= "key.length" 0031 /// Name (String). 0032 case Name
File.swift:215
                    return [SwiftDocKey.Name.rawValue: markName]
JSONOutput.swift:82
    set(.Name, decl.name)
= "key.name" 0033 /// Name length (Int64). 0034 case NameLength
SwiftDocKey.swift:188
        return get(.NameLength, dictionary)
= "key.namelength" 0035 /// Name offset (Int64). 0036 case NameOffset
SwiftDocKey.swift:177
        return get(.NameOffset, dictionary)
= "key.nameoffset" 0037 /// Offset (Int64). 0038 case Offset
Request.swift:252
        sourcekitd_request_dictionary_set_int64(request, sourcekitd_uid_get_from_cstr(SwiftDocKey.Offset.rawValue), offset)
SwiftDocKey.swift:122
        return get(.Offset, dictionary)
= "key.offset" 0039 /// Substructure ([SourceKitRepresentable]). 0040 case Substructure
File.swift:155
            dictionary[SwiftDocKey.Substructure.rawValue] = substructure
File.swift:267
            parent[SwiftDocKey.Substructure.rawValue] = substructure
JSONOutput.swift:91
    setA(.Substructure, decl.children.map(toOutputDictionary))
SwiftDocKey.swift:166
        return get(.Substructure, dictionary)
= "key.substructure" 0041 /// Syntax map (NSData). 0042 case SyntaxMap
Structure.swift:23
        _ = sourceKitResponse.removeValueForKey(SwiftDocKey.SyntaxMap.rawValue)
SwiftDocKey.swift:111
        return get(.SyntaxMap, dictionary)
SwiftDocs.swift:53
        let syntaxMapData = dictionary.removeValueForKey(SwiftDocKey.SyntaxMap.rawValue) as! [SourceKitRepresentable]
= "key.syntaxmap" 0043 /// Type name (String). 0044 case TypeName
SwiftDocKey.swift:144
        return get(.TypeName, dictionary)
= "key.typename" 0045 0046 // MARK: Custom Keys 0047 0048 /// Column where the token's declaration begins (Int64). 0049 case DocColumn
JSONOutput.swift:81
    set(.DocColumn, Int(decl.location.column))
= "key.doc.column" 0050 /// Documentation comment (String). 0051 case DocumentationComment
File.swift:149
                dictionary[SwiftDocKey.DocumentationComment.rawValue] = commentBody
JSONOutput.swift:85
    set(.DocumentationComment, decl.commentBody)
= "key.doc.comment" 0052 /// Declaration of documented token (String). 0053 case DocDeclaration = "key.doc.declaration" 0054 /// Discussion documentation of documented token ([SourceKitRepresentable]). 0055 case DocDiscussion = "key.doc.discussion" 0056 /// File where the documented token is located (String). 0057 case DocFile
JSONOutput.swift:79
    set(.DocFile, decl.location.file)
= "key.doc.file" 0058 /// Line where the token's declaration begins (Int64). 0059 case DocLine
JSONOutput.swift:80
    set(.DocLine, Int(decl.location.line))
= "key.doc.line" 0060 /// Name of documented token (String). 0061 case DocName = "key.doc.name" 0062 /// Parameters of documented token ([SourceKitRepresentable]). 0063 case DocParameters
JSONOutput.swift:90
    setA(.DocParameters, decl.documentation?.parameters.map(toOutputDictionary))
= "key.doc.parameters" 0064 /// Parsed declaration (String). 0065 case DocResultDiscussion
JSONOutput.swift:89
    setA(.DocResultDiscussion, decl.documentation?.returnDiscussion.map(toOutputDictionary))
= "key.doc.result_discussion" 0066 /// Parsed scope start (Int64). 0067 case DocType = "key.doc.type" 0068 /// Parsed scope start end (Int64). 0069 case USR
JSONOutput.swift:83
    set(.USR, decl.usr)
= "key.usr" 0070 /// Result discussion documentation of documented token ([SourceKitRepresentable]). 0071 case ParsedDeclaration
File.swift:134
            dictionary[SwiftDocKey.ParsedDeclaration.rawValue] = parsedDeclaration
JSONOutput.swift:84
    set(.ParsedDeclaration, decl.declaration)
= "key.parsed_declaration" 0072 /// Type of documented token (String). 0073 case ParsedScopeEnd
File.swift:140
            dictionary[SwiftDocKey.ParsedScopeEnd.rawValue] = Int64(parsedScopeRange.end)
JSONOutput.swift:87
    set(.ParsedScopeEnd, Int(decl.extent.end.line))
= "key.parsed_scope.end" 0074 /// USR of documented token (String). 0075 case ParsedScopeStart
File.swift:139
            dictionary[SwiftDocKey.ParsedScopeStart.rawValue] = Int64(parsedScopeRange.start)
JSONOutput.swift:86
    set(.ParsedScopeStart, Int(decl.extent.start.line))
= "key.parsed_scope.start" 0076 0077 0078 // MARK: Typed SwiftDocKey Getters 0079 0080 /** 0081 Returns the typed value of a dictionary key. 0082 0083 - parameter key: SwiftDoctKey to get from the dictionary. 0084 - parameter dictionary: Dictionary to get value from. 0085 0086 - returns: Typed value of a dictionary key. 0087 */ 0088 private static func get
SwiftDocKey.swift:100
        return get(.Kind, dictionary)
SwiftDocKey.swift:111
        return get(.SyntaxMap, dictionary)
SwiftDocKey.swift:122
        return get(.Offset, dictionary)
SwiftDocKey.swift:133
        return get(.Length, dictionary)
SwiftDocKey.swift:144
        return get(.TypeName, dictionary)
SwiftDocKey.swift:155
        return get(.AnnotatedDeclaration, dictionary)
SwiftDocKey.swift:166
        return get(.Substructure, dictionary)
SwiftDocKey.swift:177
        return get(.NameOffset, dictionary)
SwiftDocKey.swift:188
        return get(.NameLength, dictionary)
SwiftDocKey.swift:199
        return get(.BodyOffset, dictionary)
SwiftDocKey.swift:210
        return get(.BodyLength, dictionary)
SwiftDocKey.swift:221
        return get(.FilePath, dictionary)
SwiftDocKey.swift:232
        return get(.FullXMLDocs, dictionary)
<T>(key: SwiftDocKey, _ dictionary: [String: SourceKitRepresentable]) -> T? { 0089 return dictionary[key.rawValue] as! T? 0090 } 0091 0092 /** 0093 Get kind string from dictionary. 0094 0095 - parameter dictionary: Dictionary to get value from. 0096 0097 - returns: Kind string if successful. 0098 */ 0099 internal static func getKind
File.swift:105
        precondition(SwiftDocKey.getKind(dictionary)! == SyntaxKind.CommentMark.rawValue)
File.swift:173
                kind = SwiftDocKey.getKind(response),
File.swift:210
        if let kind = SwiftDocKey.getKind(dictionary) {
File.swift:305
        let isntExtension           = SwiftDocKey.getKind(dictionary) != SwiftDeclarationKind.Extension.rawValue
File.swift:340
    if let kind = SwiftDocKey.getKind(dictionary) {
(dictionary: [String: SourceKitRepresentable]) -> String? { 0100 return get(.Kind, dictionary) 0101 } 0102 0103 /** 0104 Get syntax map data from dictionary. 0105 0106 - parameter dictionary: Dictionary to get value from. 0107 0108 - returns: Syntax map data if successful. 0109 */ 0110 internal static func getSyntaxMap
SyntaxMap.swift:43
        self.init(data: SwiftDocKey.getSyntaxMap(sourceKitResponse)!)
(dictionary: [String: SourceKitRepresentable]) -> [SourceKitRepresentable]? { 0111 return get(.SyntaxMap, dictionary) 0112 } 0113 0114 /** 0115 Get offset int from dictionary. 0116 0117 - parameter dictionary: Dictionary to get value from. 0118 0119 - returns: Offset int if successful. 0120 */ 0121 internal static func getOffset
File.swift:65
        return SwiftDocKey.getOffset(dictionary).flatMap { start in
File.swift:85
        return SwiftDocKey.getOffset(dictionary).flatMap { start in
File.swift:106
        let offset = Int(SwiftDocKey.getOffset(dictionary)!)
File.swift:241
            (shouldTreatAsSameFile(parent) && SwiftDocKey.getOffset(parent) == offset))
File.swift:261
                if SwiftDocKey.getOffset(structure as! [String: SourceKitRepresentable])! < offset {
File.swift:304
        let hasOffset               = SwiftDocKey.getOffset(dictionary) != nil
File.swift:319
        return SwiftDocKey.getOffset(dictionary).flatMap { offset in
(dictionary: [String: SourceKitRepresentable]) -> Int64? { 0122 return get(.Offset, dictionary) 0123 } 0124 0125 /** 0126 Get length int from dictionary. 0127 0128 - parameter dictionary: Dictionary to get value from. 0129 0130 - returns: Length int if successful. 0131 */ 0132 internal static func getLength
File.swift:107
        let length = Int(SwiftDocKey.getLength(dictionary)!)
(dictionary: [String: SourceKitRepresentable]) -> Int64? { 0133 return get(.Length, dictionary) 0134 } 0135 0136 /** 0137 Get type name string from dictionary. 0138 0139 - parameter dictionary: Dictionary to get value from. 0140 0141 - returns: Type name string if successful. 0142 */ 0143 internal static func getTypeName
File.swift:302
        let hasTypeName             = SwiftDocKey.getTypeName(dictionary) != nil
(dictionary: [String: SourceKitRepresentable]) -> String? { 0144 return get(.TypeName, dictionary) 0145 } 0146 0147 /** 0148 Get annotated declaration string from dictionary. 0149 0150 - parameter dictionary: Dictionary to get value from. 0151 0152 - returns: Annotated declaration string if successful. 0153 */ 0154 internal static func getAnnotatedDeclaration
File.swift:303
        let hasAnnotatedDeclaration = SwiftDocKey.getAnnotatedDeclaration(dictionary) != nil
(dictionary: [String: SourceKitRepresentable]) -> String? { 0155 return get(.AnnotatedDeclaration, dictionary) 0156 } 0157 0158 /** 0159 Get substructure array from dictionary. 0160 0161 - parameter dictionary: Dictionary to get value from. 0162 0163 - returns: Substructure array if successful. 0164 */ 0165 internal static func getSubstructure
File.swift:195
        return SwiftDocKey.getSubstructure(dictionary)?
File.swift:239
        return SwiftDocKey.getSubstructure(parent) != nil &&
File.swift:258
            var substructure = SwiftDocKey.getSubstructure(parent)!
OffsetMap.swift:66
        if let substructure = SwiftDocKey.getSubstructure(dictionary) {
(dictionary: [String: SourceKitRepresentable]) -> [SourceKitRepresentable]? { 0166 return get(.Substructure, dictionary) 0167 } 0168 0169 /** 0170 Get name offset int from dictionary. 0171 0172 - parameter dictionary: Dictionary to get value from. 0173 0174 - returns: Name offset int if successful. 0175 */ 0176 internal static func getNameOffset
File.swift:220
                    atOffset: SwiftDocKey.getNameOffset(dictionary)!) ?? [String: SourceKitRepresentable]()
OffsetMap.swift:52
        if let rangeStart = SwiftDocKey.getNameOffset(dictionary),
(dictionary: [String: SourceKitRepresentable]) -> Int64? { 0177 return get(.NameOffset, dictionary) 0178 } 0179 0180 /** 0181 Get length int from dictionary. 0182 0183 - parameter dictionary: Dictionary to get value from. 0184 0185 - returns: Length int if successful. 0186 */ 0187 internal static func getNameLength
OffsetMap.swift:53
            rangeLength = SwiftDocKey.getNameLength(dictionary) where
(dictionary: [String: SourceKitRepresentable]) -> Int64? { 0188 return get(.NameLength, dictionary) 0189 } 0190 0191 /** 0192 Get body offset int from dictionary. 0193 0194 - parameter dictionary: Dictionary to get value from. 0195 0196 - returns: Body offset int if successful. 0197 */ 0198 internal static func getBodyOffset
File.swift:66
            let end = SwiftDocKey.getBodyOffset(dictionary).map { Int($0) }
File.swift:87
            let end = SwiftDocKey.getBodyOffset(dictionary).flatMap { bodyOffset in
(dictionary: [String: SourceKitRepresentable]) -> Int64? { 0199 return get(.BodyOffset, dictionary) 0200 } 0201 0202 /** 0203 Get body length int from dictionary. 0204 0205 - parameter dictionary: Dictionary to get value from. 0206 0207 - returns: Body length int if successful. 0208 */ 0209 internal static func getBodyLength
File.swift:88
                return SwiftDocKey.getBodyLength(dictionary).map { bodyLength in
OffsetMap.swift:55
            let bodyLength = SwiftDocKey.getBodyLength(dictionary) ?? 0
(dictionary: [String: SourceKitRepresentable]) -> Int64? { 0210 return get(.BodyLength, dictionary) 0211 } 0212 0213 /** 0214 Get file path string from dictionary. 0215 0216 - parameter dictionary: Dictionary to get value from. 0217 0218 - returns: File path string if successful. 0219 */ 0220 internal static func getFilePath
File.swift:292
        return path == SwiftDocKey.getFilePath(dictionary)
(dictionary: [String: SourceKitRepresentable]) -> String? { 0221 return get(.FilePath, dictionary) 0222 } 0223 0224 /** 0225 Get full xml docs string from dictionary. 0226 0227 - parameter dictionary: Dictionary to get value from. 0228 0229 - returns: Full xml docs string if successful. 0230 */ 0231 internal static func getFullXMLDocs
File.swift:144
        if let parsedXMLDocs = (SwiftDocKey.getFullXMLDocs(dictionary).flatMap(parseFullXMLDocs)) {
(dictionary: [String: SourceKitRepresentable]) -> String? { 0232 return get(.FullXMLDocs, dictionary) 0233 } 0234 } 0235