         return symbolSet
     }()
 
-    private func generateTokens() -> [Token] {
+    private func lineNumber(of location: Int) -> Int {
+        let string = scanner.string as NSString
+        let subString = string.substring(to: location)
+        return subString.characters.filter({ $0 == "\n" }).count
+    }
+
+    private func generateTokens() -> ([Token], [TokenLocation]) {
 
         func scanBeginObject() -> Token? {
             return scanner.scanString("{", into: nil) ? .beginObject("{") : nil

                next += 1
            }
            guard let token = tokens[coolie_safe: next] else {
                print("No token for parseBool")
                return nil
            }
            if case .bool(let bool) = token {

                next += 1
            }
            guard let token = tokens[coolie_safe: next] else {
                print("No token for parseNull: [\(lineNumber(of: tokenLocations[next].location))]")
                return nil
            }
            if case .null = token {
