         "key.request": sourcekitd_uid_get_from_cstr("source.request.editor.open"),
         "key.name": "",
         "key.sourcefile": file])
-    let data = sendSourceKitRequest(request)["key.syntaxmap"] as NSData!
-
-    // Get number of syntax tokens
-    var tokens = 0
-    data.getBytes(&tokens, range: NSRange(location: 8, length: 8))
-    tokens = tokens >> 4
-
-    var identifierOffsets = [Int]()
-
-    for i in 0..<tokens {
-        let parserOffset = 16 * i
-
-        var uid = UInt64(0)
-        data.getBytes(&uid, range: NSRange(location: 16 + parserOffset, length: 8))
-        let type = stringForSourceKitUID(uid)!
-
-        // Only append identifiers
-        if type != "source.lang.swift.syntaxtype.identifier" {
-            continue
-        }
-        var offset = 0
-        data.getBytes(&offset, range: NSRange(location: 24 + parserOffset, length: 4))
-        identifierOffsets.append(offset)
-    }
-
-    let fileContents = files[file]!
-    let regex = NSRegularExpression(pattern: "(///.*\\n|\\*/\\n)", options: nil, error: nil)!
-    let range = NSRange(location: 0, length: fileContents.length)
-    let matches = regex.matchesInString(fileContents, options: nil, range: range)
-
-    var offsets = [Int]()
-    for match in matches {
-        offsets.append(identifierOffsets.filter({ $0 >= match.range.location})[0])
-    }
-    return offsets
+    return documentedTokenOffsets(sendSourceKitRequest(request)["key.syntaxmap"] as NSData!, file)
 }
 
 /**

}

/**
Parses the compiler arguments needed to compile the Swift aspects of an Xcode project

:param: xcodebuildOutput output of `xcodebuild` to be parsed for swift compiler arguments

*/
func main() {
    let arguments = Process.arguments
    if arguments.count > 1 && arguments[1] == "--single-file" {
        var sourcekitdArguments = Array<String>(arguments[3..<arguments.count])
        docs_for_swift_compiler_args(sourcekitdArguments, arguments[2])
    } else if arguments.count == 3 && arguments[1] == "--structure" {
        printStructure(file: arguments[2])
    } else if arguments.count == 3 && arguments[1] == "--syntax" {
