Tagging a class definition with a macro

Computing 2018. 8. 27. 12:23

Let's say we have following macro that defines a class definition:


  1. #define DEFINE_A_CLASS(aClass) \  
  2.     class aClass: public Base<aClass##Req, aClass##Res>  
  3.   
  4. DEFINE_A_CLASS(Foo)  
  5. {  
  6.     public:  
  7.         Foo() : mBar(0)  
  8.         {  
  9.         }  
  10.     public:  
  11.         int mBar;  
  12. };  


To make the exuberent-ctags to tag this file correctly, you can use --regex-<LANG> option:


  1. ctags --fields=+iaS --extras=+q --languages=C++ --regex-c++='/DEFINE_ACTION_CLASS\(([A-Za-z][A-Za-z0-9_]*)\)/\1/c,class,class definition/'  





: