changed git call from https to git readonly
[atutor.git] / mods / phpdoc2 / PhpDocumentor / scripts / tokenizer_test.php
1 <?php\r
2 /**\r
3  * @package tests\r
4  */\r
5 /**\r
6 $fp = fopen("../phpDocumentor/Converter.inc","r");\r
7 $file = fread($fp,filesize("../phpDocumentor/Converter.inc"));\r
8 fclose($fp);\r
9 */\r
10 $file = "\r
11 <?php\r
12     function &newSmarty()\r
13     {\r
14         if (!isset(\$this->package_index))\r
15         foreach(\$this->all_packages as \$key => \$val)\r
16         {\r
17             if (isset(\$this->pkg_elements[\$key]))\r
18             {\r
19                 if (!isset(\$start)) \$start = \$key;\r
20                 \$this->package_index[] = array('link' => \"li_\$key.html\", 'title' => \$key);\r
21             }\r
22         }\r
23         \$templ = new Smarty;\r
24         \$templ->template_dir = \$this->smarty_dir . PATH_DELIMITER . 'templates';\r
25         \$templ->compile_dir = \$this->smarty_dir . PATH_DELIMITER . 'templates_c';\r
26         \$templ->config_dir = \$this->smarty_dir . PATH_DELIMITER . 'configs';\r
27         \$templ->assign(\"packageindex\",\$this->package_index);\r
28         \$templ->assign(\"phpdocversion\",PHPDOCUMENTOR_VER);\r
29         \$templ->assign(\"phpdocwebsite\",PHPDOCUMENTOR_WEBSITE);\r
30         \$templ->assign(\"package\",\$this->package);\r
31         \$templ->assign(\"subdir\",'');\r
32         return \$templ;\r
33     }\r
34 ?>\r
35 ";\r
36 $tokens = token_get_all($file);\r
37 \r
38 $nl_check = array(T_WHITESPACE,T_ENCAPSED_AND_WHITESPACE,T_COMMENT,T_DOC_COMMENT,T_OPEN_TAG,T_CLOSE_TAG,T_INLINE_HTML);\r
39 print '<pre>';\r
40 $line = 0;\r
41 foreach($tokens as $key => $val)\r
42 {\r
43         if (is_array($val))\r
44         {\r
45                 // seeing if we can get line numbers out of the beast\r
46                 if (in_array($val[0],$nl_check))\r
47                 {\r
48                         $line+=substr_count($val[1],"\n");\r
49                 }\r
50                 echo token_name($val[0])." => ".htmlentities($val[1])."\n";\r
51         }\r
52         else\r
53         {\r
54                 echo "*** $val\n";\r
55         }\r
56 }\r
57 echo "$line\n";\r
58 print '</pre>';\r
59 ?>\r