]> gitweb.factorcode.org Git - factor.git/commitdiff
json.reader: make json parsing faster for files that contain a lot of spaces.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 12 Jul 2012 01:45:10 +0000 (18:45 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 12 Jul 2012 01:45:10 +0000 (18:45 -0700)
basis/json/reader/reader.factor

index fd6e808957627db649b114dba80bb233966e01ed..8ebe2ee67f6ca4ec2b7bb360b9c8233d66ad2bdd 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2008 Peter Burns, 2009 Philipp Winkler
 ! See http://factorcode.org/license.txt for BSD license.
 
-USING: arrays assocs combinators hashtables io io.streams.string
-json kernel make math math.parser prettyprint sequences strings
-vectors ;
+USING: arrays assocs combinators fry hashtables io
+io.streams.string json kernel make math math.parser namespaces
+prettyprint sequences strings vectors ;
 
 IN: json.reader
 
@@ -80,7 +80,8 @@ ERROR: json-error ;
 PRIVATE>
 
 : read-jsons ( -- objects )
-    V{ } clone [ read1 dup ] [ scan ] while drop ;
+    V{ } clone input-stream get
+    '[ _ stream-read1 dup ] [ scan ] while drop ;
 
 : json> ( string -- object )
     [ read-jsons first ] with-string-reader ;