PHPDoc - regular exoressions
| From: | Hayk Chamyan | Date: | Fri, 07 Dec 2001 09:05:57 +0000 |
| Subject: | PHPDoc - regular exoressions | ||
| Groups: | php.pear.dev php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-3420@lists.php.net to get a copy of this message | ||
Hi everybody!
I have a question about the regular expressions used in the
/parser/PhpdocParserRegExp.php file.
For the global variable (@global) documenting we need to use the following
description format: "@global (object objectname|type) $varname [description]";
while for the returned variable (@return) documenting
it's like this: "@return (object objectname|type) [$varname]
[description]".
The question is: what is the difference between these descriptions? The
difference is in the fact that $varname for @return is optional.
In this case we probably need to use the following construction:
$this->TAGS["global"] =
sprintf("/%s(?:%s(%s))?(?:%s(%s))%s(.*)?/is",
$this->C_BASE["vartype"],
$this->PHP_BASE["space"],
$this->PHP_BASE["label"],
$this->PHP_BASE["space"],
$this->PHP_COMPLEX["varname"],
$this->PHP_BASE["space_optional"]
);
instead of
$this->TAGS["global"] = sprintf("/%s%s(%s)%s(%s)%s(.*)/is",
$this->C_BASE["vartype"],
$this->PHP_BASE["space_optional"],
$this->C_COMPLEX["objectname_optional"],
$this->PHP_BASE["space"],
$this->PHP_COMPLEX["varname"],
$this->PHP_BASE["space_optional"]
);
?
--
Sincerely yours,
Hayk
mailto:hayk@softerra.com
icq: 363611