Verified Commit 11e4d468 authored by Camil Staps's avatar Camil Staps 🚀

JSON: don't escape / (it's allowed, but not required)

parent b6502d17
Pipeline #27671 passed with stage
in 3 minutes and 2 seconds
......@@ -40,7 +40,7 @@ where
count i s n
| i < size s
#! c = s.[i]
| c == '"' || c == '/' || c == '\b' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\\'
| c == '"' || c == '\b' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\\'
= count (i + 1) s (n + 1) //We'll add a '\' to escape
| c < ' '
= count (i + 1) s (n + 5) //We'll replace the character by '\uXXXX'
......@@ -116,7 +116,7 @@ copyAndEscapeChars soffset doffset num src dst
| num > 0
#! c = src.[soffset]
//Check for special characters
| c == '"' || c == '/' || c == '\b' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\\'
| c == '"' || c == '\b' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\\'
#! dst & [doffset] = '\\'
#! dst & [doffset + 1] = charOf c
= copyAndEscapeChars (soffset + 1) (doffset + 2) (num - 1) src dst
......@@ -136,7 +136,6 @@ copyAndEscapeChars soffset doffset num src dst
= dst
where
charOf '"' = '"'
charOf '/' = '/'
charOf '\b' = 'b'
charOf '\f' = 'f'
charOf '\n' = 'n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment