|
|
|
@ -15,14 +15,14 @@
|
|
|
|
|
(defn decode-key
|
|
|
|
|
"Returns the first character if the string is a char. Return the number if the string is a number."
|
|
|
|
|
[str]
|
|
|
|
|
(if (ps/unsigned-int? str)
|
|
|
|
|
(if (ps/unsigned-int-string? str)
|
|
|
|
|
(Integer/parseInt str)
|
|
|
|
|
(first str)))
|
|
|
|
|
|
|
|
|
|
(defn decode-pair
|
|
|
|
|
"Decode a numbers as a string and a char as a string"
|
|
|
|
|
[acc [key value]]
|
|
|
|
|
(if (ps/unsigned-int? key)
|
|
|
|
|
(if (ps/unsigned-int-string? key)
|
|
|
|
|
(assoc acc (decode-key key) (decode-key value))
|
|
|
|
|
(assoc acc (decode-key key) value)))
|
|
|
|
|
|
|
|
|
@ -38,7 +38,7 @@
|
|
|
|
|
(defn generate-table-or-decode-json
|
|
|
|
|
"It generate the table and return map with the key and the table if the argument is a key. Else it decode the json."
|
|
|
|
|
[key-or-json symbols]
|
|
|
|
|
(if (ps/unsigned-int? key-or-json)
|
|
|
|
|
(if (ps/unsigned-int-string? key-or-json)
|
|
|
|
|
(-> {"key" key-or-json}
|
|
|
|
|
(assoc "table" (ss/generate-substitution-table symbols)))
|
|
|
|
|
(decode-key-and-substitution-table-from-json key-or-json)))
|
|
|
|
|