Code Duplication    Length = 245-245 lines in 2 locations

view/SSTemplateParser.php 2 locations

@@ 202-446 (lines=245) @@
199
	/* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
200
	OpenBlock | MalformedBlock | Injection | Text)+ */
201
	protected $match_Template_typestack = array('Template');
202
	function match_Template ($stack = array()) {
203
		$matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null);
204
		$count = 0;
205
		while (true) {
206
			$res_50 = $result;
207
			$pos_50 = $this->pos;
208
			$_49 = NULL;
209
			do {
210
				$_47 = NULL;
211
				do {
212
					$res_0 = $result;
213
					$pos_0 = $this->pos;
214
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
215
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
216
					if ($subres !== FALSE) {
217
						$this->store( $result, $subres );
218
						$_47 = TRUE; break;
219
					}
220
					$result = $res_0;
221
					$this->pos = $pos_0;
222
					$_45 = NULL;
223
					do {
224
						$res_2 = $result;
225
						$pos_2 = $this->pos;
226
						$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
227
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
228
						if ($subres !== FALSE) {
229
							$this->store( $result, $subres );
230
							$_45 = TRUE; break;
231
						}
232
						$result = $res_2;
233
						$this->pos = $pos_2;
234
						$_43 = NULL;
235
						do {
236
							$res_4 = $result;
237
							$pos_4 = $this->pos;
238
							$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
239
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
240
							if ($subres !== FALSE) {
241
								$this->store( $result, $subres );
242
								$_43 = TRUE; break;
243
							}
244
							$result = $res_4;
245
							$this->pos = $pos_4;
246
							$_41 = NULL;
247
							do {
248
								$res_6 = $result;
249
								$pos_6 = $this->pos;
250
								$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
251
								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
252
								if ($subres !== FALSE) {
253
									$this->store( $result, $subres );
254
									$_41 = TRUE; break;
255
								}
256
								$result = $res_6;
257
								$this->pos = $pos_6;
258
								$_39 = NULL;
259
								do {
260
									$res_8 = $result;
261
									$pos_8 = $this->pos;
262
									$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
263
									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
264
									if ($subres !== FALSE) {
265
										$this->store( $result, $subres );
266
										$_39 = TRUE; break;
267
									}
268
									$result = $res_8;
269
									$this->pos = $pos_8;
270
									$_37 = NULL;
271
									do {
272
										$res_10 = $result;
273
										$pos_10 = $this->pos;
274
										$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
275
										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
276
										if ($subres !== FALSE) {
277
											$this->store( $result, $subres );
278
											$_37 = TRUE; break;
279
										}
280
										$result = $res_10;
281
										$this->pos = $pos_10;
282
										$_35 = NULL;
283
										do {
284
											$res_12 = $result;
285
											$pos_12 = $this->pos;
286
											$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
287
											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
288
											if ($subres !== FALSE) {
289
												$this->store( $result, $subres );
290
												$_35 = TRUE; break;
291
											}
292
											$result = $res_12;
293
											$this->pos = $pos_12;
294
											$_33 = NULL;
295
											do {
296
												$res_14 = $result;
297
												$pos_14 = $this->pos;
298
												$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
299
												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
300
												if ($subres !== FALSE) {
301
													$this->store( $result, $subres );
302
													$_33 = TRUE; break;
303
												}
304
												$result = $res_14;
305
												$this->pos = $pos_14;
306
												$_31 = NULL;
307
												do {
308
													$res_16 = $result;
309
													$pos_16 = $this->pos;
310
													$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
311
													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
312
													if ($subres !== FALSE) {
313
														$this->store( $result, $subres );
314
														$_31 = TRUE; break;
315
													}
316
													$result = $res_16;
317
													$this->pos = $pos_16;
318
													$_29 = NULL;
319
													do {
320
														$res_18 = $result;
321
														$pos_18 = $this->pos;
322
														$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
323
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
324
														if ($subres !== FALSE) {
325
															$this->store( $result, $subres );
326
															$_29 = TRUE; break;
327
														}
328
														$result = $res_18;
329
														$this->pos = $pos_18;
330
														$_27 = NULL;
331
														do {
332
															$res_20 = $result;
333
															$pos_20 = $this->pos;
334
															$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
335
															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
336
															if ($subres !== FALSE) {
337
																$this->store( $result, $subres );
338
																$_27 = TRUE; break;
339
															}
340
															$result = $res_20;
341
															$this->pos = $pos_20;
342
															$_25 = NULL;
343
															do {
344
																$res_22 = $result;
345
																$pos_22 = $this->pos;
346
																$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
347
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
348
																if ($subres !== FALSE) {
349
																	$this->store( $result, $subres );
350
																	$_25 = TRUE; break;
351
																}
352
																$result = $res_22;
353
																$this->pos = $pos_22;
354
																$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
355
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
356
																if ($subres !== FALSE) {
357
																	$this->store( $result, $subres );
358
																	$_25 = TRUE; break;
359
																}
360
																$result = $res_22;
361
																$this->pos = $pos_22;
362
																$_25 = FALSE; break;
363
															}
364
															while(0);
365
															if( $_25 === TRUE ) { $_27 = TRUE; break; }
366
															$result = $res_20;
367
															$this->pos = $pos_20;
368
															$_27 = FALSE; break;
369
														}
370
														while(0);
371
														if( $_27 === TRUE ) { $_29 = TRUE; break; }
372
														$result = $res_18;
373
														$this->pos = $pos_18;
374
														$_29 = FALSE; break;
375
													}
376
													while(0);
377
													if( $_29 === TRUE ) { $_31 = TRUE; break; }
378
													$result = $res_16;
379
													$this->pos = $pos_16;
380
													$_31 = FALSE; break;
381
												}
382
												while(0);
383
												if( $_31 === TRUE ) { $_33 = TRUE; break; }
384
												$result = $res_14;
385
												$this->pos = $pos_14;
386
												$_33 = FALSE; break;
387
											}
388
											while(0);
389
											if( $_33 === TRUE ) { $_35 = TRUE; break; }
390
											$result = $res_12;
391
											$this->pos = $pos_12;
392
											$_35 = FALSE; break;
393
										}
394
										while(0);
395
										if( $_35 === TRUE ) { $_37 = TRUE; break; }
396
										$result = $res_10;
397
										$this->pos = $pos_10;
398
										$_37 = FALSE; break;
399
									}
400
									while(0);
401
									if( $_37 === TRUE ) { $_39 = TRUE; break; }
402
									$result = $res_8;
403
									$this->pos = $pos_8;
404
									$_39 = FALSE; break;
405
								}
406
								while(0);
407
								if( $_39 === TRUE ) { $_41 = TRUE; break; }
408
								$result = $res_6;
409
								$this->pos = $pos_6;
410
								$_41 = FALSE; break;
411
							}
412
							while(0);
413
							if( $_41 === TRUE ) { $_43 = TRUE; break; }
414
							$result = $res_4;
415
							$this->pos = $pos_4;
416
							$_43 = FALSE; break;
417
						}
418
						while(0);
419
						if( $_43 === TRUE ) { $_45 = TRUE; break; }
420
						$result = $res_2;
421
						$this->pos = $pos_2;
422
						$_45 = FALSE; break;
423
					}
424
					while(0);
425
					if( $_45 === TRUE ) { $_47 = TRUE; break; }
426
					$result = $res_0;
427
					$this->pos = $pos_0;
428
					$_47 = FALSE; break;
429
				}
430
				while(0);
431
				if( $_47 === FALSE) { $_49 = FALSE; break; }
432
				$_49 = TRUE; break;
433
			}
434
			while(0);
435
			if( $_49 === FALSE) {
436
				$result = $res_50;
437
				$this->pos = $pos_50;
438
				unset( $res_50 );
439
				unset( $pos_50 );
440
				break;
441
			}
442
			$count += 1;
443
		}
