--- parser3/tests/253.html 2010/08/31 21:51:56 1.1 +++ parser3/tests/253.html 2010/10/01 23:11:24 1.4 @@ -1,38 +1,45 @@ @main[] -$f[^file::load[text;253_json.txt]] +$f[^file::load[text;253_json.txt; $.charset[windows-1251]]] +$s[^taint[as-is][$f.text]] -$o[^json:parse[^taint[as-is][$f.text]][ $.double(false) ]] +^try_catch{$o[^json:parse[$s]]} + +$o[^json:parse[$s][ $.object[$hook] $.distinct[first] ]] ^print[$o] -$o[^json:parse[^taint[as-is][$f.text]][ $.object[$hook] ]] +$o[^json:parse[$s][ $.double(false) $.distinct[last] ]] ^print[$o] -@print[hash] -^hash.foreach[k;v]{ - $k = ^if($v is 'hash'){{^print[$v] - }}{ - $v.CLASS_NAME ^if($v is 'bool'){ ^if($v){true}{false} }($v is 'class1' || $v is 'class2'){^v.print[]}{$v} - } +$o[^json:parse[$s][ $.object[$hook_key] $.distinct[all] ]] +^print[$o] + +@try_catch[code] +^try{ + $code +}{ + $exception.handled(true) + $exception.source + $exception.comment } +@print[hash] +^json:string[$hash; $.indent(1)] + @hook[key;value] $result[^if(def $value.type){^reflection:create[$value.type;create;$value]}{$value}] +@hook_key[key;value] +$result[^if($key eq 'object'){^reflection:create[$value.type;create;$value]}{$value}] + @CLASS class1 @create[h] -$value[$h.value] - -@print[] -value "$value" +$value[class1 $h.value] @CLASS class2 @create[h] -$value[$h.value] - -@print[] -value "$value" +$value[class2 $h.value]