cvs: php4 /pear/PHPDoc/parser PhpdocConstantParser.php PhpdocParserRegExp.php PhpdocParserTags.php PhpdocVariableParser.php
/pear/PHPDoc/renderer/html/templates class.html
| From: | Ulf Wendel | Date: | Sun, 03 Dec 2000 19:31:30 +0000 |
| Subject: | cvs: php4 /pear/PHPDoc/parser PhpdocConstantParser.php PhpdocParserRegExp.php PhpdocParserTags.php PhpdocVariableParser.php /pear/PHPDoc/renderer/html/templates class.html |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2897@lists.php.net to get a copy of this message | ||
uw Sun Dec 3 11:31:30 2000 EDT
Modified files:
/php4/pear/PHPDoc/parser PhpdocConstantParser.php
PhpdocParserRegExp.php
PhpdocParserTags.php
PhpdocVariableParser.php
/php4/pear/PHPDoc/renderer/html/templates class.html
Log:
- fixed a @var bug
Index: php4/pear/PHPDoc/parser/PhpdocConstantParser.php
diff -u php4/pear/PHPDoc/parser/PhpdocConstantParser.php:1.2
php4/pear/PHPDoc/parser/PhpdocConstantParser.php:1.3
--- php4/pear/PHPDoc/parser/PhpdocConstantParser.php:1.2 Sun Dec 3 09:05:07 2000
+++ php4/pear/PHPDoc/parser/PhpdocConstantParser.php Sun Dec 3 11:31:30 2000
@@ -3,7 +3,7 @@
* Extracts define statements and their documentation from php code.
*
* @author Ulf Wendel <ulf.wendel@redsys.de>
-* @version $Id: PhpdocConstantParser.php,v 1.2 2000/12/03 17:05:07 uw Exp $
+* @version $Id: PhpdocConstantParser.php,v 1.3 2000/12/03 19:31:30 uw Exp $
*/
class PhpdocConstantParser extends PhpdocUseParser {
Index: php4/pear/PHPDoc/parser/PhpdocParserRegExp.php
diff -u php4/pear/PHPDoc/parser/PhpdocParserRegExp.php:1.2
php4/pear/PHPDoc/parser/PhpdocParserRegExp.php:1.3
--- php4/pear/PHPDoc/parser/PhpdocParserRegExp.php:1.2 Sun Dec 3 09:05:07 2000
+++ php4/pear/PHPDoc/parser/PhpdocParserRegExp.php Sun Dec 3 11:31:30 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 $Id: PhpdocParserRegExp.php,v 1.2 2000/12/03 17:05:07 uw Exp $
+* @version $Id: PhpdocParserRegExp.php,v 1.3 2000/12/03 19:31:30 uw Exp $
*/
class PhpdocParserRegExp extends PhpdocObject {
@@ -440,23 +440,15 @@
//
// Regular expressions used to analyse phpdoc tags.
//
- $this->TAGS["return"] = sprintf("/%s%s(%s)%s(%s)?%s(.*)/is",
+ $this->TAGS["var"] = 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"]
- );
-
- $this->TAGS["var"] = 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["label"],
$this->PHP_BASE["space"],
$this->PHP_COMPLEX["varname"],
$this->PHP_BASE["space_optional"]
);
+ $this->TAGS["return"] = $this->TAGS["var"];
$this->TAGS["global"] = sprintf("/%s%s(%s)%s(%s)%s(.*)/is",
$this->C_BASE["vartype"],
Index: php4/pear/PHPDoc/parser/PhpdocParserTags.php
diff -u php4/pear/PHPDoc/parser/PhpdocParserTags.php:1.2
php4/pear/PHPDoc/parser/PhpdocParserTags.php:1.3
--- php4/pear/PHPDoc/parser/PhpdocParserTags.php:1.2 Sun Dec 3 08:47:15 2000
+++ php4/pear/PHPDoc/parser/PhpdocParserTags.php Sun Dec 3 11:31:30 2000
@@ -2,7 +2,7 @@
/**
* Functions used to parse PHPDoc Tags.
*
-* @version $Id: PhpdocParserTags.php,v 1.2 2000/12/03 16:47:15 uw Exp $
+* @version $Id: PhpdocParserTags.php,v 1.3 2000/12/03 19:31:30 uw Exp $
*/
class PhpdocParserTags extends PhpdocParserRegExp {
@@ -98,6 +98,8 @@
if (preg_match($this->TAGS[$tagname], $tag["value"], $regs)) {
+ $desc = "";
+
if ("object" == $regs[1]) {
$type = "object ";
@@ -113,22 +115,27 @@
}
+ $desc = $regs[4];
+
} else {
$type = $regs[1];
+ $desc = $regs[2] . " " . $regs[4];
}
$data[$tagname] = array (
"type" => $type,
- "name" => $regs[3]
+ "name" => $regs[3],
);
- if ("return" == $tagname && "" != $regs[4])
- $data[$tagname]["desc"] = $regs[4];
-
+
+ if ("" != trim($desc))
+ $data[$tagname]["desc"] = $desc;
+
} else {
$tag["msg"] = "General syntax error, syntax: '" .
$this->PHPDOC_TAGS["@$tagname"] . "'.";
+ $tag["msg"] .= $this->TAGS[$tagname];
$data["syntaxerror"][] = $tag;
}
Index: php4/pear/PHPDoc/parser/PhpdocVariableParser.php
diff -u php4/pear/PHPDoc/parser/PhpdocVariableParser.php:1.1
php4/pear/PHPDoc/parser/PhpdocVariableParser.php:1.2
--- php4/pear/PHPDoc/parser/PhpdocVariableParser.php:1.1 Sun Oct 8 03:03:19 2000
+++ php4/pear/PHPDoc/parser/PhpdocVariableParser.php Sun Dec 3 11:31:30 2000
@@ -1,8 +1,9 @@
<?php
/**
* Extract class variables and their documentation from phpcode
+*
* @author Ulf Wendel <ulf@redsys.de>
-* @version 0.2
+* @version $Id: PhpdocVariableParser.php,v 1.2 2000/12/03 19:31:30 uw Exp $
*/
class PhpdocVariableParser extends PhpdocModuleParser {
@@ -57,12 +58,12 @@
$variable = $this->emptyVariable;
$variable["name"] = $para["name"];
- if (""!=$para["doc"]) {
+ if ("" != $para["doc"]) {
$variable = $this->analyseTags($this->getTags($para["doc"]), $variable,
$this->variableTags);
list($msg, $variable) = $this->checkParserErrors($variable, "variable");
- if (""!=$msg)
+ if ("" != $msg)
$this->warn->addDocWarning($this->currentFile, "variable",
$variable["name"], $msg, "mismatch");
list($variable["sdesc"], $variable["desc"]) =
$this->getDescription($para["doc"]);
@@ -73,8 +74,10 @@
list($type, $value, $raw_value) = $this->getVariableTypeAndValue($para["value"],
false);
$variable["type"] = $type;
- $variable["value"] = $value;
+ if ("unknown" != $value)
+ $variable["value"] = $value;
+
$variable = $this->checkVarDocs($variable);
return $variable;
@@ -91,24 +94,32 @@
if (!isset($variable["var"]))
return $variable;
- if ("unknown"!=$variable["type"] &&
$variable["var"]["type"] != $variable["type"]) {
+ if ("unknown" != $variable["type"] && "mixed" !=
$variable["type"] && $variable["var"]["type"] !=
$variable["type"]) {
- $msg = sprintf("The documented class variable type does not match the type found. Update
the tag to '@var %s [%s]'.",
+ $msg = sprintf("The documented class variable type does not match the type found. Update
the tag to '@var %s [%s]%s'.",
$variable["type"],
- $variable["name"]
+ $variable["name"],
+ (isset($variable["var"]["desc"])) ? " " .
$variable["var"]["desc"] : ""
);
$this->warn->addDocWarning($this->currentFile, "variable",
$variable["name"], $msg, "mismatch");
+
+ } else if ("unknown" == $variable["type"] && "" !=
$variable["var"]["type"]) {
+
+ $variable["type"] = $variable["var"]["type"];
+
}
- if ($variable["var"]["name"] != $variable["name"]) {
+ if ("" != $variable["var"]["name"] &&
$variable["var"]["name"] != $variable["name"]) {
- $msg = sprintf("The documented class variable name does not match the name found. Update
the tag to '@var %s [%s]'.",
- $variable["type"],
- $variable["name"]
+ $msg = sprintf("The documented class variable name does not match the name found. Update
the tag to '@var %s [%s]%s'.",
+ ("" != $variable["var"]["type"]) ?
$variable["var"]["type"] : $variable["type"],
+ $variable["name"],
+ (isset($variable["var"]["desc"])) ? " " .
$variable["var"]["desc"] : ""
);
$this->warn->addDocWarning($this->currentFile, "variable",
$variable["name"], $msg, "mismatch");
}
+
unset($variable["var"]);
return $variable;
Index: php4/pear/PHPDoc/renderer/html/templates/class.html
diff -u php4/pear/PHPDoc/renderer/html/templates/class.html:1.3
php4/pear/PHPDoc/renderer/html/templates/class.html:1.4
--- php4/pear/PHPDoc/renderer/html/templates/class.html:1.3 Sun Dec 3 06:36:01 2000
+++ php4/pear/PHPDoc/renderer/html/templates/class.html Sun Dec 3 11:31:30 2000
@@ -1,4 +1,4 @@
-C<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Generated with PHPDoc, http://www.phpdoc.de -->
<html>
<head>