我是ctags新手,使用PHP编码。我在网上找到了这个ctags文件:
-R
--exclude=.svn
--tag-relative=yes
--PHP-kinds=+cfpd
--regex-PHP=/abstract\s+class\s+([^ ]+)/\1/c/
--regex-PHP=/interface\s+([^ ]+)/\1/c/
--regex-PHP=/(public\s+|static\s+|protected\s+|private\s+)\$([^ =]+)/\2/p/
--regex-PHP=/const\s+([^ =]+)/\1/d/
--regex-PHP=/final\s+(public\s+|static\s+|abstract\s+|protected\s+|private\s+)function\s+\&?\s*([^ (]+)/\2/f/
Run Code Online (Sandbox Code Playgroud)
但是,我收到此错误:
$ ctags
ctags: Warning: Unsupported parameter 'p' for --PHP-kinds option
Run Code Online (Sandbox Code Playgroud)
从实验中,我看到p需要定义,实际上,它是在文件的第七行定义的。那么为什么会引发错误呢?
这是我的配置的输出:
$ ctags --version
ctags: Warning: Unsupported parameter 'p' for --PHP-kinds option
Exuberant Ctags 5.6, Copyright (C) 1996-2004 Darren Hiebert
Compiled: Jan 6 2007, 02:10:54
Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex
$ cat ~/.ctags
-R
--exclude=.svn
--tag-relative=yes
--regex-PHP=/abstract\s+class\s+([^ ]+)/\1/c/
--regex-PHP=/interface\s+([^ ]+)/\1/c/
--regex-PHP=/(public\s+|static\s+|protected\s+|private\s+)\$([^ \t=]+)/\2/p/
--regex-PHP=/const\s+([^ \t=]+)/\1/d/
--regex-PHP=/final\s+(public\s+|static\s+|abstract\s+|protected\s+|private\s+)function\s+\&?\s*([^ (]+)/\2/f/
--PHP-kinds=+cpdf
$ ctags
ctags: Warning: Unsupported parameter 'p' for --PHP-kinds option
$
Run Code Online (Sandbox Code Playgroud)
默认情况下,未为PHP定义'p'类型。
--regex-PHP=/(public\s+|static\s+|protected\s+|private\s+)\$([^ =]+)/\2/p/
Run Code Online (Sandbox Code Playgroud)
在您的情况下为PHP定义了一种“ p”类型。如果你移动
--PHP-kinds=+cfpd
Run Code Online (Sandbox Code Playgroud)
在此之后,它不会给您错误。
注意:这是我的ctags版本信息:
$ ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Apr 19 2012, 11:31:19
Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex
Run Code Online (Sandbox Code Playgroud)