# HG changeset patch # User Mike Pavone # Date 1376207930 25200 # Node ID fe816637fcc49b13df2d93e41038a0d0dbcbac43 # Parent 75be44ed9df5d42f5bb5b6799b2c0e903ec79dad Add support for parsing true and false to JSON parser diff -r 75be44ed9df5 -r fe816637fcc4 modules/json.tp --- a/modules/json.tp Sat Aug 10 22:26:26 2013 -0700 +++ b/modules/json.tp Sun Aug 11 00:58:50 2013 -0700 @@ -12,6 +12,8 @@ comma <- "," byte: 0 tab <- "\t" byte: 0 colon <- ":" byte: 0 + t <- "t" byte: 0 + f <- "f" byte: 0 parseNumAt <- :str :at :recvResult { num <- 0 @@ -122,10 +124,25 @@ value <- val } } else: { - #{ - value <- "foobar" - after <- (text length) + if: b = t && (text from: cur withLength: 4) = "true" { + #{ + value <- true + after <- cur + 4 + } + } else: { + if: b = f && (text from: cur withLength: 5) = "false" { + #{ + value <- false + after <- cur + 5 + } + } else: { + #{ + value <- "foobar" + after <- (text length) + } + } } + } } }