444
		if ($count > 0) { return $this->finalise($result); }
445
		else { return FALSE; }
446
	}
447
448
449
@@ 2432-2676 (lines=245) @@
2429
	/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
2430
	OpenBlock | MalformedBlock | Injection | Text)+ */
2431
	protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template');
2432
	function match_CacheRestrictedTemplate ($stack = array()) {
2433
		$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null);
2434
		$count = 0;
2435
		while (true) {
2436
			$res_437 = $result;
2437
			$pos_437 = $this->pos;
2438
			$_436 = NULL;
2439
			do {
2440
				$_434 = NULL;
2441
				do {
2442
					$res_387 = $result;
2443
					$pos_387 = $this->pos;
2444
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
2445
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2446
					if ($subres !== FALSE) {
2447
						$this->store( $result, $subres );
2448
						$_434 = TRUE; break;
2449
					}
2450
					$result = $res_387;
2451
					$this->pos = $pos_387;
2452
					$_432 = NULL;
2453
					do {
2454
						$res_389 = $result;
2455
						$pos_389 = $this->pos;
2456
						$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
2457
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2458
						if ($subres !== FALSE) {
2459
							$this->store( $result, $subres );
2460
							$_432 = TRUE; break;
2461
						}
2462
						$result = $res_389;
2463
						$this->pos = $pos_389;
2464
						$_430 = NULL;
2465
						do {
2466
							$res_391 = $result;
2467
							$pos_391 = $this->pos;
2468
							$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
2469
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2470
							if ($subres !== FALSE) {
2471
								$this->store( $result, $subres );
2472
								$_430 = TRUE; break;
2473
							}
2474
							$result = $res_391;
2475
							$this->pos = $pos_391;
2476
							$_428 = NULL;
2477
							do {
2478
								$res_393 = $result;
2479
								$pos_393 = $this->pos;
2480
								$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
2481
								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2482
								if ($subres !== FALSE) {
2483
									$this->store( $result, $subres );
2484
									$_428 = TRUE; break;
2485
								}
2486
								$result = $res_393;
2487
								$this->pos = $pos_393;
2488
								$_426 = NULL;
2489
								do {
2490
									$res_395 = $result;
2491
									$pos_395 = $this->pos;
2492
									$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
2493
									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2494
									if ($subres !== FALSE) {
2495
										$this->store( $result, $subres );
2496
										$_426 = TRUE; break;
2497
									}
2498
									$result = $res_395;
2499
									$this->pos = $pos_395;
2500
									$_424 = NULL;
2501
									do {
2502
										$res_397 = $result;
2503
										$pos_397 = $this->pos;
2504
										$matcher = 'match_'.'UncachedBlock'; $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
											$_424 = TRUE; break;
2509
										}
2510
										$result = $res_397;
2511
										$this->pos = $pos_397;
2512
										$_422 = NULL;
2513
										do {
2514
											$res_399 = $result;
2515
											$pos_399 = $this->pos;
2516
											$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
2517
											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2518
											if ($subres !== FALSE) {
2519
												$this->store( $result, $subres );
2520
												$_422 = TRUE; break;
2521
											}
2522
											$result = $res_399;
2523
											$this->pos = $pos_399;
2524
											$_420 = NULL;
2525
											do {
2526
												$res_401 = $result;
2527
												$pos_401 = $this->pos;
2528
												$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
2529
												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2530
												if ($subres !== FALSE) {
2531
													$this->store( $result, $subres );
2532
													$_420 = TRUE; break;
2533
												}
2534
												$result = $res_401;
2535
												$this->pos = $pos_401;
2536
												$_418 = NULL;
2537
												do {
2538
													$res_403 = $result;
2539
													$pos_403 = $this->pos;
2540
													$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
2541
													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2542
													if ($subres !== FALSE) {
2543
														$this->store( $result, $subres );
2544
														$_418 = TRUE; break;
2545
													}
2546
													$result = $res_403;
2547
													$this->pos = $pos_403;
2548
													$_416 = NULL;
2549
													do {
2550
														$res_405 = $result;
2551
														$pos_405 = $this->pos;
2552
														$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
2553
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2554
														if ($subres !== FALSE) {
2555
															$this->store( $result, $subres );
2556
															$_416 = TRUE; break;
2557
														}
2558
														$result = $res_405;
2559
														$this->pos = $pos_405;
2560
														$_414 = NULL;
2561
														do {
2562
															$res_407 = $result;
2563
															$pos_407 = $this->pos;
2564
															$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
2565
															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2566
															if ($subres !== FALSE) {
2567
																$this->store( $result, $subres );
2568
																$_414 = TRUE; break;
2569
															}
2570
															$result = $res_407;
2571
															$this->pos = $pos_407;
2572
															$_412 = NULL;
2573
															do {
2574
																$res_409 = $result;
2575
																$pos_409 = $this->pos;
2576
																$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
2577
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2578
																if ($subres !== FALSE) {
2579
																	$this->store( $result, $subres );
2580
																	$_412 = TRUE; break;
2581
																}
2582
																$result = $res_409;
2583
																$this->pos = $pos_409;
2584
																$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
2585
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2586
																if ($subres !== FALSE) {
2587
																	$this->store( $result, $subres );
2588
																	$_412 = TRUE; break;
2589
																}
2590
																$result = $res_409;
2591
																$this->pos = $pos_409;
2592
																$_412 = FALSE; break;
2593
															}
2594
															while(0);
2595
															if( $_412 === TRUE ) { $_414 = TRUE; break; }
2596
															$result = $res_407;
2597
															$this->pos = $pos_407;
2598
															$_414 = FALSE; break;
2599
														}
2600
														while(0);
2601
														if( $_414 === TRUE ) { $_416 = TRUE; break; }
2602
														$result = $res_405;
2603
														$this->pos = $pos_405;
2604
														$_416 = FALSE; break;
2605
													}
2606
													while(0);
2607
													if( $_416 === TRUE ) { $_418 = TRUE; break; }
2608
													$result = $res_403;
2609
													$this->pos = $pos_403;
2610
													$_418 = FALSE; break;
2611
												}
2612
												while(0);
2613
												if( $_418 === TRUE ) { $_420 = TRUE; break; }
2614
												$result = $res_401;
2615
												$this->pos = $pos_401;
2616
												$_420 = FALSE; break;
2617
											}
2618
											while(0);
2619
											if( $_420 === TRUE ) { $_422 = TRUE; break; }
2620
											$result = $res_399;
2621
											$this->pos = $pos_399;
2622
											$_422 = FALSE; break;
2623
										}
2624
										while(0);
2625
										if( $_422 === TRUE ) { $_424 = TRUE; break; }
2626
										$result = $res_397;
2627
										$this->pos = $pos_397;
2628
										$_424 = FALSE; break;
2629
									}
2630
									while(0);
2631
									if( $_424 === TRUE ) { $_426 = TRUE; break; }
2632
									$result = $res_395;
2633
									$this->pos = $pos_395;
2634
									$_426 = FALSE; break;
2635
								}
2636
								while(0);
2637
								if( $_426 === TRUE ) { $_428 = TRUE; break; }
2638
								$result = $res_393;
2639
								$this->pos = $pos_393;
2640
								$_428 = FALSE; break;
2641
							}
2642
							while(0);
2643
							if( $_428 === TRUE ) { $_430 = TRUE; break; }
2644
							$result = $res_391;
2645
							$this->pos = $pos_391;
2646
							$_430 = FALSE; break;
2647
						}
2648
						while(0);
2649
						if( $_430 === TRUE ) { $_432 = TRUE; break; }
2650
						$result = $res_389;
2651
						$this->pos = $pos_389;
2652
						$_432 = FALSE; break;
2653
					}
2654
					while(0);
2655
					if( $_432 === TRUE ) { $_434 = TRUE; break; }
2656
					$result = $res_387;
2657
					$this->pos = $pos_387;
2658
					$_434 = FALSE; break;
2659
				}
2660
				while(0);
2661
				if( $_434 === FALSE) { $_436 = FALSE; break; }
2662
				$_436 = TRUE; break;
2663
			}
2664
			while(0);
2665
			if( $_436 === FALSE) {
2666
				$result = $res_437;
2667
				$this->pos = $pos_437;
2668
				unset( $res_437 );
2669
				unset( $pos_437 );
2670
				break;
2671
			}
2672
			$count += 1;
2673
		}
2674
		if ($count > 0) { return $this->finalise($result); }
2675
		else { return FALSE; }
2676
	}
2677
2678
2679