7 var parser - very simple!
8 uses parent (master codedoc object) which contains the active tokens
13 class PHP_CodeDoc_Parser_Var {
16 var $var; // current return value;
17 function read ($inclass) {
21 if ($c = PHP_CodeDoc_Parser_Var::parse()) {
23 $c->activeFile = $this->activeFile;
24 $this->classes[$this->_active_class]->Attributes[$c->name] = $c;
25 $this->classes[$this->_active_class]->Attributes[$c->name]->class =
26 $this->classes[$this->_active_class]->name;
32 { // read var declares in a class
33 $flags= array($this->look_nws(-1), $this->look_nws(-2), $this->look_nws(-3), $this->look_nws(-4));
36 $startpos = $this->pos;
38 $var = new PHP_CodeDoc_Data_Var;
39 $var->name = $this->tokens[$this->pos+2][1];
40 $var->type = "Public";
44 $var->isConstant = $this->tokens[$this->pos][0] == T_CONST;
46 if (in_array(T_PRIVATE, $flags)) {
47 $var->type = "Private";
51 if (in_array(T_PROTECTED, $flags)) {
52 $var->type = "Protected";
56 if (in_array(T_STATIC, $flags)) {
62 PHP_CodeDoc_Parser_Var::_store_tokens($var);
64 if ($v = PHP_CodeDoc_Parser_Comment::parse()) {
65 $var->description = $v;
67 $this->pos = $startpos;
74 remember the tokens for a var.. (for printing later)
76 function _store_tokens(&$var) {
78 $var->tokenStart=$this->pos;
84 while ($pos < $this->total) {
85 $v = $this->tokens[$pos];
87 if (trim($v) == ";") {
88 $var->tokenEnd = $pos;
93 $var->tokens[$n] = $v;
97 $var->tokenEnd = $pos;