Ignore patterns in comments (php)
Brought to you by:
dhiebert
E.g. in php files, the following file will create a "class tag":
<?php
/**
* ... class name ...
*/
?>
Obviously, this is a comment and therefor should get ignored.
Maybe it would make sense to have some properties per mode which indicate line and block comments and if defined, would make ctags ignore those, e.g. for the patterns added by addTagRegex.
Logged In: YES
user_id=1117045
Originator: NO
Also reported at
https://sourceforge.net/tracker/?func=detail&atid=787791&aid=1841239&group_id=153444
and
http://lists.uvena.de/geany/2007-December/002317.html.
Logged In: YES
user_id=1620546
Originator: NO
For myself I've fixed this by changing ctags to use explicit visibility markers (public, private, protected). Here's the patch:
--- php.old.c 2007-12-17 12:08:39.000000000 +0100
+++ php.new.c 2007-12-17 12:08:30.000000000 +0100
@@ -64,16 +64,18 @@
static void installPHPRegex (const langType language)
{
- addTagRegex(language, "(^|[ \t])class[ \t]+([" ALPHA "_][" ALNUM "_]*)",
- "\\2", "c,class,classes", NULL);
- addTagRegex(language, "(^|[ \t])interface[ \t]+([" ALPHA "_][" ALNUM "_]*)",
- "\\2", "i,interface,interfaces", NULL);
- addTagRegex(language, "(^|[ \t])define[ \t]*\\([ \t]*['\"]?([" ALPHA "_][" ALNUM "_]*)",
- "\\2", "d,define,constant definitions", NULL);
- addTagRegex(language, "(^|[ \t])function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)",
- "\\2", "f,function,functions", NULL);
- addTagRegex(language, "(^|[ \t])\\$([" ALPHA "_][" ALNUM "_]*)[ \t]*=",
- "\\2", "v,variable,variables", NULL);
+ addTagRegex(language, "(^[ \t]*)((public|private|protected)[ \t]*)?class[ \t]+([" ALPHA "_][" ALNUM "_]*)",
+ "\\4", "c,class,classes", NULL);
+ addTagRegex(language, "(^[ \t]*)((public|private|protected)[ \t]*)?interface[ \t]+([" ALPHA "_][" ALNUM "_]*)",
+ "\\4", "i,interface,interfaces", NULL);
+ addTagRegex(language, "(^[ \t]*)((public|private|protected)[ \t]*)?const[ \t]*\\([ \t]*['\"]?([" ALPHA "_][" ALNUM "_]*)",
+ "\\4", "d,define,constant definitions", NULL);
+ addTagRegex(language, "(^[ \t]*)((public|private|protected)[ \t]*)?define[ \t]*\\([ \t]*['\"]?([" ALPHA "_][" ALNUM "_]*)",
+ "\\4", "d,define,constant definitions", NULL);
+ addTagRegex(language, "(^[ \t]*)((public|private|protected)[ \t]*)?function[ \t]+&?[ \t]*([" ALPHA "_][" ALNUM "_]*)",
+ "\\4", "f,function,functions", NULL);
+ addTagRegex(language, "(^[ \t]*)((public|private|protected)[ \t]*)?\\$([" ALPHA "_][" ALNUM "_]*)[ \t]*=",
+ "\\4", "v,variable,variables", NULL);
/* function regex is covered by PHP regex */
addTagRegex (language, "(^|[ \t])([A-Za-z0-9_]+)[ \t]*[=:][ \t]*function[ \t]*\\(",
Logged In: YES
user_id=1127237
Originator: NO
see also duplicate 1894455.
public|protected|private only applies to functions and variables. abstract is the only modifier for classes. I will check in an update.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
<spam deleted=""></spam>
Last edit: Anonymous 2018-01-14
The fix is checked into trunk. It will be in the next release (after 5.8.0)