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