summaryrefslogtreecommitdiff
path: root/lib/ur
diff options
context:
space:
mode:
authorGravatar majorseitan@blockfreie.org <majorseitan@blockfreie.org>2018-04-15 16:20:31 -0400
committerGravatar majorseitan@blockfreie.org <majorseitan@blockfreie.org>2018-04-15 16:20:31 -0400
commite2552a79ed87721a81c246b9cfd053701d665f25 (patch)
tree8e2e2008afaae431bf0aeccfa0b91789eda10221 /lib/ur
parent2bc51bd866b52bc738f259ffe6e9fb8f6068a6b6 (diff)
Handling of JSON escape characters
1. Handle the escape character \\
Diffstat (limited to 'lib/ur')
-rw-r--r--lib/ur/json.ur2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/ur/json.ur b/lib/ur/json.ur
index 1e3e3f39..7ebb010f 100644
--- a/lib/ur/json.ur
+++ b/lib/ur/json.ur
@@ -52,6 +52,7 @@ fun escape s =
| #"\t" => "\\t"
| #"\"" => "\\\""
| #"\'" => "\\\'"
+ | #"\\" => "\\\\"
| x => String.str ch
) ^ esc (String.suffix s 1)
end
@@ -100,6 +101,7 @@ fun unescape s =
| #"t" => "\t"
| #"\"" => "\""
| #"\'" => "\'"
+ | #"\\" => "\\"
| x => error <xml>JSON unescape: Bad escape char: {[x]}</xml>)
^
unesc (i+2)