如何添加注释到旺盛的Ctags配置文件? [英] How to add comments to an Exuberant Ctags config file?

查看:146
本文介绍了如何添加注释到旺盛的Ctags配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用什么字符在旺盛的Ctags .ctags文件中添加注释?

What character can I use to put comments in an Exuberant Ctags .ctags file?

我想添加带说明的注释,也许要禁用一些正则表达式.

I would like to add comments with explanations, and perhaps to disable some regexps.

但是我找不到ctags-exuberant接受的任何注释字符!
我不断收到警告:

But I can't find any comment character which ctags-exuberant accepts!
I keep getting the warning:

ctags: Warning: Ignoring non-option in /home/joey/.ctags

这比错误要好,但仍然有点烦人.

which is better than an error, but still a little annoying.

我已经尝试过# // /* ... */;作为注释,但是ctags试图将它们全部解析!

I have tried # // /* ... */ and ; as comments, but ctags tries to parse them all!

这是一个带有一些注释的示例文件,ctags会抱怨:

Here is an example file with some comments which ctags will complain about:

# Add some more rules for Javascript
--langmap=javascript:+.jpp
--regex-javascript=/^[ \t]*var ([a-zA-Z_$][0-9a-zA-Z_$]*).*$/\1/v,variable/
--regex-javascript=/^[ \t]*this\.([a-zA-Z_$][0-9a-zA-Z_$]*)[ \t]*=.*$/\1/e,export/
--regex-javascript=/^[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*):.*$/\1/p,property/
--regex-javascript=/^\<function\>[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*)/\1/f,function/

# Define tags for the Coffeescript language
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^class @?([a-zA-Z_$][0-9a-zA-Z_$]*)( extends [a-zA-Z_$][0-9a-zA-Z_$]*)?$/\1/c,class/
--regex-coffee=/^[ \t]*(@|this\.)([a-zA-Z_$][0-9a-zA-Z_$]*).*$/\2/e,export/
--regex-coffee=/^[ \t]*@?([a-zA-Z_$][0-9a-zA-Z_$]*):.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*)[ \t]+=.*[-=]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([a-zA-Z_$][0-9a-zA-Z_$]*)[ \t]+=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@?([a-zA-Z_$][0-9a-zA-Z_$]*):.*$/\1/p,property/

推荐答案

正如@joeytwiddle指出的那样,解析器不支持注释,但是有一种解决方法.

As @joeytwiddle points out, comments are not supported by the parser, but there is a work-around.

示例.ctags文件:

--regex-C=/$x/x/x/e/ The ctags parser currently doesn't support comments
--regex-C=/$x/x/x/e/ This is a work-around which works with '/' characters
--regex-C=/$x/x/x/e/ http://stackoverflow.com/questions/10973224/how-to-add-comments-to-an-exuberant-ctags-config-file
--regex-C=/$x/x/x/e/ 
--regex-C=/$x/x/x/e/ You can add whatever comment text you want here.

这篇关于如何添加注释到旺盛的Ctags配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