Annotation of parser3/tests/432.html, revision 1.2

1.1       moko        1: @main[]
                      2: $a[^array::create[]]
                      3: ^first_and_last[Empty hash (^$a[^^hash::create[]]);$a]
                      4: 
                      5: $a.1[a]
                      6: ^first_and_last[One element was added (^$a.1[a]);$a]
                      7: 
                      8: ^a.delete(1)
                      9: ^first_and_last[One element was deleted (^^a.delete[1]);$a]
                     10: 
                     11: $a.1[a]
                     12: ^first_and_last[One element was added (^$a.1[a]);$a]
                     13: 
1.2     ! moko       14: $a[^array::copy[
1.1       moko       15:        $.1[a]
                     16:        $.2[b]
                     17:        $.3[c]
                     18:        $.4[d]
                     19:        $.5[e]
                     20: ]]
                     21: ^first_and_last[Hash with 5 elements (^$a[ ^$.1[a] ^$.2[b] ^$.3[c] ^$.4[d] ^$.5[e] ]);$a]
                     22: 
                     23: ^a.delete(5)
                     24: ^first_and_last[The last element was deleted (^^a.delete[5]);$a]
                     25: 
                     26: ^a.delete(1)
                     27: ^first_and_last[The first element was deleted (^^a.delete[1]);$a]
                     28: 
                     29: $a.5[e]
                     30: ^first_and_last[One element was added at the end (^$a.5[e]);$a]
                     31: 
                     32: $a.3[cc]
                     33: ^first_and_last[One element was added at the middle (^$a.3[cc]);$a]
                     34: 
                     35: <h3>_at on hash with 5 elements (^$a[ ^$.1[a] ^$.2[b] ^$.3[c] ^$.4[d] ^$.5[e] ])</h3>
1.2     ! moko       36: $a[^array::copy[
1.1       moko       37:        $.1[a]
                     38:        $.2[b]
                     39:        $.3[c]
                     40:        $.4[d]
                     41:        $.5[e]
                     42: ]]
                     43: ^at(0)
                     44: ^at(1)
                     45: ^at(2)
                     46: ^at(3)
                     47: ^at(4)
                     48: 
                     49: <br />
                     50: ^at(-1)
                     51: ^at(-2)
                     52: ^at(-3)
                     53: ^at(-4)
                     54: ^at(-5)
                     55: 
                     56: <br />
                     57: ^at(0)[key]
                     58: ^at(1)[key]
                     59: ^at(2)[key]
                     60: ^at(3)[key]
                     61: ^at(4)[key]
                     62: 
                     63: <br />
                     64: ^at(0)[value]
                     65: ^at(1)[value]
                     66: ^at(2)[value]
                     67: ^at(3)[value]
                     68: ^at(4)[value]
                     69: 
                     70: <br />
                     71: ^at(0)[hash]
                     72: ^at(1)[hash]
                     73: ^at(2)[hash]
                     74: ^at(3)[hash]
                     75: ^at(4)[hash]
                     76: 
                     77: <br />
                     78: # check if values preserve tainting. keys are always lost tainting
                     79: <h3>The first element was replaced (^$a.1[b&b])</h3>
                     80: $a.1[b&b]
                     81: ^^a._at[first;hash]=^print[^a._at[first;hash]]<br />
                     82: ^at(0)[key]
                     83: ^at(0)[value]
                     84: ^at(0)[hash]
                     85: <h3>One element was added at the end (^$a.100[^^taint[d&d]])</h3>
                     86: $a.100[^taint[d&d]]
                     87: ^at(5)[key]
                     88: ^at(5)[value]
                     89: ^at(5)[hash]
                     90: ^^a._at[last;hash]=^print[^a._at[last;hash]]<br />
                     91: 
                     92: <br />
                     93: ^do[^^a._at[]]{must fail^a._at[]}
                     94: ^do[^^a._at[first^;key^;hren]]{must fail^a._at[first;key;hren]}
                     95: ^do[^^a._at(1){code}]{must fail^a._at(1){code}}
                     96: ^do[^^a._at(1)(true)]{must fail^a._at(1)(true)}
                     97: ^do[^^a._at[hren]]{must fail^a._at[hren]}
                     98: ^do[^^a._at[first][hren]]{must fail^a._at[first][hren]}
                     99: ^do[^^a._at[last][hren]]{must fail^a._at[last][hren]}
                    100: ^do[^^a._at(1)[hren]]{must fail^a._at(1)[hren]}
                    101: 
                    102: @at[i;type]
                    103: ^^a._at($i)^if(def $type){[$type]}=^print[^if(def $type){^a._at($i)[$type]}{^a._at($i)}]<br />
                    104: 
                    105: @first_and_last[sTitle;a]
                    106: ^if(def $sTitle){<h3>$sTitle</h3>}
                    107: first:last='^a._at[first]':'^a._at[last;value]'<br />
                    108: first_key:last_key='^a._at[first;key]':'^a._at[last;key]'<br />
                    109: 
                    110: @do[label;code]
                    111: $label=^try{${code}}{$exception.handled(true)<b>^taint[as-is;$exception.comment]</b>}<br />
                    112: 
                    113: @print[u][k;v]
                    114: ^if($u is "array" || $u is "hash"){
                    115:        $result[^u.foreach[k;v]{'$k':'$v'}[, ]]
                    116: }{
                    117:        $result[$u]
                    118: }

E-mail: