Search code examples
exuberant-ctags

ctags not generating tags for custom language


I am trying to extend ctags ( Exuberant Ctags 5.8 MacOSX ) with a custom language, however the tags file is always empty for the custom language. In order to track down the issue. I used the example from the documentation.

I have the following .ctags in ~:

--langdef=swine
--langmap=swine:.swn
--regex-swine=/^def[ \t]*([a-zA-Z0-9_]+)/\1/d,definition/

When I run ctags --list-kinds I see:

...
swine
d  definition

I have a file test.swn:

def hehll

When I run ctags -L test.swn I see:

ctags: Warning: cannot open source file "def hehll" : No such file or directory

and the tags file generated looks like this:

!_TAG_FILE_FORMAT       2       /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED       1       /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR    Darren Hiebert  /[email protected]/
!_TAG_PROGRAM_NAME      Exuberant Ctags //
!_TAG_PROGRAM_URL       http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION   5.8     //

With other languages the tags file is filled as expected. Only with this custom extension it is empty.

I am not sure what I else I need to do to make ctags produce tags for the custom language.


Solution

  • Doh! Have to run:

     ctags test.swn
    

    instead of

     ctags -L test.swn