json.reader: make json parsing faster for files that contain a lot of spaces.
parent
0bf89b2c97
commit
8d4ab73a52
|
|
@ -1,9 +1,9 @@
|
||||||
! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler
|
! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
|
||||||
USING: arrays assocs combinators hashtables io io.streams.string
|
USING: arrays assocs combinators fry hashtables io
|
||||||
json kernel make math math.parser prettyprint sequences strings
|
io.streams.string json kernel make math math.parser namespaces
|
||||||
vectors ;
|
prettyprint sequences strings vectors ;
|
||||||
|
|
||||||
IN: json.reader
|
IN: json.reader
|
||||||
|
|
||||||
|
|
@ -80,7 +80,8 @@ ERROR: json-error ;
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: read-jsons ( -- objects )
|
: read-jsons ( -- objects )
|
||||||
V{ } clone [ read1 dup ] [ scan ] while drop ;
|
V{ } clone input-stream get
|
||||||
|
'[ _ stream-read1 dup ] [ scan ] while drop ;
|
||||||
|
|
||||||
: json> ( string -- object )
|
: json> ( string -- object )
|
||||||
[ read-jsons first ] with-string-reader ;
|
[ read-jsons first ] with-string-reader ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue