diff --git a/basis/json/reader/reader-docs.factor b/basis/json/reader/reader-docs.factor index 2ffe24247d..488a7c6f8b 100644 --- a/basis/json/reader/reader-docs.factor +++ b/basis/json/reader/reader-docs.factor @@ -1,14 +1,18 @@ ! Copyright (C) 2006 Chris Double. ! See http://factorcode.org/license.txt for BSD license. -USING: help.markup help.syntax ; +USING: help.markup help.syntax kernel ; IN: json.reader HELP: json> { $values { "string" "a string in JSON format" } { "object" "a deserialized object" } } { $description "Deserializes the JSON formatted string into a Factor object. JSON objects are converted to Factor hashtables. All other JSON objects convert to their obvious Factor equivalents." } ; +HELP: read-jsons +{ $values { "objects" "a vector of deserialized objects" } } +{ $description "Reads JSON formatted strings into a vector of Factor object until the end of the stream is reached. JSON objects are converted to Factor hashtables. All other JSON objects convert to their obvious Factor equivalents." } ; + ARTICLE: "json.reader" "JSON reader" "The " { $vocab-link "json.reader" } " vocabulary defines a word for parsing strings in JSON format." -{ $subsections json> } ; +{ $subsections json> read-jsons } ; ABOUT: "json.reader" diff --git a/basis/json/reader/reader-tests.factor b/basis/json/reader/reader-tests.factor index 390fce1f94..bac8c96e1a 100644 --- a/basis/json/reader/reader-tests.factor +++ b/basis/json/reader/reader-tests.factor @@ -1,5 +1,5 @@ USING: assocs arrays json.reader kernel strings tools.test -hashtables json ; +hashtables json io.streams.string ; IN: json.reader.tests { f } [ "false" json> ] unit-test @@ -59,5 +59,8 @@ IN: json.reader.tests { 0 } [ "0 " json> ] unit-test { 0 } [ " 0 " json> ] unit-test +{ V{ H{ { "a" "b" } } H{ { "c" "d" } } } } +[ """{"a": "b"} {"c": "d"}""" [ read-jsons ] with-string-reader ] unit-test + ! empty objects are allowed as values in objects { H{ { "foo" H{ } } } } [ "{ \"foo\" : {}}" json> ] unit-test diff --git a/basis/json/reader/reader.factor b/basis/json/reader/reader.factor index 8eca1995a2..f684321846 100644 --- a/basis/json/reader/reader.factor +++ b/basis/json/reader/reader.factor @@ -78,7 +78,7 @@ DEFER: j-string { CHAR: { [ 2 [ V{ } clone over push ] times ] } { CHAR: : [ v-pick-push ] } { CHAR: } [ (close-hash) ] } - { CHAR: \u000020 [ ] } + { CHAR: \s [ ] } { CHAR: \t [ ] } { CHAR: \r [ ] } { CHAR: \n [ ] } @@ -89,10 +89,10 @@ DEFER: j-string } case ] when* ; -: (json-parser>) ( string -- object ) - [ V{ } clone [ read1 dup ] [ scan ] while drop first ] with-string-reader ; - PRIVATE> +: read-jsons ( -- objects ) + V{ } clone [ read1 dup ] [ scan ] while drop ; + : json> ( string -- object ) - (json-parser>) ; + [ read-jsons first ] with-string-reader ; diff --git a/basis/ui/backend/windows/windows.factor b/basis/ui/backend/windows/windows.factor index 8b8bd3cdf9..0e0de67440 100755 --- a/basis/ui/backend/windows/windows.factor +++ b/basis/ui/backend/windows/windows.factor @@ -248,7 +248,7 @@ CONSTANT: window-control>ex-style { minimize-button 0 } { maximize-button 0 } { resize-handles $ WS_EX_WINDOWEDGE } - { small-title-bar $ WS_EX_TOOLWINDOW } + { small-title-bar $[ WS_EX_TOOLWINDOW WS_EX_TOPMOST bitor ] } { normal-title-bar $ WS_EX_APPWINDOW } } diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor index 5b1ce8e80c..67bf6da23c 100644 --- a/core/combinators/combinators-docs.factor +++ b/core/combinators/combinators-docs.factor @@ -65,9 +65,9 @@ ARTICLE: "apply-combinators" "Apply combinators" "All of the apply combinators are equivalent to using the corresponding " { $link "spread-combinators" } " with the same quotation supplied for every value." ; ARTICLE: "dip-keep-combinators" "Preserving combinators" -"Sometimes it is necessary to temporarily hide values on the datastack. The " { $snippet "dip" } " combinators invoke the quotation at the top of the stack, hiding some number of values underneath:" +"Sometimes it is necessary to temporarily hide values on the datastack. The " { $snippet "dip" } " combinators invoke the quotation at the top of the stack, hiding some number of values:" { $subsections dip 2dip 3dip 4dip } -"The " { $snippet "keep" } " combinators invoke a quotation and restore some number of values to the top of the stack when it completes:" +"The " { $snippet "keep" } " combinators invoke a quotation and restore some number of values to the top of the stack:" { $subsections keep 2keep 3keep } ; ARTICLE: "curried-dataflow" "Curried dataflow combinators"