Hi,
I appreciate the desire to improve my code, but please open issues or make
pull requests to me on GitHub, because I don't follow the PicoLisp mailing
list closely: https://github.com/aw/picolisp-json
Thanks,
AW
On Wed, 27 Mar 2019, C K Kashyap wrote:
Hi,
I am trying to write a script to parse data from IEX (
https://iextrading.com/developer/docs/) - naturally, the stock quotes are
in floating point numbers.
I made a tiny change to support floating point (to be used with scaling
that is). I wanted to get it reviewed to confirm if I am not missing
something.
I added a condition to json-parse-unicode in json.l
<https://github.com/aw/picolisp-json/blob/master/json.l>
[de json-parse-unicode (Value)
(pack
(make
(while Value
(let R (pop 'Value)
(cond
[(= "\^" R) (link "\\\^") ] # ^ becomes \^
[(and (= "\\" R) (= "u" (car Value))) (let U (cut 5 'Value)
(link (json-parse-unicode-special (pack (tail 4 U) ] # \uNNNN hex
[(and (= "\\" R) (= "b" (car Value))) (pop 'Value) (link (char
(hex "08") ] # \b backspace
[(and (= "\\" R) (= "f" (car Value))) (pop 'Value) (link (char
(hex "0C") ] # \f formfeed
[*(and (= "." (car Value))) (pop 'Value) (link R '. (pop
'Value)) ]*
(T (link R)) ]
Regards,
Kashyap
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe