 
 final class Parser {
 
+    struct Line {
+        let content: String
+        let isComment: Bool
+        let annotations: [String: NSObject]
+    }
+
     let verbose: Bool
     fileprivate var contents: String = ""
+    fileprivate var lines = [Line]()
     fileprivate var path: String? = nil
     fileprivate var logPrefix: String {
         return path.flatMap { "\($0): " } ?? ""

    }

    fileprivate func parseAnnotations(_ source: [String: SourceKitRepresentable]) -> [String: NSObject] {
        guard let substring = extract(.keyPrefix, from: source) else { return [:] }

        let newlines = NSCharacterSet.newlines
        let lines = substring
                .unicodeScalars
                .split(omittingEmptySubsequences: false, whereSeparator: { newlines.contains($0) })
                .flatMap(String.init)
                .reversed()
                .dropFirst()    //! last line is the actual key definition so skip it

        var commentLines = [String]()

        //! move lines iteratively and stop after the first one that's not a comment line:
        for var line in lines {
            line = line.trimmingCharacters(in: .whitespaces)
            if !line.hasPrefix("//") {
                break
            }

            commentLines.append(line)
        }

        var annotations = [String: NSObject]()
        commentLines.map(searchForAnnotations).forEach { collected in
                    collected.forEach {
                        annotations[$0.key] = $0.value
                    }
                }
        return annotations
    }


        }

        self.contents = contents
        self.lines = contents.lines()
                .map { $0.content.trimmingCharacters(in: .whitespaces) }
                .map { line in
                    var annotations = [String: NSObject]()
                    let isComment = line.hasPrefix("//")
                    if isComment {
                        annotations = searchForAnnotations(commentLine: line)
                    }

                    return Line(content: line,
                            isComment: isComment,
                            annotations: annotations)
                }

        let file = File(contents: contents)
        let types = parseTypes(Structure(file: file).dictionary, existingTypes: existingTypes.types)
