[nem-en] exuberant ctags support for nemerle

Kamil Dworakowski kamil.dworakowski at googlemail.com
Tue Sep 5 15:11:01 CEST 2006


Michal Moskal wrote:
> On 9/5/06, Kamil Dworakowski <kamil.dworakowski at googlemail.com> wrote:
>> Michał commited a patch for exuberant ctags a year ago. It was to
>> support nemerle code. That, however, does not work with indentation
>> based syntax. Has anyone fixed that?
>
> At least I didn't.
>
> Maybe adding an option to the compiler to do that wouldn't be that bad 
> idea?

I don't know about compiler way. I have came up with a quick solution 
using AWK. I recognizes only classes, but is easy to extend and does the 
job. I attach it in case someone is interested.

Kamil Dworakowski
-------------- next part --------------
# to generate a tags file for nemerle files writen in indentation based syntax
# anyway, it works also with normal sytax
# currently gentags.awk returns only tags for classes
# to make vim search tags in two tags files add to local _vimrc:
# set tags=tags,tags_i
# if a tag is not found in tags file it will be searched for in tags_i
find . -name *.n -print | xargs gawk -f gentags.awk | sort > tags_i
-------------- next part --------------
# generates a half finished tags file in a basic format of ctags 
# (not an exuberant ctags format)
# the output needs to be sorted to be valid tags file
BEGIN { 
    print ("!_TAG_FILE_FORMAT\t1\t") 
    print ("!_TAG_FILE_SORTED\t1\t/0 - unsorted, 1 - sorted/") 
}
# \w 	alphanumeric character or '_'
# [:space:] 	Space characters (such as space, TAB, ... ). 
/.*public[[:space:]]+class[[:space:]]+\w+.*/ {
    match($0, /.*(public[[:space:]]+class[[:space:]]+)(\w+).*/, arr )
# Format: {tagname}	{TAB} {tagfile} {TAB} {tagaddress}
    print( arr[2] "\t" FILENAME "\t" "/" arr[1] arr[2] "/" )
}


More information about the devel-en mailing list