From: Matt S Trout Date: Tue, 19 Jun 2012 17:22:30 +0000 (+0000) Subject: moar functional X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c468fcd3e600a1cc8a29f4dc8f2411ddaaa2b3a;p=scpubgit%2FTenDotTcl.git moar functional --- diff --git a/json.tcl b/json.tcl index 67c1b2e..f9c9e68 100644 --- a/json.tcl +++ b/json.tcl @@ -60,11 +60,10 @@ namespace eval ten::json { proc deparse {data} { switch -regexp [lindex $data 0] { - ^true|false|null$ { uplevel 1 return [lindex $data 0] } - ^num|str|obj|list$ {} + ^true|false|null$ { lindex $data 0 } + ^num|str|obj|list$ { eval $data } default { error [ concat "Invalid JSON type " [lindex $data 0 0] ] } } - eval $data } } @@ -131,7 +130,6 @@ namespace eval ten::json { proc parse_str {} { variable json -puts $json # like Text::Balanced except ugly (borrowed from tcvJSON's code) set reStr {(?:(?:\")(?:[^\\\"]*(?:\\.[^\\\"]*)*)(?:\"))} if {![regexp $reStr $json string]} {