| Total Complexity | 1176 |
| Total Lines | 5146 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like SSTemplateParser often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SSTemplateParser, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 57 | class SSTemplateParser extends Parser implements TemplateParser |
||
| 58 | { |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @var bool - Set true by SSTemplateParser::compileString if the template should include comments intended |
||
| 62 | * for debugging (template source, included files, etc) |
||
| 63 | */ |
||
| 64 | protected $includeDebuggingComments = false; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Stores the user-supplied closed block extension rules in the form: |
||
| 68 | * array( |
||
| 69 | * 'name' => function (&$res) {} |
||
| 70 | * ) |
||
| 71 | * See SSTemplateParser::ClosedBlock_Handle_Loop for an example of what the callable should look like |
||
| 72 | * @var array |
||
| 73 | */ |
||
| 74 | protected $closedBlocks = array(); |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Stores the user-supplied open block extension rules in the form: |
||
| 78 | * array( |
||
| 79 | * 'name' => function (&$res) {} |
||
| 80 | * ) |
||
| 81 | * See SSTemplateParser::OpenBlock_Handle_Base_tag for an example of what the callable should look like |
||
| 82 | * @var array |
||
| 83 | */ |
||
| 84 | protected $openBlocks = array(); |
||
| 85 | |||
| 86 | /** |
||
| 87 | * Allow the injection of new closed & open block callables |
||
| 88 | * @param array $closedBlocks |
||
| 89 | * @param array $openBlocks |
||
| 90 | */ |
||
| 91 | public function __construct($closedBlocks = array(), $openBlocks = array()) |
||
| 92 | { |
||
| 93 | parent::__construct(null); |
||
| 94 | $this->setClosedBlocks($closedBlocks); |
||
| 95 | $this->setOpenBlocks($openBlocks); |
||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * Override the function that constructs the result arrays to also prepare a 'php' item in the array |
||
| 100 | */ |
||
| 101 | function construct($matchrule, $name, $arguments = null) |
||
| 102 | { |
||
| 103 | $res = parent::construct($matchrule, $name, $arguments); |
||
| 104 | if (!isset($res['php'])) { |
||
| 105 | $res['php'] = ''; |
||
| 106 | } |
||
| 107 | return $res; |
||
| 108 | } |
||
| 109 | |||
| 110 | /** |
||
| 111 | * Set the closed blocks that the template parser should use |
||
| 112 | * |
||
| 113 | * This method will delete any existing closed blocks, please use addClosedBlock if you don't |
||
| 114 | * want to overwrite |
||
| 115 | * @param array $closedBlocks |
||
| 116 | * @throws InvalidArgumentException |
||
| 117 | */ |
||
| 118 | public function setClosedBlocks($closedBlocks) |
||
| 119 | { |
||
| 120 | $this->closedBlocks = array(); |
||
| 121 | foreach ((array) $closedBlocks as $name => $callable) { |
||
| 122 | $this->addClosedBlock($name, $callable); |
||
| 123 | } |
||
| 124 | } |
||
| 125 | |||
| 126 | /** |
||
| 127 | * Set the open blocks that the template parser should use |
||
| 128 | * |
||
| 129 | * This method will delete any existing open blocks, please use addOpenBlock if you don't |
||
| 130 | * want to overwrite |
||
| 131 | * @param array $openBlocks |
||
| 132 | * @throws InvalidArgumentException |
||
| 133 | */ |
||
| 134 | public function setOpenBlocks($openBlocks) |
||
| 135 | { |
||
| 136 | $this->openBlocks = array(); |
||
| 137 | foreach ((array) $openBlocks as $name => $callable) { |
||
| 138 | $this->addOpenBlock($name, $callable); |
||
| 139 | } |
||
| 140 | } |
||
| 141 | |||
| 142 | /** |
||
| 143 | * Add a closed block callable to allow <% name %><% end_name %> syntax |
||
| 144 | * @param string $name The name of the token to be used in the syntax <% name %><% end_name %> |
||
| 145 | * @param callable $callable The function that modifies the generation of template code |
||
| 146 | * @throws InvalidArgumentException |
||
| 147 | */ |
||
| 148 | public function addClosedBlock($name, $callable) |
||
| 149 | { |
||
| 150 | $this->validateExtensionBlock($name, $callable, 'Closed block'); |
||
| 151 | $this->closedBlocks[$name] = $callable; |
||
| 152 | } |
||
| 153 | |||
| 154 | /** |
||
| 155 | * Add a closed block callable to allow <% name %> syntax |
||
| 156 | * @param string $name The name of the token to be used in the syntax <% name %> |
||
| 157 | * @param callable $callable The function that modifies the generation of template code |
||
| 158 | * @throws InvalidArgumentException |
||
| 159 | */ |
||
| 160 | public function addOpenBlock($name, $callable) |
||
| 161 | { |
||
| 162 | $this->validateExtensionBlock($name, $callable, 'Open block'); |
||
| 163 | $this->openBlocks[$name] = $callable; |
||
| 164 | } |
||
| 165 | |||
| 166 | /** |
||
| 167 | * Ensures that the arguments to addOpenBlock and addClosedBlock are valid |
||
| 168 | * @param $name |
||
| 169 | * @param $callable |
||
| 170 | * @param $type |
||
| 171 | * @throws InvalidArgumentException |
||
| 172 | */ |
||
| 173 | protected function validateExtensionBlock($name, $callable, $type) |
||
| 174 | { |
||
| 175 | if (!is_string($name)) { |
||
| 176 | throw new InvalidArgumentException( |
||
| 177 | sprintf( |
||
| 178 | "Name argument for %s must be a string", |
||
| 179 | $type |
||
| 180 | ) |
||
| 181 | ); |
||
| 182 | } elseif (!is_callable($callable)) { |
||
| 183 | throw new InvalidArgumentException( |
||
| 184 | sprintf( |
||
| 185 | "Callable %s argument named '%s' is not callable", |
||
| 186 | $type, |
||
| 187 | $name |
||
| 188 | ) |
||
| 189 | ); |
||
| 190 | } |
||
| 191 | } |
||
| 192 | |||
| 193 | /* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | |
||
| 194 | OpenBlock | MalformedBlock | Injection | Text)+ */ |
||
| 195 | protected $match_Template_typestack = array('Template'); |
||
| 196 | function match_Template ($stack = array()) { |
||
| 197 | $matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 198 | $count = 0; |
||
| 199 | while (true) { |
||
| 200 | $res_50 = $result; |
||
| 201 | $pos_50 = $this->pos; |
||
| 202 | $_49 = NULL; |
||
| 203 | do { |
||
| 204 | $_47 = NULL; |
||
| 205 | do { |
||
| 206 | $res_0 = $result; |
||
| 207 | $pos_0 = $this->pos; |
||
| 208 | $matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
||
| 209 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 210 | if ($subres !== FALSE) { |
||
| 211 | $this->store( $result, $subres ); |
||
| 212 | $_47 = TRUE; break; |
||
| 213 | } |
||
| 214 | $result = $res_0; |
||
| 215 | $this->pos = $pos_0; |
||
| 216 | $_45 = NULL; |
||
| 217 | do { |
||
| 218 | $res_2 = $result; |
||
| 219 | $pos_2 = $this->pos; |
||
| 220 | $matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
||
| 221 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 222 | if ($subres !== FALSE) { |
||
| 223 | $this->store( $result, $subres ); |
||
| 224 | $_45 = TRUE; break; |
||
| 225 | } |
||
| 226 | $result = $res_2; |
||
| 227 | $this->pos = $pos_2; |
||
| 228 | $_43 = NULL; |
||
| 229 | do { |
||
| 230 | $res_4 = $result; |
||
| 231 | $pos_4 = $this->pos; |
||
| 232 | $matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
||
| 233 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 234 | if ($subres !== FALSE) { |
||
| 235 | $this->store( $result, $subres ); |
||
| 236 | $_43 = TRUE; break; |
||
| 237 | } |
||
| 238 | $result = $res_4; |
||
| 239 | $this->pos = $pos_4; |
||
| 240 | $_41 = NULL; |
||
| 241 | do { |
||
| 242 | $res_6 = $result; |
||
| 243 | $pos_6 = $this->pos; |
||
| 244 | $matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
||
| 245 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 246 | if ($subres !== FALSE) { |
||
| 247 | $this->store( $result, $subres ); |
||
| 248 | $_41 = TRUE; break; |
||
| 249 | } |
||
| 250 | $result = $res_6; |
||
| 251 | $this->pos = $pos_6; |
||
| 252 | $_39 = NULL; |
||
| 253 | do { |
||
| 254 | $res_8 = $result; |
||
| 255 | $pos_8 = $this->pos; |
||
| 256 | $matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
||
| 257 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 258 | if ($subres !== FALSE) { |
||
| 259 | $this->store( $result, $subres ); |
||
| 260 | $_39 = TRUE; break; |
||
| 261 | } |
||
| 262 | $result = $res_8; |
||
| 263 | $this->pos = $pos_8; |
||
| 264 | $_37 = NULL; |
||
| 265 | do { |
||
| 266 | $res_10 = $result; |
||
| 267 | $pos_10 = $this->pos; |
||
| 268 | $matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 269 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 270 | if ($subres !== FALSE) { |
||
| 271 | $this->store( $result, $subres ); |
||
| 272 | $_37 = TRUE; break; |
||
| 273 | } |
||
| 274 | $result = $res_10; |
||
| 275 | $this->pos = $pos_10; |
||
| 276 | $_35 = NULL; |
||
| 277 | do { |
||
| 278 | $res_12 = $result; |
||
| 279 | $pos_12 = $this->pos; |
||
| 280 | $matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
||
| 281 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 282 | if ($subres !== FALSE) { |
||
| 283 | $this->store( $result, $subres ); |
||
| 284 | $_35 = TRUE; break; |
||
| 285 | } |
||
| 286 | $result = $res_12; |
||
| 287 | $this->pos = $pos_12; |
||
| 288 | $_33 = NULL; |
||
| 289 | do { |
||
| 290 | $res_14 = $result; |
||
| 291 | $pos_14 = $this->pos; |
||
| 292 | $matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
||
| 293 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 294 | if ($subres !== FALSE) { |
||
| 295 | $this->store( $result, $subres ); |
||
| 296 | $_33 = TRUE; break; |
||
| 297 | } |
||
| 298 | $result = $res_14; |
||
| 299 | $this->pos = $pos_14; |
||
| 300 | $_31 = NULL; |
||
| 301 | do { |
||
| 302 | $res_16 = $result; |
||
| 303 | $pos_16 = $this->pos; |
||
| 304 | $matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 305 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 306 | if ($subres !== FALSE) { |
||
| 307 | $this->store( $result, $subres ); |
||
| 308 | $_31 = TRUE; break; |
||
| 309 | } |
||
| 310 | $result = $res_16; |
||
| 311 | $this->pos = $pos_16; |
||
| 312 | $_29 = NULL; |
||
| 313 | do { |
||
| 314 | $res_18 = $result; |
||
| 315 | $pos_18 = $this->pos; |
||
| 316 | $matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
||
| 317 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 318 | if ($subres !== FALSE) { |
||
| 319 | $this->store( $result, $subres ); |
||
| 320 | $_29 = TRUE; break; |
||
| 321 | } |
||
| 322 | $result = $res_18; |
||
| 323 | $this->pos = $pos_18; |
||
| 324 | $_27 = NULL; |
||
| 325 | do { |
||
| 326 | $res_20 = $result; |
||
| 327 | $pos_20 = $this->pos; |
||
| 328 | $matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 329 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 330 | if ($subres !== FALSE) { |
||
| 331 | $this->store( $result, $subres ); |
||
| 332 | $_27 = TRUE; break; |
||
| 333 | } |
||
| 334 | $result = $res_20; |
||
| 335 | $this->pos = $pos_20; |
||
| 336 | $_25 = NULL; |
||
| 337 | do { |
||
| 338 | $res_22 = $result; |
||
| 339 | $pos_22 = $this->pos; |
||
| 340 | $matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
||
| 341 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 342 | if ($subres !== FALSE) { |
||
| 343 | $this->store( $result, $subres ); |
||
| 344 | $_25 = TRUE; break; |
||
| 345 | } |
||
| 346 | $result = $res_22; |
||
| 347 | $this->pos = $pos_22; |
||
| 348 | $matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
||
| 349 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 350 | if ($subres !== FALSE) { |
||
| 351 | $this->store( $result, $subres ); |
||
| 352 | $_25 = TRUE; break; |
||
| 353 | } |
||
| 354 | $result = $res_22; |
||
| 355 | $this->pos = $pos_22; |
||
| 356 | $_25 = FALSE; break; |
||
| 357 | } |
||
| 358 | while(0); |
||
| 359 | if( $_25 === TRUE ) { $_27 = TRUE; break; } |
||
| 360 | $result = $res_20; |
||
| 361 | $this->pos = $pos_20; |
||
| 362 | $_27 = FALSE; break; |
||
| 363 | } |
||
| 364 | while(0); |
||
| 365 | if( $_27 === TRUE ) { $_29 = TRUE; break; } |
||
| 366 | $result = $res_18; |
||
| 367 | $this->pos = $pos_18; |
||
| 368 | $_29 = FALSE; break; |
||
| 369 | } |
||
| 370 | while(0); |
||
| 371 | if( $_29 === TRUE ) { $_31 = TRUE; break; } |
||
| 372 | $result = $res_16; |
||
| 373 | $this->pos = $pos_16; |
||
| 374 | $_31 = FALSE; break; |
||
| 375 | } |
||
| 376 | while(0); |
||
| 377 | if( $_31 === TRUE ) { $_33 = TRUE; break; } |
||
| 378 | $result = $res_14; |
||
| 379 | $this->pos = $pos_14; |
||
| 380 | $_33 = FALSE; break; |
||
| 381 | } |
||
| 382 | while(0); |
||
| 383 | if( $_33 === TRUE ) { $_35 = TRUE; break; } |
||
| 384 | $result = $res_12; |
||
| 385 | $this->pos = $pos_12; |
||
| 386 | $_35 = FALSE; break; |
||
| 387 | } |
||
| 388 | while(0); |
||
| 389 | if( $_35 === TRUE ) { $_37 = TRUE; break; } |
||
| 390 | $result = $res_10; |
||
| 391 | $this->pos = $pos_10; |
||
| 392 | $_37 = FALSE; break; |
||
| 393 | } |
||
| 394 | while(0); |
||
| 395 | if( $_37 === TRUE ) { $_39 = TRUE; break; } |
||
| 396 | $result = $res_8; |
||
| 397 | $this->pos = $pos_8; |
||
| 398 | $_39 = FALSE; break; |
||
| 399 | } |
||
| 400 | while(0); |
||
| 401 | if( $_39 === TRUE ) { $_41 = TRUE; break; } |
||
| 402 | $result = $res_6; |
||
| 403 | $this->pos = $pos_6; |
||
| 404 | $_41 = FALSE; break; |
||
| 405 | } |
||
| 406 | while(0); |
||
| 407 | if( $_41 === TRUE ) { $_43 = TRUE; break; } |
||
| 408 | $result = $res_4; |
||
| 409 | $this->pos = $pos_4; |
||
| 410 | $_43 = FALSE; break; |
||
| 411 | } |
||
| 412 | while(0); |
||
| 413 | if( $_43 === TRUE ) { $_45 = TRUE; break; } |
||
| 414 | $result = $res_2; |
||
| 415 | $this->pos = $pos_2; |
||
| 416 | $_45 = FALSE; break; |
||
| 417 | } |
||
| 418 | while(0); |
||
| 419 | if( $_45 === TRUE ) { $_47 = TRUE; break; } |
||
| 420 | $result = $res_0; |
||
| 421 | $this->pos = $pos_0; |
||
| 422 | $_47 = FALSE; break; |
||
| 423 | } |
||
| 424 | while(0); |
||
| 425 | if( $_47 === FALSE) { $_49 = FALSE; break; } |
||
| 426 | $_49 = TRUE; break; |
||
| 427 | } |
||
| 428 | while(0); |
||
| 429 | if( $_49 === FALSE) { |
||
| 430 | $result = $res_50; |
||
| 431 | $this->pos = $pos_50; |
||
| 432 | unset( $res_50 ); |
||
| 433 | unset( $pos_50 ); |
||
| 434 | break; |
||
| 435 | } |
||
| 436 | $count += 1; |
||
| 437 | } |
||
| 438 | if ($count > 0) { return $this->finalise($result); } |
||
| 439 | else { return FALSE; } |
||
| 440 | } |
||
| 441 | |||
| 442 | |||
| 443 | |||
| 444 | function Template_STR(&$res, $sub) |
||
| 445 | { |
||
| 446 | $res['php'] .= $sub['php'] . PHP_EOL ; |
||
| 447 | } |
||
| 448 | |||
| 449 | /* Word: / [A-Za-z_] [A-Za-z0-9_]* / */ |
||
| 450 | protected $match_Word_typestack = array('Word'); |
||
| 451 | function match_Word ($stack = array()) { |
||
| 458 | } |
||
| 459 | |||
| 460 | |||
| 461 | /* NamespacedWord: / [A-Za-z_\/\\] [A-Za-z0-9_\/\\]* / */ |
||
| 462 | protected $match_NamespacedWord_typestack = array('NamespacedWord'); |
||
| 463 | function match_NamespacedWord ($stack = array()) { |
||
| 464 | $matchrule = "NamespacedWord"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 465 | if (( $subres = $this->rx( '/ [A-Za-z_\/\\\\] [A-Za-z0-9_\/\\\\]* /' ) ) !== FALSE) { |
||
| 466 | $result["text"] .= $subres; |
||
| 467 | return $this->finalise($result); |
||
| 468 | } |
||
| 469 | else { return FALSE; } |
||
| 470 | } |
||
| 471 | |||
| 472 | |||
| 473 | /* Number: / [0-9]+ / */ |
||
| 474 | protected $match_Number_typestack = array('Number'); |
||
| 475 | function match_Number ($stack = array()) { |
||
| 476 | $matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 477 | if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) { |
||
| 478 | $result["text"] .= $subres; |
||
| 479 | return $this->finalise($result); |
||
| 480 | } |
||
| 481 | else { return FALSE; } |
||
| 482 | } |
||
| 483 | |||
| 484 | |||
| 485 | /* Value: / [A-Za-z0-9_]+ / */ |
||
| 486 | protected $match_Value_typestack = array('Value'); |
||
| 487 | function match_Value ($stack = array()) { |
||
| 488 | $matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 489 | if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) { |
||
| 490 | $result["text"] .= $subres; |
||
| 491 | return $this->finalise($result); |
||
| 492 | } |
||
| 493 | else { return FALSE; } |
||
| 494 | } |
||
| 495 | |||
| 496 | |||
| 497 | /* CallArguments: :Argument ( < "," < :Argument )* */ |
||
| 498 | protected $match_CallArguments_typestack = array('CallArguments'); |
||
| 499 | function match_CallArguments ($stack = array()) { |
||
| 543 | } |
||
| 544 | |||
| 545 | |||
| 546 | |||
| 547 | |||
| 548 | /** |
||
| 549 | * Values are bare words in templates, but strings in PHP. We rely on PHP's type conversion to back-convert |
||
| 550 | * strings to numbers when needed. |
||
| 551 | */ |
||
| 552 | function CallArguments_Argument(&$res, $sub) |
||
| 553 | { |
||
| 554 | if (!empty($res['php'])) { |
||
| 555 | $res['php'] .= ', '; |
||
| 556 | } |
||
| 557 | |||
| 558 | $res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : |
||
| 559 | str_replace('$$FINAL', 'XML_val', $sub['php']); |
||
| 560 | } |
||
| 561 | |||
| 562 | /* Call: Method:Word ( "(" < :CallArguments? > ")" )? */ |
||
| 563 | protected $match_Call_typestack = array('Call'); |
||
| 564 | function match_Call ($stack = array()) { |
||
| 565 | $matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 566 | $_72 = NULL; |
||
| 567 | do { |
||
| 568 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 569 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 570 | if ($subres !== FALSE) { |
||
| 571 | $this->store( $result, $subres, "Method" ); |
||
| 572 | } |
||
| 573 | else { $_72 = FALSE; break; } |
||
| 574 | $res_71 = $result; |
||
| 575 | $pos_71 = $this->pos; |
||
| 576 | $_70 = NULL; |
||
| 577 | do { |
||
| 578 | if (substr($this->string,$this->pos,1) == '(') { |
||
| 579 | $this->pos += 1; |
||
| 580 | $result["text"] .= '('; |
||
| 581 | } |
||
| 582 | else { $_70 = FALSE; break; } |
||
| 583 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 584 | $res_67 = $result; |
||
| 585 | $pos_67 = $this->pos; |
||
| 586 | $matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
||
| 587 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 588 | if ($subres !== FALSE) { |
||
| 589 | $this->store( $result, $subres, "CallArguments" ); |
||
| 590 | } |
||
| 591 | else { |
||
| 592 | $result = $res_67; |
||
| 593 | $this->pos = $pos_67; |
||
| 594 | unset( $res_67 ); |
||
| 595 | unset( $pos_67 ); |
||
| 596 | } |
||
| 597 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 598 | if (substr($this->string,$this->pos,1) == ')') { |
||
| 599 | $this->pos += 1; |
||
| 600 | $result["text"] .= ')'; |
||
| 601 | } |
||
| 602 | else { $_70 = FALSE; break; } |
||
| 603 | $_70 = TRUE; break; |
||
| 604 | } |
||
| 605 | while(0); |
||
| 606 | if( $_70 === FALSE) { |
||
| 607 | $result = $res_71; |
||
| 608 | $this->pos = $pos_71; |
||
| 609 | unset( $res_71 ); |
||
| 610 | unset( $pos_71 ); |
||
| 611 | } |
||
| 612 | $_72 = TRUE; break; |
||
| 613 | } |
||
| 614 | while(0); |
||
| 615 | if( $_72 === TRUE ) { return $this->finalise($result); } |
||
| 616 | if( $_72 === FALSE) { return FALSE; } |
||
| 617 | } |
||
| 618 | |||
| 619 | |||
| 620 | /* LookupStep: :Call &"." */ |
||
| 621 | protected $match_LookupStep_typestack = array('LookupStep'); |
||
| 622 | function match_LookupStep ($stack = array()) { |
||
| 623 | $matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 624 | $_76 = NULL; |
||
| 625 | do { |
||
| 626 | $matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos; |
||
| 627 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 628 | if ($subres !== FALSE) { |
||
| 629 | $this->store( $result, $subres, "Call" ); |
||
| 630 | } |
||
| 631 | else { $_76 = FALSE; break; } |
||
| 632 | $res_75 = $result; |
||
| 633 | $pos_75 = $this->pos; |
||
| 634 | if (substr($this->string,$this->pos,1) == '.') { |
||
| 635 | $this->pos += 1; |
||
| 636 | $result["text"] .= '.'; |
||
| 637 | $result = $res_75; |
||
| 638 | $this->pos = $pos_75; |
||
| 639 | } |
||
| 640 | else { |
||
| 641 | $result = $res_75; |
||
| 642 | $this->pos = $pos_75; |
||
| 643 | $_76 = FALSE; break; |
||
| 644 | } |
||
| 645 | $_76 = TRUE; break; |
||
| 646 | } |
||
| 647 | while(0); |
||
| 648 | if( $_76 === TRUE ) { return $this->finalise($result); } |
||
| 649 | if( $_76 === FALSE) { return FALSE; } |
||
| 650 | } |
||
| 651 | |||
| 652 | |||
| 653 | /* LastLookupStep: :Call */ |
||
| 654 | protected $match_LastLookupStep_typestack = array('LastLookupStep'); |
||
| 655 | function match_LastLookupStep ($stack = array()) { |
||
| 656 | $matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 657 | $matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos; |
||
| 658 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 659 | if ($subres !== FALSE) { |
||
| 660 | $this->store( $result, $subres, "Call" ); |
||
| 661 | return $this->finalise($result); |
||
| 662 | } |
||
| 663 | else { return FALSE; } |
||
| 664 | } |
||
| 665 | |||
| 666 | |||
| 667 | /* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */ |
||
| 668 | protected $match_Lookup_typestack = array('Lookup'); |
||
| 669 | function match_Lookup ($stack = array()) { |
||
| 740 | } |
||
| 741 | |||
| 742 | |||
| 743 | |||
| 744 | |||
| 745 | function Lookup__construct(&$res) |
||
| 746 | { |
||
| 747 | $res['php'] = '$scope->locally()'; |
||
| 748 | $res['LookupSteps'] = array(); |
||
| 749 | } |
||
| 750 | |||
| 751 | /** |
||
| 752 | * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to |
||
| 753 | * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj) |
||
| 754 | * depending on the context the lookup is used in. |
||
| 755 | */ |
||
| 756 | function Lookup_AddLookupStep(&$res, $sub, $method) |
||
| 757 | { |
||
| 758 | $res['LookupSteps'][] = $sub; |
||
| 759 | |||
| 760 | $property = $sub['Call']['Method']['text']; |
||
| 761 | |||
| 762 | if (isset($sub['Call']['CallArguments']) && isset($sub['Call']['CallArguments']['php'])) { |
||
| 763 | $arguments = $sub['Call']['CallArguments']['php']; |
||
| 764 | $res['php'] .= "->$method('$property', array($arguments), true)"; |
||
| 765 | } else { |
||
| 766 | $res['php'] .= "->$method('$property', null, true)"; |
||
| 767 | } |
||
| 768 | } |
||
| 769 | |||
| 770 | function Lookup_LookupStep(&$res, $sub) |
||
| 771 | { |
||
| 772 | $this->Lookup_AddLookupStep($res, $sub, 'obj'); |
||
| 773 | } |
||
| 774 | |||
| 775 | function Lookup_LastLookupStep(&$res, $sub) |
||
| 776 | { |
||
| 777 | $this->Lookup_AddLookupStep($res, $sub, '$$FINAL'); |
||
| 778 | } |
||
| 779 | |||
| 780 | |||
| 781 | /* Translate: "<%t" < Entity < (Default:QuotedString)? < (!("is" "=") < "is" < Context:QuotedString)? < |
||
| 782 | (InjectionVariables)? > "%>" */ |
||
| 783 | protected $match_Translate_typestack = array('Translate'); |
||
| 784 | function match_Translate ($stack = array()) { |
||
| 785 | $matchrule = "Translate"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 786 | $_116 = NULL; |
||
| 787 | do { |
||
| 788 | if (( $subres = $this->literal( '<%t' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 789 | else { $_116 = FALSE; break; } |
||
| 790 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 791 | $matcher = 'match_'.'Entity'; $key = $matcher; $pos = $this->pos; |
||
| 792 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 793 | if ($subres !== FALSE) { |
||
| 794 | $this->store( $result, $subres ); |
||
| 795 | } |
||
| 796 | else { $_116 = FALSE; break; } |
||
| 797 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 798 | $res_98 = $result; |
||
| 799 | $pos_98 = $this->pos; |
||
| 800 | $_97 = NULL; |
||
| 801 | do { |
||
| 802 | $matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
||
| 803 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 804 | if ($subres !== FALSE) { |
||
| 805 | $this->store( $result, $subres, "Default" ); |
||
| 806 | } |
||
| 807 | else { $_97 = FALSE; break; } |
||
| 808 | $_97 = TRUE; break; |
||
| 809 | } |
||
| 810 | while(0); |
||
| 811 | if( $_97 === FALSE) { |
||
| 812 | $result = $res_98; |
||
| 813 | $this->pos = $pos_98; |
||
| 814 | unset( $res_98 ); |
||
| 815 | unset( $pos_98 ); |
||
| 816 | } |
||
| 817 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 818 | $res_109 = $result; |
||
| 819 | $pos_109 = $this->pos; |
||
| 820 | $_108 = NULL; |
||
| 821 | do { |
||
| 822 | $res_103 = $result; |
||
| 823 | $pos_103 = $this->pos; |
||
| 824 | $_102 = NULL; |
||
| 825 | do { |
||
| 826 | if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 827 | else { $_102 = FALSE; break; } |
||
| 828 | if (substr($this->string,$this->pos,1) == '=') { |
||
| 829 | $this->pos += 1; |
||
| 830 | $result["text"] .= '='; |
||
| 831 | } |
||
| 832 | else { $_102 = FALSE; break; } |
||
| 833 | $_102 = TRUE; break; |
||
| 834 | } |
||
| 835 | while(0); |
||
| 836 | if( $_102 === TRUE ) { |
||
| 837 | $result = $res_103; |
||
| 838 | $this->pos = $pos_103; |
||
| 839 | $_108 = FALSE; break; |
||
| 840 | } |
||
| 841 | if( $_102 === FALSE) { |
||
| 842 | $result = $res_103; |
||
| 843 | $this->pos = $pos_103; |
||
| 844 | } |
||
| 845 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 846 | if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 847 | else { $_108 = FALSE; break; } |
||
| 848 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 849 | $matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
||
| 850 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 851 | if ($subres !== FALSE) { |
||
| 852 | $this->store( $result, $subres, "Context" ); |
||
| 853 | } |
||
| 854 | else { $_108 = FALSE; break; } |
||
| 855 | $_108 = TRUE; break; |
||
| 856 | } |
||
| 857 | while(0); |
||
| 858 | if( $_108 === FALSE) { |
||
| 859 | $result = $res_109; |
||
| 860 | $this->pos = $pos_109; |
||
| 861 | unset( $res_109 ); |
||
| 862 | unset( $pos_109 ); |
||
| 863 | } |
||
| 864 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 865 | $res_113 = $result; |
||
| 866 | $pos_113 = $this->pos; |
||
| 867 | $_112 = NULL; |
||
| 868 | do { |
||
| 869 | $matcher = 'match_'.'InjectionVariables'; $key = $matcher; $pos = $this->pos; |
||
| 870 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 871 | if ($subres !== FALSE) { |
||
| 872 | $this->store( $result, $subres ); |
||
| 873 | } |
||
| 874 | else { $_112 = FALSE; break; } |
||
| 875 | $_112 = TRUE; break; |
||
| 876 | } |
||
| 877 | while(0); |
||
| 878 | if( $_112 === FALSE) { |
||
| 879 | $result = $res_113; |
||
| 880 | $this->pos = $pos_113; |
||
| 881 | unset( $res_113 ); |
||
| 882 | unset( $pos_113 ); |
||
| 883 | } |
||
| 884 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 885 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 886 | else { $_116 = FALSE; break; } |
||
| 887 | $_116 = TRUE; break; |
||
| 888 | } |
||
| 889 | while(0); |
||
| 890 | if( $_116 === TRUE ) { return $this->finalise($result); } |
||
| 891 | if( $_116 === FALSE) { return FALSE; } |
||
| 892 | } |
||
| 893 | |||
| 894 | |||
| 895 | /* InjectionVariables: (< InjectionName:Word "=" Argument)+ */ |
||
| 896 | protected $match_InjectionVariables_typestack = array('InjectionVariables'); |
||
| 897 | function match_InjectionVariables ($stack = array()) { |
||
| 898 | $matchrule = "InjectionVariables"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 899 | $count = 0; |
||
| 900 | while (true) { |
||
| 901 | $res_123 = $result; |
||
| 902 | $pos_123 = $this->pos; |
||
| 903 | $_122 = NULL; |
||
| 904 | do { |
||
| 905 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 906 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 907 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 908 | if ($subres !== FALSE) { |
||
| 909 | $this->store( $result, $subres, "InjectionName" ); |
||
| 910 | } |
||
| 911 | else { $_122 = FALSE; break; } |
||
| 912 | if (substr($this->string,$this->pos,1) == '=') { |
||
| 913 | $this->pos += 1; |
||
| 914 | $result["text"] .= '='; |
||
| 915 | } |
||
| 916 | else { $_122 = FALSE; break; } |
||
| 917 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 918 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 919 | if ($subres !== FALSE) { |
||
| 920 | $this->store( $result, $subres ); |
||
| 921 | } |
||
| 922 | else { $_122 = FALSE; break; } |
||
| 923 | $_122 = TRUE; break; |
||
| 924 | } |
||
| 925 | while(0); |
||
| 926 | if( $_122 === FALSE) { |
||
| 927 | $result = $res_123; |
||
| 928 | $this->pos = $pos_123; |
||
| 929 | unset( $res_123 ); |
||
| 930 | unset( $pos_123 ); |
||
| 931 | break; |
||
| 932 | } |
||
| 933 | $count += 1; |
||
| 934 | } |
||
| 935 | if ($count > 0) { return $this->finalise($result); } |
||
| 936 | else { return FALSE; } |
||
| 937 | } |
||
| 938 | |||
| 939 | |||
| 940 | /* Entity: / [A-Za-z_\\] [\w\.\\]* / */ |
||
| 941 | protected $match_Entity_typestack = array('Entity'); |
||
| 942 | function match_Entity ($stack = array()) { |
||
| 943 | $matchrule = "Entity"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 944 | if (( $subres = $this->rx( '/ [A-Za-z_\\\\] [\w\.\\\\]* /' ) ) !== FALSE) { |
||
| 945 | $result["text"] .= $subres; |
||
| 946 | return $this->finalise($result); |
||
| 947 | } |
||
| 948 | else { return FALSE; } |
||
| 949 | } |
||
| 950 | |||
| 951 | |||
| 952 | |||
| 953 | |||
| 954 | function Translate__construct(&$res) |
||
| 955 | { |
||
| 956 | $res['php'] = '$val .= _t('; |
||
| 957 | } |
||
| 958 | |||
| 959 | function Translate_Entity(&$res, $sub) |
||
| 960 | { |
||
| 961 | $res['php'] .= "'$sub[text]'"; |
||
| 962 | } |
||
| 963 | |||
| 964 | function Translate_Default(&$res, $sub) |
||
| 965 | { |
||
| 966 | $res['php'] .= ",$sub[text]"; |
||
| 967 | } |
||
| 968 | |||
| 969 | function Translate_Context(&$res, $sub) |
||
| 970 | { |
||
| 971 | $res['php'] .= ",$sub[text]"; |
||
| 972 | } |
||
| 973 | |||
| 974 | function Translate_InjectionVariables(&$res, $sub) |
||
| 975 | { |
||
| 976 | $res['php'] .= ",$sub[php]"; |
||
| 977 | } |
||
| 978 | |||
| 979 | function Translate__finalise(&$res) |
||
| 980 | { |
||
| 981 | $res['php'] .= ');'; |
||
| 982 | } |
||
| 983 | |||
| 984 | function InjectionVariables__construct(&$res) |
||
| 985 | { |
||
| 986 | $res['php'] = "array("; |
||
| 987 | } |
||
| 988 | |||
| 989 | function InjectionVariables_InjectionName(&$res, $sub) |
||
| 990 | { |
||
| 991 | $res['php'] .= "'$sub[text]'=>"; |
||
| 992 | } |
||
| 993 | |||
| 994 | function InjectionVariables_Argument(&$res, $sub) |
||
| 995 | { |
||
| 996 | $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']) . ','; |
||
| 997 | } |
||
| 998 | |||
| 999 | function InjectionVariables__finalise(&$res) |
||
| 1000 | { |
||
| 1001 | if (substr($res['php'], -1) == ',') { |
||
| 1002 | $res['php'] = substr($res['php'], 0, -1); //remove last comma in the array |
||
| 1003 | } |
||
| 1004 | $res['php'] .= ')'; |
||
| 1005 | } |
||
| 1006 | |||
| 1007 | |||
| 1008 | /* SimpleInjection: '$' :Lookup */ |
||
| 1009 | protected $match_SimpleInjection_typestack = array('SimpleInjection'); |
||
| 1010 | function match_SimpleInjection ($stack = array()) { |
||
| 1011 | $matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1012 | $_127 = NULL; |
||
| 1013 | do { |
||
| 1014 | if (substr($this->string,$this->pos,1) == '$') { |
||
| 1015 | $this->pos += 1; |
||
| 1016 | $result["text"] .= '$'; |
||
| 1017 | } |
||
| 1018 | else { $_127 = FALSE; break; } |
||
| 1019 | $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
||
| 1020 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1021 | if ($subres !== FALSE) { |
||
| 1022 | $this->store( $result, $subres, "Lookup" ); |
||
| 1023 | } |
||
| 1024 | else { $_127 = FALSE; break; } |
||
| 1025 | $_127 = TRUE; break; |
||
| 1026 | } |
||
| 1027 | while(0); |
||
| 1028 | if( $_127 === TRUE ) { return $this->finalise($result); } |
||
| 1029 | if( $_127 === FALSE) { return FALSE; } |
||
| 1030 | } |
||
| 1031 | |||
| 1032 | |||
| 1033 | /* BracketInjection: '{$' :Lookup "}" */ |
||
| 1034 | protected $match_BracketInjection_typestack = array('BracketInjection'); |
||
| 1035 | function match_BracketInjection ($stack = array()) { |
||
| 1036 | $matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1037 | $_132 = NULL; |
||
| 1038 | do { |
||
| 1039 | if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1040 | else { $_132 = FALSE; break; } |
||
| 1041 | $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
||
| 1042 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1043 | if ($subres !== FALSE) { |
||
| 1044 | $this->store( $result, $subres, "Lookup" ); |
||
| 1045 | } |
||
| 1046 | else { $_132 = FALSE; break; } |
||
| 1047 | if (substr($this->string,$this->pos,1) == '}') { |
||
| 1048 | $this->pos += 1; |
||
| 1049 | $result["text"] .= '}'; |
||
| 1050 | } |
||
| 1051 | else { $_132 = FALSE; break; } |
||
| 1052 | $_132 = TRUE; break; |
||
| 1053 | } |
||
| 1054 | while(0); |
||
| 1055 | if( $_132 === TRUE ) { return $this->finalise($result); } |
||
| 1056 | if( $_132 === FALSE) { return FALSE; } |
||
| 1057 | } |
||
| 1058 | |||
| 1059 | |||
| 1060 | /* Injection: BracketInjection | SimpleInjection */ |
||
| 1061 | protected $match_Injection_typestack = array('Injection'); |
||
| 1062 | function match_Injection ($stack = array()) { |
||
| 1063 | $matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1064 | $_137 = NULL; |
||
| 1065 | do { |
||
| 1066 | $res_134 = $result; |
||
| 1067 | $pos_134 = $this->pos; |
||
| 1068 | $matcher = 'match_'.'BracketInjection'; $key = $matcher; $pos = $this->pos; |
||
| 1069 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1070 | if ($subres !== FALSE) { |
||
| 1071 | $this->store( $result, $subres ); |
||
| 1072 | $_137 = TRUE; break; |
||
| 1073 | } |
||
| 1074 | $result = $res_134; |
||
| 1075 | $this->pos = $pos_134; |
||
| 1076 | $matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos; |
||
| 1077 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1078 | if ($subres !== FALSE) { |
||
| 1079 | $this->store( $result, $subres ); |
||
| 1080 | $_137 = TRUE; break; |
||
| 1081 | } |
||
| 1082 | $result = $res_134; |
||
| 1083 | $this->pos = $pos_134; |
||
| 1084 | $_137 = FALSE; break; |
||
| 1085 | } |
||
| 1086 | while(0); |
||
| 1087 | if( $_137 === TRUE ) { return $this->finalise($result); } |
||
| 1088 | if( $_137 === FALSE) { return FALSE; } |
||
| 1089 | } |
||
| 1090 | |||
| 1091 | |||
| 1092 | |||
| 1093 | function Injection_STR(&$res, $sub) |
||
| 1094 | { |
||
| 1095 | $res['php'] = '$val .= '. str_replace('$$FINAL', 'XML_val', $sub['Lookup']['php']) . ';'; |
||
| 1096 | } |
||
| 1097 | |||
| 1098 | /* DollarMarkedLookup: SimpleInjection */ |
||
| 1099 | protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup'); |
||
| 1100 | function match_DollarMarkedLookup ($stack = array()) { |
||
| 1101 | $matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1102 | $matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos; |
||
| 1103 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1104 | if ($subres !== FALSE) { |
||
| 1105 | $this->store( $result, $subres ); |
||
| 1106 | return $this->finalise($result); |
||
| 1107 | } |
||
| 1108 | else { return FALSE; } |
||
| 1109 | } |
||
| 1110 | |||
| 1111 | |||
| 1112 | |||
| 1113 | function DollarMarkedLookup_STR(&$res, $sub) |
||
| 1114 | { |
||
| 1115 | $res['Lookup'] = $sub['Lookup']; |
||
| 1116 | } |
||
| 1117 | |||
| 1118 | /* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */ |
||
| 1119 | protected $match_QuotedString_typestack = array('QuotedString'); |
||
| 1120 | function match_QuotedString ($stack = array()) { |
||
| 1121 | $matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1122 | $_143 = NULL; |
||
| 1123 | do { |
||
| 1124 | $stack[] = $result; $result = $this->construct( $matchrule, "q" ); |
||
| 1125 | if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) { |
||
| 1126 | $result["text"] .= $subres; |
||
| 1127 | $subres = $result; $result = array_pop($stack); |
||
| 1128 | $this->store( $result, $subres, 'q' ); |
||
| 1129 | } |
||
| 1130 | else { |
||
| 1131 | $result = array_pop($stack); |
||
| 1132 | $_143 = FALSE; break; |
||
| 1133 | } |
||
| 1134 | $stack[] = $result; $result = $this->construct( $matchrule, "String" ); |
||
| 1135 | if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) { |
||
| 1136 | $result["text"] .= $subres; |
||
| 1137 | $subres = $result; $result = array_pop($stack); |
||
| 1138 | $this->store( $result, $subres, 'String' ); |
||
| 1139 | } |
||
| 1140 | else { |
||
| 1141 | $result = array_pop($stack); |
||
| 1142 | $_143 = FALSE; break; |
||
| 1143 | } |
||
| 1144 | if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1145 | else { $_143 = FALSE; break; } |
||
| 1146 | $_143 = TRUE; break; |
||
| 1147 | } |
||
| 1148 | while(0); |
||
| 1149 | if( $_143 === TRUE ) { return $this->finalise($result); } |
||
| 1150 | if( $_143 === FALSE) { return FALSE; } |
||
| 1151 | } |
||
| 1152 | |||
| 1153 | |||
| 1154 | /* Boolean: / (true|false) /i */ |
||
| 1155 | protected $match_Boolean_typestack = array('Boolean'); |
||
| 1156 | function match_Boolean ($stack = array()) { |
||
| 1157 | $matchrule = "Boolean"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1158 | if (( $subres = $this->rx( '/ (true|false) /i' ) ) !== FALSE) { |
||
| 1159 | $result["text"] .= $subres; |
||
| 1160 | return $this->finalise($result); |
||
| 1161 | } |
||
| 1162 | else { return FALSE; } |
||
| 1163 | } |
||
| 1164 | |||
| 1165 | |||
| 1166 | /* Sign: / [+-] / */ |
||
| 1167 | protected $match_Sign_typestack = array('Sign'); |
||
| 1168 | function match_Sign ($stack = array()) { |
||
| 1169 | $matchrule = "Sign"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1170 | if (( $subres = $this->rx( '/ [+-] /' ) ) !== FALSE) { |
||
| 1171 | $result["text"] .= $subres; |
||
| 1172 | return $this->finalise($result); |
||
| 1173 | } |
||
| 1174 | else { return FALSE; } |
||
| 1175 | } |
||
| 1176 | |||
| 1177 | |||
| 1178 | /* Float: / [0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? / */ |
||
| 1179 | protected $match_Float_typestack = array('Float'); |
||
| 1180 | function match_Float ($stack = array()) { |
||
| 1181 | $matchrule = "Float"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1182 | if (( $subres = $this->rx( '/ [0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? /' ) ) !== FALSE) { |
||
| 1183 | $result["text"] .= $subres; |
||
| 1184 | return $this->finalise($result); |
||
| 1185 | } |
||
| 1186 | else { return FALSE; } |
||
| 1187 | } |
||
| 1188 | |||
| 1189 | |||
| 1190 | /* Hexadecimal: / 0[xX][0-9a-fA-F]+ / */ |
||
| 1191 | protected $match_Hexadecimal_typestack = array('Hexadecimal'); |
||
| 1192 | function match_Hexadecimal ($stack = array()) { |
||
| 1193 | $matchrule = "Hexadecimal"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1194 | if (( $subres = $this->rx( '/ 0[xX][0-9a-fA-F]+ /' ) ) !== FALSE) { |
||
| 1195 | $result["text"] .= $subres; |
||
| 1196 | return $this->finalise($result); |
||
| 1197 | } |
||
| 1198 | else { return FALSE; } |
||
| 1199 | } |
||
| 1200 | |||
| 1201 | |||
| 1202 | /* Octal: / 0[0-7]+ / */ |
||
| 1203 | protected $match_Octal_typestack = array('Octal'); |
||
| 1204 | function match_Octal ($stack = array()) { |
||
| 1205 | $matchrule = "Octal"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1206 | if (( $subres = $this->rx( '/ 0[0-7]+ /' ) ) !== FALSE) { |
||
| 1207 | $result["text"] .= $subres; |
||
| 1208 | return $this->finalise($result); |
||
| 1209 | } |
||
| 1210 | else { return FALSE; } |
||
| 1211 | } |
||
| 1212 | |||
| 1213 | |||
| 1214 | /* Binary: / 0[bB][01]+ / */ |
||
| 1215 | protected $match_Binary_typestack = array('Binary'); |
||
| 1216 | function match_Binary ($stack = array()) { |
||
| 1217 | $matchrule = "Binary"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1218 | if (( $subres = $this->rx( '/ 0[bB][01]+ /' ) ) !== FALSE) { |
||
| 1219 | $result["text"] .= $subres; |
||
| 1220 | return $this->finalise($result); |
||
| 1221 | } |
||
| 1222 | else { return FALSE; } |
||
| 1223 | } |
||
| 1224 | |||
| 1225 | |||
| 1226 | /* Decimal: / 0 | [1-9][0-9]* / */ |
||
| 1227 | protected $match_Decimal_typestack = array('Decimal'); |
||
| 1228 | function match_Decimal ($stack = array()) { |
||
| 1229 | $matchrule = "Decimal"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1230 | if (( $subres = $this->rx( '/ 0 | [1-9][0-9]* /' ) ) !== FALSE) { |
||
| 1231 | $result["text"] .= $subres; |
||
| 1232 | return $this->finalise($result); |
||
| 1233 | } |
||
| 1234 | else { return FALSE; } |
||
| 1235 | } |
||
| 1236 | |||
| 1237 | |||
| 1238 | /* IntegerOrFloat: ( Sign )? ( Hexadecimal | Binary | Float | Octal | Decimal ) */ |
||
| 1239 | protected $match_IntegerOrFloat_typestack = array('IntegerOrFloat'); |
||
| 1240 | function match_IntegerOrFloat ($stack = array()) { |
||
| 1241 | $matchrule = "IntegerOrFloat"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1242 | $_174 = NULL; |
||
| 1243 | do { |
||
| 1244 | $res_154 = $result; |
||
| 1245 | $pos_154 = $this->pos; |
||
| 1246 | $_153 = NULL; |
||
| 1247 | do { |
||
| 1248 | $matcher = 'match_'.'Sign'; $key = $matcher; $pos = $this->pos; |
||
| 1249 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1250 | if ($subres !== FALSE) { |
||
| 1251 | $this->store( $result, $subres ); |
||
| 1252 | } |
||
| 1253 | else { $_153 = FALSE; break; } |
||
| 1254 | $_153 = TRUE; break; |
||
| 1255 | } |
||
| 1256 | while(0); |
||
| 1257 | if( $_153 === FALSE) { |
||
| 1258 | $result = $res_154; |
||
| 1259 | $this->pos = $pos_154; |
||
| 1260 | unset( $res_154 ); |
||
| 1261 | unset( $pos_154 ); |
||
| 1262 | } |
||
| 1263 | $_172 = NULL; |
||
| 1264 | do { |
||
| 1265 | $_170 = NULL; |
||
| 1266 | do { |
||
| 1267 | $res_155 = $result; |
||
| 1268 | $pos_155 = $this->pos; |
||
| 1269 | $matcher = 'match_'.'Hexadecimal'; $key = $matcher; $pos = $this->pos; |
||
| 1270 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1271 | if ($subres !== FALSE) { |
||
| 1272 | $this->store( $result, $subres ); |
||
| 1273 | $_170 = TRUE; break; |
||
| 1274 | } |
||
| 1275 | $result = $res_155; |
||
| 1276 | $this->pos = $pos_155; |
||
| 1277 | $_168 = NULL; |
||
| 1278 | do { |
||
| 1279 | $res_157 = $result; |
||
| 1280 | $pos_157 = $this->pos; |
||
| 1281 | $matcher = 'match_'.'Binary'; $key = $matcher; $pos = $this->pos; |
||
| 1282 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1283 | if ($subres !== FALSE) { |
||
| 1284 | $this->store( $result, $subres ); |
||
| 1285 | $_168 = TRUE; break; |
||
| 1286 | } |
||
| 1287 | $result = $res_157; |
||
| 1288 | $this->pos = $pos_157; |
||
| 1289 | $_166 = NULL; |
||
| 1290 | do { |
||
| 1291 | $res_159 = $result; |
||
| 1292 | $pos_159 = $this->pos; |
||
| 1293 | $matcher = 'match_'.'Float'; $key = $matcher; $pos = $this->pos; |
||
| 1294 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1295 | if ($subres !== FALSE) { |
||
| 1296 | $this->store( $result, $subres ); |
||
| 1297 | $_166 = TRUE; break; |
||
| 1298 | } |
||
| 1299 | $result = $res_159; |
||
| 1300 | $this->pos = $pos_159; |
||
| 1301 | $_164 = NULL; |
||
| 1302 | do { |
||
| 1303 | $res_161 = $result; |
||
| 1304 | $pos_161 = $this->pos; |
||
| 1305 | $matcher = 'match_'.'Octal'; $key = $matcher; $pos = $this->pos; |
||
| 1306 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1307 | if ($subres !== FALSE) { |
||
| 1308 | $this->store( $result, $subres ); |
||
| 1309 | $_164 = TRUE; break; |
||
| 1310 | } |
||
| 1311 | $result = $res_161; |
||
| 1312 | $this->pos = $pos_161; |
||
| 1313 | $matcher = 'match_'.'Decimal'; $key = $matcher; $pos = $this->pos; |
||
| 1314 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1315 | if ($subres !== FALSE) { |
||
| 1316 | $this->store( $result, $subres ); |
||
| 1317 | $_164 = TRUE; break; |
||
| 1318 | } |
||
| 1319 | $result = $res_161; |
||
| 1320 | $this->pos = $pos_161; |
||
| 1321 | $_164 = FALSE; break; |
||
| 1322 | } |
||
| 1323 | while(0); |
||
| 1324 | if( $_164 === TRUE ) { $_166 = TRUE; break; } |
||
| 1325 | $result = $res_159; |
||
| 1326 | $this->pos = $pos_159; |
||
| 1327 | $_166 = FALSE; break; |
||
| 1328 | } |
||
| 1329 | while(0); |
||
| 1330 | if( $_166 === TRUE ) { $_168 = TRUE; break; } |
||
| 1331 | $result = $res_157; |
||
| 1332 | $this->pos = $pos_157; |
||
| 1333 | $_168 = FALSE; break; |
||
| 1334 | } |
||
| 1335 | while(0); |
||
| 1336 | if( $_168 === TRUE ) { $_170 = TRUE; break; } |
||
| 1337 | $result = $res_155; |
||
| 1338 | $this->pos = $pos_155; |
||
| 1339 | $_170 = FALSE; break; |
||
| 1340 | } |
||
| 1341 | while(0); |
||
| 1342 | if( $_170 === FALSE) { $_172 = FALSE; break; } |
||
| 1343 | $_172 = TRUE; break; |
||
| 1344 | } |
||
| 1345 | while(0); |
||
| 1346 | if( $_172 === FALSE) { $_174 = FALSE; break; } |
||
| 1347 | $_174 = TRUE; break; |
||
| 1348 | } |
||
| 1349 | while(0); |
||
| 1350 | if( $_174 === TRUE ) { return $this->finalise($result); } |
||
| 1351 | if( $_174 === FALSE) { return FALSE; } |
||
| 1352 | } |
||
| 1353 | |||
| 1354 | |||
| 1355 | /* FreeString: /[^,)%!=><|&]+/ */ |
||
| 1356 | protected $match_FreeString_typestack = array('FreeString'); |
||
| 1357 | function match_FreeString ($stack = array()) { |
||
| 1358 | $matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1359 | if (( $subres = $this->rx( '/[^,)%!=><|&]+/' ) ) !== FALSE) { |
||
| 1360 | $result["text"] .= $subres; |
||
| 1361 | return $this->finalise($result); |
||
| 1362 | } |
||
| 1363 | else { return FALSE; } |
||
| 1364 | } |
||
| 1365 | |||
| 1366 | |||
| 1367 | /* Argument: |
||
| 1368 | :DollarMarkedLookup | |
||
| 1369 | :QuotedString | |
||
| 1370 | :Boolean | |
||
| 1371 | :IntegerOrFloat | |
||
| 1372 | :Lookup !(< FreeString)| |
||
| 1373 | :FreeString */ |
||
| 1374 | protected $match_Argument_typestack = array('Argument'); |
||
| 1375 | function match_Argument ($stack = array()) { |
||
| 1376 | $matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1377 | $_202 = NULL; |
||
| 1378 | do { |
||
| 1379 | $res_177 = $result; |
||
| 1380 | $pos_177 = $this->pos; |
||
| 1381 | $matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos; |
||
| 1382 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1383 | if ($subres !== FALSE) { |
||
| 1384 | $this->store( $result, $subres, "DollarMarkedLookup" ); |
||
| 1385 | $_202 = TRUE; break; |
||
| 1386 | } |
||
| 1387 | $result = $res_177; |
||
| 1388 | $this->pos = $pos_177; |
||
| 1389 | $_200 = NULL; |
||
| 1390 | do { |
||
| 1391 | $res_179 = $result; |
||
| 1392 | $pos_179 = $this->pos; |
||
| 1393 | $matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
||
| 1394 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1395 | if ($subres !== FALSE) { |
||
| 1396 | $this->store( $result, $subres, "QuotedString" ); |
||
| 1397 | $_200 = TRUE; break; |
||
| 1398 | } |
||
| 1399 | $result = $res_179; |
||
| 1400 | $this->pos = $pos_179; |
||
| 1401 | $_198 = NULL; |
||
| 1402 | do { |
||
| 1403 | $res_181 = $result; |
||
| 1404 | $pos_181 = $this->pos; |
||
| 1405 | $matcher = 'match_'.'Boolean'; $key = $matcher; $pos = $this->pos; |
||
| 1406 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1407 | if ($subres !== FALSE) { |
||
| 1408 | $this->store( $result, $subres, "Boolean" ); |
||
| 1409 | $_198 = TRUE; break; |
||
| 1410 | } |
||
| 1411 | $result = $res_181; |
||
| 1412 | $this->pos = $pos_181; |
||
| 1413 | $_196 = NULL; |
||
| 1414 | do { |
||
| 1415 | $res_183 = $result; |
||
| 1416 | $pos_183 = $this->pos; |
||
| 1417 | $matcher = 'match_'.'IntegerOrFloat'; $key = $matcher; $pos = $this->pos; |
||
| 1418 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1419 | if ($subres !== FALSE) { |
||
| 1420 | $this->store( $result, $subres, "IntegerOrFloat" ); |
||
| 1421 | $_196 = TRUE; break; |
||
| 1422 | } |
||
| 1423 | $result = $res_183; |
||
| 1424 | $this->pos = $pos_183; |
||
| 1425 | $_194 = NULL; |
||
| 1426 | do { |
||
| 1427 | $res_185 = $result; |
||
| 1428 | $pos_185 = $this->pos; |
||
| 1429 | $_191 = NULL; |
||
| 1430 | do { |
||
| 1431 | $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
||
| 1432 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1433 | if ($subres !== FALSE) { |
||
| 1434 | $this->store( $result, $subres, "Lookup" ); |
||
| 1435 | } |
||
| 1436 | else { $_191 = FALSE; break; } |
||
| 1437 | $res_190 = $result; |
||
| 1438 | $pos_190 = $this->pos; |
||
| 1439 | $_189 = NULL; |
||
| 1440 | do { |
||
| 1441 | if (( $subres = $this->whitespace( ) ) !== FALSE) { |
||
| 1442 | $result["text"] .= $subres; |
||
| 1443 | } |
||
| 1444 | $matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos; |
||
| 1445 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1446 | if ($subres !== FALSE) { |
||
| 1447 | $this->store( $result, $subres ); |
||
| 1448 | } |
||
| 1449 | else { $_189 = FALSE; break; } |
||
| 1450 | $_189 = TRUE; break; |
||
| 1451 | } |
||
| 1452 | while(0); |
||
| 1453 | if( $_189 === TRUE ) { |
||
| 1454 | $result = $res_190; |
||
| 1455 | $this->pos = $pos_190; |
||
| 1456 | $_191 = FALSE; break; |
||
| 1457 | } |
||
| 1458 | if( $_189 === FALSE) { |
||
| 1459 | $result = $res_190; |
||
| 1460 | $this->pos = $pos_190; |
||
| 1461 | } |
||
| 1462 | $_191 = TRUE; break; |
||
| 1463 | } |
||
| 1464 | while(0); |
||
| 1465 | if( $_191 === TRUE ) { $_194 = TRUE; break; } |
||
| 1466 | $result = $res_185; |
||
| 1467 | $this->pos = $pos_185; |
||
| 1468 | $matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos; |
||
| 1469 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1470 | if ($subres !== FALSE) { |
||
| 1471 | $this->store( $result, $subres, "FreeString" ); |
||
| 1472 | $_194 = TRUE; break; |
||
| 1473 | } |
||
| 1474 | $result = $res_185; |
||
| 1475 | $this->pos = $pos_185; |
||
| 1476 | $_194 = FALSE; break; |
||
| 1477 | } |
||
| 1478 | while(0); |
||
| 1479 | if( $_194 === TRUE ) { $_196 = TRUE; break; } |
||
| 1480 | $result = $res_183; |
||
| 1481 | $this->pos = $pos_183; |
||
| 1482 | $_196 = FALSE; break; |
||
| 1483 | } |
||
| 1484 | while(0); |
||
| 1485 | if( $_196 === TRUE ) { $_198 = TRUE; break; } |
||
| 1486 | $result = $res_181; |
||
| 1487 | $this->pos = $pos_181; |
||
| 1488 | $_198 = FALSE; break; |
||
| 1489 | } |
||
| 1490 | while(0); |
||
| 1491 | if( $_198 === TRUE ) { $_200 = TRUE; break; } |
||
| 1492 | $result = $res_179; |
||
| 1493 | $this->pos = $pos_179; |
||
| 1494 | $_200 = FALSE; break; |
||
| 1495 | } |
||
| 1496 | while(0); |
||
| 1497 | if( $_200 === TRUE ) { $_202 = TRUE; break; } |
||
| 1498 | $result = $res_177; |
||
| 1499 | $this->pos = $pos_177; |
||
| 1500 | $_202 = FALSE; break; |
||
| 1501 | } |
||
| 1502 | while(0); |
||
| 1503 | if( $_202 === TRUE ) { return $this->finalise($result); } |
||
| 1504 | if( $_202 === FALSE) { return FALSE; } |
||
| 1505 | } |
||
| 1506 | |||
| 1507 | |||
| 1508 | |||
| 1509 | |||
| 1510 | /** |
||
| 1511 | * If we get a bare value, we don't know enough to determine exactly what php would be the translation, because |
||
| 1512 | * we don't know if the position of use indicates a lookup or a string argument. |
||
| 1513 | * |
||
| 1514 | * Instead, we record 'ArgumentMode' as a member of this matches results node, which can be: |
||
| 1515 | * - lookup if this argument was unambiguously a lookup (marked as such) |
||
| 1516 | * - string is this argument was unambiguously a string (marked as such, or impossible to parse as lookup) |
||
| 1517 | * - default if this argument needs to be handled as per 2.4 |
||
| 1518 | * |
||
| 1519 | * In the case of 'default', there is no php member of the results node, but instead 'lookup_php', which |
||
| 1520 | * should be used by the parent if the context indicates a lookup, and 'string_php' which should be used |
||
| 1521 | * if the context indicates a string |
||
| 1522 | */ |
||
| 1523 | |||
| 1524 | function Argument_DollarMarkedLookup(&$res, $sub) |
||
| 1525 | { |
||
| 1526 | $res['ArgumentMode'] = 'lookup'; |
||
| 1527 | $res['php'] = $sub['Lookup']['php']; |
||
| 1528 | } |
||
| 1529 | |||
| 1530 | function Argument_QuotedString(&$res, $sub) |
||
| 1531 | { |
||
| 1532 | $res['ArgumentMode'] = 'string'; |
||
| 1533 | $res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'"; |
||
| 1534 | } |
||
| 1535 | |||
| 1536 | function Argument_Boolean(&$res, $sub) |
||
| 1537 | { |
||
| 1538 | $res['ArgumentMode'] = 'string'; |
||
| 1539 | $res['php'] = $sub['text']; |
||
| 1540 | } |
||
| 1541 | |||
| 1542 | function Argument_IntegerOrFloat(&$res, $sub) |
||
| 1543 | { |
||
| 1544 | $res['ArgumentMode'] = 'string'; |
||
| 1545 | $res['php'] = $sub['text']; |
||
| 1546 | } |
||
| 1547 | |||
| 1548 | function Argument_Lookup(&$res, $sub) |
||
| 1549 | { |
||
| 1550 | if (count($sub['LookupSteps']) == 1 && !isset($sub['LookupSteps'][0]['Call']['Arguments'])) { |
||
| 1551 | $res['ArgumentMode'] = 'default'; |
||
| 1552 | $res['lookup_php'] = $sub['php']; |
||
| 1553 | $res['string_php'] = "'".$sub['LookupSteps'][0]['Call']['Method']['text']."'"; |
||
| 1554 | } else { |
||
| 1555 | $res['ArgumentMode'] = 'lookup'; |
||
| 1556 | $res['php'] = $sub['php']; |
||
| 1557 | } |
||
| 1558 | } |
||
| 1559 | |||
| 1560 | function Argument_FreeString(&$res, $sub) |
||
| 1561 | { |
||
| 1562 | $res['ArgumentMode'] = 'string'; |
||
| 1563 | $res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'"; |
||
| 1564 | } |
||
| 1565 | |||
| 1566 | /* ComparisonOperator: "!=" | "==" | ">=" | ">" | "<=" | "<" | "=" */ |
||
| 1567 | protected $match_ComparisonOperator_typestack = array('ComparisonOperator'); |
||
| 1568 | function match_ComparisonOperator ($stack = array()) { |
||
| 1569 | $matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1570 | $_227 = NULL; |
||
| 1571 | do { |
||
| 1572 | $res_204 = $result; |
||
| 1573 | $pos_204 = $this->pos; |
||
| 1574 | if (( $subres = $this->literal( '!=' ) ) !== FALSE) { |
||
| 1575 | $result["text"] .= $subres; |
||
| 1576 | $_227 = TRUE; break; |
||
| 1577 | } |
||
| 1578 | $result = $res_204; |
||
| 1579 | $this->pos = $pos_204; |
||
| 1580 | $_225 = NULL; |
||
| 1581 | do { |
||
| 1582 | $res_206 = $result; |
||
| 1583 | $pos_206 = $this->pos; |
||
| 1584 | if (( $subres = $this->literal( '==' ) ) !== FALSE) { |
||
| 1585 | $result["text"] .= $subres; |
||
| 1586 | $_225 = TRUE; break; |
||
| 1587 | } |
||
| 1588 | $result = $res_206; |
||
| 1589 | $this->pos = $pos_206; |
||
| 1590 | $_223 = NULL; |
||
| 1591 | do { |
||
| 1592 | $res_208 = $result; |
||
| 1593 | $pos_208 = $this->pos; |
||
| 1594 | if (( $subres = $this->literal( '>=' ) ) !== FALSE) { |
||
| 1595 | $result["text"] .= $subres; |
||
| 1596 | $_223 = TRUE; break; |
||
| 1597 | } |
||
| 1598 | $result = $res_208; |
||
| 1599 | $this->pos = $pos_208; |
||
| 1600 | $_221 = NULL; |
||
| 1601 | do { |
||
| 1602 | $res_210 = $result; |
||
| 1603 | $pos_210 = $this->pos; |
||
| 1604 | if (substr($this->string,$this->pos,1) == '>') { |
||
| 1605 | $this->pos += 1; |
||
| 1606 | $result["text"] .= '>'; |
||
| 1607 | $_221 = TRUE; break; |
||
| 1608 | } |
||
| 1609 | $result = $res_210; |
||
| 1610 | $this->pos = $pos_210; |
||
| 1611 | $_219 = NULL; |
||
| 1612 | do { |
||
| 1613 | $res_212 = $result; |
||
| 1614 | $pos_212 = $this->pos; |
||
| 1615 | if (( $subres = $this->literal( '<=' ) ) !== FALSE) { |
||
| 1616 | $result["text"] .= $subres; |
||
| 1617 | $_219 = TRUE; break; |
||
| 1618 | } |
||
| 1619 | $result = $res_212; |
||
| 1620 | $this->pos = $pos_212; |
||
| 1621 | $_217 = NULL; |
||
| 1622 | do { |
||
| 1623 | $res_214 = $result; |
||
| 1624 | $pos_214 = $this->pos; |
||
| 1625 | if (substr($this->string,$this->pos,1) == '<') { |
||
| 1626 | $this->pos += 1; |
||
| 1627 | $result["text"] .= '<'; |
||
| 1628 | $_217 = TRUE; break; |
||
| 1629 | } |
||
| 1630 | $result = $res_214; |
||
| 1631 | $this->pos = $pos_214; |
||
| 1632 | if (substr($this->string,$this->pos,1) == '=') { |
||
| 1633 | $this->pos += 1; |
||
| 1634 | $result["text"] .= '='; |
||
| 1635 | $_217 = TRUE; break; |
||
| 1636 | } |
||
| 1637 | $result = $res_214; |
||
| 1638 | $this->pos = $pos_214; |
||
| 1639 | $_217 = FALSE; break; |
||
| 1640 | } |
||
| 1641 | while(0); |
||
| 1642 | if( $_217 === TRUE ) { $_219 = TRUE; break; } |
||
| 1643 | $result = $res_212; |
||
| 1644 | $this->pos = $pos_212; |
||
| 1645 | $_219 = FALSE; break; |
||
| 1646 | } |
||
| 1647 | while(0); |
||
| 1648 | if( $_219 === TRUE ) { $_221 = TRUE; break; } |
||
| 1649 | $result = $res_210; |
||
| 1650 | $this->pos = $pos_210; |
||
| 1651 | $_221 = FALSE; break; |
||
| 1652 | } |
||
| 1653 | while(0); |
||
| 1654 | if( $_221 === TRUE ) { $_223 = TRUE; break; } |
||
| 1655 | $result = $res_208; |
||
| 1656 | $this->pos = $pos_208; |
||
| 1657 | $_223 = FALSE; break; |
||
| 1658 | } |
||
| 1659 | while(0); |
||
| 1660 | if( $_223 === TRUE ) { $_225 = TRUE; break; } |
||
| 1661 | $result = $res_206; |
||
| 1662 | $this->pos = $pos_206; |
||
| 1663 | $_225 = FALSE; break; |
||
| 1664 | } |
||
| 1665 | while(0); |
||
| 1666 | if( $_225 === TRUE ) { $_227 = TRUE; break; } |
||
| 1667 | $result = $res_204; |
||
| 1668 | $this->pos = $pos_204; |
||
| 1669 | $_227 = FALSE; break; |
||
| 1670 | } |
||
| 1671 | while(0); |
||
| 1672 | if( $_227 === TRUE ) { return $this->finalise($result); } |
||
| 1673 | if( $_227 === FALSE) { return FALSE; } |
||
| 1674 | } |
||
| 1675 | |||
| 1676 | |||
| 1677 | /* Comparison: Argument < ComparisonOperator > Argument */ |
||
| 1678 | protected $match_Comparison_typestack = array('Comparison'); |
||
| 1679 | function match_Comparison ($stack = array()) { |
||
| 1680 | $matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1681 | $_234 = NULL; |
||
| 1682 | do { |
||
| 1683 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 1684 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1685 | if ($subres !== FALSE) { |
||
| 1686 | $this->store( $result, $subres ); |
||
| 1687 | } |
||
| 1688 | else { $_234 = FALSE; break; } |
||
| 1689 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1690 | $matcher = 'match_'.'ComparisonOperator'; $key = $matcher; $pos = $this->pos; |
||
| 1691 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1692 | if ($subres !== FALSE) { |
||
| 1693 | $this->store( $result, $subres ); |
||
| 1694 | } |
||
| 1695 | else { $_234 = FALSE; break; } |
||
| 1696 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1697 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 1698 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1699 | if ($subres !== FALSE) { |
||
| 1700 | $this->store( $result, $subres ); |
||
| 1701 | } |
||
| 1702 | else { $_234 = FALSE; break; } |
||
| 1703 | $_234 = TRUE; break; |
||
| 1704 | } |
||
| 1705 | while(0); |
||
| 1706 | if( $_234 === TRUE ) { return $this->finalise($result); } |
||
| 1707 | if( $_234 === FALSE) { return FALSE; } |
||
| 1708 | } |
||
| 1709 | |||
| 1710 | |||
| 1711 | |||
| 1712 | function Comparison_Argument(&$res, $sub) |
||
| 1713 | { |
||
| 1714 | if ($sub['ArgumentMode'] == 'default') { |
||
| 1715 | if (!empty($res['php'])) { |
||
| 1716 | $res['php'] .= $sub['string_php']; |
||
| 1717 | } else { |
||
| 1718 | $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']); |
||
| 1719 | } |
||
| 1720 | } else { |
||
| 1721 | $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']); |
||
| 1722 | } |
||
| 1723 | } |
||
| 1724 | |||
| 1725 | function Comparison_ComparisonOperator(&$res, $sub) |
||
| 1726 | { |
||
| 1727 | $res['php'] .= ($sub['text'] == '=' ? '==' : $sub['text']); |
||
| 1728 | } |
||
| 1729 | |||
| 1730 | /* PresenceCheck: (Not:'not' <)? Argument */ |
||
| 1731 | protected $match_PresenceCheck_typestack = array('PresenceCheck'); |
||
| 1732 | function match_PresenceCheck ($stack = array()) { |
||
| 1733 | $matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1734 | $_241 = NULL; |
||
| 1735 | do { |
||
| 1736 | $res_239 = $result; |
||
| 1737 | $pos_239 = $this->pos; |
||
| 1738 | $_238 = NULL; |
||
| 1739 | do { |
||
| 1740 | $stack[] = $result; $result = $this->construct( $matchrule, "Not" ); |
||
| 1741 | if (( $subres = $this->literal( 'not' ) ) !== FALSE) { |
||
| 1742 | $result["text"] .= $subres; |
||
| 1743 | $subres = $result; $result = array_pop($stack); |
||
| 1744 | $this->store( $result, $subres, 'Not' ); |
||
| 1745 | } |
||
| 1746 | else { |
||
| 1747 | $result = array_pop($stack); |
||
| 1748 | $_238 = FALSE; break; |
||
| 1749 | } |
||
| 1750 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1751 | $_238 = TRUE; break; |
||
| 1752 | } |
||
| 1753 | while(0); |
||
| 1754 | if( $_238 === FALSE) { |
||
| 1755 | $result = $res_239; |
||
| 1756 | $this->pos = $pos_239; |
||
| 1757 | unset( $res_239 ); |
||
| 1758 | unset( $pos_239 ); |
||
| 1759 | } |
||
| 1760 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 1761 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1762 | if ($subres !== FALSE) { |
||
| 1763 | $this->store( $result, $subres ); |
||
| 1764 | } |
||
| 1765 | else { $_241 = FALSE; break; } |
||
| 1766 | $_241 = TRUE; break; |
||
| 1767 | } |
||
| 1768 | while(0); |
||
| 1769 | if( $_241 === TRUE ) { return $this->finalise($result); } |
||
| 1770 | if( $_241 === FALSE) { return FALSE; } |
||
| 1771 | } |
||
| 1772 | |||
| 1773 | |||
| 1774 | |||
| 1775 | function PresenceCheck_Not(&$res, $sub) |
||
| 1776 | { |
||
| 1777 | $res['php'] = '!'; |
||
| 1778 | } |
||
| 1779 | |||
| 1780 | function PresenceCheck_Argument(&$res, $sub) |
||
| 1781 | { |
||
| 1782 | if ($sub['ArgumentMode'] == 'string') { |
||
| 1783 | $res['php'] .= '((bool)'.$sub['php'].')'; |
||
| 1784 | } else { |
||
| 1785 | $php = ($sub['ArgumentMode'] == 'default' ? $sub['lookup_php'] : $sub['php']); |
||
| 1786 | // TODO: kinda hacky - maybe we need a way to pass state down the parse chain so |
||
| 1787 | // Lookup_LastLookupStep and Argument_BareWord can produce hasValue instead of XML_val |
||
| 1788 | $res['php'] .= str_replace('$$FINAL', 'hasValue', $php); |
||
| 1789 | } |
||
| 1790 | } |
||
| 1791 | |||
| 1792 | /* IfArgumentPortion: Comparison | PresenceCheck */ |
||
| 1793 | protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion'); |
||
| 1794 | function match_IfArgumentPortion ($stack = array()) { |
||
| 1795 | $matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1796 | $_246 = NULL; |
||
| 1797 | do { |
||
| 1798 | $res_243 = $result; |
||
| 1799 | $pos_243 = $this->pos; |
||
| 1800 | $matcher = 'match_'.'Comparison'; $key = $matcher; $pos = $this->pos; |
||
| 1801 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1802 | if ($subres !== FALSE) { |
||
| 1803 | $this->store( $result, $subres ); |
||
| 1804 | $_246 = TRUE; break; |
||
| 1805 | } |
||
| 1806 | $result = $res_243; |
||
| 1807 | $this->pos = $pos_243; |
||
| 1808 | $matcher = 'match_'.'PresenceCheck'; $key = $matcher; $pos = $this->pos; |
||
| 1809 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1810 | if ($subres !== FALSE) { |
||
| 1811 | $this->store( $result, $subres ); |
||
| 1812 | $_246 = TRUE; break; |
||
| 1813 | } |
||
| 1814 | $result = $res_243; |
||
| 1815 | $this->pos = $pos_243; |
||
| 1816 | $_246 = FALSE; break; |
||
| 1817 | } |
||
| 1818 | while(0); |
||
| 1819 | if( $_246 === TRUE ) { return $this->finalise($result); } |
||
| 1820 | if( $_246 === FALSE) { return FALSE; } |
||
| 1821 | } |
||
| 1822 | |||
| 1823 | |||
| 1824 | |||
| 1825 | function IfArgumentPortion_STR(&$res, $sub) |
||
| 1826 | { |
||
| 1827 | $res['php'] = $sub['php']; |
||
| 1828 | } |
||
| 1829 | |||
| 1830 | /* BooleanOperator: "||" | "&&" */ |
||
| 1831 | protected $match_BooleanOperator_typestack = array('BooleanOperator'); |
||
| 1832 | function match_BooleanOperator ($stack = array()) { |
||
| 1833 | $matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1834 | $_251 = NULL; |
||
| 1835 | do { |
||
| 1836 | $res_248 = $result; |
||
| 1837 | $pos_248 = $this->pos; |
||
| 1838 | if (( $subres = $this->literal( '||' ) ) !== FALSE) { |
||
| 1839 | $result["text"] .= $subres; |
||
| 1840 | $_251 = TRUE; break; |
||
| 1841 | } |
||
| 1842 | $result = $res_248; |
||
| 1843 | $this->pos = $pos_248; |
||
| 1844 | if (( $subres = $this->literal( '&&' ) ) !== FALSE) { |
||
| 1845 | $result["text"] .= $subres; |
||
| 1846 | $_251 = TRUE; break; |
||
| 1847 | } |
||
| 1848 | $result = $res_248; |
||
| 1849 | $this->pos = $pos_248; |
||
| 1850 | $_251 = FALSE; break; |
||
| 1851 | } |
||
| 1852 | while(0); |
||
| 1853 | if( $_251 === TRUE ) { return $this->finalise($result); } |
||
| 1854 | if( $_251 === FALSE) { return FALSE; } |
||
| 1855 | } |
||
| 1856 | |||
| 1857 | |||
| 1858 | /* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */ |
||
| 1859 | protected $match_IfArgument_typestack = array('IfArgument'); |
||
| 1860 | function match_IfArgument ($stack = array()) { |
||
| 1861 | $matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1862 | $_260 = NULL; |
||
| 1863 | do { |
||
| 1864 | $matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos; |
||
| 1865 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1866 | if ($subres !== FALSE) { |
||
| 1867 | $this->store( $result, $subres, "IfArgumentPortion" ); |
||
| 1868 | } |
||
| 1869 | else { $_260 = FALSE; break; } |
||
| 1870 | while (true) { |
||
| 1871 | $res_259 = $result; |
||
| 1872 | $pos_259 = $this->pos; |
||
| 1873 | $_258 = NULL; |
||
| 1874 | do { |
||
| 1875 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1876 | $matcher = 'match_'.'BooleanOperator'; $key = $matcher; $pos = $this->pos; |
||
| 1877 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1878 | if ($subres !== FALSE) { |
||
| 1879 | $this->store( $result, $subres, "BooleanOperator" ); |
||
| 1880 | } |
||
| 1881 | else { $_258 = FALSE; break; } |
||
| 1882 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1883 | $matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos; |
||
| 1884 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1885 | if ($subres !== FALSE) { |
||
| 1886 | $this->store( $result, $subres, "IfArgumentPortion" ); |
||
| 1887 | } |
||
| 1888 | else { $_258 = FALSE; break; } |
||
| 1889 | $_258 = TRUE; break; |
||
| 1890 | } |
||
| 1891 | while(0); |
||
| 1892 | if( $_258 === FALSE) { |
||
| 1893 | $result = $res_259; |
||
| 1894 | $this->pos = $pos_259; |
||
| 1895 | unset( $res_259 ); |
||
| 1896 | unset( $pos_259 ); |
||
| 1897 | break; |
||
| 1898 | } |
||
| 1899 | } |
||
| 1900 | $_260 = TRUE; break; |
||
| 1901 | } |
||
| 1902 | while(0); |
||
| 1903 | if( $_260 === TRUE ) { return $this->finalise($result); } |
||
| 1904 | if( $_260 === FALSE) { return FALSE; } |
||
| 1905 | } |
||
| 1906 | |||
| 1907 | |||
| 1908 | |||
| 1909 | function IfArgument_IfArgumentPortion(&$res, $sub) |
||
| 1910 | { |
||
| 1911 | $res['php'] .= $sub['php']; |
||
| 1912 | } |
||
| 1913 | |||
| 1914 | function IfArgument_BooleanOperator(&$res, $sub) |
||
| 1915 | { |
||
| 1916 | $res['php'] .= $sub['text']; |
||
| 1917 | } |
||
| 1918 | |||
| 1919 | /* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */ |
||
| 1920 | protected $match_IfPart_typestack = array('IfPart'); |
||
| 1921 | function match_IfPart ($stack = array()) { |
||
| 1922 | $matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1923 | $_270 = NULL; |
||
| 1924 | do { |
||
| 1925 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1926 | else { $_270 = FALSE; break; } |
||
| 1927 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1928 | if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1929 | else { $_270 = FALSE; break; } |
||
| 1930 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1931 | else { $_270 = FALSE; break; } |
||
| 1932 | $matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
||
| 1933 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1934 | if ($subres !== FALSE) { |
||
| 1935 | $this->store( $result, $subres, "IfArgument" ); |
||
| 1936 | } |
||
| 1937 | else { $_270 = FALSE; break; } |
||
| 1938 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1939 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1940 | else { $_270 = FALSE; break; } |
||
| 1941 | $res_269 = $result; |
||
| 1942 | $pos_269 = $this->pos; |
||
| 1943 | $matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
||
| 1944 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1945 | if ($subres !== FALSE) { |
||
| 1946 | $this->store( $result, $subres, "Template" ); |
||
| 1947 | } |
||
| 1948 | else { |
||
| 1949 | $result = $res_269; |
||
| 1950 | $this->pos = $pos_269; |
||
| 1951 | unset( $res_269 ); |
||
| 1952 | unset( $pos_269 ); |
||
| 1953 | } |
||
| 1954 | $_270 = TRUE; break; |
||
| 1955 | } |
||
| 1956 | while(0); |
||
| 1957 | if( $_270 === TRUE ) { return $this->finalise($result); } |
||
| 1958 | if( $_270 === FALSE) { return FALSE; } |
||
| 1959 | } |
||
| 1960 | |||
| 1961 | |||
| 1962 | /* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher? */ |
||
| 1963 | protected $match_ElseIfPart_typestack = array('ElseIfPart'); |
||
| 1964 | function match_ElseIfPart ($stack = array()) { |
||
| 1965 | $matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 1966 | $_280 = NULL; |
||
| 1967 | do { |
||
| 1968 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1969 | else { $_280 = FALSE; break; } |
||
| 1970 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1971 | if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1972 | else { $_280 = FALSE; break; } |
||
| 1973 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1974 | else { $_280 = FALSE; break; } |
||
| 1975 | $matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
||
| 1976 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1977 | if ($subres !== FALSE) { |
||
| 1978 | $this->store( $result, $subres, "IfArgument" ); |
||
| 1979 | } |
||
| 1980 | else { $_280 = FALSE; break; } |
||
| 1981 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1982 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 1983 | else { $_280 = FALSE; break; } |
||
| 1984 | $res_279 = $result; |
||
| 1985 | $pos_279 = $this->pos; |
||
| 1986 | $matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
||
| 1987 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 1988 | if ($subres !== FALSE) { |
||
| 1989 | $this->store( $result, $subres, "Template" ); |
||
| 1990 | } |
||
| 1991 | else { |
||
| 1992 | $result = $res_279; |
||
| 1993 | $this->pos = $pos_279; |
||
| 1994 | unset( $res_279 ); |
||
| 1995 | unset( $pos_279 ); |
||
| 1996 | } |
||
| 1997 | $_280 = TRUE; break; |
||
| 1998 | } |
||
| 1999 | while(0); |
||
| 2000 | if( $_280 === TRUE ) { return $this->finalise($result); } |
||
| 2001 | if( $_280 === FALSE) { return FALSE; } |
||
| 2002 | } |
||
| 2003 | |||
| 2004 | |||
| 2005 | /* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher? */ |
||
| 2006 | protected $match_ElsePart_typestack = array('ElsePart'); |
||
| 2007 | function match_ElsePart ($stack = array()) { |
||
| 2008 | $matchrule = "ElsePart"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 2009 | $_288 = NULL; |
||
| 2010 | do { |
||
| 2011 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2012 | else { $_288 = FALSE; break; } |
||
| 2013 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2014 | if (( $subres = $this->literal( 'else' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2015 | else { $_288 = FALSE; break; } |
||
| 2016 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2017 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2018 | else { $_288 = FALSE; break; } |
||
| 2019 | $res_287 = $result; |
||
| 2020 | $pos_287 = $this->pos; |
||
| 2021 | $matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
||
| 2022 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2023 | if ($subres !== FALSE) { |
||
| 2024 | $this->store( $result, $subres, "Template" ); |
||
| 2025 | } |
||
| 2026 | else { |
||
| 2027 | $result = $res_287; |
||
| 2028 | $this->pos = $pos_287; |
||
| 2029 | unset( $res_287 ); |
||
| 2030 | unset( $pos_287 ); |
||
| 2031 | } |
||
| 2032 | $_288 = TRUE; break; |
||
| 2033 | } |
||
| 2034 | while(0); |
||
| 2035 | if( $_288 === TRUE ) { return $this->finalise($result); } |
||
| 2036 | if( $_288 === FALSE) { return FALSE; } |
||
| 2037 | } |
||
| 2038 | |||
| 2039 | |||
| 2040 | /* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */ |
||
| 2041 | protected $match_If_typestack = array('If'); |
||
| 2042 | function match_If ($stack = array()) { |
||
| 2043 | $matchrule = "If"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 2044 | $_298 = NULL; |
||
| 2045 | do { |
||
| 2046 | $matcher = 'match_'.'IfPart'; $key = $matcher; $pos = $this->pos; |
||
| 2047 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2048 | if ($subres !== FALSE) { |
||
| 2049 | $this->store( $result, $subres ); |
||
| 2050 | } |
||
| 2051 | else { $_298 = FALSE; break; } |
||
| 2052 | while (true) { |
||
| 2053 | $res_291 = $result; |
||
| 2054 | $pos_291 = $this->pos; |
||
| 2055 | $matcher = 'match_'.'ElseIfPart'; $key = $matcher; $pos = $this->pos; |
||
| 2056 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2057 | if ($subres !== FALSE) { |
||
| 2058 | $this->store( $result, $subres ); |
||
| 2059 | } |
||
| 2060 | else { |
||
| 2061 | $result = $res_291; |
||
| 2062 | $this->pos = $pos_291; |
||
| 2063 | unset( $res_291 ); |
||
| 2064 | unset( $pos_291 ); |
||
| 2065 | break; |
||
| 2066 | } |
||
| 2067 | } |
||
| 2068 | $res_292 = $result; |
||
| 2069 | $pos_292 = $this->pos; |
||
| 2070 | $matcher = 'match_'.'ElsePart'; $key = $matcher; $pos = $this->pos; |
||
| 2071 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2072 | if ($subres !== FALSE) { |
||
| 2073 | $this->store( $result, $subres ); |
||
| 2074 | } |
||
| 2075 | else { |
||
| 2076 | $result = $res_292; |
||
| 2077 | $this->pos = $pos_292; |
||
| 2078 | unset( $res_292 ); |
||
| 2079 | unset( $pos_292 ); |
||
| 2080 | } |
||
| 2081 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2082 | else { $_298 = FALSE; break; } |
||
| 2083 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2084 | if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2085 | else { $_298 = FALSE; break; } |
||
| 2086 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2087 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2088 | else { $_298 = FALSE; break; } |
||
| 2089 | $_298 = TRUE; break; |
||
| 2090 | } |
||
| 2091 | while(0); |
||
| 2092 | if( $_298 === TRUE ) { return $this->finalise($result); } |
||
| 2093 | if( $_298 === FALSE) { return FALSE; } |
||
| 2094 | } |
||
| 2095 | |||
| 2096 | |||
| 2097 | |||
| 2098 | function If_IfPart(&$res, $sub) |
||
| 2099 | { |
||
| 2100 | $res['php'] = |
||
| 2101 | 'if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL . |
||
| 2102 | (isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL . |
||
| 2103 | '}'; |
||
| 2104 | } |
||
| 2105 | |||
| 2106 | function If_ElseIfPart(&$res, $sub) |
||
| 2107 | { |
||
| 2108 | $res['php'] .= |
||
| 2109 | 'else if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL . |
||
| 2110 | (isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL . |
||
| 2111 | '}'; |
||
| 2112 | } |
||
| 2113 | |||
| 2114 | function If_ElsePart(&$res, $sub) |
||
| 2115 | { |
||
| 2116 | $res['php'] .= |
||
| 2117 | 'else { ' . PHP_EOL . |
||
| 2118 | (isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL . |
||
| 2119 | '}'; |
||
| 2120 | } |
||
| 2121 | |||
| 2122 | /* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */ |
||
| 2123 | protected $match_Require_typestack = array('Require'); |
||
| 2124 | function match_Require ($stack = array()) { |
||
| 2181 | } |
||
| 2182 | |||
| 2183 | |||
| 2184 | |||
| 2185 | function Require_Call(&$res, $sub) |
||
| 2186 | { |
||
| 2187 | $requirements = '\\SilverStripe\\View\\Requirements'; |
||
| 2188 | $res['php'] = "{$requirements}::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');'; |
||
| 2189 | } |
||
| 2190 | |||
| 2191 | |||
| 2192 | /* CacheBlockArgument: |
||
| 2193 | !( "if " | "unless " ) |
||
| 2194 | ( |
||
| 2195 | :DollarMarkedLookup | |
||
| 2196 | :QuotedString | |
||
| 2197 | :Lookup |
||
| 2198 | ) */ |
||
| 2199 | protected $match_CacheBlockArgument_typestack = array('CacheBlockArgument'); |
||
| 2200 | function match_CacheBlockArgument ($stack = array()) { |
||
| 2201 | $matchrule = "CacheBlockArgument"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 2202 | $_334 = NULL; |
||
| 2203 | do { |
||
| 2204 | $res_322 = $result; |
||
| 2205 | $pos_322 = $this->pos; |
||
| 2206 | $_321 = NULL; |
||
| 2207 | do { |
||
| 2208 | $_319 = NULL; |
||
| 2209 | do { |
||
| 2210 | $res_316 = $result; |
||
| 2211 | $pos_316 = $this->pos; |
||
| 2212 | if (( $subres = $this->literal( 'if ' ) ) !== FALSE) { |
||
| 2213 | $result["text"] .= $subres; |
||
| 2214 | $_319 = TRUE; break; |
||
| 2215 | } |
||
| 2216 | $result = $res_316; |
||
| 2217 | $this->pos = $pos_316; |
||
| 2218 | if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) { |
||
| 2219 | $result["text"] .= $subres; |
||
| 2220 | $_319 = TRUE; break; |
||
| 2221 | } |
||
| 2222 | $result = $res_316; |
||
| 2223 | $this->pos = $pos_316; |
||
| 2224 | $_319 = FALSE; break; |
||
| 2225 | } |
||
| 2226 | while(0); |
||
| 2227 | if( $_319 === FALSE) { $_321 = FALSE; break; } |
||
| 2228 | $_321 = TRUE; break; |
||
| 2229 | } |
||
| 2230 | while(0); |
||
| 2231 | if( $_321 === TRUE ) { |
||
| 2232 | $result = $res_322; |
||
| 2233 | $this->pos = $pos_322; |
||
| 2234 | $_334 = FALSE; break; |
||
| 2235 | } |
||
| 2236 | if( $_321 === FALSE) { |
||
| 2237 | $result = $res_322; |
||
| 2238 | $this->pos = $pos_322; |
||
| 2239 | } |
||
| 2240 | $_332 = NULL; |
||
| 2241 | do { |
||
| 2242 | $_330 = NULL; |
||
| 2243 | do { |
||
| 2244 | $res_323 = $result; |
||
| 2245 | $pos_323 = $this->pos; |
||
| 2246 | $matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos; |
||
| 2247 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2248 | if ($subres !== FALSE) { |
||
| 2249 | $this->store( $result, $subres, "DollarMarkedLookup" ); |
||
| 2250 | $_330 = TRUE; break; |
||
| 2251 | } |
||
| 2252 | $result = $res_323; |
||
| 2253 | $this->pos = $pos_323; |
||
| 2254 | $_328 = NULL; |
||
| 2255 | do { |
||
| 2256 | $res_325 = $result; |
||
| 2257 | $pos_325 = $this->pos; |
||
| 2258 | $matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
||
| 2259 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2260 | if ($subres !== FALSE) { |
||
| 2261 | $this->store( $result, $subres, "QuotedString" ); |
||
| 2262 | $_328 = TRUE; break; |
||
| 2263 | } |
||
| 2264 | $result = $res_325; |
||
| 2265 | $this->pos = $pos_325; |
||
| 2266 | $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos; |
||
| 2267 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2268 | if ($subres !== FALSE) { |
||
| 2269 | $this->store( $result, $subres, "Lookup" ); |
||
| 2270 | $_328 = TRUE; break; |
||
| 2271 | } |
||
| 2272 | $result = $res_325; |
||
| 2273 | $this->pos = $pos_325; |
||
| 2274 | $_328 = FALSE; break; |
||
| 2275 | } |
||
| 2276 | while(0); |
||
| 2277 | if( $_328 === TRUE ) { $_330 = TRUE; break; } |
||
| 2278 | $result = $res_323; |
||
| 2279 | $this->pos = $pos_323; |
||
| 2280 | $_330 = FALSE; break; |
||
| 2281 | } |
||
| 2282 | while(0); |
||
| 2283 | if( $_330 === FALSE) { $_332 = FALSE; break; } |
||
| 2284 | $_332 = TRUE; break; |
||
| 2285 | } |
||
| 2286 | while(0); |
||
| 2287 | if( $_332 === FALSE) { $_334 = FALSE; break; } |
||
| 2288 | $_334 = TRUE; break; |
||
| 2289 | } |
||
| 2290 | while(0); |
||
| 2291 | if( $_334 === TRUE ) { return $this->finalise($result); } |
||
| 2292 | if( $_334 === FALSE) { return FALSE; } |
||
| 2293 | } |
||
| 2294 | |||
| 2295 | |||
| 2296 | |||
| 2297 | function CacheBlockArgument_DollarMarkedLookup(&$res, $sub) |
||
| 2298 | { |
||
| 2299 | $res['php'] = $sub['Lookup']['php']; |
||
| 2300 | } |
||
| 2301 | |||
| 2302 | function CacheBlockArgument_QuotedString(&$res, $sub) |
||
| 2303 | { |
||
| 2304 | $res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'"; |
||
| 2305 | } |
||
| 2306 | |||
| 2307 | function CacheBlockArgument_Lookup(&$res, $sub) |
||
| 2308 | { |
||
| 2309 | $res['php'] = $sub['php']; |
||
| 2310 | } |
||
| 2311 | |||
| 2312 | /* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */ |
||
| 2313 | protected $match_CacheBlockArguments_typestack = array('CacheBlockArguments'); |
||
| 2314 | function match_CacheBlockArguments ($stack = array()) { |
||
| 2315 | $matchrule = "CacheBlockArguments"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 2316 | $_343 = NULL; |
||
| 2317 | do { |
||
| 2318 | $matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos; |
||
| 2319 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2320 | if ($subres !== FALSE) { |
||
| 2321 | $this->store( $result, $subres ); |
||
| 2322 | } |
||
| 2323 | else { $_343 = FALSE; break; } |
||
| 2324 | while (true) { |
||
| 2325 | $res_342 = $result; |
||
| 2326 | $pos_342 = $this->pos; |
||
| 2327 | $_341 = NULL; |
||
| 2328 | do { |
||
| 2329 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2330 | if (substr($this->string,$this->pos,1) == ',') { |
||
| 2331 | $this->pos += 1; |
||
| 2332 | $result["text"] .= ','; |
||
| 2333 | } |
||
| 2334 | else { $_341 = FALSE; break; } |
||
| 2335 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2336 | $matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos; |
||
| 2337 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2338 | if ($subres !== FALSE) { |
||
| 2339 | $this->store( $result, $subres ); |
||
| 2340 | } |
||
| 2341 | else { $_341 = FALSE; break; } |
||
| 2342 | $_341 = TRUE; break; |
||
| 2343 | } |
||
| 2344 | while(0); |
||
| 2345 | if( $_341 === FALSE) { |
||
| 2346 | $result = $res_342; |
||
| 2347 | $this->pos = $pos_342; |
||
| 2348 | unset( $res_342 ); |
||
| 2349 | unset( $pos_342 ); |
||
| 2350 | break; |
||
| 2351 | } |
||
| 2352 | } |
||
| 2353 | $_343 = TRUE; break; |
||
| 2354 | } |
||
| 2355 | while(0); |
||
| 2356 | if( $_343 === TRUE ) { return $this->finalise($result); } |
||
| 2357 | if( $_343 === FALSE) { return FALSE; } |
||
| 2358 | } |
||
| 2359 | |||
| 2360 | |||
| 2361 | |||
| 2362 | function CacheBlockArguments_CacheBlockArgument(&$res, $sub) |
||
| 2363 | { |
||
| 2364 | if (!empty($res['php'])) { |
||
| 2365 | $res['php'] .= ".'_'."; |
||
| 2366 | } else { |
||
| 2367 | $res['php'] = ''; |
||
| 2368 | } |
||
| 2369 | |||
| 2370 | $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']); |
||
| 2371 | } |
||
| 2372 | |||
| 2373 | /* CacheBlockTemplate: (Comment | Translate | If | Require | OldI18NTag | Include | ClosedBlock | |
||
| 2374 | OpenBlock | MalformedBlock | Injection | Text)+ */ |
||
| 2375 | protected $match_CacheBlockTemplate_typestack = array('CacheBlockTemplate','Template'); |
||
| 2376 | function match_CacheBlockTemplate ($stack = array()) { |
||
| 2377 | $matchrule = "CacheBlockTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'CacheRestrictedTemplate')); |
||
| 2378 | $count = 0; |
||
| 2379 | while (true) { |
||
| 2380 | $res_387 = $result; |
||
| 2381 | $pos_387 = $this->pos; |
||
| 2382 | $_386 = NULL; |
||
| 2383 | do { |
||
| 2384 | $_384 = NULL; |
||
| 2385 | do { |
||
| 2386 | $res_345 = $result; |
||
| 2387 | $pos_345 = $this->pos; |
||
| 2388 | $matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
||
| 2389 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2390 | if ($subres !== FALSE) { |
||
| 2391 | $this->store( $result, $subres ); |
||
| 2392 | $_384 = TRUE; break; |
||
| 2393 | } |
||
| 2394 | $result = $res_345; |
||
| 2395 | $this->pos = $pos_345; |
||
| 2396 | $_382 = NULL; |
||
| 2397 | do { |
||
| 2398 | $res_347 = $result; |
||
| 2399 | $pos_347 = $this->pos; |
||
| 2400 | $matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
||
| 2401 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2402 | if ($subres !== FALSE) { |
||
| 2403 | $this->store( $result, $subres ); |
||
| 2404 | $_382 = TRUE; break; |
||
| 2405 | } |
||
| 2406 | $result = $res_347; |
||
| 2407 | $this->pos = $pos_347; |
||
| 2408 | $_380 = NULL; |
||
| 2409 | do { |
||
| 2410 | $res_349 = $result; |
||
| 2411 | $pos_349 = $this->pos; |
||
| 2412 | $matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
||
| 2413 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2414 | if ($subres !== FALSE) { |
||
| 2415 | $this->store( $result, $subres ); |
||
| 2416 | $_380 = TRUE; break; |
||
| 2417 | } |
||
| 2418 | $result = $res_349; |
||
| 2419 | $this->pos = $pos_349; |
||
| 2420 | $_378 = NULL; |
||
| 2421 | do { |
||
| 2422 | $res_351 = $result; |
||
| 2423 | $pos_351 = $this->pos; |
||
| 2424 | $matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
||
| 2425 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2426 | if ($subres !== FALSE) { |
||
| 2427 | $this->store( $result, $subres ); |
||
| 2428 | $_378 = TRUE; break; |
||
| 2429 | } |
||
| 2430 | $result = $res_351; |
||
| 2431 | $this->pos = $pos_351; |
||
| 2432 | $_376 = NULL; |
||
| 2433 | do { |
||
| 2434 | $res_353 = $result; |
||
| 2435 | $pos_353 = $this->pos; |
||
| 2436 | $matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
||
| 2437 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2438 | if ($subres !== FALSE) { |
||
| 2439 | $this->store( $result, $subres ); |
||
| 2440 | $_376 = TRUE; break; |
||
| 2441 | } |
||
| 2442 | $result = $res_353; |
||
| 2443 | $this->pos = $pos_353; |
||
| 2444 | $_374 = NULL; |
||
| 2445 | do { |
||
| 2446 | $res_355 = $result; |
||
| 2447 | $pos_355 = $this->pos; |
||
| 2448 | $matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
||
| 2449 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2450 | if ($subres !== FALSE) { |
||
| 2451 | $this->store( $result, $subres ); |
||
| 2452 | $_374 = TRUE; break; |
||
| 2453 | } |
||
| 2454 | $result = $res_355; |
||
| 2455 | $this->pos = $pos_355; |
||
| 2456 | $_372 = NULL; |
||
| 2457 | do { |
||
| 2458 | $res_357 = $result; |
||
| 2459 | $pos_357 = $this->pos; |
||
| 2460 | $matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2461 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2462 | if ($subres !== FALSE) { |
||
| 2463 | $this->store( $result, $subres ); |
||
| 2464 | $_372 = TRUE; break; |
||
| 2465 | } |
||
| 2466 | $result = $res_357; |
||
| 2467 | $this->pos = $pos_357; |
||
| 2468 | $_370 = NULL; |
||
| 2469 | do { |
||
| 2470 | $res_359 = $result; |
||
| 2471 | $pos_359 = $this->pos; |
||
| 2472 | $matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2473 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2474 | if ($subres !== FALSE) { |
||
| 2475 | $this->store( $result, $subres ); |
||
| 2476 | $_370 = TRUE; break; |
||
| 2477 | } |
||
| 2478 | $result = $res_359; |
||
| 2479 | $this->pos = $pos_359; |
||
| 2480 | $_368 = NULL; |
||
| 2481 | do { |
||
| 2482 | $res_361 = $result; |
||
| 2483 | $pos_361 = $this->pos; |
||
| 2484 | $matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2485 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2486 | if ($subres !== FALSE) { |
||
| 2487 | $this->store( $result, $subres ); |
||
| 2488 | $_368 = TRUE; break; |
||
| 2489 | } |
||
| 2490 | $result = $res_361; |
||
| 2491 | $this->pos = $pos_361; |
||
| 2492 | $_366 = NULL; |
||
| 2493 | do { |
||
| 2494 | $res_363 = $result; |
||
| 2495 | $pos_363 = $this->pos; |
||
| 2496 | $matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
||
| 2497 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2498 | if ($subres !== FALSE) { |
||
| 2499 | $this->store( $result, $subres ); |
||
| 2500 | $_366 = TRUE; break; |
||
| 2501 | } |
||
| 2502 | $result = $res_363; |
||
| 2503 | $this->pos = $pos_363; |
||
| 2504 | $matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
||
| 2505 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2506 | if ($subres !== FALSE) { |
||
| 2507 | $this->store( $result, $subres ); |
||
| 2508 | $_366 = TRUE; break; |
||
| 2509 | } |
||
| 2510 | $result = $res_363; |
||
| 2511 | $this->pos = $pos_363; |
||
| 2512 | $_366 = FALSE; break; |
||
| 2513 | } |
||
| 2514 | while(0); |
||
| 2515 | if( $_366 === TRUE ) { $_368 = TRUE; break; } |
||
| 2516 | $result = $res_361; |
||
| 2517 | $this->pos = $pos_361; |
||
| 2518 | $_368 = FALSE; break; |
||
| 2519 | } |
||
| 2520 | while(0); |
||
| 2521 | if( $_368 === TRUE ) { $_370 = TRUE; break; } |
||
| 2522 | $result = $res_359; |
||
| 2523 | $this->pos = $pos_359; |
||
| 2524 | $_370 = FALSE; break; |
||
| 2525 | } |
||
| 2526 | while(0); |
||
| 2527 | if( $_370 === TRUE ) { $_372 = TRUE; break; } |
||
| 2528 | $result = $res_357; |
||
| 2529 | $this->pos = $pos_357; |
||
| 2530 | $_372 = FALSE; break; |
||
| 2531 | } |
||
| 2532 | while(0); |
||
| 2533 | if( $_372 === TRUE ) { $_374 = TRUE; break; } |
||
| 2534 | $result = $res_355; |
||
| 2535 | $this->pos = $pos_355; |
||
| 2536 | $_374 = FALSE; break; |
||
| 2537 | } |
||
| 2538 | while(0); |
||
| 2539 | if( $_374 === TRUE ) { $_376 = TRUE; break; } |
||
| 2540 | $result = $res_353; |
||
| 2541 | $this->pos = $pos_353; |
||
| 2542 | $_376 = FALSE; break; |
||
| 2543 | } |
||
| 2544 | while(0); |
||
| 2545 | if( $_376 === TRUE ) { $_378 = TRUE; break; } |
||
| 2546 | $result = $res_351; |
||
| 2547 | $this->pos = $pos_351; |
||
| 2548 | $_378 = FALSE; break; |
||
| 2549 | } |
||
| 2550 | while(0); |
||
| 2551 | if( $_378 === TRUE ) { $_380 = TRUE; break; } |
||
| 2552 | $result = $res_349; |
||
| 2553 | $this->pos = $pos_349; |
||
| 2554 | $_380 = FALSE; break; |
||
| 2555 | } |
||
| 2556 | while(0); |
||
| 2557 | if( $_380 === TRUE ) { $_382 = TRUE; break; } |
||
| 2558 | $result = $res_347; |
||
| 2559 | $this->pos = $pos_347; |
||
| 2560 | $_382 = FALSE; break; |
||
| 2561 | } |
||
| 2562 | while(0); |
||
| 2563 | if( $_382 === TRUE ) { $_384 = TRUE; break; } |
||
| 2564 | $result = $res_345; |
||
| 2565 | $this->pos = $pos_345; |
||
| 2566 | $_384 = FALSE; break; |
||
| 2567 | } |
||
| 2568 | while(0); |
||
| 2569 | if( $_384 === FALSE) { $_386 = FALSE; break; } |
||
| 2570 | $_386 = TRUE; break; |
||
| 2571 | } |
||
| 2572 | while(0); |
||
| 2573 | if( $_386 === FALSE) { |
||
| 2574 | $result = $res_387; |
||
| 2575 | $this->pos = $pos_387; |
||
| 2576 | unset( $res_387 ); |
||
| 2577 | unset( $pos_387 ); |
||
| 2578 | break; |
||
| 2579 | } |
||
| 2580 | $count += 1; |
||
| 2581 | } |
||
| 2582 | if ($count > 0) { return $this->finalise($result); } |
||
| 2583 | else { return FALSE; } |
||
| 2584 | } |
||
| 2585 | |||
| 2586 | |||
| 2587 | |||
| 2588 | |||
| 2589 | /* UncachedBlock: |
||
| 2590 | '<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>' |
||
| 2591 | Template:$TemplateMatcher? |
||
| 2592 | '<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>' */ |
||
| 2593 | protected $match_UncachedBlock_typestack = array('UncachedBlock'); |
||
| 2594 | function match_UncachedBlock ($stack = array()) { |
||
| 2595 | $matchrule = "UncachedBlock"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 2596 | $_424 = NULL; |
||
| 2597 | do { |
||
| 2598 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2599 | else { $_424 = FALSE; break; } |
||
| 2600 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2601 | if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2602 | else { $_424 = FALSE; break; } |
||
| 2603 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2604 | $res_392 = $result; |
||
| 2605 | $pos_392 = $this->pos; |
||
| 2606 | $matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos; |
||
| 2607 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2608 | if ($subres !== FALSE) { |
||
| 2609 | $this->store( $result, $subres ); |
||
| 2610 | } |
||
| 2611 | else { |
||
| 2612 | $result = $res_392; |
||
| 2613 | $this->pos = $pos_392; |
||
| 2614 | unset( $res_392 ); |
||
| 2615 | unset( $pos_392 ); |
||
| 2616 | } |
||
| 2617 | $res_404 = $result; |
||
| 2618 | $pos_404 = $this->pos; |
||
| 2619 | $_403 = NULL; |
||
| 2620 | do { |
||
| 2621 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2622 | $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); |
||
| 2623 | $_399 = NULL; |
||
| 2624 | do { |
||
| 2625 | $_397 = NULL; |
||
| 2626 | do { |
||
| 2627 | $res_394 = $result; |
||
| 2628 | $pos_394 = $this->pos; |
||
| 2629 | if (( $subres = $this->literal( 'if' ) ) !== FALSE) { |
||
| 2630 | $result["text"] .= $subres; |
||
| 2631 | $_397 = TRUE; break; |
||
| 2632 | } |
||
| 2633 | $result = $res_394; |
||
| 2634 | $this->pos = $pos_394; |
||
| 2635 | if (( $subres = $this->literal( 'unless' ) ) !== FALSE) { |
||
| 2636 | $result["text"] .= $subres; |
||
| 2637 | $_397 = TRUE; break; |
||
| 2638 | } |
||
| 2639 | $result = $res_394; |
||
| 2640 | $this->pos = $pos_394; |
||
| 2641 | $_397 = FALSE; break; |
||
| 2642 | } |
||
| 2643 | while(0); |
||
| 2644 | if( $_397 === FALSE) { $_399 = FALSE; break; } |
||
| 2645 | $_399 = TRUE; break; |
||
| 2646 | } |
||
| 2647 | while(0); |
||
| 2648 | if( $_399 === TRUE ) { |
||
| 2649 | $subres = $result; $result = array_pop($stack); |
||
| 2650 | $this->store( $result, $subres, 'Conditional' ); |
||
| 2651 | } |
||
| 2652 | if( $_399 === FALSE) { |
||
| 2653 | $result = array_pop($stack); |
||
| 2654 | $_403 = FALSE; break; |
||
| 2655 | } |
||
| 2656 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2657 | $matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
||
| 2658 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2659 | if ($subres !== FALSE) { |
||
| 2660 | $this->store( $result, $subres, "Condition" ); |
||
| 2661 | } |
||
| 2662 | else { $_403 = FALSE; break; } |
||
| 2663 | $_403 = TRUE; break; |
||
| 2664 | } |
||
| 2665 | while(0); |
||
| 2666 | if( $_403 === FALSE) { |
||
| 2667 | $result = $res_404; |
||
| 2668 | $this->pos = $pos_404; |
||
| 2669 | unset( $res_404 ); |
||
| 2670 | unset( $pos_404 ); |
||
| 2671 | } |
||
| 2672 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2673 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2674 | else { $_424 = FALSE; break; } |
||
| 2675 | $res_407 = $result; |
||
| 2676 | $pos_407 = $this->pos; |
||
| 2677 | $matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
||
| 2678 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2679 | if ($subres !== FALSE) { |
||
| 2680 | $this->store( $result, $subres, "Template" ); |
||
| 2681 | } |
||
| 2682 | else { |
||
| 2683 | $result = $res_407; |
||
| 2684 | $this->pos = $pos_407; |
||
| 2685 | unset( $res_407 ); |
||
| 2686 | unset( $pos_407 ); |
||
| 2687 | } |
||
| 2688 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2689 | else { $_424 = FALSE; break; } |
||
| 2690 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2691 | if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2692 | else { $_424 = FALSE; break; } |
||
| 2693 | $_420 = NULL; |
||
| 2694 | do { |
||
| 2695 | $_418 = NULL; |
||
| 2696 | do { |
||
| 2697 | $res_411 = $result; |
||
| 2698 | $pos_411 = $this->pos; |
||
| 2699 | if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { |
||
| 2700 | $result["text"] .= $subres; |
||
| 2701 | $_418 = TRUE; break; |
||
| 2702 | } |
||
| 2703 | $result = $res_411; |
||
| 2704 | $this->pos = $pos_411; |
||
| 2705 | $_416 = NULL; |
||
| 2706 | do { |
||
| 2707 | $res_413 = $result; |
||
| 2708 | $pos_413 = $this->pos; |
||
| 2709 | if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
||
| 2710 | $result["text"] .= $subres; |
||
| 2711 | $_416 = TRUE; break; |
||
| 2712 | } |
||
| 2713 | $result = $res_413; |
||
| 2714 | $this->pos = $pos_413; |
||
| 2715 | if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
||
| 2716 | $result["text"] .= $subres; |
||
| 2717 | $_416 = TRUE; break; |
||
| 2718 | } |
||
| 2719 | $result = $res_413; |
||
| 2720 | $this->pos = $pos_413; |
||
| 2721 | $_416 = FALSE; break; |
||
| 2722 | } |
||
| 2723 | while(0); |
||
| 2724 | if( $_416 === TRUE ) { $_418 = TRUE; break; } |
||
| 2725 | $result = $res_411; |
||
| 2726 | $this->pos = $pos_411; |
||
| 2727 | $_418 = FALSE; break; |
||
| 2728 | } |
||
| 2729 | while(0); |
||
| 2730 | if( $_418 === FALSE) { $_420 = FALSE; break; } |
||
| 2731 | $_420 = TRUE; break; |
||
| 2732 | } |
||
| 2733 | while(0); |
||
| 2734 | if( $_420 === FALSE) { $_424 = FALSE; break; } |
||
| 2735 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2736 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 2737 | else { $_424 = FALSE; break; } |
||
| 2738 | $_424 = TRUE; break; |
||
| 2739 | } |
||
| 2740 | while(0); |
||
| 2741 | if( $_424 === TRUE ) { return $this->finalise($result); } |
||
| 2742 | if( $_424 === FALSE) { return FALSE; } |
||
| 2743 | } |
||
| 2744 | |||
| 2745 | |||
| 2746 | |||
| 2747 | function UncachedBlock_Template(&$res, $sub) |
||
| 2748 | { |
||
| 2749 | $res['php'] = $sub['php']; |
||
| 2750 | } |
||
| 2751 | |||
| 2752 | /* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | |
||
| 2753 | OpenBlock | MalformedBlock | Injection | Text)+ */ |
||
| 2754 | protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template'); |
||
| 2755 | function match_CacheRestrictedTemplate ($stack = array()) { |
||
| 2756 | $matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 2757 | $count = 0; |
||
| 2758 | while (true) { |
||
| 2759 | $res_476 = $result; |
||
| 2760 | $pos_476 = $this->pos; |
||
| 2761 | $_475 = NULL; |
||
| 2762 | do { |
||
| 2763 | $_473 = NULL; |
||
| 2764 | do { |
||
| 2765 | $res_426 = $result; |
||
| 2766 | $pos_426 = $this->pos; |
||
| 2767 | $matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
||
| 2768 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2769 | if ($subres !== FALSE) { |
||
| 2770 | $this->store( $result, $subres ); |
||
| 2771 | $_473 = TRUE; break; |
||
| 2772 | } |
||
| 2773 | $result = $res_426; |
||
| 2774 | $this->pos = $pos_426; |
||
| 2775 | $_471 = NULL; |
||
| 2776 | do { |
||
| 2777 | $res_428 = $result; |
||
| 2778 | $pos_428 = $this->pos; |
||
| 2779 | $matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
||
| 2780 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2781 | if ($subres !== FALSE) { |
||
| 2782 | $this->store( $result, $subres ); |
||
| 2783 | $_471 = TRUE; break; |
||
| 2784 | } |
||
| 2785 | $result = $res_428; |
||
| 2786 | $this->pos = $pos_428; |
||
| 2787 | $_469 = NULL; |
||
| 2788 | do { |
||
| 2789 | $res_430 = $result; |
||
| 2790 | $pos_430 = $this->pos; |
||
| 2791 | $matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
||
| 2792 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2793 | if ($subres !== FALSE) { |
||
| 2794 | $this->store( $result, $subres ); |
||
| 2795 | $_469 = TRUE; break; |
||
| 2796 | } |
||
| 2797 | $result = $res_430; |
||
| 2798 | $this->pos = $pos_430; |
||
| 2799 | $_467 = NULL; |
||
| 2800 | do { |
||
| 2801 | $res_432 = $result; |
||
| 2802 | $pos_432 = $this->pos; |
||
| 2803 | $matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
||
| 2804 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2805 | if ($subres !== FALSE) { |
||
| 2806 | $this->store( $result, $subres ); |
||
| 2807 | $_467 = TRUE; break; |
||
| 2808 | } |
||
| 2809 | $result = $res_432; |
||
| 2810 | $this->pos = $pos_432; |
||
| 2811 | $_465 = NULL; |
||
| 2812 | do { |
||
| 2813 | $res_434 = $result; |
||
| 2814 | $pos_434 = $this->pos; |
||
| 2815 | $matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2816 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2817 | if ($subres !== FALSE) { |
||
| 2818 | $this->store( $result, $subres ); |
||
| 2819 | $_465 = TRUE; break; |
||
| 2820 | } |
||
| 2821 | $result = $res_434; |
||
| 2822 | $this->pos = $pos_434; |
||
| 2823 | $_463 = NULL; |
||
| 2824 | do { |
||
| 2825 | $res_436 = $result; |
||
| 2826 | $pos_436 = $this->pos; |
||
| 2827 | $matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2828 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2829 | if ($subres !== FALSE) { |
||
| 2830 | $this->store( $result, $subres ); |
||
| 2831 | $_463 = TRUE; break; |
||
| 2832 | } |
||
| 2833 | $result = $res_436; |
||
| 2834 | $this->pos = $pos_436; |
||
| 2835 | $_461 = NULL; |
||
| 2836 | do { |
||
| 2837 | $res_438 = $result; |
||
| 2838 | $pos_438 = $this->pos; |
||
| 2839 | $matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
||
| 2840 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2841 | if ($subres !== FALSE) { |
||
| 2842 | $this->store( $result, $subres ); |
||
| 2843 | $_461 = TRUE; break; |
||
| 2844 | } |
||
| 2845 | $result = $res_438; |
||
| 2846 | $this->pos = $pos_438; |
||
| 2847 | $_459 = NULL; |
||
| 2848 | do { |
||
| 2849 | $res_440 = $result; |
||
| 2850 | $pos_440 = $this->pos; |
||
| 2851 | $matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
||
| 2852 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2853 | if ($subres !== FALSE) { |
||
| 2854 | $this->store( $result, $subres ); |
||
| 2855 | $_459 = TRUE; break; |
||
| 2856 | } |
||
| 2857 | $result = $res_440; |
||
| 2858 | $this->pos = $pos_440; |
||
| 2859 | $_457 = NULL; |
||
| 2860 | do { |
||
| 2861 | $res_442 = $result; |
||
| 2862 | $pos_442 = $this->pos; |
||
| 2863 | $matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2864 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2865 | if ($subres !== FALSE) { |
||
| 2866 | $this->store( $result, $subres ); |
||
| 2867 | $_457 = TRUE; break; |
||
| 2868 | } |
||
| 2869 | $result = $res_442; |
||
| 2870 | $this->pos = $pos_442; |
||
| 2871 | $_455 = NULL; |
||
| 2872 | do { |
||
| 2873 | $res_444 = $result; |
||
| 2874 | $pos_444 = $this->pos; |
||
| 2875 | $matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2876 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2877 | if ($subres !== FALSE) { |
||
| 2878 | $this->store( $result, $subres ); |
||
| 2879 | $_455 = TRUE; break; |
||
| 2880 | } |
||
| 2881 | $result = $res_444; |
||
| 2882 | $this->pos = $pos_444; |
||
| 2883 | $_453 = NULL; |
||
| 2884 | do { |
||
| 2885 | $res_446 = $result; |
||
| 2886 | $pos_446 = $this->pos; |
||
| 2887 | $matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 2888 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2889 | if ($subres !== FALSE) { |
||
| 2890 | $this->store( $result, $subres ); |
||
| 2891 | $_453 = TRUE; break; |
||
| 2892 | } |
||
| 2893 | $result = $res_446; |
||
| 2894 | $this->pos = $pos_446; |
||
| 2895 | $_451 = NULL; |
||
| 2896 | do { |
||
| 2897 | $res_448 = $result; |
||
| 2898 | $pos_448 = $this->pos; |
||
| 2899 | $matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
||
| 2900 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2901 | if ($subres !== FALSE) { |
||
| 2902 | $this->store( $result, $subres ); |
||
| 2903 | $_451 = TRUE; break; |
||
| 2904 | } |
||
| 2905 | $result = $res_448; |
||
| 2906 | $this->pos = $pos_448; |
||
| 2907 | $matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
||
| 2908 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 2909 | if ($subres !== FALSE) { |
||
| 2910 | $this->store( $result, $subres ); |
||
| 2911 | $_451 = TRUE; break; |
||
| 2912 | } |
||
| 2913 | $result = $res_448; |
||
| 2914 | $this->pos = $pos_448; |
||
| 2915 | $_451 = FALSE; break; |
||
| 2916 | } |
||
| 2917 | while(0); |
||
| 2918 | if( $_451 === TRUE ) { $_453 = TRUE; break; } |
||
| 2919 | $result = $res_446; |
||
| 2920 | $this->pos = $pos_446; |
||
| 2921 | $_453 = FALSE; break; |
||
| 2922 | } |
||
| 2923 | while(0); |
||
| 2924 | if( $_453 === TRUE ) { $_455 = TRUE; break; } |
||
| 2925 | $result = $res_444; |
||
| 2926 | $this->pos = $pos_444; |
||
| 2927 | $_455 = FALSE; break; |
||
| 2928 | } |
||
| 2929 | while(0); |
||
| 2930 | if( $_455 === TRUE ) { $_457 = TRUE; break; } |
||
| 2931 | $result = $res_442; |
||
| 2932 | $this->pos = $pos_442; |
||
| 2933 | $_457 = FALSE; break; |
||
| 2934 | } |
||
| 2935 | while(0); |
||
| 2936 | if( $_457 === TRUE ) { $_459 = TRUE; break; } |
||
| 2937 | $result = $res_440; |
||
| 2938 | $this->pos = $pos_440; |
||
| 2939 | $_459 = FALSE; break; |
||
| 2940 | } |
||
| 2941 | while(0); |
||
| 2942 | if( $_459 === TRUE ) { $_461 = TRUE; break; } |
||
| 2943 | $result = $res_438; |
||
| 2944 | $this->pos = $pos_438; |
||
| 2945 | $_461 = FALSE; break; |
||
| 2946 | } |
||
| 2947 | while(0); |
||
| 2948 | if( $_461 === TRUE ) { $_463 = TRUE; break; } |
||
| 2949 | $result = $res_436; |
||
| 2950 | $this->pos = $pos_436; |
||
| 2951 | $_463 = FALSE; break; |
||
| 2952 | } |
||
| 2953 | while(0); |
||
| 2954 | if( $_463 === TRUE ) { $_465 = TRUE; break; } |
||
| 2955 | $result = $res_434; |
||
| 2956 | $this->pos = $pos_434; |
||
| 2957 | $_465 = FALSE; break; |
||
| 2958 | } |
||
| 2959 | while(0); |
||
| 2960 | if( $_465 === TRUE ) { $_467 = TRUE; break; } |
||
| 2961 | $result = $res_432; |
||
| 2962 | $this->pos = $pos_432; |
||
| 2963 | $_467 = FALSE; break; |
||
| 2964 | } |
||
| 2965 | while(0); |
||
| 2966 | if( $_467 === TRUE ) { $_469 = TRUE; break; } |
||
| 2967 | $result = $res_430; |
||
| 2968 | $this->pos = $pos_430; |
||
| 2969 | $_469 = FALSE; break; |
||
| 2970 | } |
||
| 2971 | while(0); |
||
| 2972 | if( $_469 === TRUE ) { $_471 = TRUE; break; } |
||
| 2973 | $result = $res_428; |
||
| 2974 | $this->pos = $pos_428; |
||
| 2975 | $_471 = FALSE; break; |
||
| 2976 | } |
||
| 2977 | while(0); |
||
| 2978 | if( $_471 === TRUE ) { $_473 = TRUE; break; } |
||
| 2979 | $result = $res_426; |
||
| 2980 | $this->pos = $pos_426; |
||
| 2981 | $_473 = FALSE; break; |
||
| 2982 | } |
||
| 2983 | while(0); |
||
| 2984 | if( $_473 === FALSE) { $_475 = FALSE; break; } |
||
| 2985 | $_475 = TRUE; break; |
||
| 2986 | } |
||
| 2987 | while(0); |
||
| 2988 | if( $_475 === FALSE) { |
||
| 2989 | $result = $res_476; |
||
| 2990 | $this->pos = $pos_476; |
||
| 2991 | unset( $res_476 ); |
||
| 2992 | unset( $pos_476 ); |
||
| 2993 | break; |
||
| 2994 | } |
||
| 2995 | $count += 1; |
||
| 2996 | } |
||
| 2997 | if ($count > 0) { return $this->finalise($result); } |
||
| 2998 | else { return FALSE; } |
||
| 2999 | } |
||
| 3000 | |||
| 3001 | |||
| 3002 | |||
| 3003 | function CacheRestrictedTemplate_CacheBlock(&$res, $sub) |
||
| 3004 | { |
||
| 3005 | throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks ' . |
||
| 3006 | 'that are within cache blocks', $this); |
||
| 3007 | } |
||
| 3008 | |||
| 3009 | function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) |
||
| 3010 | { |
||
| 3011 | throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks ' . |
||
| 3012 | 'that are within cache blocks', $this); |
||
| 3013 | } |
||
| 3014 | |||
| 3015 | /* CacheBlock: |
||
| 3016 | '<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") > |
||
| 3017 | Condition:IfArgument )? > '%>' |
||
| 3018 | (CacheBlock | UncachedBlock | CacheBlockTemplate)* |
||
| 3019 | '<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>' */ |
||
| 3020 | protected $match_CacheBlock_typestack = array('CacheBlock'); |
||
| 3021 | function match_CacheBlock ($stack = array()) { |
||
| 3022 | $matchrule = "CacheBlock"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3023 | $_531 = NULL; |
||
| 3024 | do { |
||
| 3025 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3026 | else { $_531 = FALSE; break; } |
||
| 3027 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3028 | $stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); |
||
| 3029 | $_484 = NULL; |
||
| 3030 | do { |
||
| 3031 | $_482 = NULL; |
||
| 3032 | do { |
||
| 3033 | $res_479 = $result; |
||
| 3034 | $pos_479 = $this->pos; |
||
| 3035 | if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
||
| 3036 | $result["text"] .= $subres; |
||
| 3037 | $_482 = TRUE; break; |
||
| 3038 | } |
||
| 3039 | $result = $res_479; |
||
| 3040 | $this->pos = $pos_479; |
||
| 3041 | if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
||
| 3042 | $result["text"] .= $subres; |
||
| 3043 | $_482 = TRUE; break; |
||
| 3044 | } |
||
| 3045 | $result = $res_479; |
||
| 3046 | $this->pos = $pos_479; |
||
| 3047 | $_482 = FALSE; break; |
||
| 3048 | } |
||
| 3049 | while(0); |
||
| 3050 | if( $_482 === FALSE) { $_484 = FALSE; break; } |
||
| 3051 | $_484 = TRUE; break; |
||
| 3052 | } |
||
| 3053 | while(0); |
||
| 3054 | if( $_484 === TRUE ) { |
||
| 3055 | $subres = $result; $result = array_pop($stack); |
||
| 3056 | $this->store( $result, $subres, 'CacheTag' ); |
||
| 3057 | } |
||
| 3058 | if( $_484 === FALSE) { |
||
| 3059 | $result = array_pop($stack); |
||
| 3060 | $_531 = FALSE; break; |
||
| 3061 | } |
||
| 3062 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3063 | $res_489 = $result; |
||
| 3064 | $pos_489 = $this->pos; |
||
| 3065 | $_488 = NULL; |
||
| 3066 | do { |
||
| 3067 | $matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos; |
||
| 3068 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3069 | if ($subres !== FALSE) { |
||
| 3070 | $this->store( $result, $subres ); |
||
| 3071 | } |
||
| 3072 | else { $_488 = FALSE; break; } |
||
| 3073 | $_488 = TRUE; break; |
||
| 3074 | } |
||
| 3075 | while(0); |
||
| 3076 | if( $_488 === FALSE) { |
||
| 3077 | $result = $res_489; |
||
| 3078 | $this->pos = $pos_489; |
||
| 3079 | unset( $res_489 ); |
||
| 3080 | unset( $pos_489 ); |
||
| 3081 | } |
||
| 3082 | $res_501 = $result; |
||
| 3083 | $pos_501 = $this->pos; |
||
| 3084 | $_500 = NULL; |
||
| 3085 | do { |
||
| 3086 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3087 | $stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); |
||
| 3088 | $_496 = NULL; |
||
| 3089 | do { |
||
| 3090 | $_494 = NULL; |
||
| 3091 | do { |
||
| 3092 | $res_491 = $result; |
||
| 3093 | $pos_491 = $this->pos; |
||
| 3094 | if (( $subres = $this->literal( 'if' ) ) !== FALSE) { |
||
| 3095 | $result["text"] .= $subres; |
||
| 3096 | $_494 = TRUE; break; |
||
| 3097 | } |
||
| 3098 | $result = $res_491; |
||
| 3099 | $this->pos = $pos_491; |
||
| 3100 | if (( $subres = $this->literal( 'unless' ) ) !== FALSE) { |
||
| 3101 | $result["text"] .= $subres; |
||
| 3102 | $_494 = TRUE; break; |
||
| 3103 | } |
||
| 3104 | $result = $res_491; |
||
| 3105 | $this->pos = $pos_491; |
||
| 3106 | $_494 = FALSE; break; |
||
| 3107 | } |
||
| 3108 | while(0); |
||
| 3109 | if( $_494 === FALSE) { $_496 = FALSE; break; } |
||
| 3110 | $_496 = TRUE; break; |
||
| 3111 | } |
||
| 3112 | while(0); |
||
| 3113 | if( $_496 === TRUE ) { |
||
| 3114 | $subres = $result; $result = array_pop($stack); |
||
| 3115 | $this->store( $result, $subres, 'Conditional' ); |
||
| 3116 | } |
||
| 3117 | if( $_496 === FALSE) { |
||
| 3118 | $result = array_pop($stack); |
||
| 3119 | $_500 = FALSE; break; |
||
| 3120 | } |
||
| 3121 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3122 | $matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos; |
||
| 3123 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3124 | if ($subres !== FALSE) { |
||
| 3125 | $this->store( $result, $subres, "Condition" ); |
||
| 3126 | } |
||
| 3127 | else { $_500 = FALSE; break; } |
||
| 3128 | $_500 = TRUE; break; |
||
| 3129 | } |
||
| 3130 | while(0); |
||
| 3131 | if( $_500 === FALSE) { |
||
| 3132 | $result = $res_501; |
||
| 3133 | $this->pos = $pos_501; |
||
| 3134 | unset( $res_501 ); |
||
| 3135 | unset( $pos_501 ); |
||
| 3136 | } |
||
| 3137 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3138 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3139 | else { $_531 = FALSE; break; } |
||
| 3140 | while (true) { |
||
| 3141 | $res_514 = $result; |
||
| 3142 | $pos_514 = $this->pos; |
||
| 3143 | $_513 = NULL; |
||
| 3144 | do { |
||
| 3145 | $_511 = NULL; |
||
| 3146 | do { |
||
| 3147 | $res_504 = $result; |
||
| 3148 | $pos_504 = $this->pos; |
||
| 3149 | $matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
||
| 3150 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3151 | if ($subres !== FALSE) { |
||
| 3152 | $this->store( $result, $subres ); |
||
| 3153 | $_511 = TRUE; break; |
||
| 3154 | } |
||
| 3155 | $result = $res_504; |
||
| 3156 | $this->pos = $pos_504; |
||
| 3157 | $_509 = NULL; |
||
| 3158 | do { |
||
| 3159 | $res_506 = $result; |
||
| 3160 | $pos_506 = $this->pos; |
||
| 3161 | $matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 3162 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3163 | if ($subres !== FALSE) { |
||
| 3164 | $this->store( $result, $subres ); |
||
| 3165 | $_509 = TRUE; break; |
||
| 3166 | } |
||
| 3167 | $result = $res_506; |
||
| 3168 | $this->pos = $pos_506; |
||
| 3169 | $matcher = 'match_'.'CacheBlockTemplate'; $key = $matcher; $pos = $this->pos; |
||
| 3170 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3171 | if ($subres !== FALSE) { |
||
| 3172 | $this->store( $result, $subres ); |
||
| 3173 | $_509 = TRUE; break; |
||
| 3174 | } |
||
| 3175 | $result = $res_506; |
||
| 3176 | $this->pos = $pos_506; |
||
| 3177 | $_509 = FALSE; break; |
||
| 3178 | } |
||
| 3179 | while(0); |
||
| 3180 | if( $_509 === TRUE ) { $_511 = TRUE; break; } |
||
| 3181 | $result = $res_504; |
||
| 3182 | $this->pos = $pos_504; |
||
| 3183 | $_511 = FALSE; break; |
||
| 3184 | } |
||
| 3185 | while(0); |
||
| 3186 | if( $_511 === FALSE) { $_513 = FALSE; break; } |
||
| 3187 | $_513 = TRUE; break; |
||
| 3188 | } |
||
| 3189 | while(0); |
||
| 3190 | if( $_513 === FALSE) { |
||
| 3191 | $result = $res_514; |
||
| 3192 | $this->pos = $pos_514; |
||
| 3193 | unset( $res_514 ); |
||
| 3194 | unset( $pos_514 ); |
||
| 3195 | break; |
||
| 3196 | } |
||
| 3197 | } |
||
| 3198 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3199 | else { $_531 = FALSE; break; } |
||
| 3200 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3201 | if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3202 | else { $_531 = FALSE; break; } |
||
| 3203 | $_527 = NULL; |
||
| 3204 | do { |
||
| 3205 | $_525 = NULL; |
||
| 3206 | do { |
||
| 3207 | $res_518 = $result; |
||
| 3208 | $pos_518 = $this->pos; |
||
| 3209 | if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
||
| 3210 | $result["text"] .= $subres; |
||
| 3211 | $_525 = TRUE; break; |
||
| 3212 | } |
||
| 3213 | $result = $res_518; |
||
| 3214 | $this->pos = $pos_518; |
||
| 3215 | $_523 = NULL; |
||
| 3216 | do { |
||
| 3217 | $res_520 = $result; |
||
| 3218 | $pos_520 = $this->pos; |
||
| 3219 | if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { |
||
| 3220 | $result["text"] .= $subres; |
||
| 3221 | $_523 = TRUE; break; |
||
| 3222 | } |
||
| 3223 | $result = $res_520; |
||
| 3224 | $this->pos = $pos_520; |
||
| 3225 | if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
||
| 3226 | $result["text"] .= $subres; |
||
| 3227 | $_523 = TRUE; break; |
||
| 3228 | } |
||
| 3229 | $result = $res_520; |
||
| 3230 | $this->pos = $pos_520; |
||
| 3231 | $_523 = FALSE; break; |
||
| 3232 | } |
||
| 3233 | while(0); |
||
| 3234 | if( $_523 === TRUE ) { $_525 = TRUE; break; } |
||
| 3235 | $result = $res_518; |
||
| 3236 | $this->pos = $pos_518; |
||
| 3237 | $_525 = FALSE; break; |
||
| 3238 | } |
||
| 3239 | while(0); |
||
| 3240 | if( $_525 === FALSE) { $_527 = FALSE; break; } |
||
| 3241 | $_527 = TRUE; break; |
||
| 3242 | } |
||
| 3243 | while(0); |
||
| 3244 | if( $_527 === FALSE) { $_531 = FALSE; break; } |
||
| 3245 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3246 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3247 | else { $_531 = FALSE; break; } |
||
| 3248 | $_531 = TRUE; break; |
||
| 3249 | } |
||
| 3250 | while(0); |
||
| 3251 | if( $_531 === TRUE ) { return $this->finalise($result); } |
||
| 3252 | if( $_531 === FALSE) { return FALSE; } |
||
| 3253 | } |
||
| 3254 | |||
| 3255 | |||
| 3256 | |||
| 3257 | function CacheBlock__construct(&$res) |
||
| 3258 | { |
||
| 3259 | $res['subblocks'] = 0; |
||
| 3260 | } |
||
| 3261 | |||
| 3262 | function CacheBlock_CacheBlockArguments(&$res, $sub) |
||
| 3265 | } |
||
| 3266 | |||
| 3267 | function CacheBlock_Condition(&$res, $sub) |
||
| 3268 | { |
||
| 3269 | $res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && '; |
||
| 3270 | } |
||
| 3271 | |||
| 3272 | function CacheBlock_CacheBlock(&$res, $sub) |
||
| 3273 | { |
||
| 3274 | $res['php'] .= $sub['php']; |
||
| 3275 | } |
||
| 3276 | |||
| 3277 | function CacheBlock_UncachedBlock(&$res, $sub) |
||
| 3278 | { |
||
| 3279 | $res['php'] .= $sub['php']; |
||
| 3280 | } |
||
| 3281 | |||
| 3282 | function CacheBlock_CacheBlockTemplate(&$res, $sub) |
||
| 3283 | { |
||
| 3284 | // Get the block counter |
||
| 3285 | $block = ++$res['subblocks']; |
||
| 3286 | // Build the key for this block from the global key (evaluated in a closure within the template), |
||
| 3287 | // the passed cache key, the block index, and the sha hash of the template. |
||
| 3288 | $res['php'] .= '$keyExpression = function() use ($scope, $cache) {' . PHP_EOL; |
||
| 3289 | $res['php'] .= '$val = \'\';' . PHP_EOL; |
||
| 3290 | if ($globalKey = SSViewer::config()->get('global_key')) { |
||
| 3291 | // Embed the code necessary to evaluate the globalKey directly into the template, |
||
| 3292 | // so that SSTemplateParser only needs to be called during template regeneration. |
||
| 3293 | // Warning: If the global key is changed, it's necessary to flush the template cache. |
||
| 3294 | $parser = Injector::inst()->get(__CLASS__, false); |
||
| 3295 | $result = $parser->compileString($globalKey, '', false, false); |
||
| 3296 | if (!$result) { |
||
| 3297 | throw new SSTemplateParseException('Unexpected problem parsing template', $parser); |
||
| 3298 | } |
||
| 3299 | $res['php'] .= $result . PHP_EOL; |
||
| 3300 | } |
||
| 3301 | $res['php'] .= 'return $val;' . PHP_EOL; |
||
| 3302 | $res['php'] .= '};' . PHP_EOL; |
||
| 3303 | $key = 'sha1($keyExpression())' // Global key |
||
| 3304 | . '.\'_' . sha1($sub['php']) // sha of template |
||
| 3305 | . (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") // Passed key |
||
| 3306 | . ".'_$block'"; // block index |
||
| 3307 | // Get any condition |
||
| 3308 | $condition = isset($res['condition']) ? $res['condition'] : ''; |
||
| 3309 | |||
| 3310 | $res['php'] .= 'if ('.$condition.'($partial = $cache->get('.$key.'))) $val .= $partial;' . PHP_EOL; |
||
| 3311 | $res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL; |
||
| 3312 | $res['php'] .= $sub['php'] . PHP_EOL; |
||
| 3313 | $res['php'] .= $condition . ' $cache->set('.$key.', $val); $val = $oldval . $val;' . PHP_EOL; |
||
| 3314 | $res['php'] .= '}'; |
||
| 3315 | } |
||
| 3316 | |||
| 3317 | /* OldTPart: "_t" N "(" N QuotedString (N "," N CallArguments)? N ")" N (";")? */ |
||
| 3318 | protected $match_OldTPart_typestack = array('OldTPart'); |
||
| 3319 | function match_OldTPart ($stack = array()) { |
||
| 3320 | $matchrule = "OldTPart"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3321 | $_550 = NULL; |
||
| 3322 | do { |
||
| 3323 | if (( $subres = $this->literal( '_t' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3324 | else { $_550 = FALSE; break; } |
||
| 3325 | $matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
||
| 3326 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3327 | if ($subres !== FALSE) { |
||
| 3328 | $this->store( $result, $subres ); |
||
| 3329 | } |
||
| 3330 | else { $_550 = FALSE; break; } |
||
| 3331 | if (substr($this->string,$this->pos,1) == '(') { |
||
| 3332 | $this->pos += 1; |
||
| 3333 | $result["text"] .= '('; |
||
| 3334 | } |
||
| 3335 | else { $_550 = FALSE; break; } |
||
| 3336 | $matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
||
| 3337 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3338 | if ($subres !== FALSE) { |
||
| 3339 | $this->store( $result, $subres ); |
||
| 3340 | } |
||
| 3341 | else { $_550 = FALSE; break; } |
||
| 3342 | $matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos; |
||
| 3343 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3344 | if ($subres !== FALSE) { |
||
| 3345 | $this->store( $result, $subres ); |
||
| 3346 | } |
||
| 3347 | else { $_550 = FALSE; break; } |
||
| 3348 | $res_543 = $result; |
||
| 3349 | $pos_543 = $this->pos; |
||
| 3350 | $_542 = NULL; |
||
| 3351 | do { |
||
| 3352 | $matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
||
| 3353 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3354 | if ($subres !== FALSE) { |
||
| 3355 | $this->store( $result, $subres ); |
||
| 3356 | } |
||
| 3357 | else { $_542 = FALSE; break; } |
||
| 3358 | if (substr($this->string,$this->pos,1) == ',') { |
||
| 3359 | $this->pos += 1; |
||
| 3360 | $result["text"] .= ','; |
||
| 3361 | } |
||
| 3362 | else { $_542 = FALSE; break; } |
||
| 3363 | $matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
||
| 3364 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3365 | if ($subres !== FALSE) { |
||
| 3366 | $this->store( $result, $subres ); |
||
| 3367 | } |
||
| 3368 | else { $_542 = FALSE; break; } |
||
| 3369 | $matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
||
| 3370 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3371 | if ($subres !== FALSE) { |
||
| 3372 | $this->store( $result, $subres ); |
||
| 3373 | } |
||
| 3374 | else { $_542 = FALSE; break; } |
||
| 3375 | $_542 = TRUE; break; |
||
| 3376 | } |
||
| 3377 | while(0); |
||
| 3378 | if( $_542 === FALSE) { |
||
| 3379 | $result = $res_543; |
||
| 3380 | $this->pos = $pos_543; |
||
| 3381 | unset( $res_543 ); |
||
| 3382 | unset( $pos_543 ); |
||
| 3383 | } |
||
| 3384 | $matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
||
| 3385 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3386 | if ($subres !== FALSE) { |
||
| 3387 | $this->store( $result, $subres ); |
||
| 3388 | } |
||
| 3389 | else { $_550 = FALSE; break; } |
||
| 3390 | if (substr($this->string,$this->pos,1) == ')') { |
||
| 3391 | $this->pos += 1; |
||
| 3392 | $result["text"] .= ')'; |
||
| 3393 | } |
||
| 3394 | else { $_550 = FALSE; break; } |
||
| 3395 | $matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos; |
||
| 3396 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3397 | if ($subres !== FALSE) { |
||
| 3398 | $this->store( $result, $subres ); |
||
| 3399 | } |
||
| 3400 | else { $_550 = FALSE; break; } |
||
| 3401 | $res_549 = $result; |
||
| 3402 | $pos_549 = $this->pos; |
||
| 3403 | $_548 = NULL; |
||
| 3404 | do { |
||
| 3405 | if (substr($this->string,$this->pos,1) == ';') { |
||
| 3406 | $this->pos += 1; |
||
| 3407 | $result["text"] .= ';'; |
||
| 3408 | } |
||
| 3409 | else { $_548 = FALSE; break; } |
||
| 3410 | $_548 = TRUE; break; |
||
| 3411 | } |
||
| 3412 | while(0); |
||
| 3413 | if( $_548 === FALSE) { |
||
| 3414 | $result = $res_549; |
||
| 3415 | $this->pos = $pos_549; |
||
| 3416 | unset( $res_549 ); |
||
| 3417 | unset( $pos_549 ); |
||
| 3418 | } |
||
| 3419 | $_550 = TRUE; break; |
||
| 3420 | } |
||
| 3421 | while(0); |
||
| 3422 | if( $_550 === TRUE ) { return $this->finalise($result); } |
||
| 3423 | if( $_550 === FALSE) { return FALSE; } |
||
| 3424 | } |
||
| 3425 | |||
| 3426 | |||
| 3427 | /* N: / [\s\n]* / */ |
||
| 3428 | protected $match_N_typestack = array('N'); |
||
| 3429 | function match_N ($stack = array()) { |
||
| 3430 | $matchrule = "N"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3431 | if (( $subres = $this->rx( '/ [\s\n]* /' ) ) !== FALSE) { |
||
| 3432 | $result["text"] .= $subres; |
||
| 3433 | return $this->finalise($result); |
||
| 3434 | } |
||
| 3435 | else { return FALSE; } |
||
| 3436 | } |
||
| 3437 | |||
| 3438 | |||
| 3439 | |||
| 3440 | function OldTPart__construct(&$res) |
||
| 3441 | { |
||
| 3442 | $res['php'] = "_t("; |
||
| 3443 | } |
||
| 3444 | |||
| 3445 | function OldTPart_QuotedString(&$res, $sub) |
||
| 3446 | { |
||
| 3447 | $entity = $sub['String']['text']; |
||
| 3448 | if (strpos($entity, '.') === false) { |
||
| 3449 | $res['php'] .= "\$scope->XML_val('I18NNamespace').'.$entity'"; |
||
| 3450 | } else { |
||
| 3451 | $res['php'] .= "'$entity'"; |
||
| 3452 | } |
||
| 3453 | } |
||
| 3454 | |||
| 3455 | function OldTPart_CallArguments(&$res, $sub) |
||
| 3456 | { |
||
| 3457 | $res['php'] .= ',' . $sub['php']; |
||
| 3458 | } |
||
| 3459 | |||
| 3460 | function OldTPart__finalise(&$res) |
||
| 3461 | { |
||
| 3462 | $res['php'] .= ')'; |
||
| 3463 | } |
||
| 3464 | |||
| 3465 | /* OldTTag: "<%" < OldTPart > "%>" */ |
||
| 3466 | protected $match_OldTTag_typestack = array('OldTTag'); |
||
| 3467 | function match_OldTTag ($stack = array()) { |
||
| 3468 | $matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3469 | $_558 = NULL; |
||
| 3470 | do { |
||
| 3471 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3472 | else { $_558 = FALSE; break; } |
||
| 3473 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3474 | $matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos; |
||
| 3475 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3476 | if ($subres !== FALSE) { |
||
| 3477 | $this->store( $result, $subres ); |
||
| 3478 | } |
||
| 3479 | else { $_558 = FALSE; break; } |
||
| 3480 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3481 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3482 | else { $_558 = FALSE; break; } |
||
| 3483 | $_558 = TRUE; break; |
||
| 3484 | } |
||
| 3485 | while(0); |
||
| 3486 | if( $_558 === TRUE ) { return $this->finalise($result); } |
||
| 3487 | if( $_558 === FALSE) { return FALSE; } |
||
| 3488 | } |
||
| 3489 | |||
| 3490 | |||
| 3491 | |||
| 3492 | function OldTTag_OldTPart(&$res, $sub) |
||
| 3493 | { |
||
| 3494 | $res['php'] = $sub['php']; |
||
| 3495 | } |
||
| 3496 | |||
| 3497 | /* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */ |
||
| 3498 | protected $match_OldSprintfTag_typestack = array('OldSprintfTag'); |
||
| 3499 | function match_OldSprintfTag ($stack = array()) { |
||
| 3500 | $matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3501 | $_575 = NULL; |
||
| 3502 | do { |
||
| 3503 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3504 | else { $_575 = FALSE; break; } |
||
| 3505 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3506 | if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3507 | else { $_575 = FALSE; break; } |
||
| 3508 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3509 | if (substr($this->string,$this->pos,1) == '(') { |
||
| 3510 | $this->pos += 1; |
||
| 3511 | $result["text"] .= '('; |
||
| 3512 | } |
||
| 3513 | else { $_575 = FALSE; break; } |
||
| 3514 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3515 | $matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos; |
||
| 3516 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3517 | if ($subres !== FALSE) { |
||
| 3518 | $this->store( $result, $subres ); |
||
| 3519 | } |
||
| 3520 | else { $_575 = FALSE; break; } |
||
| 3521 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3522 | if (substr($this->string,$this->pos,1) == ',') { |
||
| 3523 | $this->pos += 1; |
||
| 3524 | $result["text"] .= ','; |
||
| 3525 | } |
||
| 3526 | else { $_575 = FALSE; break; } |
||
| 3527 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3528 | $matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos; |
||
| 3529 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3530 | if ($subres !== FALSE) { |
||
| 3531 | $this->store( $result, $subres ); |
||
| 3532 | } |
||
| 3533 | else { $_575 = FALSE; break; } |
||
| 3534 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3535 | if (substr($this->string,$this->pos,1) == ')') { |
||
| 3536 | $this->pos += 1; |
||
| 3537 | $result["text"] .= ')'; |
||
| 3538 | } |
||
| 3539 | else { $_575 = FALSE; break; } |
||
| 3540 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3541 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3542 | else { $_575 = FALSE; break; } |
||
| 3543 | $_575 = TRUE; break; |
||
| 3544 | } |
||
| 3545 | while(0); |
||
| 3546 | if( $_575 === TRUE ) { return $this->finalise($result); } |
||
| 3547 | if( $_575 === FALSE) { return FALSE; } |
||
| 3548 | } |
||
| 3549 | |||
| 3550 | |||
| 3551 | |||
| 3552 | function OldSprintfTag__construct(&$res) |
||
| 3553 | { |
||
| 3554 | $res['php'] = "sprintf("; |
||
| 3555 | } |
||
| 3556 | |||
| 3557 | function OldSprintfTag_OldTPart(&$res, $sub) |
||
| 3558 | { |
||
| 3559 | $res['php'] .= $sub['php']; |
||
| 3560 | } |
||
| 3561 | |||
| 3562 | function OldSprintfTag_CallArguments(&$res, $sub) |
||
| 3563 | { |
||
| 3564 | $res['php'] .= ',' . $sub['php'] . ')'; |
||
| 3565 | } |
||
| 3566 | |||
| 3567 | /* OldI18NTag: OldSprintfTag | OldTTag */ |
||
| 3568 | protected $match_OldI18NTag_typestack = array('OldI18NTag'); |
||
| 3569 | function match_OldI18NTag ($stack = array()) { |
||
| 3570 | $matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3571 | $_580 = NULL; |
||
| 3572 | do { |
||
| 3573 | $res_577 = $result; |
||
| 3574 | $pos_577 = $this->pos; |
||
| 3575 | $matcher = 'match_'.'OldSprintfTag'; $key = $matcher; $pos = $this->pos; |
||
| 3576 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3577 | if ($subres !== FALSE) { |
||
| 3578 | $this->store( $result, $subres ); |
||
| 3579 | $_580 = TRUE; break; |
||
| 3580 | } |
||
| 3581 | $result = $res_577; |
||
| 3582 | $this->pos = $pos_577; |
||
| 3583 | $matcher = 'match_'.'OldTTag'; $key = $matcher; $pos = $this->pos; |
||
| 3584 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3585 | if ($subres !== FALSE) { |
||
| 3586 | $this->store( $result, $subres ); |
||
| 3587 | $_580 = TRUE; break; |
||
| 3588 | } |
||
| 3589 | $result = $res_577; |
||
| 3590 | $this->pos = $pos_577; |
||
| 3591 | $_580 = FALSE; break; |
||
| 3592 | } |
||
| 3593 | while(0); |
||
| 3594 | if( $_580 === TRUE ) { return $this->finalise($result); } |
||
| 3595 | if( $_580 === FALSE) { return FALSE; } |
||
| 3596 | } |
||
| 3597 | |||
| 3598 | |||
| 3599 | |||
| 3600 | function OldI18NTag_STR(&$res, $sub) |
||
| 3601 | { |
||
| 3602 | $res['php'] = '$val .= ' . $sub['php'] . ';'; |
||
| 3603 | } |
||
| 3604 | |||
| 3605 | /* NamedArgument: Name:Word "=" Value:Argument */ |
||
| 3606 | protected $match_NamedArgument_typestack = array('NamedArgument'); |
||
| 3607 | function match_NamedArgument ($stack = array()) { |
||
| 3608 | $matchrule = "NamedArgument"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3609 | $_585 = NULL; |
||
| 3610 | do { |
||
| 3611 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 3612 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3613 | if ($subres !== FALSE) { |
||
| 3614 | $this->store( $result, $subres, "Name" ); |
||
| 3615 | } |
||
| 3616 | else { $_585 = FALSE; break; } |
||
| 3617 | if (substr($this->string,$this->pos,1) == '=') { |
||
| 3618 | $this->pos += 1; |
||
| 3619 | $result["text"] .= '='; |
||
| 3620 | } |
||
| 3621 | else { $_585 = FALSE; break; } |
||
| 3622 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 3623 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3624 | if ($subres !== FALSE) { |
||
| 3625 | $this->store( $result, $subres, "Value" ); |
||
| 3626 | } |
||
| 3627 | else { $_585 = FALSE; break; } |
||
| 3628 | $_585 = TRUE; break; |
||
| 3629 | } |
||
| 3630 | while(0); |
||
| 3631 | if( $_585 === TRUE ) { return $this->finalise($result); } |
||
| 3632 | if( $_585 === FALSE) { return FALSE; } |
||
| 3633 | } |
||
| 3634 | |||
| 3635 | |||
| 3636 | |||
| 3637 | function NamedArgument_Name(&$res, $sub) |
||
| 3638 | { |
||
| 3639 | $res['php'] = "'" . $sub['text'] . "' => "; |
||
| 3640 | } |
||
| 3641 | |||
| 3642 | function NamedArgument_Value(&$res, $sub) |
||
| 3643 | { |
||
| 3644 | switch ($sub['ArgumentMode']) { |
||
| 3645 | case 'string': |
||
| 3646 | $res['php'] .= $sub['php']; |
||
| 3647 | break; |
||
| 3648 | |||
| 3649 | case 'default': |
||
| 3650 | $res['php'] .= $sub['string_php']; |
||
| 3651 | break; |
||
| 3652 | |||
| 3653 | default: |
||
| 3654 | $res['php'] .= str_replace('$$FINAL', 'obj', $sub['php']) . '->self()'; |
||
| 3655 | break; |
||
| 3656 | } |
||
| 3657 | } |
||
| 3658 | |||
| 3659 | /* Include: "<%" < "include" < Template:NamespacedWord < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */ |
||
| 3660 | protected $match_Include_typestack = array('Include'); |
||
| 3661 | function match_Include ($stack = array()) { |
||
| 3662 | $matchrule = "Include"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3663 | $_604 = NULL; |
||
| 3664 | do { |
||
| 3665 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3666 | else { $_604 = FALSE; break; } |
||
| 3667 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3668 | if (( $subres = $this->literal( 'include' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3669 | else { $_604 = FALSE; break; } |
||
| 3670 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3671 | $matcher = 'match_'.'NamespacedWord'; $key = $matcher; $pos = $this->pos; |
||
| 3672 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3673 | if ($subres !== FALSE) { |
||
| 3674 | $this->store( $result, $subres, "Template" ); |
||
| 3675 | } |
||
| 3676 | else { $_604 = FALSE; break; } |
||
| 3677 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3678 | $res_601 = $result; |
||
| 3679 | $pos_601 = $this->pos; |
||
| 3680 | $_600 = NULL; |
||
| 3681 | do { |
||
| 3682 | $matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos; |
||
| 3683 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3684 | if ($subres !== FALSE) { |
||
| 3685 | $this->store( $result, $subres ); |
||
| 3686 | } |
||
| 3687 | else { $_600 = FALSE; break; } |
||
| 3688 | while (true) { |
||
| 3689 | $res_599 = $result; |
||
| 3690 | $pos_599 = $this->pos; |
||
| 3691 | $_598 = NULL; |
||
| 3692 | do { |
||
| 3693 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3694 | if (substr($this->string,$this->pos,1) == ',') { |
||
| 3695 | $this->pos += 1; |
||
| 3696 | $result["text"] .= ','; |
||
| 3697 | } |
||
| 3698 | else { $_598 = FALSE; break; } |
||
| 3699 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3700 | $matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos; |
||
| 3701 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3702 | if ($subres !== FALSE) { |
||
| 3703 | $this->store( $result, $subres ); |
||
| 3704 | } |
||
| 3705 | else { $_598 = FALSE; break; } |
||
| 3706 | $_598 = TRUE; break; |
||
| 3707 | } |
||
| 3708 | while(0); |
||
| 3709 | if( $_598 === FALSE) { |
||
| 3710 | $result = $res_599; |
||
| 3711 | $this->pos = $pos_599; |
||
| 3712 | unset( $res_599 ); |
||
| 3713 | unset( $pos_599 ); |
||
| 3714 | break; |
||
| 3715 | } |
||
| 3716 | } |
||
| 3717 | $_600 = TRUE; break; |
||
| 3718 | } |
||
| 3719 | while(0); |
||
| 3720 | if( $_600 === FALSE) { |
||
| 3721 | $result = $res_601; |
||
| 3722 | $this->pos = $pos_601; |
||
| 3723 | unset( $res_601 ); |
||
| 3724 | unset( $pos_601 ); |
||
| 3725 | } |
||
| 3726 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3727 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3728 | else { $_604 = FALSE; break; } |
||
| 3729 | $_604 = TRUE; break; |
||
| 3730 | } |
||
| 3731 | while(0); |
||
| 3732 | if( $_604 === TRUE ) { return $this->finalise($result); } |
||
| 3733 | if( $_604 === FALSE) { return FALSE; } |
||
| 3734 | } |
||
| 3735 | |||
| 3736 | |||
| 3737 | |||
| 3738 | function Include__construct(&$res) |
||
| 3739 | { |
||
| 3740 | $res['arguments'] = array(); |
||
| 3741 | } |
||
| 3742 | |||
| 3743 | function Include_Template(&$res, $sub) |
||
| 3744 | { |
||
| 3745 | $res['template'] = "'" . $sub['text'] . "'"; |
||
| 3746 | } |
||
| 3747 | |||
| 3748 | function Include_NamedArgument(&$res, $sub) |
||
| 3749 | { |
||
| 3750 | $res['arguments'][] = $sub['php']; |
||
| 3751 | } |
||
| 3752 | |||
| 3753 | function Include__finalise(&$res) |
||
| 3754 | { |
||
| 3755 | $template = $res['template']; |
||
| 3756 | $arguments = $res['arguments']; |
||
| 3757 | |||
| 3758 | // Note: 'type' here is important to disable subTemplates in SSViewer::getSubtemplateFor() |
||
| 3759 | $res['php'] = '$val .= \\SilverStripe\\View\\SSViewer::execute_template([["type" => "Includes", '.$template.'], '.$template.'], $scope->getItem(), array(' . |
||
| 3760 | implode(',', $arguments)."), \$scope, true);\n"; |
||
| 3761 | |||
| 3762 | if ($this->includeDebuggingComments) { // Add include filename comments on dev sites |
||
| 3763 | $res['php'] = |
||
| 3764 | '$val .= \'<!-- include '.addslashes($template).' -->\';'. "\n". |
||
| 3765 | $res['php']. |
||
| 3766 | '$val .= \'<!-- end include '.addslashes($template).' -->\';'. "\n"; |
||
| 3767 | } |
||
| 3768 | } |
||
| 3769 | |||
| 3770 | /* BlockArguments: :Argument ( < "," < :Argument)* */ |
||
| 3771 | protected $match_BlockArguments_typestack = array('BlockArguments'); |
||
| 3772 | function match_BlockArguments ($stack = array()) { |
||
| 3773 | $matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3774 | $_613 = NULL; |
||
| 3775 | do { |
||
| 3776 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 3777 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3778 | if ($subres !== FALSE) { |
||
| 3779 | $this->store( $result, $subres, "Argument" ); |
||
| 3780 | } |
||
| 3781 | else { $_613 = FALSE; break; } |
||
| 3782 | while (true) { |
||
| 3783 | $res_612 = $result; |
||
| 3784 | $pos_612 = $this->pos; |
||
| 3785 | $_611 = NULL; |
||
| 3786 | do { |
||
| 3787 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3788 | if (substr($this->string,$this->pos,1) == ',') { |
||
| 3789 | $this->pos += 1; |
||
| 3790 | $result["text"] .= ','; |
||
| 3791 | } |
||
| 3792 | else { $_611 = FALSE; break; } |
||
| 3793 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3794 | $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos; |
||
| 3795 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3796 | if ($subres !== FALSE) { |
||
| 3797 | $this->store( $result, $subres, "Argument" ); |
||
| 3798 | } |
||
| 3799 | else { $_611 = FALSE; break; } |
||
| 3800 | $_611 = TRUE; break; |
||
| 3801 | } |
||
| 3802 | while(0); |
||
| 3803 | if( $_611 === FALSE) { |
||
| 3804 | $result = $res_612; |
||
| 3805 | $this->pos = $pos_612; |
||
| 3806 | unset( $res_612 ); |
||
| 3807 | unset( $pos_612 ); |
||
| 3808 | break; |
||
| 3809 | } |
||
| 3810 | } |
||
| 3811 | $_613 = TRUE; break; |
||
| 3812 | } |
||
| 3813 | while(0); |
||
| 3814 | if( $_613 === TRUE ) { return $this->finalise($result); } |
||
| 3815 | if( $_613 === FALSE) { return FALSE; } |
||
| 3816 | } |
||
| 3817 | |||
| 3818 | |||
| 3819 | /* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock" | "include")]) */ |
||
| 3820 | protected $match_NotBlockTag_typestack = array('NotBlockTag'); |
||
| 3821 | function match_NotBlockTag ($stack = array()) { |
||
| 3822 | $matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3823 | $_651 = NULL; |
||
| 3824 | do { |
||
| 3825 | $res_615 = $result; |
||
| 3826 | $pos_615 = $this->pos; |
||
| 3827 | if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { |
||
| 3828 | $result["text"] .= $subres; |
||
| 3829 | $_651 = TRUE; break; |
||
| 3830 | } |
||
| 3831 | $result = $res_615; |
||
| 3832 | $this->pos = $pos_615; |
||
| 3833 | $_649 = NULL; |
||
| 3834 | do { |
||
| 3835 | $_646 = NULL; |
||
| 3836 | do { |
||
| 3837 | $_644 = NULL; |
||
| 3838 | do { |
||
| 3839 | $res_617 = $result; |
||
| 3840 | $pos_617 = $this->pos; |
||
| 3841 | if (( $subres = $this->literal( 'if' ) ) !== FALSE) { |
||
| 3842 | $result["text"] .= $subres; |
||
| 3843 | $_644 = TRUE; break; |
||
| 3844 | } |
||
| 3845 | $result = $res_617; |
||
| 3846 | $this->pos = $pos_617; |
||
| 3847 | $_642 = NULL; |
||
| 3848 | do { |
||
| 3849 | $res_619 = $result; |
||
| 3850 | $pos_619 = $this->pos; |
||
| 3851 | if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { |
||
| 3852 | $result["text"] .= $subres; |
||
| 3853 | $_642 = TRUE; break; |
||
| 3854 | } |
||
| 3855 | $result = $res_619; |
||
| 3856 | $this->pos = $pos_619; |
||
| 3857 | $_640 = NULL; |
||
| 3858 | do { |
||
| 3859 | $res_621 = $result; |
||
| 3860 | $pos_621 = $this->pos; |
||
| 3861 | if (( $subres = $this->literal( 'else' ) ) !== FALSE) { |
||
| 3862 | $result["text"] .= $subres; |
||
| 3863 | $_640 = TRUE; break; |
||
| 3864 | } |
||
| 3865 | $result = $res_621; |
||
| 3866 | $this->pos = $pos_621; |
||
| 3867 | $_638 = NULL; |
||
| 3868 | do { |
||
| 3869 | $res_623 = $result; |
||
| 3870 | $pos_623 = $this->pos; |
||
| 3871 | if (( $subres = $this->literal( 'require' ) ) !== FALSE) { |
||
| 3872 | $result["text"] .= $subres; |
||
| 3873 | $_638 = TRUE; break; |
||
| 3874 | } |
||
| 3875 | $result = $res_623; |
||
| 3876 | $this->pos = $pos_623; |
||
| 3877 | $_636 = NULL; |
||
| 3878 | do { |
||
| 3879 | $res_625 = $result; |
||
| 3880 | $pos_625 = $this->pos; |
||
| 3881 | if (( $subres = $this->literal( 'cached' ) ) !== FALSE) { |
||
| 3882 | $result["text"] .= $subres; |
||
| 3883 | $_636 = TRUE; break; |
||
| 3884 | } |
||
| 3885 | $result = $res_625; |
||
| 3886 | $this->pos = $pos_625; |
||
| 3887 | $_634 = NULL; |
||
| 3888 | do { |
||
| 3889 | $res_627 = $result; |
||
| 3890 | $pos_627 = $this->pos; |
||
| 3891 | if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { |
||
| 3892 | $result["text"] .= $subres; |
||
| 3893 | $_634 = TRUE; break; |
||
| 3894 | } |
||
| 3895 | $result = $res_627; |
||
| 3896 | $this->pos = $pos_627; |
||
| 3897 | $_632 = NULL; |
||
| 3898 | do { |
||
| 3899 | $res_629 = $result; |
||
| 3900 | $pos_629 = $this->pos; |
||
| 3901 | if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) { |
||
| 3902 | $result["text"] .= $subres; |
||
| 3903 | $_632 = TRUE; break; |
||
| 3904 | } |
||
| 3905 | $result = $res_629; |
||
| 3906 | $this->pos = $pos_629; |
||
| 3907 | if (( $subres = $this->literal( 'include' ) ) !== FALSE) { |
||
| 3908 | $result["text"] .= $subres; |
||
| 3909 | $_632 = TRUE; break; |
||
| 3910 | } |
||
| 3911 | $result = $res_629; |
||
| 3912 | $this->pos = $pos_629; |
||
| 3913 | $_632 = FALSE; break; |
||
| 3914 | } |
||
| 3915 | while(0); |
||
| 3916 | if( $_632 === TRUE ) { $_634 = TRUE; break; } |
||
| 3917 | $result = $res_627; |
||
| 3918 | $this->pos = $pos_627; |
||
| 3919 | $_634 = FALSE; break; |
||
| 3920 | } |
||
| 3921 | while(0); |
||
| 3922 | if( $_634 === TRUE ) { $_636 = TRUE; break; } |
||
| 3923 | $result = $res_625; |
||
| 3924 | $this->pos = $pos_625; |
||
| 3925 | $_636 = FALSE; break; |
||
| 3926 | } |
||
| 3927 | while(0); |
||
| 3928 | if( $_636 === TRUE ) { $_638 = TRUE; break; } |
||
| 3929 | $result = $res_623; |
||
| 3930 | $this->pos = $pos_623; |
||
| 3931 | $_638 = FALSE; break; |
||
| 3932 | } |
||
| 3933 | while(0); |
||
| 3934 | if( $_638 === TRUE ) { $_640 = TRUE; break; } |
||
| 3935 | $result = $res_621; |
||
| 3936 | $this->pos = $pos_621; |
||
| 3937 | $_640 = FALSE; break; |
||
| 3938 | } |
||
| 3939 | while(0); |
||
| 3940 | if( $_640 === TRUE ) { $_642 = TRUE; break; } |
||
| 3941 | $result = $res_619; |
||
| 3942 | $this->pos = $pos_619; |
||
| 3943 | $_642 = FALSE; break; |
||
| 3944 | } |
||
| 3945 | while(0); |
||
| 3946 | if( $_642 === TRUE ) { $_644 = TRUE; break; } |
||
| 3947 | $result = $res_617; |
||
| 3948 | $this->pos = $pos_617; |
||
| 3949 | $_644 = FALSE; break; |
||
| 3950 | } |
||
| 3951 | while(0); |
||
| 3952 | if( $_644 === FALSE) { $_646 = FALSE; break; } |
||
| 3953 | $_646 = TRUE; break; |
||
| 3954 | } |
||
| 3955 | while(0); |
||
| 3956 | if( $_646 === FALSE) { $_649 = FALSE; break; } |
||
| 3957 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3958 | else { $_649 = FALSE; break; } |
||
| 3959 | $_649 = TRUE; break; |
||
| 3960 | } |
||
| 3961 | while(0); |
||
| 3962 | if( $_649 === TRUE ) { $_651 = TRUE; break; } |
||
| 3963 | $result = $res_615; |
||
| 3964 | $this->pos = $pos_615; |
||
| 3965 | $_651 = FALSE; break; |
||
| 3966 | } |
||
| 3967 | while(0); |
||
| 3968 | if( $_651 === TRUE ) { return $this->finalise($result); } |
||
| 3969 | if( $_651 === FALSE) { return FALSE; } |
||
| 3970 | } |
||
| 3971 | |||
| 3972 | |||
| 3973 | /* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? |
||
| 3974 | '<%' < 'end_' '$BlockName' > '%>' */ |
||
| 3975 | protected $match_ClosedBlock_typestack = array('ClosedBlock'); |
||
| 3976 | function match_ClosedBlock ($stack = array()) { |
||
| 3977 | $matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 3978 | $_671 = NULL; |
||
| 3979 | do { |
||
| 3980 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3981 | else { $_671 = FALSE; break; } |
||
| 3982 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 3983 | $res_655 = $result; |
||
| 3984 | $pos_655 = $this->pos; |
||
| 3985 | $matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos; |
||
| 3986 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3987 | if ($subres !== FALSE) { |
||
| 3988 | $this->store( $result, $subres ); |
||
| 3989 | $result = $res_655; |
||
| 3990 | $this->pos = $pos_655; |
||
| 3991 | $_671 = FALSE; break; |
||
| 3992 | } |
||
| 3993 | else { |
||
| 3994 | $result = $res_655; |
||
| 3995 | $this->pos = $pos_655; |
||
| 3996 | } |
||
| 3997 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 3998 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 3999 | if ($subres !== FALSE) { |
||
| 4000 | $this->store( $result, $subres, "BlockName" ); |
||
| 4001 | } |
||
| 4002 | else { $_671 = FALSE; break; } |
||
| 4003 | $res_661 = $result; |
||
| 4004 | $pos_661 = $this->pos; |
||
| 4005 | $_660 = NULL; |
||
| 4006 | do { |
||
| 4007 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4008 | else { $_660 = FALSE; break; } |
||
| 4009 | $matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos; |
||
| 4010 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4011 | if ($subres !== FALSE) { |
||
| 4012 | $this->store( $result, $subres, "BlockArguments" ); |
||
| 4013 | } |
||
| 4014 | else { $_660 = FALSE; break; } |
||
| 4015 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4016 | else { $_660 = FALSE; break; } |
||
| 4017 | $_660 = TRUE; break; |
||
| 4018 | } |
||
| 4019 | while(0); |
||
| 4020 | if( $_660 === FALSE) { |
||
| 4021 | $result = $res_661; |
||
| 4022 | $this->pos = $pos_661; |
||
| 4023 | unset( $res_661 ); |
||
| 4024 | unset( $pos_661 ); |
||
| 4025 | } |
||
| 4026 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4027 | $stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); |
||
| 4028 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { |
||
| 4029 | $result["text"] .= $subres; |
||
| 4030 | $subres = $result; $result = array_pop($stack); |
||
| 4031 | $this->store( $result, $subres, 'Zap' ); |
||
| 4032 | } |
||
| 4033 | else { |
||
| 4034 | $result = array_pop($stack); |
||
| 4035 | $_671 = FALSE; break; |
||
| 4036 | } |
||
| 4037 | $res_664 = $result; |
||
| 4038 | $pos_664 = $this->pos; |
||
| 4039 | $matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos; |
||
| 4040 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4041 | if ($subres !== FALSE) { |
||
| 4042 | $this->store( $result, $subres, "Template" ); |
||
| 4043 | } |
||
| 4044 | else { |
||
| 4045 | $result = $res_664; |
||
| 4046 | $this->pos = $pos_664; |
||
| 4047 | unset( $res_664 ); |
||
| 4048 | unset( $pos_664 ); |
||
| 4049 | } |
||
| 4050 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4051 | else { $_671 = FALSE; break; } |
||
| 4052 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4053 | if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4054 | else { $_671 = FALSE; break; } |
||
| 4055 | if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4056 | else { $_671 = FALSE; break; } |
||
| 4057 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4058 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4059 | else { $_671 = FALSE; break; } |
||
| 4060 | $_671 = TRUE; break; |
||
| 4061 | } |
||
| 4062 | while(0); |
||
| 4063 | if( $_671 === TRUE ) { return $this->finalise($result); } |
||
| 4064 | if( $_671 === FALSE) { return FALSE; } |
||
| 4065 | } |
||
| 4066 | |||
| 4067 | |||
| 4068 | |||
| 4069 | |||
| 4070 | /** |
||
| 4071 | * As mentioned in the parser comment, block handling is kept fairly generic for extensibility. The match rule |
||
| 4072 | * builds up two important elements in the match result array: |
||
| 4073 | * 'ArgumentCount' - how many arguments were passed in the opening tag |
||
| 4074 | * 'Arguments' an array of the Argument match rule result arrays |
||
| 4075 | * |
||
| 4076 | * Once a block has successfully been matched against, it will then look for the actual handler, which should |
||
| 4077 | * be on this class (either defined or extended on) as ClosedBlock_Handler_Name(&$res), where Name is the |
||
| 4078 | * tag name, first letter captialized (i.e Control, Loop, With, etc). |
||
| 4079 | * |
||
| 4080 | * This function will be called with the match rule result array as it's first argument. It should return |
||
| 4081 | * the php result of this block as it's return value, or throw an error if incorrect arguments were passed. |
||
| 4082 | */ |
||
| 4083 | |||
| 4084 | function ClosedBlock__construct(&$res) |
||
| 4085 | { |
||
| 4086 | $res['ArgumentCount'] = 0; |
||
| 4087 | } |
||
| 4088 | |||
| 4089 | function ClosedBlock_BlockArguments(&$res, $sub) |
||
| 4090 | { |
||
| 4091 | if (isset($sub['Argument']['ArgumentMode'])) { |
||
| 4092 | $res['Arguments'] = array($sub['Argument']); |
||
| 4093 | $res['ArgumentCount'] = 1; |
||
| 4094 | } else { |
||
| 4095 | $res['Arguments'] = $sub['Argument']; |
||
| 4096 | $res['ArgumentCount'] = count($res['Arguments']); |
||
| 4097 | } |
||
| 4098 | } |
||
| 4099 | |||
| 4100 | function ClosedBlock__finalise(&$res) |
||
| 4101 | { |
||
| 4102 | $blockname = $res['BlockName']['text']; |
||
| 4103 | |||
| 4104 | $method = 'ClosedBlock_Handle_'.$blockname; |
||
| 4105 | if (method_exists($this, $method)) { |
||
| 4106 | $res['php'] = $this->$method($res); |
||
| 4107 | } elseif (isset($this->closedBlocks[$blockname])) { |
||
| 4108 | $res['php'] = call_user_func($this->closedBlocks[$blockname], $res); |
||
| 4109 | } else { |
||
| 4110 | throw new SSTemplateParseException('Unknown closed block "'.$blockname.'" encountered. Perhaps you are ' . |
||
| 4111 | 'not supposed to close this block, or have mis-spelled it?', $this); |
||
| 4112 | } |
||
| 4113 | } |
||
| 4114 | |||
| 4115 | /** |
||
| 4116 | * This is an example of a block handler function. This one handles the loop tag. |
||
| 4117 | */ |
||
| 4118 | function ClosedBlock_Handle_Loop(&$res) |
||
| 4144 | } |
||
| 4145 | |||
| 4146 | /** |
||
| 4147 | * The closed block handler for with blocks |
||
| 4148 | */ |
||
| 4149 | function ClosedBlock_Handle_With(&$res) |
||
| 4150 | { |
||
| 4151 | if ($res['ArgumentCount'] != 1) { |
||
| 4152 | throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' . |
||
| 4153 | 'argument only.', $this); |
||
| 4154 | } |
||
| 4155 | |||
| 4156 | $arg = $res['Arguments'][0]; |
||
| 4157 | if ($arg['ArgumentMode'] == 'string') { |
||
| 4158 | throw new SSTemplateParseException('Control block cant take string as argument.', $this); |
||
| 4159 | } |
||
| 4160 | |||
| 4161 | $on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']); |
||
| 4162 | return |
||
| 4163 | $on . '; $scope->pushScope();' . PHP_EOL . |
||
| 4164 | $res['Template']['php'] . PHP_EOL . |
||
| 4165 | '; $scope->popScope(); '; |
||
| 4166 | } |
||
| 4167 | |||
| 4168 | /* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */ |
||
| 4169 | protected $match_OpenBlock_typestack = array('OpenBlock'); |
||
| 4170 | function match_OpenBlock ($stack = array()) { |
||
| 4171 | $matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 4172 | $_684 = NULL; |
||
| 4173 | do { |
||
| 4174 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4175 | else { $_684 = FALSE; break; } |
||
| 4176 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4177 | $res_675 = $result; |
||
| 4178 | $pos_675 = $this->pos; |
||
| 4179 | $matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos; |
||
| 4180 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4181 | if ($subres !== FALSE) { |
||
| 4182 | $this->store( $result, $subres ); |
||
| 4183 | $result = $res_675; |
||
| 4184 | $this->pos = $pos_675; |
||
| 4185 | $_684 = FALSE; break; |
||
| 4186 | } |
||
| 4187 | else { |
||
| 4188 | $result = $res_675; |
||
| 4189 | $this->pos = $pos_675; |
||
| 4190 | } |
||
| 4191 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 4192 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4193 | if ($subres !== FALSE) { |
||
| 4194 | $this->store( $result, $subres, "BlockName" ); |
||
| 4195 | } |
||
| 4196 | else { $_684 = FALSE; break; } |
||
| 4197 | $res_681 = $result; |
||
| 4198 | $pos_681 = $this->pos; |
||
| 4199 | $_680 = NULL; |
||
| 4200 | do { |
||
| 4201 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4202 | else { $_680 = FALSE; break; } |
||
| 4203 | $matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos; |
||
| 4204 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4205 | if ($subres !== FALSE) { |
||
| 4206 | $this->store( $result, $subres, "BlockArguments" ); |
||
| 4207 | } |
||
| 4208 | else { $_680 = FALSE; break; } |
||
| 4209 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4210 | else { $_680 = FALSE; break; } |
||
| 4211 | $_680 = TRUE; break; |
||
| 4212 | } |
||
| 4213 | while(0); |
||
| 4214 | if( $_680 === FALSE) { |
||
| 4215 | $result = $res_681; |
||
| 4216 | $this->pos = $pos_681; |
||
| 4217 | unset( $res_681 ); |
||
| 4218 | unset( $pos_681 ); |
||
| 4219 | } |
||
| 4220 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4221 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4222 | else { $_684 = FALSE; break; } |
||
| 4223 | $_684 = TRUE; break; |
||
| 4224 | } |
||
| 4225 | while(0); |
||
| 4226 | if( $_684 === TRUE ) { return $this->finalise($result); } |
||
| 4227 | if( $_684 === FALSE) { return FALSE; } |
||
| 4228 | } |
||
| 4229 | |||
| 4230 | |||
| 4231 | |||
| 4232 | function OpenBlock__construct(&$res) |
||
| 4233 | { |
||
| 4234 | $res['ArgumentCount'] = 0; |
||
| 4235 | } |
||
| 4236 | |||
| 4237 | function OpenBlock_BlockArguments(&$res, $sub) |
||
| 4238 | { |
||
| 4239 | if (isset($sub['Argument']['ArgumentMode'])) { |
||
| 4240 | $res['Arguments'] = array($sub['Argument']); |
||
| 4241 | $res['ArgumentCount'] = 1; |
||
| 4242 | } else { |
||
| 4243 | $res['Arguments'] = $sub['Argument']; |
||
| 4244 | $res['ArgumentCount'] = count($res['Arguments']); |
||
| 4245 | } |
||
| 4246 | } |
||
| 4247 | |||
| 4248 | function OpenBlock__finalise(&$res) |
||
| 4249 | { |
||
| 4250 | $blockname = $res['BlockName']['text']; |
||
| 4251 | |||
| 4252 | $method = 'OpenBlock_Handle_'.$blockname; |
||
| 4253 | if (method_exists($this, $method)) { |
||
| 4254 | $res['php'] = $this->$method($res); |
||
| 4255 | } elseif (isset($this->openBlocks[$blockname])) { |
||
| 4256 | $res['php'] = call_user_func($this->openBlocks[$blockname], $res); |
||
| 4257 | } else { |
||
| 4258 | throw new SSTemplateParseException('Unknown open block "'.$blockname.'" encountered. Perhaps you missed ' . |
||
| 4259 | ' the closing tag or have mis-spelled it?', $this); |
||
| 4260 | } |
||
| 4261 | } |
||
| 4262 | |||
| 4263 | /** |
||
| 4264 | * This is an open block handler, for the <% debug %> utility tag |
||
| 4265 | */ |
||
| 4266 | function OpenBlock_Handle_Debug(&$res) |
||
| 4267 | { |
||
| 4268 | if ($res['ArgumentCount'] == 0) { |
||
| 4269 | return '$scope->debug();'; |
||
| 4270 | } elseif ($res['ArgumentCount'] == 1) { |
||
| 4271 | $arg = $res['Arguments'][0]; |
||
| 4272 | |||
| 4273 | if ($arg['ArgumentMode'] == 'string') { |
||
| 4274 | return 'Debug::show('.$arg['php'].');'; |
||
| 4275 | } |
||
| 4276 | |||
| 4277 | $php = ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']; |
||
| 4278 | return '$val .= Debug::show('.str_replace('FINALGET!', 'cachedCall', $php).');'; |
||
| 4279 | } else { |
||
| 4280 | throw new SSTemplateParseException('Debug takes 0 or 1 argument only.', $this); |
||
| 4281 | } |
||
| 4282 | } |
||
| 4283 | |||
| 4284 | /** |
||
| 4285 | * This is an open block handler, for the <% base_tag %> tag |
||
| 4286 | */ |
||
| 4287 | function OpenBlock_Handle_Base_tag(&$res) |
||
| 4288 | { |
||
| 4289 | if ($res['ArgumentCount'] != 0) { |
||
| 4290 | throw new SSTemplateParseException('Base_tag takes no arguments', $this); |
||
| 4291 | } |
||
| 4292 | return '$val .= \\SilverStripe\\View\\SSViewer::get_base_tag($val);'; |
||
| 4293 | } |
||
| 4294 | |||
| 4295 | /** |
||
| 4296 | * This is an open block handler, for the <% current_page %> tag |
||
| 4297 | */ |
||
| 4298 | function OpenBlock_Handle_Current_page(&$res) |
||
| 4304 | } |
||
| 4305 | |||
| 4306 | /* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */ |
||
| 4307 | protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock'); |
||
| 4308 | function match_MismatchedEndBlock ($stack = array()) { |
||
| 4309 | $matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 4310 | $_692 = NULL; |
||
| 4311 | do { |
||
| 4312 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4313 | else { $_692 = FALSE; break; } |
||
| 4314 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4315 | if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4316 | else { $_692 = FALSE; break; } |
||
| 4317 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 4318 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4319 | if ($subres !== FALSE) { |
||
| 4320 | $this->store( $result, $subres, "Word" ); |
||
| 4321 | } |
||
| 4322 | else { $_692 = FALSE; break; } |
||
| 4323 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4324 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4325 | else { $_692 = FALSE; break; } |
||
| 4326 | $_692 = TRUE; break; |
||
| 4327 | } |
||
| 4328 | while(0); |
||
| 4329 | if( $_692 === TRUE ) { return $this->finalise($result); } |
||
| 4330 | if( $_692 === FALSE) { return FALSE; } |
||
| 4331 | } |
||
| 4332 | |||
| 4333 | |||
| 4334 | |||
| 4335 | function MismatchedEndBlock__finalise(&$res) |
||
| 4336 | { |
||
| 4337 | $blockname = $res['Word']['text']; |
||
| 4338 | throw new SSTemplateParseException('Unexpected close tag end_' . $blockname . |
||
| 4339 | ' encountered. Perhaps you have mis-nested blocks, or have mis-spelled a tag?', $this); |
||
| 4340 | } |
||
| 4341 | |||
| 4342 | /* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */ |
||
| 4343 | protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag'); |
||
| 4344 | function match_MalformedOpenTag ($stack = array()) { |
||
| 4345 | $matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 4346 | $_707 = NULL; |
||
| 4347 | do { |
||
| 4348 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4349 | else { $_707 = FALSE; break; } |
||
| 4350 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4351 | $res_696 = $result; |
||
| 4352 | $pos_696 = $this->pos; |
||
| 4353 | $matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos; |
||
| 4354 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4355 | if ($subres !== FALSE) { |
||
| 4356 | $this->store( $result, $subres ); |
||
| 4357 | $result = $res_696; |
||
| 4358 | $this->pos = $pos_696; |
||
| 4359 | $_707 = FALSE; break; |
||
| 4360 | } |
||
| 4361 | else { |
||
| 4362 | $result = $res_696; |
||
| 4363 | $this->pos = $pos_696; |
||
| 4364 | } |
||
| 4365 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 4366 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4367 | if ($subres !== FALSE) { |
||
| 4368 | $this->store( $result, $subres, "Tag" ); |
||
| 4369 | } |
||
| 4370 | else { $_707 = FALSE; break; } |
||
| 4371 | $res_706 = $result; |
||
| 4372 | $pos_706 = $this->pos; |
||
| 4373 | $_705 = NULL; |
||
| 4374 | do { |
||
| 4375 | $res_702 = $result; |
||
| 4376 | $pos_702 = $this->pos; |
||
| 4377 | $_701 = NULL; |
||
| 4378 | do { |
||
| 4379 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4380 | else { $_701 = FALSE; break; } |
||
| 4381 | $matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos; |
||
| 4382 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4383 | if ($subres !== FALSE) { |
||
| 4384 | $this->store( $result, $subres, "BlockArguments" ); |
||
| 4385 | } |
||
| 4386 | else { $_701 = FALSE; break; } |
||
| 4387 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4388 | else { $_701 = FALSE; break; } |
||
| 4389 | $_701 = TRUE; break; |
||
| 4390 | } |
||
| 4391 | while(0); |
||
| 4392 | if( $_701 === FALSE) { |
||
| 4393 | $result = $res_702; |
||
| 4394 | $this->pos = $pos_702; |
||
| 4395 | unset( $res_702 ); |
||
| 4396 | unset( $pos_702 ); |
||
| 4397 | } |
||
| 4398 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4399 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4400 | else { $_705 = FALSE; break; } |
||
| 4401 | $_705 = TRUE; break; |
||
| 4402 | } |
||
| 4403 | while(0); |
||
| 4404 | if( $_705 === TRUE ) { |
||
| 4405 | $result = $res_706; |
||
| 4406 | $this->pos = $pos_706; |
||
| 4407 | $_707 = FALSE; break; |
||
| 4408 | } |
||
| 4409 | if( $_705 === FALSE) { |
||
| 4410 | $result = $res_706; |
||
| 4411 | $this->pos = $pos_706; |
||
| 4412 | } |
||
| 4413 | $_707 = TRUE; break; |
||
| 4414 | } |
||
| 4415 | while(0); |
||
| 4416 | if( $_707 === TRUE ) { return $this->finalise($result); } |
||
| 4417 | if( $_707 === FALSE) { return FALSE; } |
||
| 4418 | } |
||
| 4419 | |||
| 4420 | |||
| 4421 | |||
| 4422 | function MalformedOpenTag__finalise(&$res) |
||
| 4423 | { |
||
| 4424 | $tag = $res['Tag']['text']; |
||
| 4425 | throw new SSTemplateParseException("Malformed opening block tag $tag. Perhaps you have tried to use operators?", $this); |
||
| 4426 | } |
||
| 4427 | |||
| 4428 | /* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */ |
||
| 4429 | protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag'); |
||
| 4430 | function match_MalformedCloseTag ($stack = array()) { |
||
| 4431 | $matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 4432 | $_719 = NULL; |
||
| 4433 | do { |
||
| 4434 | if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4435 | else { $_719 = FALSE; break; } |
||
| 4436 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4437 | $stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); |
||
| 4438 | $_713 = NULL; |
||
| 4439 | do { |
||
| 4440 | if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4441 | else { $_713 = FALSE; break; } |
||
| 4442 | $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos; |
||
| 4443 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4444 | if ($subres !== FALSE) { |
||
| 4445 | $this->store( $result, $subres, "Word" ); |
||
| 4446 | } |
||
| 4447 | else { $_713 = FALSE; break; } |
||
| 4448 | $_713 = TRUE; break; |
||
| 4449 | } |
||
| 4450 | while(0); |
||
| 4451 | if( $_713 === TRUE ) { |
||
| 4452 | $subres = $result; $result = array_pop($stack); |
||
| 4453 | $this->store( $result, $subres, 'Tag' ); |
||
| 4454 | } |
||
| 4455 | if( $_713 === FALSE) { |
||
| 4456 | $result = array_pop($stack); |
||
| 4457 | $_719 = FALSE; break; |
||
| 4458 | } |
||
| 4459 | $res_718 = $result; |
||
| 4460 | $pos_718 = $this->pos; |
||
| 4461 | $_717 = NULL; |
||
| 4462 | do { |
||
| 4463 | if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4464 | if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; } |
||
| 4465 | else { $_717 = FALSE; break; } |
||
| 4466 | $_717 = TRUE; break; |
||
| 4467 | } |
||
| 4468 | while(0); |
||
| 4469 | if( $_717 === TRUE ) { |
||
| 4470 | $result = $res_718; |
||
| 4471 | $this->pos = $pos_718; |
||
| 4472 | $_719 = FALSE; break; |
||
| 4473 | } |
||
| 4474 | if( $_717 === FALSE) { |
||
| 4475 | $result = $res_718; |
||
| 4476 | $this->pos = $pos_718; |
||
| 4477 | } |
||
| 4478 | $_719 = TRUE; break; |
||
| 4479 | } |
||
| 4480 | while(0); |
||
| 4481 | if( $_719 === TRUE ) { return $this->finalise($result); } |
||
| 4482 | if( $_719 === FALSE) { return FALSE; } |
||
| 4483 | } |
||
| 4484 | |||
| 4485 | |||
| 4486 | |||
| 4487 | function MalformedCloseTag__finalise(&$res) |
||
| 4492 | } |
||
| 4493 | |||
| 4494 | /* MalformedBlock: MalformedOpenTag | MalformedCloseTag */ |
||
| 4495 | protected $match_MalformedBlock_typestack = array('MalformedBlock'); |
||
| 4496 | function match_MalformedBlock ($stack = array()) { |
||
| 4497 | $matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 4498 | $_724 = NULL; |
||
| 4499 | do { |
||
| 4500 | $res_721 = $result; |
||
| 4501 | $pos_721 = $this->pos; |
||
| 4502 | $matcher = 'match_'.'MalformedOpenTag'; $key = $matcher; $pos = $this->pos; |
||
| 4503 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4504 | if ($subres !== FALSE) { |
||
| 4505 | $this->store( $result, $subres ); |
||
| 4506 | $_724 = TRUE; break; |
||
| 4507 | } |
||
| 4508 | $result = $res_721; |
||
| 4509 | $this->pos = $pos_721; |
||
| 4510 | $matcher = 'match_'.'MalformedCloseTag'; $key = $matcher; $pos = $this->pos; |
||
| 4511 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4512 | if ($subres !== FALSE) { |
||
| 4513 | $this->store( $result, $subres ); |
||
| 4514 | $_724 = TRUE; break; |
||
| 4515 | } |
||
| 4516 | $result = $res_721; |
||
| 4517 | $this->pos = $pos_721; |
||
| 4518 | $_724 = FALSE; break; |
||
| 4519 | } |
||
| 4520 | while(0); |
||
| 4521 | if( $_724 === TRUE ) { return $this->finalise($result); } |
||
| 4522 | if( $_724 === FALSE) { return FALSE; } |
||
| 4523 | } |
||
| 4524 | |||
| 4525 | |||
| 4526 | |||
| 4527 | |||
| 4528 | /* Comment: "<%--" (!"--%>" /(?s)./)+ "--%>" */ |
||
| 4529 | protected $match_Comment_typestack = array('Comment'); |
||
| 4530 | function match_Comment ($stack = array()) { |
||
| 4577 | } |
||
| 4578 | |||
| 4579 | |||
| 4580 | |||
| 4581 | function Comment__construct(&$res) |
||
| 4582 | { |
||
| 4583 | $res['php'] = ''; |
||
| 4584 | } |
||
| 4585 | |||
| 4586 | /* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | |
||
| 4587 | OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */ |
||
| 4588 | protected $match_TopTemplate_typestack = array('TopTemplate','Template'); |
||
| 4589 | function match_TopTemplate ($stack = array()) { |
||
| 4590 | $matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template')); |
||
| 4591 | $count = 0; |
||
| 4592 | while (true) { |
||
| 4593 | $res_788 = $result; |
||
| 4594 | $pos_788 = $this->pos; |
||
| 4595 | $_787 = NULL; |
||
| 4596 | do { |
||
| 4597 | $_785 = NULL; |
||
| 4598 | do { |
||
| 4599 | $res_734 = $result; |
||
| 4600 | $pos_734 = $this->pos; |
||
| 4601 | $matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos; |
||
| 4602 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4603 | if ($subres !== FALSE) { |
||
| 4604 | $this->store( $result, $subres ); |
||
| 4605 | $_785 = TRUE; break; |
||
| 4606 | } |
||
| 4607 | $result = $res_734; |
||
| 4608 | $this->pos = $pos_734; |
||
| 4609 | $_783 = NULL; |
||
| 4610 | do { |
||
| 4611 | $res_736 = $result; |
||
| 4612 | $pos_736 = $this->pos; |
||
| 4613 | $matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos; |
||
| 4614 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4615 | if ($subres !== FALSE) { |
||
| 4616 | $this->store( $result, $subres ); |
||
| 4617 | $_783 = TRUE; break; |
||
| 4618 | } |
||
| 4619 | $result = $res_736; |
||
| 4620 | $this->pos = $pos_736; |
||
| 4621 | $_781 = NULL; |
||
| 4622 | do { |
||
| 4623 | $res_738 = $result; |
||
| 4624 | $pos_738 = $this->pos; |
||
| 4625 | $matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos; |
||
| 4626 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4627 | if ($subres !== FALSE) { |
||
| 4628 | $this->store( $result, $subres ); |
||
| 4629 | $_781 = TRUE; break; |
||
| 4630 | } |
||
| 4631 | $result = $res_738; |
||
| 4632 | $this->pos = $pos_738; |
||
| 4633 | $_779 = NULL; |
||
| 4634 | do { |
||
| 4635 | $res_740 = $result; |
||
| 4636 | $pos_740 = $this->pos; |
||
| 4637 | $matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos; |
||
| 4638 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4639 | if ($subres !== FALSE) { |
||
| 4640 | $this->store( $result, $subres ); |
||
| 4641 | $_779 = TRUE; break; |
||
| 4642 | } |
||
| 4643 | $result = $res_740; |
||
| 4644 | $this->pos = $pos_740; |
||
| 4645 | $_777 = NULL; |
||
| 4646 | do { |
||
| 4647 | $res_742 = $result; |
||
| 4648 | $pos_742 = $this->pos; |
||
| 4649 | $matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos; |
||
| 4650 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4651 | if ($subres !== FALSE) { |
||
| 4652 | $this->store( $result, $subres ); |
||
| 4653 | $_777 = TRUE; break; |
||
| 4654 | } |
||
| 4655 | $result = $res_742; |
||
| 4656 | $this->pos = $pos_742; |
||
| 4657 | $_775 = NULL; |
||
| 4658 | do { |
||
| 4659 | $res_744 = $result; |
||
| 4660 | $pos_744 = $this->pos; |
||
| 4661 | $matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 4662 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4663 | if ($subres !== FALSE) { |
||
| 4664 | $this->store( $result, $subres ); |
||
| 4665 | $_775 = TRUE; break; |
||
| 4666 | } |
||
| 4667 | $result = $res_744; |
||
| 4668 | $this->pos = $pos_744; |
||
| 4669 | $_773 = NULL; |
||
| 4670 | do { |
||
| 4671 | $res_746 = $result; |
||
| 4672 | $pos_746 = $this->pos; |
||
| 4673 | $matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos; |
||
| 4674 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4675 | if ($subres !== FALSE) { |
||
| 4676 | $this->store( $result, $subres ); |
||
| 4677 | $_773 = TRUE; break; |
||
| 4678 | } |
||
| 4679 | $result = $res_746; |
||
| 4680 | $this->pos = $pos_746; |
||
| 4681 | $_771 = NULL; |
||
| 4682 | do { |
||
| 4683 | $res_748 = $result; |
||
| 4684 | $pos_748 = $this->pos; |
||
| 4685 | $matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos; |
||
| 4686 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4687 | if ($subres !== FALSE) { |
||
| 4688 | $this->store( $result, $subres ); |
||
| 4689 | $_771 = TRUE; break; |
||
| 4690 | } |
||
| 4691 | $result = $res_748; |
||
| 4692 | $this->pos = $pos_748; |
||
| 4693 | $_769 = NULL; |
||
| 4694 | do { |
||
| 4695 | $res_750 = $result; |
||
| 4696 | $pos_750 = $this->pos; |
||
| 4697 | $matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 4698 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4699 | if ($subres !== FALSE) { |
||
| 4700 | $this->store( $result, $subres ); |
||
| 4701 | $_769 = TRUE; break; |
||
| 4702 | } |
||
| 4703 | $result = $res_750; |
||
| 4704 | $this->pos = $pos_750; |
||
| 4705 | $_767 = NULL; |
||
| 4706 | do { |
||
| 4707 | $res_752 = $result; |
||
| 4708 | $pos_752 = $this->pos; |
||
| 4709 | $matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos; |
||
| 4710 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4711 | if ($subres !== FALSE) { |
||
| 4712 | $this->store( $result, $subres ); |
||
| 4713 | $_767 = TRUE; break; |
||
| 4714 | } |
||
| 4715 | $result = $res_752; |
||
| 4716 | $this->pos = $pos_752; |
||
| 4717 | $_765 = NULL; |
||
| 4718 | do { |
||
| 4719 | $res_754 = $result; |
||
| 4720 | $pos_754 = $this->pos; |
||
| 4721 | $matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos; |
||
| 4722 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4723 | if ($subres !== FALSE) { |
||
| 4724 | $this->store( $result, $subres ); |
||
| 4725 | $_765 = TRUE; break; |
||
| 4726 | } |
||
| 4727 | $result = $res_754; |
||
| 4728 | $this->pos = $pos_754; |
||
| 4729 | $_763 = NULL; |
||
| 4730 | do { |
||
| 4731 | $res_756 = $result; |
||
| 4732 | $pos_756 = $this->pos; |
||
| 4733 | $matcher = 'match_'.'MismatchedEndBlock'; $key = $matcher; $pos = $this->pos; |
||
| 4734 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4735 | if ($subres !== FALSE) { |
||
| 4736 | $this->store( $result, $subres ); |
||
| 4737 | $_763 = TRUE; break; |
||
| 4738 | } |
||
| 4739 | $result = $res_756; |
||
| 4740 | $this->pos = $pos_756; |
||
| 4741 | $_761 = NULL; |
||
| 4742 | do { |
||
| 4743 | $res_758 = $result; |
||
| 4744 | $pos_758 = $this->pos; |
||
| 4745 | $matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos; |
||
| 4746 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4747 | if ($subres !== FALSE) { |
||
| 4748 | $this->store( $result, $subres ); |
||
| 4749 | $_761 = TRUE; break; |
||
| 4750 | } |
||
| 4751 | $result = $res_758; |
||
| 4752 | $this->pos = $pos_758; |
||
| 4753 | $matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos; |
||
| 4754 | $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) ); |
||
| 4755 | if ($subres !== FALSE) { |
||
| 4756 | $this->store( $result, $subres ); |
||
| 4757 | $_761 = TRUE; break; |
||
| 4758 | } |
||
| 4759 | $result = $res_758; |
||
| 4760 | $this->pos = $pos_758; |
||
| 4761 | $_761 = FALSE; break; |
||
| 4762 | } |
||
| 4763 | while(0); |
||
| 4764 | if( $_761 === TRUE ) { |
||
| 4765 | $_763 = TRUE; break; |
||
| 4766 | } |
||
| 4767 | $result = $res_756; |
||
| 4768 | $this->pos = $pos_756; |
||
| 4769 | $_763 = FALSE; break; |
||
| 4770 | } |
||
| 4771 | while(0); |
||
| 4772 | if( $_763 === TRUE ) { $_765 = TRUE; break; } |
||
| 4773 | $result = $res_754; |
||
| 4774 | $this->pos = $pos_754; |
||
| 4775 | $_765 = FALSE; break; |
||
| 4776 | } |
||
| 4777 | while(0); |
||
| 4778 | if( $_765 === TRUE ) { $_767 = TRUE; break; } |
||
| 4779 | $result = $res_752; |
||
| 4780 | $this->pos = $pos_752; |
||
| 4781 | $_767 = FALSE; break; |
||
| 4782 | } |
||
| 4783 | while(0); |
||
| 4784 | if( $_767 === TRUE ) { $_769 = TRUE; break; } |
||
| 4785 | $result = $res_750; |
||
| 4786 | $this->pos = $pos_750; |
||
| 4787 | $_769 = FALSE; break; |
||
| 4788 | } |
||
| 4789 | while(0); |
||
| 4790 | if( $_769 === TRUE ) { $_771 = TRUE; break; } |
||
| 4791 | $result = $res_748; |
||
| 4792 | $this->pos = $pos_748; |
||
| 4793 | $_771 = FALSE; break; |
||
| 4794 | } |
||
| 4795 | while(0); |
||
| 4796 | if( $_771 === TRUE ) { $_773 = TRUE; break; } |
||
| 4797 | $result = $res_746; |
||
| 4798 | $this->pos = $pos_746; |
||
| 4799 | $_773 = FALSE; break; |
||
| 4800 | } |
||
| 4801 | while(0); |
||
| 4802 | if( $_773 === TRUE ) { $_775 = TRUE; break; } |
||
| 4803 | $result = $res_744; |
||
| 4804 | $this->pos = $pos_744; |
||
| 4805 | $_775 = FALSE; break; |
||
| 4806 | } |
||
| 4807 | while(0); |
||
| 4808 | if( $_775 === TRUE ) { $_777 = TRUE; break; } |
||
| 4809 | $result = $res_742; |
||
| 4810 | $this->pos = $pos_742; |
||
| 4811 | $_777 = FALSE; break; |
||
| 4812 | } |
||
| 4813 | while(0); |
||
| 4814 | if( $_777 === TRUE ) { $_779 = TRUE; break; } |
||
| 4815 | $result = $res_740; |
||
| 4816 | $this->pos = $pos_740; |
||
| 4817 | $_779 = FALSE; break; |
||
| 4818 | } |
||
| 4819 | while(0); |
||
| 4820 | if( $_779 === TRUE ) { $_781 = TRUE; break; } |
||
| 4821 | $result = $res_738; |
||
| 4822 | $this->pos = $pos_738; |
||
| 4823 | $_781 = FALSE; break; |
||
| 4824 | } |
||
| 4825 | while(0); |
||
| 4826 | if( $_781 === TRUE ) { $_783 = TRUE; break; } |
||
| 4827 | $result = $res_736; |
||
| 4828 | $this->pos = $pos_736; |
||
| 4829 | $_783 = FALSE; break; |
||
| 4830 | } |
||
| 4831 | while(0); |
||
| 4832 | if( $_783 === TRUE ) { $_785 = TRUE; break; } |
||
| 4833 | $result = $res_734; |
||
| 4834 | $this->pos = $pos_734; |
||
| 4835 | $_785 = FALSE; break; |
||
| 4836 | } |
||
| 4837 | while(0); |
||
| 4838 | if( $_785 === FALSE) { $_787 = FALSE; break; } |
||
| 4839 | $_787 = TRUE; break; |
||
| 4840 | } |
||
| 4841 | while(0); |
||
| 4842 | if( $_787 === FALSE) { |
||
| 4843 | $result = $res_788; |
||
| 4844 | $this->pos = $pos_788; |
||
| 4845 | unset( $res_788 ); |
||
| 4846 | unset( $pos_788 ); |
||
| 4847 | break; |
||
| 4848 | } |
||
| 4849 | $count += 1; |
||
| 4850 | } |
||
| 4851 | if ($count > 0) { return $this->finalise($result); } |
||
| 4852 | else { return FALSE; } |
||
| 4853 | } |
||
| 4854 | |||
| 4855 | |||
| 4856 | |||
| 4857 | |||
| 4858 | /** |
||
| 4859 | * The TopTemplate also includes the opening stanza to start off the template |
||
| 4860 | */ |
||
| 4861 | function TopTemplate__construct(&$res) |
||
| 4862 | { |
||
| 4863 | $res['php'] = "<?php" . PHP_EOL; |
||
| 4864 | } |
||
| 4865 | |||
| 4866 | /* Text: ( |
||
| 4867 | / [^<${\\]+ / | |
||
| 4868 | / (\\.) / | |
||
| 4869 | '<' !'%' | |
||
| 4870 | '$' !(/[A-Za-z_]/) | |
||
| 4871 | '{' !'$' | |
||
| 4872 | '{$' !(/[A-Za-z_]/) |
||
| 4873 | )+ */ |
||
| 4874 | protected $match_Text_typestack = array('Text'); |
||
| 4875 | function match_Text ($stack = array()) { |
||
| 4876 | $matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null); |
||
| 4877 | $count = 0; |
||
| 4878 | while (true) { |
||
| 4879 | $res_827 = $result; |
||
| 4880 | $pos_827 = $this->pos; |
||
| 4881 | $_826 = NULL; |
||
| 4882 | do { |
||
| 4883 | $_824 = NULL; |
||
| 4884 | do { |
||
| 4885 | $res_789 = $result; |
||
| 4886 | $pos_789 = $this->pos; |
||
| 4887 | if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) { |
||
| 4888 | $result["text"] .= $subres; |
||
| 4889 | $_824 = TRUE; break; |
||
| 4890 | } |
||
| 4891 | $result = $res_789; |
||
| 4892 | $this->pos = $pos_789; |
||
| 4893 | $_822 = NULL; |
||
| 4894 | do { |
||
| 4895 | $res_791 = $result; |
||
| 4896 | $pos_791 = $this->pos; |
||
| 4897 | if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) { |
||
| 4898 | $result["text"] .= $subres; |
||
| 4899 | $_822 = TRUE; break; |
||
| 4900 | } |
||
| 4901 | $result = $res_791; |
||
| 4902 | $this->pos = $pos_791; |
||
| 4903 | $_820 = NULL; |
||
| 4904 | do { |
||
| 4905 | $res_793 = $result; |
||
| 4906 | $pos_793 = $this->pos; |
||
| 4907 | $_796 = NULL; |
||
| 4908 | do { |
||
| 4909 | if (substr($this->string,$this->pos,1) == '<') { |
||
| 4910 | $this->pos += 1; |
||
| 4911 | $result["text"] .= '<'; |
||
| 4912 | } |
||
| 4913 | else { $_796 = FALSE; break; } |
||
| 4914 | $res_795 = $result; |
||
| 4915 | $pos_795 = $this->pos; |
||
| 4916 | if (substr($this->string,$this->pos,1) == '%') { |
||
| 4917 | $this->pos += 1; |
||
| 4918 | $result["text"] .= '%'; |
||
| 4919 | $result = $res_795; |
||
| 4920 | $this->pos = $pos_795; |
||
| 4921 | $_796 = FALSE; break; |
||
| 4922 | } |
||
| 4923 | else { |
||
| 4924 | $result = $res_795; |
||
| 4925 | $this->pos = $pos_795; |
||
| 4926 | } |
||
| 4927 | $_796 = TRUE; break; |
||
| 4928 | } |
||
| 4929 | while(0); |
||
| 4930 | if( $_796 === TRUE ) { $_820 = TRUE; break; } |
||
| 4931 | $result = $res_793; |
||
| 4932 | $this->pos = $pos_793; |
||
| 4933 | $_818 = NULL; |
||
| 4934 | do { |
||
| 4935 | $res_798 = $result; |
||
| 4936 | $pos_798 = $this->pos; |
||
| 4937 | $_803 = NULL; |
||
| 4938 | do { |
||
| 4939 | if (substr($this->string,$this->pos,1) == '$') { |
||
| 4940 | $this->pos += 1; |
||
| 4941 | $result["text"] .= '$'; |
||
| 4942 | } |
||
| 4943 | else { $_803 = FALSE; break; } |
||
| 4944 | $res_802 = $result; |
||
| 4945 | $pos_802 = $this->pos; |
||
| 4946 | $_801 = NULL; |
||
| 4947 | do { |
||
| 4948 | if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { |
||
| 4949 | $result["text"] .= $subres; |
||
| 4950 | } |
||
| 4951 | else { $_801 = FALSE; break; } |
||
| 4952 | $_801 = TRUE; break; |
||
| 4953 | } |
||
| 4954 | while(0); |
||
| 4955 | if( $_801 === TRUE ) { |
||
| 4956 | $result = $res_802; |
||
| 4957 | $this->pos = $pos_802; |
||
| 4958 | $_803 = FALSE; break; |
||
| 4959 | } |
||
| 4960 | if( $_801 === FALSE) { |
||
| 4961 | $result = $res_802; |
||
| 4962 | $this->pos = $pos_802; |
||
| 4963 | } |
||
| 4964 | $_803 = TRUE; break; |
||
| 4965 | } |
||
| 4966 | while(0); |
||
| 4967 | if( $_803 === TRUE ) { $_818 = TRUE; break; } |
||
| 4968 | $result = $res_798; |
||
| 4969 | $this->pos = $pos_798; |
||
| 4970 | $_816 = NULL; |
||
| 4971 | do { |
||
| 4972 | $res_805 = $result; |
||
| 4973 | $pos_805 = $this->pos; |
||
| 4974 | $_808 = NULL; |
||
| 4975 | do { |
||
| 4976 | if (substr($this->string,$this->pos,1) == '{') { |
||
| 4977 | $this->pos += 1; |
||
| 4978 | $result["text"] .= '{'; |
||
| 4979 | } |
||
| 4980 | else { $_808 = FALSE; break; } |
||
| 4981 | $res_807 = $result; |
||
| 4982 | $pos_807 = $this->pos; |
||
| 4983 | if (substr($this->string,$this->pos,1) == '$') { |
||
| 4984 | $this->pos += 1; |
||
| 4985 | $result["text"] .= '$'; |
||
| 4986 | $result = $res_807; |
||
| 4987 | $this->pos = $pos_807; |
||
| 4988 | $_808 = FALSE; break; |
||
| 4989 | } |
||
| 4990 | else { |
||
| 4991 | $result = $res_807; |
||
| 4992 | $this->pos = $pos_807; |
||
| 4993 | } |
||
| 4994 | $_808 = TRUE; break; |
||
| 4995 | } |
||
| 4996 | while(0); |
||
| 4997 | if( $_808 === TRUE ) { $_816 = TRUE; break; } |
||
| 4998 | $result = $res_805; |
||
| 4999 | $this->pos = $pos_805; |
||
| 5000 | $_814 = NULL; |
||
| 5001 | do { |
||
| 5002 | if (( $subres = $this->literal( '{$' ) ) !== FALSE) { |
||
| 5003 | $result["text"] .= $subres; |
||
| 5004 | } |
||
| 5005 | else { $_814 = FALSE; break; } |
||
| 5006 | $res_813 = $result; |
||
| 5007 | $pos_813 = $this->pos; |
||
| 5008 | $_812 = NULL; |
||
| 5009 | do { |
||
| 5010 | if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { |
||
| 5011 | $result["text"] .= $subres; |
||
| 5012 | } |
||
| 5013 | else { $_812 = FALSE; break; } |
||
| 5014 | $_812 = TRUE; break; |
||
| 5015 | } |
||
| 5016 | while(0); |
||
| 5017 | if( $_812 === TRUE ) { |
||
| 5018 | $result = $res_813; |
||
| 5019 | $this->pos = $pos_813; |
||
| 5020 | $_814 = FALSE; break; |
||
| 5021 | } |
||
| 5022 | if( $_812 === FALSE) { |
||
| 5023 | $result = $res_813; |
||
| 5024 | $this->pos = $pos_813; |
||
| 5025 | } |
||
| 5026 | $_814 = TRUE; break; |
||
| 5027 | } |
||
| 5028 | while(0); |
||
| 5029 | if( $_814 === TRUE ) { $_816 = TRUE; break; } |
||
| 5030 | $result = $res_805; |
||
| 5031 | $this->pos = $pos_805; |
||
| 5032 | $_816 = FALSE; break; |
||
| 5033 | } |
||
| 5034 | while(0); |
||
| 5035 | if( $_816 === TRUE ) { $_818 = TRUE; break; } |
||
| 5036 | $result = $res_798; |
||
| 5037 | $this->pos = $pos_798; |
||
| 5038 | $_818 = FALSE; break; |
||
| 5039 | } |
||
| 5040 | while(0); |
||
| 5041 | if( $_818 === TRUE ) { $_820 = TRUE; break; } |
||
| 5042 | $result = $res_793; |
||
| 5043 | $this->pos = $pos_793; |
||
| 5044 | $_820 = FALSE; break; |
||
| 5045 | } |
||
| 5046 | while(0); |
||
| 5047 | if( $_820 === TRUE ) { $_822 = TRUE; break; } |
||
| 5048 | $result = $res_791; |
||
| 5049 | $this->pos = $pos_791; |
||
| 5050 | $_822 = FALSE; break; |
||
| 5051 | } |
||
| 5052 | while(0); |
||
| 5053 | if( $_822 === TRUE ) { $_824 = TRUE; break; } |
||
| 5054 | $result = $res_789; |
||
| 5055 | $this->pos = $pos_789; |
||
| 5056 | $_824 = FALSE; break; |
||
| 5057 | } |
||
| 5058 | while(0); |
||
| 5059 | if( $_824 === FALSE) { $_826 = FALSE; break; } |
||
| 5060 | $_826 = TRUE; break; |
||
| 5061 | } |
||
| 5062 | while(0); |
||
| 5063 | if( $_826 === FALSE) { |
||
| 5064 | $result = $res_827; |
||
| 5065 | $this->pos = $pos_827; |
||
| 5066 | unset( $res_827 ); |
||
| 5067 | unset( $pos_827 ); |
||
| 5068 | break; |
||
| 5069 | } |
||
| 5070 | $count += 1; |
||
| 5071 | } |
||
| 5072 | if ($count > 0) { return $this->finalise($result); } |
||
| 5073 | else { return FALSE; } |
||
| 5074 | } |
||
| 5075 | |||
| 5076 | |||
| 5077 | |||
| 5078 | |||
| 5079 | /** |
||
| 5080 | * We convert text |
||
| 5081 | */ |
||
| 5082 | function Text__finalise(&$res) |
||
| 5083 | { |
||
| 5084 | $text = $res['text']; |
||
| 5085 | |||
| 5086 | // Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes |
||
| 5087 | $text = stripslashes($text); |
||
| 5088 | $text = addcslashes($text, '\'\\'); |
||
| 5089 | |||
| 5090 | // TODO: This is pretty ugly & gets applied on all files not just html. I wonder if we can make this |
||
| 5091 | // non-dynamically calculated |
||
| 5092 | $code = <<<'EOC' |
||
| 5093 | (\SilverStripe\View\SSViewer::getRewriteHashLinksDefault() |
||
| 5094 | ? \SilverStripe\Core\Convert::raw2att( preg_replace("/^(\\/)+/", "/", $_SERVER['REQUEST_URI'] ) ) |
||
| 5095 | : "") |
||
| 5096 | EOC; |
||
| 5097 | // Because preg_replace replacement requires escaped slashes, addcslashes here |
||
| 5098 | $text = preg_replace( |
||
| 5099 | '/(<a[^>]+href *= *)"#/i', |
||
| 5100 | '\\1"\' . ' . addcslashes($code, '\\') . ' . \'#', |
||
| 5101 | $text |
||
| 5102 | ); |
||
| 5103 | |||
| 5104 | $res['php'] .= '$val .= \'' . $text . '\';' . PHP_EOL; |
||
| 5105 | } |
||
| 5106 | |||
| 5107 | /****************** |
||
| 5108 | * Here ends the parser itself. Below are utility methods to use the parser |
||
| 5109 | */ |
||
| 5110 | |||
| 5111 | /** |
||
| 5112 | * Compiles some passed template source code into the php code that will execute as per the template source. |
||
| 5113 | * |
||
| 5114 | * @throws SSTemplateParseException |
||
| 5115 | * @param string $string The source of the template |
||
| 5116 | * @param string $templateName The name of the template, normally the filename the template source was loaded from |
||
| 5117 | * @param bool $includeDebuggingComments True is debugging comments should be included in the output |
||
| 5118 | * @param bool $topTemplate True if this is a top template, false if it's just a template |
||
| 5119 | * @return mixed|string The php that, when executed (via include or exec) will behave as per the template source |
||
| 5120 | */ |
||
| 5121 | public function compileString($string, $templateName = "", $includeDebuggingComments = false, $topTemplate = true) |
||
| 5156 | } |
||
| 5157 | |||
| 5158 | /** |
||
| 5159 | * @param string $code |
||
| 5160 | * @return string $code |
||
| 5161 | */ |
||
| 5162 | protected function includeDebuggingComments($code, $templateName) |
||
| 5190 | } |
||
| 5191 | |||
| 5192 | /** |
||
| 5193 | * Compiles some file that contains template source code, and returns the php code that will execute as per that |
||
| 5194 | * source |
||
| 5195 | * |
||
| 5196 | * @static |
||
| 5197 | * @param $template - A file path that contains template source code |
||
| 5198 | * @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source |
||
| 5199 | */ |
||
| 5200 | public function compileFile($template) |
||
| 5201 | { |
||
| 5202 | return $this->compileString(file_get_contents($template), $template); |
||
| 5203 | } |
||
| 5204 | } |
||
| 5205 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.