2012-04-13 47 views
4

我是一個ctags新手,使用PHP編碼。我發現這個ctags的文件在線:我的.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/ 

不過,我得到這個錯誤:

$ ctags 
ctags: Warning: Unsupported parameter 'p' for --PHP-kinds option 

從實驗我看到要定義的p需求,而事實上它是在定義文件的第七行。那麼爲什麼錯誤被拋出?

編輯: 的ctags的文件來from here,這是從this terrific article鏈接。

這裏是我的配置的輸出:

$ 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: <[email protected]>, 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 
$ 
+0

請鏈接,您發現該文件的來源。 – hakre 2012-04-13 00:31:26

+0

字符類中有哪些字符:該行上的[^ =]'?如果有一個選項卡,請嘗試用'\ t'替換它。 – sarnold 2012-04-13 00:38:07

+0

謝謝你,我用文件源編輯了這個問題。 – dotancohen 2012-04-13 00:44:45

回答

4

將「P」之類的默認情況下不爲PHP定義。

--regex-PHP=/(public\s+|static\s+|protected\s+|private\s+)\$([^  =]+)/\2/p/ 

爲您的情況定義了一種'p'類型的PHP。如果你移動

--PHP-kinds=+cfpd 

在這之後,它不會給你一個錯誤。

注:這裏是我的ctags的版本信息:

$ ctags --version 
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert 
    Compiled: Apr 19 2012, 11:31:19 
    Addresses: <[email protected]>, http://ctags.sourceforge.net 
    Optional compiled features: +wildcards, +regex 
+0

順便說一下,它可以擺脫警告,並在您的標籤文件中爲您提供p條目。下一步將爭論什麼是p條目,如果你真的想要。 = D – Aaron 2012-04-24 19:05:50

+0

謝謝。將'--PHP-kinds'行直接移到'p'行之後,或者直接移到文件末尾,都不能解決我的問題。任何其他想法? – dotancohen 2012-04-30 15:31:53

+0

嗯..它解決了我和盧卡斯阿曼的問題。你使用的是什麼版本的ctags,你能發佈你的.ctags文件嗎? – Aaron 2012-05-03 18:04:08