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
@@ 2420-2664 (lines=245) @@
2417
	/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
2418
	OpenBlock | MalformedBlock | Injection | Text)+ */
2419
	protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template');
2420
	function match_CacheRestrictedTemplate ($stack = array()) {
2421
		$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null);
2422
		$count = 0;
2423
		while (true) {
2424
			$res_436 = $result;
2425
			$pos_436 = $this->pos;
2426
			$_435 = NULL;
2427
			do {
2428
				$_433 = NULL;
2429
				do {
2430
					$res_386 = $result;
2431
					$pos_386 = $this->pos;
2432
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
2433
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2434
					if ($subres !== FALSE) {
2435
						$this->store( $result, $subres );
2436
						$_433 = TRUE; break;
2437
					}
2438
					$result = $res_386;
2439
					$this->pos = $pos_386;
2440
					$_431 = NULL;
2441
					do {
2442
						$res_388 = $result;
2443
						$pos_388 = $this->pos;
2444
						$matcher = 'match_'.'Translate'; $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
							$_431 = TRUE; break;
2449
						}
2450
						$result = $res_388;
2451
						$this->pos = $pos_388;
2452
						$_429 = NULL;
2453
						do {
2454
							$res_390 = $result;
2455
							$pos_390 = $this->pos;
2456
							$matcher = 'match_'.'If'; $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
								$_429 = TRUE; break;
2461
							}
2462
							$result = $res_390;
2463
							$this->pos = $pos_390;
2464
							$_427 = NULL;
2465
							do {
2466
								$res_392 = $result;
2467
								$pos_392 = $this->pos;
2468
								$matcher = 'match_'.'Require'; $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
									$_427 = TRUE; break;
2473
								}
2474
								$result = $res_392;
2475
								$this->pos = $pos_392;
2476
								$_425 = NULL;
2477
								do {
2478
									$res_394 = $result;
2479
									$pos_394 = $this->pos;
2480
									$matcher = 'match_'.'CacheBlock'; $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
										$_425 = TRUE; break;
2485
									}
2486
									$result = $res_394;
2487
									$this->pos = $pos_394;
2488
									$_423 = NULL;
2489
									do {
2490
										$res_396 = $result;
2491
										$pos_396 = $this->pos;
2492
										$matcher = 'match_'.'UncachedBlock'; $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
											$_423 = TRUE; break;
2497
										}
2498
										$result = $res_396;
2499
										$this->pos = $pos_396;
2500
										$_421 = NULL;
2501
										do {
2502
											$res_398 = $result;
2503
											$pos_398 = $this->pos;
2504
											$matcher = 'match_'.'OldI18NTag'; $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
												$_421 = TRUE; break;
2509
											}
2510
											$result = $res_398;
2511
											$this->pos = $pos_398;
2512
											$_419 = NULL;
2513
											do {
2514
												$res_400 = $result;
2515
												$pos_400 = $this->pos;
2516
												$matcher = 'match_'.'Include'; $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
													$_419 = TRUE; break;
2521
												}
2522
												$result = $res_400;
2523
												$this->pos = $pos_400;
2524
												$_417 = NULL;
2525
												do {
2526
													$res_402 = $result;
2527
													$pos_402 = $this->pos;
2528
													$matcher = 'match_'.'ClosedBlock'; $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
														$_417 = TRUE; break;
2533
													}
2534
													$result = $res_402;
2535
													$this->pos = $pos_402;
2536
													$_415 = NULL;
2537
													do {
2538
														$res_404 = $result;
2539
														$pos_404 = $this->pos;
2540
														$matcher = 'match_'.'OpenBlock'; $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
															$_415 = TRUE; break;
2545
														}
2546
														$result = $res_404;
2547
														$this->pos = $pos_404;
2548
														$_413 = NULL;
2549
														do {
2550
															$res_406 = $result;
2551
															$pos_406 = $this->pos;
2552
															$matcher = 'match_'.'MalformedBlock'; $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
																$_413 = TRUE; break;
2557
															}
2558
															$result = $res_406;
2559
															$this->pos = $pos_406;
2560
															$_411 = NULL;
2561
															do {
2562
																$res_408 = $result;
2563
																$pos_408 = $this->pos;
2564
																$matcher = 'match_'.'Injection'; $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
																	$_411 = TRUE; break;
2569
																}
2570
																$result = $res_408;
2571
																$this->pos = $pos_408;
2572
																$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
2573
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2574
																if ($subres !== FALSE) {
2575
																	$this->store( $result, $subres );
2576
																	$_411 = TRUE; break;
2577
																}
2578
																$result = $res_408;
2579
																$this->pos = $pos_408;
2580
																$_411 = FALSE; break;
2581
															}
2582
															while(0);
2583
															if( $_411 === TRUE ) { $_413 = TRUE; break; }
2584
															$result = $res_406;
2585
															$this->pos = $pos_406;
2586
															$_413 = FALSE; break;
2587
														}
2588
														while(0);
2589
														if( $_413 === TRUE ) { $_415 = TRUE; break; }
2590
														$result = $res_404;
2591
														$this->pos = $pos_404;
2592
														$_415 = FALSE; break;
2593
													}
