]> gitweb.factorcode.org Git - factor.git/commitdiff
json: rename json-allow-nans? to json-allow-fp-special?.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 29 Nov 2014 00:36:07 +0000 (16:36 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 29 Nov 2014 00:36:07 +0000 (16:36 -0800)
basis/json/writer/writer-docs.factor
basis/json/writer/writer-tests.factor
basis/json/writer/writer.factor

index dab13883d8da591d5d3237b7fea34245c0861800..e027e4d1c83793945e8e102ce0fb4b359d8e419e 100644 (file)
@@ -14,11 +14,11 @@ HELP: json-print
 $nl
 "Some options can control the formatting of the result:"
 { $table
-     { { $link json-allow-nans? }     "Allow special floating-points: NaN, Infinity, -Infinity." }
-     { { $link json-friendly-keys? }  "Convert - to _ in tuple slots and hashtable keys" }
-     { { $link json-coerce-keys? }    "Coerce hashtable keys into strings" }
-     { { $link json-escape-slashes? } "Escape forward slashes inside strings" }
-     { { $link json-escape-unicode? } "Escape unicode values inside strings" }
+     { { $link json-allow-fp-special? } "Allow special floating-points: NaN, Infinity, -Infinity" }
+     { { $link json-friendly-keys? }    "Convert - to _ in tuple slots and hashtable keys" }
+     { { $link json-coerce-keys? }      "Coerce hashtable keys into strings" }
+     { { $link json-escape-slashes? }   "Escape forward slashes inside strings" }
+     { { $link json-escape-unicode? }   "Escape unicode values inside strings" }
 }
 }
 { $see-also >json } ;
index de895d142b6d5831250f70a676eb47e7f389b648..8f46af197a60792c110bad3670961d5858e8d6c8 100644 (file)
@@ -53,13 +53,13 @@ TUPLE: person first-name age ;
 [ H{ { json-null 1 } } >json ] unit-test
 
 { """{"Infinity":1}""" }
-[ t json-allow-nans? [ H{ { 1/0. 1 } } >json ] with-variable ] unit-test
+[ t json-allow-fp-special? [ H{ { 1/0. 1 } } >json ] with-variable ] unit-test
 
 { """{"-Infinity":1}""" }
-[ t json-allow-nans? [ H{ { -1/0. 1 } } >json ] with-variable ] unit-test
+[ t json-allow-fp-special? [ H{ { -1/0. 1 } } >json ] with-variable ] unit-test
 
 { """{"NaN":1}""" }
-[ t json-allow-nans? [ H{ { NAN: 333 1 } } >json ] with-variable ] unit-test
+[ t json-allow-fp-special? [ H{ { NAN: 333 1 } } >json ] with-variable ] unit-test
 
 {
     "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f\""
index 7a99a69eb6b3b564c405de11dd2f30c0bf2d66b3..ec654299c12c7d8f1c0fddcf79e6d428348f9bd3 100644 (file)
@@ -5,8 +5,8 @@ io.streams.string json kernel locals math math.parser mirrors
 namespaces sequences strings tr words ;
 IN: json.writer
 
-SYMBOL: json-allow-nans?
-f json-allow-nans? set-global
+SYMBOL: json-allow-fp-special?
+f json-allow-fp-special? set-global
 
 SYMBOL: json-friendly-keys?
 t json-friendly-keys? set-global
@@ -79,7 +79,7 @@ M: integer stream-json-print
 
 : float>json ( float -- string )
     dup fp-special? [
-        json-allow-nans? get [ json-error ] unless
+        json-allow-fp-special? get [ json-error ] unless
         {
             { [ dup fp-nan? ] [ drop "NaN" ] }
             { [ dup 1/0. = ] [ drop "Infinity" ] }