Annotation of parser3/tests/468.html, revision 1.1
1.1 ! moko 1: # $o.CLASS, $o.CLASS_NAME, $o.method and ^o.method[] for the types and the static classes.
! 2: # With FEATURE_GET_ELEMENT4CALL $o.method is not a method for everything with an open set of keys:
! 3: # it is empty or an error, only ^o.method[] is the method; for the rest $o.method is junction
! 4:
! 5: @main[]
! 6:
! 7: #preparing vars of all possible types
! 8: $bool(true)
! 9: $double(1.5)
! 10: $int(^double.int[])
! 11: $string[abc]
! 12: $empty[]
! 13: $void[$empty.anything]
! 14: $hash[ $.key[value] ]
! 15: $array[a;b]
! 16: $table[^table::create{a
! 17: 1}]
! 18: $file[^file::create[text;a.txt;abc]]
! 19: $date[^date::create(2026;10;12)]
! 20: $regex[^regex::create[a][i]]
! 21: $image[^image::create(1;1)]
! 22: $xdoc[^xdoc::create{<a><b/></a>}]
! 23: $xnode[$xdoc.documentElement]
! 24: $hashfile[^hashfile::open[468_dir/hf]]
! 25: $object[^test::create[]]
! 26: $junction[$object.m]
! 27: $code{code}
! 28: ^try{ ^throw[type;source;comment] }{ $exception.handled(true) $caught[$exception] }
! 29:
! 30: # object and it's method without parameters
! 31: $visible[
! 32: $.bool[int]
! 33: $.int[double]
! 34: $.double[int]
! 35: $.file[base64]
! 36: $.date[sql-string]
! 37: $.xdoc[string]
! 38: $.xnode[normalize]
! 39: $.image[html]
! 40: $.object[m]
! 41: ]
! 42:
! 43: # the objects where $o.method is inaccessible (open set of keys or possible typo)
! 44: $fields[
! 45: $.hash[count]
! 46: $.array[count]
! 47: $.table[count]
! 48: $.hashfile[cleanup]
! 49: $.string[length]
! 50: $.empty[length]
! 51: $.void[length]
! 52: ]
! 53:
! 54: $objects[ $.regex[] $.junction[] $.code[] $.caught[] ]
! 55:
! 56: # the static class, the method
! 57: $statics[
! 58: $.MAIN[] $.test[s] $.env[] $.request[] $.form[] $.cookie[] $.status[] $.console[] $.memory[compact] $.hash[] $.table[] $.file[]
! 59: $.response[] $.math[abs] $.json[string] $.reflection[classes] $.mail[send] $.inet[ntoa]
! 60: ]
! 61:
! 62: 1. CLASS_NAME and CLASS.CLASS_NAME:
! 63: 1.1 ^class_names[$visible;.]
! 64: 1.2 ^class_names[$fields;.]
! 65: 1.3 ^class_names[$objects;.]
! 66: 1.4 ^class_names[$statics;:]
! 67:
! 68: 2. the method is called:
! 69: 2.1 ^visible.foreach[name;method]{ ^show{^^${name}.${method}[]} }
! 70: 2.2 ^fields.foreach[name;method]{ ^show{^^${name}.${method}[]} }
! 71:
! 72: 3. ^$o.method is junction:
! 73: 3.1 ^visible.foreach[name;method]{ ^kind{^$${name}.$method} }
! 74: 3.2 ^statics.foreach[name;method]{ ^if(def $method){ ^kind{^$${name}:$method} } }
! 75:
! 76: 4. ^$o.method is inaccessible in objects with an open set of keys:
! 77: ^fields.foreach[name;method]{^kind{^$${name}.${method}}}
! 78: ^kind{^$response:send}
! 79:
! 80: 5. fields named as the methods are found, the methods are still called:
! 81: $hashfile.cleanup[value of cleanup]
! 82: $hash[ $.count[value of count] ]
! 83: $columns[^table::create{count data
! 84: 1 x
! 85: 2 y}]
! 86: hashfile: $hashfile.cleanup, ^hashfile.cleanup[]
! 87: hash: $hash.count, ^hash.count[]
! 88: columns: $columns.count ^columns.count[]
! 89:
! 90: $response:clear[value of clear]
! 91: ^kind{^$response:clear}
! 92: ^response:clear[]
! 93:
! 94: 6. table and hashfile keep only strings (unlike hash or array) and thus can't be called:
! 95: ^show{^$columns.data}
! 96: ^show{^^columns.data[]}
! 97: ^show{^$columns.no-such-field}
! 98: ^show{^^columns.no-such-field[]}
! 99: $hashfile.key[value of key]
! 100: ^show{^^hashfile.key[]}
! 101: 6.1 but hash values can be called:
! 102: $hash[ $.f[$junction] ]
! 103: ^show{^^hash.f[]}
! 104:
! 105: 7. CLASS is compiled into the class, the computed name is the key:
! 106: $c1[C] $c2[LASS]
! 107: $hash[ $.CLASS[key value] ]
! 108: hash: $hash.CLASS.CLASS_NAME, $hash.[${c1}${c2}]
! 109:
! 110: # memcached and redis tests in their dirs
! 111: ^hashfile.delete[]
! 112: $response:untaint[html]
! 113:
! 114: @class_names[names;separator]
! 115: ^names.foreach[name;method]{^show{^$${name}${separator}CLASS_NAME, ^$${name}${separator}CLASS.CLASS_NAME}}
! 116:
! 117: @show[code]
! 118: ${code}: ^try-catch-comment{^process{$code}}^#0A
! 119:
! 120: @kind[code][value]
! 121: ${code}: ^try-catch-comment{$value[^process{$code}]^if($value is junction){junction}{^if(def $value){value "$value"}{empty}}}^#0A
! 122:
! 123: @CLASS
! 124: test
! 125:
! 126: @create[]
! 127:
! 128: @m[]
! 129: method
! 130:
! 131: @s[]
! 132: static
E-mail: