diff options
author | Adam Chlipala <adamc@csail.mit.edu> | 2018-06-04 10:21:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-04 10:21:08 -0400 |
commit | 71dab68defc48d9be9d1e45e63925d0fb01ebb34 (patch) | |
tree | a6c96c59fb7ca903c9a96ee516a4f1c5534b0a4c /lib/ur/json.ur | |
parent | ea85b40d3a89447dcc65696cb1bb65bcf8806869 (diff) | |
parent | 87c86c5d2066a8805c7e72e3279ae8d5822f0c90 (diff) |
Merge pull request #126 from majorseitan/master
Improved support for JSON escape characters
Diffstat (limited to 'lib/ur/json.ur')
-rw-r--r-- | lib/ur/json.ur | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ur/json.ur b/lib/ur/json.ur index 1e3e3f39..817ec16e 100644 --- a/lib/ur/json.ur +++ b/lib/ur/json.ur @@ -52,6 +52,8 @@ fun escape s = | #"\t" => "\\t" | #"\"" => "\\\"" | #"\'" => "\\\'" + | #"\\" => "\\\\" + | #"/" => "\\/" | x => String.str ch ) ^ esc (String.suffix s 1) end @@ -100,6 +102,8 @@ fun unescape s = | #"t" => "\t" | #"\"" => "\"" | #"\'" => "\'" + | #"\\" => "\\" + | #"/" => "/" | x => error <xml>JSON unescape: Bad escape char: {[x]}</xml>) ^ unesc (i+2) |