include more details when error happens importing

This commit is contained in:
Bryce
2023-10-27 20:37:42 -07:00
parent 76760b7bcf
commit 6c3017d1eb
2 changed files with 15 additions and 7 deletions

View File

@@ -12,9 +12,17 @@
\"foo[bar][][baz]\"
=> [\"foo\" \"bar\" \"\" \"baz\"]"
[param-name]
(let [[_ k ks] (re-matches #"(?s)(.*?)((?:\[.*?\])*)" (name param-name))
keys (if ks (map second (re-seq #"\[(.*?)\]" ks)))]
(cons k keys)))
(let [[_ k ks] (re-matches #"(?s)(.*?)((?:(\[.*?\])|\(.*?\))*)" (name param-name))
keys (if ks (map second (re-seq #"(\[.*?\]|\(.*?\))" ks)))]
(cons k
(map (fn [k]
(let [[_ indexed-match] (re-matches k "\((.*?)\)")
[_ keyed-match] (re-matches k "\[(.*?)\]")]
(if indexed-match
[:index indexed-match]
[:key indexed-match])))))))
(defn- assoc-vec [m k v]
(let [m (if (contains? m k) m (assoc m k []))]