| 1 |
#foreach($mud in $mudsOnSpecial) |
| 2 |
#if($customer.hasPurchased($mud)) |
| 3 |
#set($a = "Velocity") |
| 4 |
#set($foo.bar[1] = 3) |
| 5 |
#{set}($map["apple"] = "orange") |
| 6 |
#if($foo == $bar)#end |
| 7 |
#if (!$foo)#end |
| 8 |
#if ($foo && $foo.bar)#end |
| 9 |
#{if}($foo1 || $foo2)#end |
| 10 |
#set( $monkey.Say = ["Not", $my, "fault"] ) |
| 11 |
#set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"}) |
| 12 |
#set( $result = $query.criteria("address") ) |
| 13 |
#set( $result = true ) |
| 14 |
#set( $result = false ) |
| 15 |
#if( $foo < 10 ) |
| 16 |
#elseif( $foo == 10 ) |
| 17 |
#else |
| 18 |
#end |
| 19 |
#if( $foo == $bar)it's true!#{else}it's not!#end |
| 20 |
#include( "greetings.txt", $seasonalstock ) |
| 21 |
#parse( "me.vm" ) |
| 22 |
#{parse}( "me.vm" ) |
| 23 |
#break |
| 24 |
#{break} |
| 25 |
#break($macro.topmost) |
| 26 |
#stop('$foo was not in context') |
| 27 |
#{stop} |
| 28 |
#evaluate($dynamicsource) |
| 29 |
#macro( d ) |
| 30 |
<tr><td></td></tr> |
| 31 |
#end |
| 32 |
#d() |
| 33 |
#@d()Hello!#end |
| 34 |
\#include( "a.txt" ) |
| 35 |
\\#include ( "a.txt" ) |
| 36 |
#set($foo=["$10 and ","a pie"])#foreach($a in $foo)$a#end |
| 37 |
#set( $foo = $bar + 3 ) |
| 38 |
#set( $foo = $bar - 4 ) |
| 39 |
#set( $foo = $bar * 6 ) |
| 40 |
#set( $foo = $bar / 2 ) |
| 41 |
#set( $foo = $bar % 5 ) |
| 42 |
#foreach( $foo in [1..5] ) |
| 43 |
|
| 44 |
---------------------------------------------------- |
| 45 |
|
| 46 |
[ |
| 47 |
["directive", [ |
| 48 |
["keyword", ["#foreach"]], |
| 49 |
["punctuation", "("], |
| 50 |
["variable", ["$mud"]], |
| 51 |
["keyword", ["in"]], |
| 52 |
["variable", ["$mudsOnSpecial"]], |
| 53 |
["punctuation", ")"] |
| 54 |
]], |
| 55 |
["directive", [ |
| 56 |
["keyword", ["#if"]], |
| 57 |
["punctuation", "("], |
| 58 |
["variable", [ |
| 59 |
"$customer", |
| 60 |
["punctuation", "."], |
| 61 |
["function", "hasPurchased"], |
| 62 |
["punctuation", "("], |
| 63 |
"$mud", |
| 64 |
["punctuation", ")"] |
| 65 |
]], |
| 66 |
["punctuation", ")"] |
| 67 |
]], |
| 68 |
["directive", [ |
| 69 |
["keyword", ["#set"]], |
| 70 |
["punctuation", "("], |
| 71 |
["variable", ["$a"]], |
| 72 |
["operator", "="], |
| 73 |
["string", "\"Velocity\""], |
| 74 |
["punctuation", ")"] |
| 75 |
]], |
| 76 |
["directive", [ |
| 77 |
["keyword", ["#set"]], |
| 78 |
["punctuation", "("], |
| 79 |
["variable", [ |
| 80 |
"$foo", |
| 81 |
["punctuation", "."], |
| 82 |
"bar", |
| 83 |
["punctuation", "["], |
| 84 |
["number", "1"], |
| 85 |
["punctuation", "]"] |
| 86 |
]], |
| 87 |
["operator", "="], |
| 88 |
["number", "3"], |
| 89 |
["punctuation", ")"] |
| 90 |
]], |
| 91 |
["directive", [ |
| 92 |
["keyword", ["#", ["punctuation", "{"], "set", ["punctuation", "}"]]], |
| 93 |
["punctuation", "("], |
| 94 |
["variable", [ |
| 95 |
"$map", |
| 96 |
["punctuation", "["], |
| 97 |
["string", "\"apple\""], |
| 98 |
["punctuation", "]"] |
| 99 |
]], |
| 100 |
["operator", "="], |
| 101 |
["string", "\"orange\""], |
| 102 |
["punctuation", ")"] |
| 103 |
]], |
| 104 |
["directive", [ |
| 105 |
["keyword", ["#if"]], |
| 106 |
["punctuation", "("], |
| 107 |
["variable", ["$foo"]], |
| 108 |
["operator", "=="], |
| 109 |
["variable", ["$bar"]], |
| 110 |
["punctuation", ")"] |
| 111 |
]], |
| 112 |
["directive", [ |
| 113 |
["keyword", ["#end"]] |
| 114 |
]], |
| 115 |
["directive", [ |
| 116 |
["keyword", ["#if"]], |
| 117 |
["punctuation", "("], |
| 118 |
["operator", "!"], |
| 119 |
["variable", ["$foo"]], |
| 120 |
["punctuation", ")"] |
| 121 |
]], |
| 122 |
["directive", [ |
| 123 |
["keyword", ["#end"]] |
| 124 |
]], |
| 125 |
["directive", [ |
| 126 |
["keyword", ["#if"]], |
| 127 |
["punctuation", "("], |
| 128 |
["variable", ["$foo"]], |
| 129 |
["operator", "&&"], |
| 130 |
["variable", ["$foo", ["punctuation", "."], "bar"]], |
| 131 |
["punctuation", ")"] |
| 132 |
]], |
| 133 |
["directive", [ |
| 134 |
["keyword", ["#end"]] |
| 135 |
]], |
| 136 |
["directive", [ |
| 137 |
["keyword", ["#", ["punctuation", "{"], "if", ["punctuation", "}"]]], |
| 138 |
["punctuation", "("], |
| 139 |
["variable", ["$foo1"]], |
| 140 |
["operator", "||"], |
| 141 |
["variable", ["$foo2"]], |
| 142 |
["punctuation", ")"] |
| 143 |
]], |
| 144 |
["directive", [ |
| 145 |
["keyword", ["#end"]] |
| 146 |
]], |
| 147 |
["directive", [ |
| 148 |
["keyword", ["#set"]], |
| 149 |
["punctuation", "("], |
| 150 |
["variable", ["$monkey", ["punctuation", "."], "Say"]], |
| 151 |
["operator", "="], |
| 152 |
["punctuation", "["], |
| 153 |
["string", "\"Not\""], |
| 154 |
["punctuation", ","], |
| 155 |
["variable", ["$my"]], |
| 156 |
["punctuation", ","], |
| 157 |
["string", "\"fault\""], |
| 158 |
["punctuation", "]"], |
| 159 |
["punctuation", ")"] |
| 160 |
]], |
| 161 |
["directive", [ |
| 162 |
["keyword", ["#set"]], |
| 163 |
["punctuation", "("], |
| 164 |
["variable", ["$monkey", ["punctuation", "."], "Map"]], |
| 165 |
["operator", "="], |
| 166 |
["punctuation", "{"], |
| 167 |
["string", "\"banana\""], |
| 168 |
["punctuation", ":"], |
| 169 |
["string", "\"good\""], |
| 170 |
["punctuation", ","], |
| 171 |
["string", "\"roast beef\""], |
| 172 |
["punctuation", ":"], |
| 173 |
["string", "\"bad\""], |
| 174 |
["punctuation", "}"], |
| 175 |
["punctuation", ")"] |
| 176 |
]], |
| 177 |
["directive", [ |
| 178 |
["keyword", ["#set"]], |
| 179 |
["punctuation", "("], |
| 180 |
["variable", ["$result"]], |
| 181 |
["operator", "="], |
| 182 |
["variable", [ |
| 183 |
"$query", |
| 184 |
["punctuation", "."], |
| 185 |
["function", "criteria"], |
| 186 |
["punctuation", "("], |
| 187 |
["string", "\"address\""], |
| 188 |
["punctuation", ")"] |
| 189 |
]], |
| 190 |
["punctuation", ")"] |
| 191 |
]], |
| 192 |
["directive", [ |
| 193 |
["keyword", ["#set"]], |
| 194 |
["punctuation", "("], |
| 195 |
["variable", ["$result"]], |
| 196 |
["operator", "="], |
| 197 |
["boolean", "true"], |
| 198 |
["punctuation", ")"] |
| 199 |
]], |
| 200 |
["directive", [ |
| 201 |
["keyword", ["#set"]], |
| 202 |
["punctuation", "("], |
| 203 |
["variable", ["$result"]], |
| 204 |
["operator", "="], |
| 205 |
["boolean", "false"], |
| 206 |
["punctuation", ")"] |
| 207 |
]], |
| 208 |
["directive", [ |
| 209 |
["keyword", ["#if"]], |
| 210 |
["punctuation", "("], |
| 211 |
["variable", ["$foo"]], |
| 212 |
["operator", "<"], |
| 213 |
["number", "10"], |
| 214 |
["punctuation", ")"] |
| 215 |
]], |
| 216 |
["directive", [ |
| 217 |
["keyword", ["#elseif"]], |
| 218 |
["punctuation", "("], |
| 219 |
["variable", ["$foo"]], |
| 220 |
["operator", "=="], |
| 221 |
["number", "10"], |
| 222 |
["punctuation", ")"] |
| 223 |
]], |
| 224 |
["directive", [ |
| 225 |
["keyword", ["#else"]] |
| 226 |
]], |
| 227 |
["directive", [ |
| 228 |
["keyword", ["#end"]] |
| 229 |
]], |
| 230 |
["directive", [ |
| 231 |
["keyword", ["#if"]], |
| 232 |
["punctuation", "("], |
| 233 |
["variable", ["$foo"]], |
| 234 |
["operator", "=="], |
| 235 |
["variable", ["$bar"]], |
| 236 |
["punctuation", ")"] |
| 237 |
]], |
| 238 |
"it's true!", |
| 239 |
["directive", [ |
| 240 |
["keyword", ["#", ["punctuation", "{"], "else", ["punctuation", "}"]]] |
| 241 |
]], |
| 242 |
"it's not!", |
| 243 |
["directive", [ |
| 244 |
["keyword", ["#end"]] |
| 245 |
]], |
| 246 |
["directive", [ |
| 247 |
["keyword", ["#include"]], |
| 248 |
["punctuation", "("], |
| 249 |
["string", "\"greetings.txt\""], |
| 250 |
["punctuation", ","], |
| 251 |
["variable", ["$seasonalstock"]], |
| 252 |
["punctuation", ")"] |
| 253 |
]], |
| 254 |
["directive", [ |
| 255 |
["keyword", ["#parse"]], |
| 256 |
["punctuation", "("], |
| 257 |
["string", "\"me.vm\""], |
| 258 |
["punctuation", ")"] |
| 259 |
]], |
| 260 |
["directive", [ |
| 261 |
["keyword", ["#", ["punctuation", "{"], "parse", ["punctuation", "}"]]], |
| 262 |
["punctuation", "("], |
| 263 |
["string", "\"me.vm\""], |
| 264 |
["punctuation", ")"] |
| 265 |
]], |
| 266 |
["directive", [ |
| 267 |
["keyword", ["#break"]] |
| 268 |
]], |
| 269 |
["directive", [ |
| 270 |
["keyword", ["#", ["punctuation", "{"], "break", ["punctuation", "}"]]] |
| 271 |
]], |
| 272 |
["directive", [ |
| 273 |
["keyword", ["#break"]], |
| 274 |
["punctuation", "("], |
| 275 |
["variable", ["$macro", ["punctuation", "."], "topmost"]], |
| 276 |
["punctuation", ")"] |
| 277 |
]], |
| 278 |
["directive", [ |
| 279 |
["keyword", ["#stop"]], |
| 280 |
["punctuation", "("], |
| 281 |
["string", "'$foo was not in context'"], |
| 282 |
["punctuation", ")"] |
| 283 |
]], |
| 284 |
["directive", [ |
| 285 |
["keyword", ["#", ["punctuation", "{"], "stop", ["punctuation", "}"]]] |
| 286 |
]], |
| 287 |
["directive", [ |
| 288 |
["keyword", ["#evaluate"]], |
| 289 |
["punctuation", "("], |
| 290 |
["variable", ["$dynamicsource"]], |
| 291 |
["punctuation", ")"] |
| 292 |
]], |
| 293 |
["directive", [ |
| 294 |
["keyword", ["#macro"]], |
| 295 |
["punctuation", "("], |
| 296 |
" d ", |
| 297 |
["punctuation", ")"] |
| 298 |
]], |
| 299 |
["tag", [["tag", [["punctuation", "<"], "tr"]], ["punctuation", ">"]]], |
| 300 |
["tag", [["tag", [["punctuation", "<"], "td"]], ["punctuation", ">"]]], |
| 301 |
["tag", [["tag", [["punctuation", "</"], "td"]], ["punctuation", ">"]]], |
| 302 |
["tag", [["tag", [["punctuation", "</"], "tr"]], ["punctuation", ">"]]], |
| 303 |
["directive", [ |
| 304 |
["keyword", ["#end"]] |
| 305 |
]], |
| 306 |
["directive", [ |
| 307 |
["keyword", ["#d"]], |
| 308 |
["punctuation", "("], |
| 309 |
["punctuation", ")"] |
| 310 |
]], |
| 311 |
["directive", [ |
| 312 |
["keyword", ["#@d"]], |
| 313 |
["punctuation", "("], |
| 314 |
["punctuation", ")"] |
| 315 |
]], |
| 316 |
"Hello!", |
| 317 |
["directive", [ |
| 318 |
["keyword", ["#end"]] |
| 319 |
]], |
| 320 |
"\r\n\\#include( \"a.txt\" )\r\n\\\\", |
| 321 |
["directive", [ |
| 322 |
["keyword", ["#include"]], |
| 323 |
["punctuation", "("], |
| 324 |
["string", "\"a.txt\""], |
| 325 |
["punctuation", ")"] |
| 326 |
]], |
| 327 |
["directive", [ |
| 328 |
["keyword", ["#set"]], |
| 329 |
["punctuation", "("], |
| 330 |
["variable", ["$foo"]], |
| 331 |
["operator", "="], |
| 332 |
["punctuation", "["], |
| 333 |
["string", "\"$10 and \""], |
| 334 |
["punctuation", ","], |
| 335 |
["string", "\"a pie\""], |
| 336 |
["punctuation", "]"], |
| 337 |
["punctuation", ")"] |
| 338 |
]], |
| 339 |
["directive", [ |
| 340 |
["keyword", ["#foreach"]], |
| 341 |
["punctuation", "("], |
| 342 |
["variable", ["$a"]], |
| 343 |
["keyword", ["in"]], |
| 344 |
["variable", ["$foo"]], |
| 345 |
["punctuation", ")"] |
| 346 |
]], |
| 347 |
["variable", ["$a"]], |
| 348 |
["directive", [ |
| 349 |
["keyword", ["#end"]] |
| 350 |
]], |
| 351 |
["directive", [ |
| 352 |
["keyword", ["#set"]], |
| 353 |
["punctuation", "("], |
| 354 |
["variable", ["$foo"]], |
| 355 |
["operator", "="], |
| 356 |
["variable", ["$bar"]], |
| 357 |
["operator", "+"], |
| 358 |
["number", "3"], |
| 359 |
["punctuation", ")"] |
| 360 |
]], |
| 361 |
["directive", [ |
| 362 |
["keyword", ["#set"]], |
| 363 |
["punctuation", "("], |
| 364 |
["variable", ["$foo"]], |
| 365 |
["operator", "="], |
| 366 |
["variable", ["$bar"]], |
| 367 |
["operator", "-"], |
| 368 |
["number", "4"], |
| 369 |
["punctuation", ")"] |
| 370 |
]], |
| 371 |
["directive", [ |
| 372 |
["keyword", ["#set"]], |
| 373 |
["punctuation", "("], |
| 374 |
["variable", ["$foo"]], |
| 375 |
["operator", "="], |
| 376 |
["variable", ["$bar"]], |
| 377 |
["operator", "*"], |
| 378 |
["number", "6"], |
| 379 |
["punctuation", ")"] |
| 380 |
]], |
| 381 |
["directive", [ |
| 382 |
["keyword", ["#set"]], |
| 383 |
["punctuation", "("], |
| 384 |
["variable", ["$foo"]], |
| 385 |
["operator", "="], |
| 386 |
["variable", ["$bar"]], |
| 387 |
["operator", "/"], |
| 388 |
["number", "2"], |
| 389 |
["punctuation", ")"] |
| 390 |
]], |
| 391 |
["directive", [ |
| 392 |
["keyword", ["#set"]], |
| 393 |
["punctuation", "("], |
| 394 |
["variable", ["$foo"]], |
| 395 |
["operator", "="], |
| 396 |
["variable", ["$bar"]], |
| 397 |
["operator", "%"], |
| 398 |
["number", "5"], |
| 399 |
["punctuation", ")"] |
| 400 |
]], |
| 401 |
["directive", [ |
| 402 |
["keyword", ["#foreach"]], |
| 403 |
["punctuation", "("], |
| 404 |
["variable", ["$foo"]], |
| 405 |
["keyword", ["in"]], |
| 406 |
["punctuation", "["], |
| 407 |
["number", "1"], |
| 408 |
["operator", ".."], |
| 409 |
["number", "5"], |
| 410 |
["punctuation", "]"], |
| 411 |
["punctuation", ")"] |
| 412 |
]] |
| 413 |
] |
| 414 |
|
| 415 |
---------------------------------------------------- |
| 416 |
|
| 417 |
Checks for directives. |