Ctags support (regexp).

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Ctags support (regexp).

laurence taylor

place the following in ~/.ctags. create the file if it doesn't exist:

--langdef=haxe
--langmap=haxe:.hx
--regex-haxe=/^[ \t]*[(private|public|static|override|inline|dynamic)( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\(([^\{]*)/\1/f,function/
--regex-haxe=/^[ \t]*([private|public|static|protected|inline][ \t]?)+var[ \t]+([A-Za-z0-9_]+)/\2/v,variable/ 
--regex-haxe=/^[ \t]*package[ \t]*([A-Za-z0-9_]+)/\1/p,package/
--regex-haxe=/^[ \t]*class[ \t]([A-Za-z0-9]+)[ \t]*[^\{]*/\1/c,class/
--regex-haxe=/^[ \t]*interface[ \t]([A-Za-z0-9]+)[ \t]*[^\{]*/\1/i,interface/

If you're using vim, to activate the language for the taglist plugin include the following in your .vimrc, and reload:

let tlist_haxe_settings='haxe;f:function;v:variable;c:class;i:interface;p:package'

What a regexp parser (line based) cannot do is distinguish between:

var variable:Int;

and:

function method(){
  var variable:Int;
}

So I made it a requirement that class variables need either public|private to qualify as variable tags to avoid method variables cluttering up the tag list.

I hope someone finds this useful.

regards,

Loz


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Ctags support (regexp).

gershon
these might also be usefull:

--regex-haxe=/^[ \t]*[import ]+[ \t]+([A-Za-z0-9_.]+)[ \t]*/\1 /F,import, imports/
--regex-haxe=/^[ \t]*[(enum) ( \t)]+ [ \t]+([A-Za-z0-9_.]+)[ \t]*\(/\1 /e,enum, enumerators/
--regex-haxe=/^[ \t]*[(typedef) ( \t)]+ [ \t]+([A-Za-z0-9_]+)[ \t]*\(/\1 /t,typedef, typedefs

though they could sure be cleaned up...

attached haxe.c file, if anyone interested to help give ctags better haxe support, this is also just regex, and a proper parser has to be written...

On Fri, Aug 14, 2009 at 10:46 AM, laurence taylor <[hidden email]> wrote:

place the following in ~/.ctags. create the file if it doesn't exist:

--langdef=haxe
--langmap=haxe:.hx
--regex-haxe=/^[ \t]*[(private|public|static|override|inline|dynamic)( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\(([^\{]*)/\1/f,function/
--regex-haxe=/^[ \t]*([private|public|static|protected|inline][ \t]?)+var[ \t]+([A-Za-z0-9_]+)/\2/v,variable/ 
--regex-haxe=/^[ \t]*package[ \t]*([A-Za-z0-9_]+)/\1/p,package/
--regex-haxe=/^[ \t]*class[ \t]([A-Za-z0-9]+)[ \t]*[^\{]*/\1/c,class/
--regex-haxe=/^[ \t]*interface[ \t]([A-Za-z0-9]+)[ \t]*[^\{]*/\1/i,interface/

If you're using vim, to activate the language for the taglist plugin include the following in your .vimrc, and reload:

let tlist_haxe_settings='haxe;f:function;v:variable;c:class;i:interface;p:package'

What a regexp parser (line based) cannot do is distinguish between:

var variable:Int;

and:

function method(){
  var variable:Int;
}

So I made it a requirement that class variables need either public|private to qualify as variable tags to avoid method variables cluttering up the tag list.

I hope someone finds this useful.

regards,

Loz


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org

haxe.c (8K) Download Attachment