Rewrite the PHP parser as a real full token-based parser, instead of using regexes. This is more complex but allows for way better parsing.
Tags are generated for:
* classes;
* constants (both "const FOO" and "define('FOO', ...)");
* functions/methods;
* interfaces;
* local variables (disabled by default, need to enable the "l" kind);
* namespaces (both syntax);
* traits;
* global (like locals, but in the root scope) and member variables.
Visible changes from current regex-based parser:
* Scope is reported for each tag;
* Visibility is reported for members and methods;
* Implementation is reported for classes, interfaces and methods;
* Traits are reported;
* Namespaces are reported;
* Separate global and local variables (local ones being disabled by default);
* Constructs outside PHP tags are completely omitted;
* "jsfunction" are not reported any more;
* Function arguments spanning several lines or including comments are properly reported;
* Commented-out code no longer generates tags.
Closes:
* https://sourceforge.net/tracker/?func=detail&aid=3602177&group_id=6556&atid=106556
* https://sourceforge.net/tracker/?func=detail&aid=3220198&group_id=6556&atid=106556
* https://sourceforge.net/tracker/?func=detail&aid=1792989&group_id=6556&atid=356556
* https://sourceforge.net/tracker/?func=detail&aid=960547&group_id=6556&atid=306556
* https://sourceforge.net/tracker/?func=detail&aid=3074659&group_id=6556&atid=306556
About the patch:
The attached patch is the complete patch against trunk. If you want, I can either provide the individual patches (I did 22 patches to get here), or the
new version of each file, just tell me what you prefer.
Patch adding this brand new PHP parser
BTW, more technical details are available on a message on the ML: https://sourceforge.net/mailarchive/message.php?msg_id=30749245
This patch doesn't apply anymore, but I'd really really love to use it. There's not very many good ways to index PHP code without an IDE, and this pretty much solves that problem!
Weird it doesn't apply since AFAIK nothing was committed to the PHP parser recently, but you can anyway get an updated version on my GitHub repository: https://github.com/b4n/ctags/commits/better-php-parser
An updated version is available on my GitHub repository: https://github.com/b4n/ctags/commits/better-php-parser
It includes:
<script language=php></script>
open/close tagsAs always, I can provide a patch against trunk if you want, just ask.
+10 awesome!
Without it we, old ViM developers, are dying badly with PHP.