ctagsexuberant-ctags

How to write .ctags file for assembly extention?


I'm using exuberant ctag program for tagging.
I saw ctags use for Assembler but couldn't exactly understand the link there. So comparing with my extesion for system verilog, I added these lines for assembly, (I just need to parse ENTRY for macro definition), I added below to .ctags file.

--langdef=assembly
--langmap=assembly:.S
--regex-assembly=/^ENTRY(([a-zA-Z_0-9]+))$/\1/m,macro/

The sample assembly file (debug.S) is like this :

ENTRY(printch)
        addruart_current r3, r1, r2
        mov r1, r0
        mov r0, #0
        b   1b
ENDPROC(printch)

But I can't find printch in the tags file. What is wrong in the .ctags file?


Solution

  • You don't have to define a new language. ctags has Asm parser. Extending the parser is enough. See how I use the backslash characters.

    $ cat /tmp/debug.S
    ENTRY(printch)
            addruart_current r3, r1, r2
            mov r1, r0
            mov r0, #0
            b   1b
    ENDPROC(printch)
    $ ctags --regex-Asm='/^ENTRY\(([a-zA-Z_0-9]+)\)$/\1/m,macro/'  -o - /tmp/debug.S
    printch /tmp/debug.S    /^ENTRY(printch)$/;"    m