cvs: php4 /pear/PHPDoc/parser PhpdocConstantParser.php PhpdocParserRegExp.php
| From: | Ulf Wendel | Date: | Sun, 03 Dec 2000 17:05:07 +0000 |
| Subject: | cvs: php4 /pear/PHPDoc/parser PhpdocConstantParser.php PhpdocParserRegExp.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2883@lists.php.net to get a copy of this message | ||
uw Sun Dec 3 09:05:07 2000 EDT
Modified files:
/php4/pear/PHPDoc/parser PhpdocConstantParser.php
PhpdocParserRegExp.php
Log:
- fixed a @const bug
@const CONSTNAME now gets recognized. Before the patch only @const CONSTNAME description was
recognized.
Index: php4/pear/PHPDoc/parser/PhpdocConstantParser.php
diff -u php4/pear/PHPDoc/parser/PhpdocConstantParser.php:1.1
php4/pear/PHPDoc/parser/PhpdocConstantParser.php:1.2
--- php4/pear/PHPDoc/parser/PhpdocConstantParser.php:1.1 Sun Oct 8 03:03:19 2000
+++ php4/pear/PHPDoc/parser/PhpdocConstantParser.php Sun Dec 3 09:05:07 2000
@@ -1,17 +1,28 @@
<?php
/**
* Extracts define statements and their documentation from php code.
+*
* @author Ulf Wendel <ulf.wendel@redsys.de>
-* @version 0.1alpha
+* @version $Id: PhpdocConstantParser.php,v 1.2 2000/12/03 17:05:07 uw Exp $
*/
class PhpdocConstantParser extends PhpdocUseParser {
+ /**
+ * Internal structure use to save a constant.
+ *
+ * @var array
+ */
var $emptyConstant = array(
"name" => "",
"value" => "",
"undoc" => true
);
-
+
+ /**
+ * Doc Tags allowed with @const[ant]
+ *
+ * @var array
+ */
var $constantTags = array(
"access" => true,
"see" => true,
@@ -28,21 +39,26 @@
"todo" => true
);
+ /**
+ * Scans the given constant doc comment.
+ *
+ * @param array
+ */
function analyseConstant($para) {
$constant = $this->emptyConstant;
$constant["name"] = $para["name"];
$constant["value"] = $para["value"];
- if (""!=$para["doc"]) {
+ if ("" != $para["doc"]) {
$constant = $this->analyseTags( $this->getTags($para["doc"]), $constant,
$this->constantTags);
list($msg, $constant) = $this->checkParserErrors($constant, "constant (define()
keyword)");
- if (""!=$msg)
+ if ("" != $msg)
$this->warn->addDocWarning($this->currentFile, "constant",
$constant["name"], $msg, "mismatch");
- list($constant["sdesc"],
$constant["desc"])=$this->getDescription($para["doc"]);
+ list($constant["sdesc"], $constant["desc"]) =
$this->getDescription($para["doc"]);
$constant["undoc"] = false;
}
@@ -64,7 +80,7 @@
if (!isset($constant["const"])) {
- $msg = "The @const[ant] tag is missing. Add '@const
".$constant["name"]." [description]' to the tag list at the end of the doc
comment.";
+ $msg = "The @const[ant] tag is missing. Add '@const " .
$constant["name"] . " [description]' to the tag list at the end of the doc
comment.";
$this->warn->addDocWarning($this->currentFile, "constant",
$constant["name"], $msg, "missing");
} else {
@@ -81,7 +97,7 @@
}
- if (""!=$constant["const"]["desc"])
+ if ("" != $constant["const"]["desc"])
$constant["const"] = $constant["const"]["desc"];
else
unset($constant["const"]);
Index: php4/pear/PHPDoc/parser/PhpdocParserRegExp.php
diff -u php4/pear/PHPDoc/parser/PhpdocParserRegExp.php:1.1
php4/pear/PHPDoc/parser/PhpdocParserRegExp.php:1.2
--- php4/pear/PHPDoc/parser/PhpdocParserRegExp.php:1.1 Sun Oct 8 03:03:19 2000
+++ php4/pear/PHPDoc/parser/PhpdocParserRegExp.php Sun Dec 3 09:05:07 2000
@@ -8,7 +8,7 @@
* From a programming point of view there's no need to do so.
*
* @author Ulf Wendel <ulf@redsys.de>
-* @version 0.1
+* @version $Id: PhpdocParserRegExp.php,v 1.2 2000/12/03 17:05:07 uw Exp $
*/
class PhpdocParserRegExp extends PhpdocObject {
@@ -472,9 +472,9 @@
$this->PHP_BASE["label"]
);
- $this->TAGS["const"] = sprintf("/(%s)%s(.*)/is",
+ $this->TAGS["const"] = sprintf("/(%s)%s(.*)?/is",
$this->PHP_BASE["label"],
- $this->PHP_BASE["space"]
+ $this->PHP_BASE["space_optional"]
);
$this->TAGS["access"] = sprintf("/%s/is",
$this->C_BASE["access"]);