2594
													while(0);
2595
													if( $_415 === TRUE ) { $_417 = TRUE; break; }
2596
													$result = $res_402;
2597
													$this->pos = $pos_402;
2598
													$_417 = FALSE; break;
2599
												}
2600
												while(0);
2601
												if( $_417 === TRUE ) { $_419 = TRUE; break; }
2602
												$result = $res_400;
2603
												$this->pos = $pos_400;
2604
												$_419 = FALSE; break;
2605
											}
2606
											while(0);
2607
											if( $_419 === TRUE ) { $_421 = TRUE; break; }
2608
											$result = $res_398;
2609
											$this->pos = $pos_398;
2610
											$_421 = FALSE; break;
2611
										}
2612
										while(0);
2613
										if( $_421 === TRUE ) { $_423 = TRUE; break; }
2614
										$result = $res_396;
2615
										$this->pos = $pos_396;
2616
										$_423 = FALSE; break;
2617
									}
2618
									while(0);
2619
									if( $_423 === TRUE ) { $_425 = TRUE; break; }
2620
									$result = $res_394;
2621
									$this->pos = $pos_394;
2622
									$_425 = FALSE; break;
2623
								}
2624
								while(0);
2625
								if( $_425 === TRUE ) { $_427 = TRUE; break; }
2626
								$result = $res_392;
2627
								$this->pos = $pos_392;
2628
								$_427 = FALSE; break;
2629
							}
2630
							while(0);
2631
							if( $_427 === TRUE ) { $_429 = TRUE; break; }
2632
							$result = $res_390;
2633
							$this->pos = $pos_390;
2634
							$_429 = FALSE; break;
2635
						}
2636
						while(0);
2637
						if( $_429 === TRUE ) { $_431 = TRUE; break; }
2638
						$result = $res_388;
2639
						$this->pos = $pos_388;
2640
						$_431 = FALSE; break;
2641
					}
2642
					while(0);
2643
					if( $_431 === TRUE ) { $_433 = TRUE; break; }
2644
					$result = $res_386;
2645
					$this->pos = $pos_386;
2646
					$_433 = FALSE; break;
2647
				}
2648
				while(0);
2649
				if( $_433 === FALSE) { $_435 = FALSE; break; }
2650
				$_435 = TRUE; break;
2651
			}
2652
			while(0);
2653
			if( $_435 === FALSE) {
2654
				$result = $res_436;
2655
				$this->pos = $pos_436;
2656
				unset( $res_436 );
2657
				unset( $pos_436 );
2658
				break;
2659
			}
2660
			$count += 1;
2661
		}
2662
		if ($count > 0) { return $this->finalise($result); }
2663
		else { return FALSE; }
2664
	}
2665
2666
2667