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

1.5       misha       1: @main[]
1.1       misha       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[
1.7     ! moko       27:                $.value[^date::create(2026;08;18;06;09;00)]
1.1       misha      28: 
                     29:                $._options[
                     30:                        $.0[$.date[unix-timestamp]]
                     31:                        $.1[$.date[gmt-string]]
1.6       moko       32:                        $.2[$.date[iso-string]]
                     33:                        $.3[$.date[sql-string]]
                     34:                        $.4[$.date[$handler]]
                     35:                        $.5[
1.5       misha      36:                                $.date[unsupported]
                     37:                                $.exception(true)
                     38:                        ]
1.1       misha      39:                ]
                     40:        ]
                     41: 
                     42:        $.table[
                     43:                $.table_nameless_empty[^table::create[nameless]{}]
                     44:                $.table_nameless_1[^table::create[nameless]{v1  v2      v3}]
                     45:                $.table_nameless_2[^table::create[nameless]{v1  v2      v3^#0Av4        v5      v6}]
                     46:                $.table_named_empty[^table::create{c1   c2      c3}]
                     47:                $.table_named_1[^table::create{c1       c2      c3^#0Av1        v2      v3}]
                     48:                $.table_named_2[^table::create{c1       c2      c3^#0Av1        v2      v3^#0Av4        v5      v6}]
                     49:                $.table_named_3[^table::create{c1       c2      c3^#0Av1        v2      v3^#0Av4        v5      v6}]
                     50: 
                     51:                $._options[
                     52:                        $.0[$.table[object]]
                     53:                        $.1[$.table[object] $.indent(true)]
                     54:                        $.2[$.table[array]]
                     55:                        $.3[$.table[array] $.indent(true)]
1.3       moko       56:                        $.4[$.table[compact]]
                     57:                        $.5[$.table[compact] $.indent(true)]
1.5       misha      58:                        $.6[
                     59:                                $.table[unsupported]
                     60:                                $.exception(true)
                     61:                        ]
1.1       misha      62:                ]
                     63:        ]
                     64: 
                     65:        $.my[
                     66:                $.object[^my::create[]]
                     67: 
                     68:                $._options[
                     69:                        $.0[$.my[$handler]]
1.5       misha      70:                        $.1[
                     71:                                $.my[$unknown]
                     72:                                $.exception(true)
                     73:                        ]
                     74:                        $.2[
                     75:                                $.my[$main]
                     76:                                $.exception(true)
                     77:                        ]
1.1       misha      78:                ]
                     79:        ]
                     80: 
                     81:        $.file[
                     82:                $.text[^file::create[text;zigi;file-content]]
                     83:                $.binary[^file::load[binary;./256.txt]]
                     84:                $.stated[^file::stat[./256.txt]]
                     85: 
                     86:                $._options[
                     87:                        $.0[$.file[text]]
                     88:                        $.1[$.file[base64] $.indent(true)]
                     89:                        $.2[$.file[$handler]]
1.5       misha      90:                        $.3[$.file[stat]]
                     91:                        $.4[
                     92:                                $.file[unsupported]
                     93:                                $.exception(true)
                     94:                        ]
1.1       misha      95:                ]
                     96:        ]
                     97: 
                     98:        $.image[
                     99:                $.value[^image::create(100;100;0)]
                    100:                $._options[
                    101:                        $.0[$.skip-unknown(true)]
                    102:                        $.1[$.image[$handler]]
                    103:                        $.2[$.exception(true)]
                    104:                ]
                    105:        ]
                    106: 
                    107:        $.hash_with_infinite_recursion[
                    108:                $.value[$a]
                    109: 
                    110:                $._options[
                    111:                        $.0[$.exception(true)]
                    112:                ]
                    113:        ]
                    114: 
1.4       misha     115:        $.xdoc[
                    116:                $.value[^xdoc::create{<?xml version="1.0"?><r><t z="1"/></r>}]
                    117:                $._options[
                    118:                        $.0[]
                    119:                        $.1[$.xdoc[
                    120:                                $.omit-xml-declaration[yes]
                    121:                                $.indent[yes]
                    122:                        ]]
                    123:                ]
                    124:        ]
1.1       misha     125: ]
                    126: 
                    127: ^h.table.table_named_3.append{v7       v8      v9      v0}
1.3       moko      128: ^h.table.table_named_3.append{vA"}
                    129: ^h.table.table_named_3.append{vB\}
1.1       misha     130: 
                    131: $s[^h.foreach[k;v]{
                    132:        <h3>$k</h3>
                    133:        ^if($v is "hash" && def $v._options){
                    134:                $hOptions[$v._options]
                    135:                $hValue[^hash::create[$v]]
                    136:                ^hValue.delete[_options]
                    137:                ^hOptions.foreach[;hOpt]{^2string[$hValue;$hOpt]}[, ]
                    138:        }{
                    139:                ^2string[$v]
                    140:        }
                    141: }]
                    142: 
                    143: ^s.match["([acm]date)":"[^^"]+"][g]{"$match.1":"-value-"}
                    144: 
                    145: 
                    146: @2string[value;options]
                    147: $options[^hash::create[$options]]
                    148: $bShouldBeException($options.exception)
                    149: ^options.delete[exception]
                    150: ^try{
                    151:        $result[^json:string[$value;$options]^if($bShouldBeException){. FAILED. EXCEPTION SHOULD BE HERE}]
                    152: }{
                    153:        $exception.handled(true)
1.5       misha     154:        $result["exception":"$exception.source, $exception.comment^if($bShouldBeException){. That's OK}"]
1.1       misha     155: }
                    156: 
                    157: 
1.3       moko      158: @handler[k;v;p][kk;vv]
1.1       misha     159: $result[^switch[$v.CLASS_NAME]{
                    160:        ^case[date]{"new Date(^v.unix-timestamp[])"}
                    161:        ^case[file]{{"file":{"name":"$v.name", "text":"$v.text", "params":"-params-"}}}
                    162:        ^case[image]{"image []"}
1.3       moko      163:        ^case[DEFAULT]{"$v.CLASS_NAME at key $k, with ^p._count[] option"}
1.1       misha     164: }]
                    165: 
                    166: 
                    167: 
                    168: @CLASS
                    169: my
                    170: 
                    171: @create[]
                    172: $v[ac/dc]

E-mail: