Weblog Entries for April 2003

Adding Support for Visual Basic to Exuberent Ctags

jEdit has a great source code navigation plugin called Tags which uses Exuberant Ctags. By default Ctags doesn't support VB, which I'm seeing a lot of lately, but it does allow one to add support for laguages using regular expressions.

I added the following to c:\ctags.cnf:

--langdef=vb
--langmap=vb:.bas.cls.ctl.frm.vbs
--regex-vb=/^(Public|Private|\b)[ \t]*Sub[ \t]+([a-zA-Z0-9_]+)/\2/s,subroutine/i
--regex-vb=/^(Public|Private|\b)[ \t]*Function[ \t]+([a-zA-Z0-9_]+)/\2/f,function/i
--regex-vb=/^(Public|Private)[ \t]+([a-zA-Z0-9_]+)[ \t]+As[ \t]+/\2/v,variable/i
--regex-vb=/^(Public|Private|\b)[ \t]*Const[ \t]+([a-zA-Z0-9_]+)[ \t]+(As|=)[ \t]+/\2/c,const/i
--regex-vb=/^(Public|\b)[ \t]*Property[ \t]*(Get|Let|Set)[ \t]+([a-zA-Z0-9_]+)/\3/n,name/i
--regex-vb=/^(Public|Private|\b)[ \t]*Enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enum/i
--regex-vb=/^([a-zA-Z_]+):/\1/l,label/i

These expressions probably aren't perfect, but I've found them to work pretty well. If you've got suggestions or improvements, please send them along.

Example output:

C:\Code\CASS\SMSSource>ctags -RV
RECURSING into directory "."
ignoring .\.cvsignore (unknown language)
ignoring .\360.ico (unknown language)
OPENING .\Advertiser.cls as vb language file
OPENING .\Advertisers.cls as vb language file
OPENING .\Affidavit.cls as vb language file
^C
C:\Code\CASS\SMSSource>

Here's a screen shot of the plugin in action:

[screen shot of Ctags w/VB in jEdit]

Saved Monday, May 05, 2003 at 01:48 PM

Blog Macro Needs More Work

Last week (or maybe the week before) I saw that AMK had written some scripts to keep his diary in reST. I was reminded of my weblog, which is also contructed with reST, but which I never update. I wrote a nice little macro which takes care of saving an entry and creating indexes for that entry. The one hitch is that I have to run my site generation scripts and then upload the entry for it to appear on my site. It's been on my todo list to update this so it can take care of generating the pages and doing the upload. Then all I'll need to do is open jEdit, type away, and execute the macro.

Saved Thursday, April 17, 2003 at 07:11 PM

View 2003, latest entries, or archive <../../archive.html>