Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | fixed escaped double quote bug in json parser |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
15097c33297cafcba2830d6c0d271f07 |
User & Date: | aldo 2017-09-11 21:16:14 |
Context
2017-09-11
| ||
21:17 | save bignums as strings in sqlite3 check-in: 1d7eb01ce5 user: aldo tags: trunk | |
21:16 | fixed escaped double quote bug in json parser check-in: 15097c3329 user: aldo tags: trunk | |
2017-08-01
| ||
11:23 | use int64 instead of int for sqlite3 bind, minor fix in sqlite3_finalize check-in: 86bf6c2faf user: aldo tags: trunk | |
Changes
Changes to json.sls.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
(include "lalr/associators.ss") (include "lalr/lalr.ss") (define (parse-json-str pos data escaping out) (cond [(>= pos (string-length data)) (error 'parse-json-str "error unexpected end of string")] [(char=? (string-ref data pos) #\") (values (list->string (reverse out)) pos)] [else (let ([char (string-ref data pos)]) (cond [escaping (let* ([special '((#\/ . #\/) (#\b . #\backspace) (#\n . #\newline) (#\r . #\return) (#\t . #\tab))] [q (assq char special)]) (cond [q (parse-json-str (+ 1 pos) data #f (cons (cdr q) out))] [(char=? char #\\) (parse-json-str (+ 1 pos) data #f (cons #\\ out))] [(char=? char #\u) (if (< (+ 4 pos) (string-length data)) (let ([num (string->number (substring data (+ pos 1) (+ pos 5)) 16)]) |
| | |
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
(include "lalr/associators.ss") (include "lalr/lalr.ss") (define (parse-json-str pos data escaping out) (cond [(>= pos (string-length data)) (error 'parse-json-str "error unexpected end of string")] [(and (char=? (string-ref data pos) #\") (not escaping)) (values (list->string (reverse out)) pos)] [else (let ([char (string-ref data pos)]) (cond [escaping (let* ([special '((#\/ . #\/) (#\b . #\backspace) (#\n . #\newline) (#\r . #\return) (#\t . #\tab) (#\\ . #\\) (#\" . #\"))] [q (assq char special)]) (cond [q (parse-json-str (+ 1 pos) data #f (cons (cdr q) out))] [(char=? char #\\) (parse-json-str (+ 1 pos) data #f (cons #\\ out))] [(char=? char #\u) (if (< (+ 4 pos) (string-length data)) (let ([num (string->number (substring data (+ pos 1) (+ pos 5)) 16)]) |