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

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

E-mail: