# HG changeset patch # User Mike Pavone # Date 1376213493 25200 # Node ID e7642715d57568c8d7f6b54a040d91c32fc16c48 # Parent fe816637fcc49b13df2d93e41038a0d0dbcbac43 Handle newlines and carriage returns in JSON decoder diff -r fe816637fcc4 -r e7642715d575 modules/json.tp --- a/modules/json.tp Sun Aug 11 00:58:50 2013 -0700 +++ b/modules/json.tp Sun Aug 11 02:31:33 2013 -0700 @@ -11,6 +11,8 @@ space <- " " byte: 0 comma <- "," byte: 0 tab <- "\t" byte: 0 + nl <- "\n" byte: 0 + cr <- "\r" byte: 0 colon <- ":" byte: 0 t <- "t" byte: 0 f <- "f" byte: 0 @@ -75,7 +77,7 @@ aft <- cur + 1 cur <- len } else: { - if: b = comma || b = space || b = tab { + if: b = comma || b = space || b = tab || b = nl || b = cr { cur <- cur + 1 } else: { el <- _decode: text at: cur @@ -98,7 +100,7 @@ key <- "" while: { cur < len } do: { b <- text byte: cur - if: b = comma || b = space || b = tab || b = colon { + if: b = comma || b = space || b = tab || b = colon || b = nl || b = cr { cur <- cur + 1 } else: { if: expectKey {