Annotation of parser3/tests/256.html, revision 1.3

1.1       misha       1: @main[]
                      2: $a[^hash::create[]]
                      3: $b[$.a[$a]]
                      4: $a.b[$b]
                      5: 
                      6: $h[
                      7:        $.hash[
1.2       moko        8:                $.void[$void]
1.1       misha       9:                $.bool-true(true)
                     10:                $.bool-false(false)
                     11:                $.int(1)
                     12:                $.double(1/2)
                     13:                $.[a/b]["1"]
                     14:                $.string[value with "quotes"/other things]
                     15:                $.string-ru[русские буквы]
                     16:                $.hash[
                     17:                        $.e[ee]
                     18:                ]
                     19: 
                     20:                $._options[
                     21:                        $.0[]
                     22:                        $.1[$.indent(true)]
                     23:                ]
                     24:        ]
                     25: 
                     26:        $.date[
                     27:                $.value[^date::create(2006;08;18;06;09;00)]
                     28: 
                     29:                $._options[
                     30:                        $.0[$.date[unix-timestamp]]
                     31:                        $.1[$.date[gmt-string]]
                     32:                        $.2[$.date[sql-string]]
                     33:                        $.3[$.date[$handler]]
                     34:                ]
                     35:        ]
                     36: 
                     37:        $.table[
                     38:                $.table_nameless_empty[^table::create[nameless]{}]
                     39:                $.table_nameless_1[^table::create[nameless]{v1  v2      v3}]
                     40:                $.table_nameless_2[^table::create[nameless]{v1  v2      v3^#0Av4        v5      v6}]
                     41:                $.table_named_empty[^table::create{c1   c2      c3}]
                     42:                $.table_named_1[^table::create{c1       c2      c3^#0Av1        v2      v3}]
                     43:                $.table_named_2[^table::create{c1       c2      c3^#0Av1        v2      v3^#0Av4        v5      v6}]
                     44:                $.table_named_3[^table::create{c1       c2      c3^#0Av1        v2      v3^#0Av4        v5      v6}]
                     45: 
                     46:                $._options[
                     47:                        $.0[$.table[object]]
                     48:                        $.1[$.table[object] $.indent(true)]
                     49:                        $.2[$.table[array]]
                     50:                        $.3[$.table[array] $.indent(true)]
1.3     ! moko       51:                        $.4[$.table[compact]]
        !            52:                        $.5[$.table[compact] $.indent(true)]
1.1       misha      53:                ]
                     54:        ]
                     55: 
                     56:        $.my[
                     57:                $.object[^my::create[]]
                     58: 
                     59:                $._options[
                     60:                        $.0[$.my[$handler]]
                     61:                ]
                     62:        ]
                     63: 
                     64:        $.file[
                     65:                $.text[^file::create[text;zigi;file-content]]
                     66:                $.binary[^file::load[binary;./256.txt]]
                     67:                $.stated[^file::stat[./256.txt]]
                     68: 
                     69:                $._options[
                     70:                        $.0[$.file[text]]
                     71:                        $.1[$.file[base64] $.indent(true)]
                     72:                        $.2[$.file[$handler]]
                     73:                ]
                     74:        ]
                     75: 
                     76:        $.image[
                     77:                $.value[^image::create(100;100;0)]
                     78:                $._options[
                     79:                        $.0[$.skip-unknown(true)]
                     80:                        $.1[$.image[$handler]]
                     81:                        $.2[$.exception(true)]
                     82:                ]
                     83:        ]
                     84: 
                     85:        $.hash_with_infinite_recursion[
                     86:                $.value[$a]
                     87: 
                     88:                $._options[
                     89:                        $.0[$.exception(true)]
                     90:                ]
                     91:        ]
                     92: 
                     93: ]
                     94: 
                     95: ^h.table.table_named_3.append{v7       v8      v9      v0}
1.3     ! moko       96: ^h.table.table_named_3.append{vA"}
        !            97: ^h.table.table_named_3.append{vB\}
1.1       misha      98: 
                     99: $s[^h.foreach[k;v]{
                    100:        <h3>$k</h3>
                    101:        ^if($v is "hash" && def $v._options){
                    102:                $hOptions[$v._options]
                    103:                $hValue[^hash::create[$v]]
                    104:                ^hValue.delete[_options]
                    105:                ^hOptions.foreach[;hOpt]{^2string[$hValue;$hOpt]}[, ]
                    106:        }{
                    107:                ^2string[$v]
                    108:        }
                    109: }]
                    110: 
                    111: ^s.match["([acm]date)":"[^^"]+"][g]{"$match.1":"-value-"}
                    112: 
                    113: 
                    114: @2string[value;options]
                    115: $options[^hash::create[$options]]
                    116: $bShouldBeException($options.exception)
                    117: ^options.delete[exception]
                    118: ^try{
                    119:        $result[^json:string[$value;$options]^if($bShouldBeException){. FAILED. EXCEPTION SHOULD BE HERE}]
                    120: }{
                    121:        $exception.handled(true)
                    122:        $result[Exception^if($bShouldBeException){. That's OK} ($exception.comment)]
                    123: }
                    124: 
                    125: 
1.3     ! moko      126: @handler[k;v;p][kk;vv]
1.1       misha     127: $result[^switch[$v.CLASS_NAME]{
                    128:        ^case[date]{"new Date(^v.unix-timestamp[])"}
                    129:        ^case[file]{{"file":{"name":"$v.name", "text":"$v.text", "params":"-params-"}}}
                    130:        ^case[image]{"image []"}
1.3     ! moko      131:        ^case[DEFAULT]{"$v.CLASS_NAME at key $k, with ^p._count[] option"}
1.1       misha     132: }]
                    133: 
                    134: 
                    135: 
                    136: @CLASS
                    137: my
                    138: 
                    139: @create[]
                    140: $v[ac/dc]

E-mail: