json-number ( char stream -- num char )


Vocabulary
json.private

Inputs
charan object
streaman object


Outputs
numan object
charan object


Definition


: json-number ( char stream -- num char )
[ 1string ] [ " \t\r\n,:}]" swap stream-read-until ] bi* [
append {
{ "Infinity" [ 1/0. ] }
{ "-Infinity" [ -1/0. ] }
{ "NaN" [ 0/0. ] }
{ "-0" [ -0.0 ] }
[ [ string>number ] [ not-a-json-number ] ?unless ]
} case
] dip ;