Mercurial > repos > tabletprog
comparison modules/json.tp @ 165:fe816637fcc4
Add support for parsing true and false to JSON parser
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 11 Aug 2013 00:58:50 -0700 |
parents | 6e579a75a0a9 |
children | e7642715d575 |
comparison
equal
deleted
inserted
replaced
164:75be44ed9df5 | 165:fe816637fcc4 |
---|---|
10 neg <- "-" byte: 0 | 10 neg <- "-" byte: 0 |
11 space <- " " byte: 0 | 11 space <- " " byte: 0 |
12 comma <- "," byte: 0 | 12 comma <- "," byte: 0 |
13 tab <- "\t" byte: 0 | 13 tab <- "\t" byte: 0 |
14 colon <- ":" byte: 0 | 14 colon <- ":" byte: 0 |
15 t <- "t" byte: 0 | |
16 f <- "f" byte: 0 | |
15 | 17 |
16 parseNumAt <- :str :at :recvResult { | 18 parseNumAt <- :str :at :recvResult { |
17 num <- 0 | 19 num <- 0 |
18 l <- str length | 20 l <- str length |
19 minus <- false | 21 minus <- false |
120 #{ | 122 #{ |
121 after <- aft | 123 after <- aft |
122 value <- val | 124 value <- val |
123 } | 125 } |
124 } else: { | 126 } else: { |
125 #{ | 127 if: b = t && (text from: cur withLength: 4) = "true" { |
126 value <- "foobar" | 128 #{ |
127 after <- (text length) | 129 value <- true |
130 after <- cur + 4 | |
131 } | |
132 } else: { | |
133 if: b = f && (text from: cur withLength: 5) = "false" { | |
134 #{ | |
135 value <- false | |
136 after <- cur + 5 | |
137 } | |
138 } else: { | |
139 #{ | |
140 value <- "foobar" | |
141 after <- (text length) | |
142 } | |
143 } | |
128 } | 144 } |
145 | |
129 } | 146 } |
130 } | 147 } |
131 } | 148 } |
132 } | 149 } |
133 } | 150 } |