是否可以使用 phpDocumentor 来解析 DocBlock 标签?
我想使用 phpDocumentor 类来解析我自己的 PHP 文档并处理结果。我可以手动执行此操作,但我很确定可以使用 phpDocumentor。
问题是我找不到任何关于此的文档。我到底应该如何使用 phpDocumentor 的类?
感谢您的链接!
I want to use phpDocumentor classes for parsing of my own PHP documentation and working with results. I can do this manually, but I'm pretty sure that phpDocumentor could be used.
The problem is that I can't find any documentation about this. How exactly should I use phpDocumentor's classes?
Thanks for the link!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现 Zend_Reflection_* 类可以完成这项工作。
I found out that Zend_Reflection_* classes can do this job.
PHPDocumentor 手册包含 700 多页,是在 PHPDoc 下运行 PHPDoc 的结果。但几个月前我只看了几个小时。该代码是标记器内容与正则表达式的极端组合 - 这使得 PHPDoc 无法为其文档字符串提供正式的 BNF 语法。
如果这很重要,您应该考虑编写自己的 PHP 解析器 - 至少了解一点编译器构造。 PHP 是一种非常简单的语言。
The PHPDocumentor Manual conatins over 700 pages as the result of running PHPDoc under PHPDoc. But i only looked for a couple of hours at it a few month ago. The code is an extreme mix of tokenizer stuff mixed with regular expressions - which makes it for example impossible for PHPDoc to give a formal BNF grammer for its doc strings.
If it is important you should consider writing your own PHP parser - at least if know a little bit about compiler construction. PHP is a pretty simple language.
phpDocumentor 是在 PHP4 时代编写的,我不认为它的设计方式允许轻松扩展自身。
此外,我几乎猜测您实际上想要作为基础的开始是 PHP 中的 tokenizer 扩展,无论如何,这主要是 phpDocumentor 内部使用的。
phpDocumentor was written back in the PHP4 days, and I don't believe it was designed in a way to allow easy extension of itself.
Further, I'd almost guess that what you actually want to start with as a base would be the tokenizer extension in PHP, which is mostly what phpDocumentor uses internally anyway.