init
[garradin.git] / include / libs / template_lite / tests / parser.php
1 <?php
2
3 require dirname(__FILE__) . '/../class.parser.php';
4
5 class Template_Tester extends Template_Parser
6 {
7 public $debug = array();
8
9 public function processString($content)
10 {
11 $this->debug[] = array('Processing string', $content);
12 return parent::processString($content);
13 }
14
15 public function processModifier($name, $content, $arguments, $map_array)
16 {
17 $this->debug[] = array('Processing modifier', $name, $content, $arguments);
18 return parent::processModifier($name, $content, $arguments, $map_array);
19 }
20
21 public function processVariable($name)
22 {
23 $this->debug[] = array('Processing variable', $name);
24 return parent::processVariable($name);
25 }
26
27 public function testArgs($args)
28 {
29 return $this->parseArguments($args);
30 }
31 }
32
33 $test = new Template_Tester;
34
35 $args = 'truc="miam $blu\' oh" miam="ah `$bla|blu`" bla=$bla|blu autre=$a|bb|cat:$miam|escape uh=bla::blou()';
36
37 print_r($test->testArgs($args));
38
39 foreach (token_get_all('<?php '.$args.'?>') as $line)
40 {
41 echo "\n";
42 if (is_array($line))
43 {
44 echo token_name($line[0]) . ": ";
45 echo $line[1];
46 echo "\t";
47 }
48 echo str_replace("\n", "", print_r($line, true));
49 }
50
51 ?>