Re: [Ctags] macro and -I definition
Brought to you by:
dhiebert
|
From: Darren H. <dar...@te...> - 2001-12-11 03:44:13
|
On Mon, 10 Dec 2001, Benoit Cerrina wrote:
> I'm not too clear about the way the -I option work, especially when putting
> a pair of token, what is the level of replacement done?
> Specifically I guess that the replacement is very basic ( -Ifoo=bar )
Correct.
> but I hope it can be made somewhat more sophisticated:
> -Ifoo(toto)=bar_##toto
> In short what I'd hope would be to be able to use the -I options
> to gain some of the preprocessor facilities.
It is not up to this task. It was intended for only simple
replacements (e.g. CLASS->class).
> Right now it is
> great but at work for different reasons (mostly due to bad
> templating support on some platforms) we use c++ but with macros
> to do what would normally be done through templates. Therefore we
> have macros like:
> DECLARE_VECTOR(foo)
> VECTOR(foo)
> IMPLEMENT_VECTOR(foo)
> each of those expand to the appropriate declaration implementation and type.
> What I'd like is to be able to replace for tag purposes the VECTOR(foo) by
> VECTOR_foo
> and the DECLARE_VECTOR(foo) by class VECTOR_foo {};
I would suggest using regular expressions to generate the tags for this:
'--regex-c++=/\bDECLARE_VECTOR\(([A-Za-z0-9_]+)\)/VECTOR_\1/c,class/'
There is not need to do anything with VECTOR(foo), because this is
just a reference to VECTOR_foo, not a definition of it.
You can do something similar with IMPLEMENT_VECTOR(foo).
> I hope this is not too unreasonable, although I understand how
> frustrating parsing c or c++ can be due to preprocessor macros.
Very.
--
Darren Hiebert <da...@hi...>
http://darren.hiebert.com
|