mirror of
https://github.com/janet-lang/janet
synced 2024-12-12 17:50:26 +00:00
eae4e0dede
take a tuple as an l-value. Remove the old multi-sym report in anticipation of a different mechanism.
32 lines
651 B
Plaintext
32 lines
651 B
Plaintext
# Helper to generate core library mappings for janet
|
|
# Used to help build the tmLanguage grammar.
|
|
|
|
(def allsyms (all-symbols))
|
|
|
|
(def- escapes
|
|
{(get "|" 0) `\|`
|
|
(get "-" 0) `\-`
|
|
(get "+" 0) `\+`
|
|
(get "*" 0) `\*`
|
|
(get "^" 0) `\^`
|
|
(get "$" 0) `\$`
|
|
(get "?" 0) `\?`
|
|
38 "&"
|
|
60 "<"
|
|
62 ">"
|
|
34 """
|
|
39 "'"
|
|
47 "/"})
|
|
|
|
(defn- escape
|
|
"Escape special characters for HTML and regex encoding."
|
|
[str]
|
|
(def buf @"")
|
|
(loop [byte :in str]
|
|
(if-let [rep (get escapes byte)]
|
|
(buffer/push-string buf rep)
|
|
(buffer/push-byte buf byte)))
|
|
buf)
|
|
|
|
(print (string/join (map escape allsyms) "|"))
|