diff options
author | Marc Weber <marco-oweber@gmx.de> | 2009-05-06 16:06:45 +0000 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2009-05-06 16:06:45 +0000 |
commit | 3cf455286f12875df10baa2f57de946a50a012f5 (patch) | |
tree | 4e6723e6f39785ad5fa55ef3aa77bce2f760f81a /pkgs/development/tools/misc/ctags | |
parent | 8cc89653796edd399cabe369bd77ffec6b2ee5e1 (diff) | |
download | nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.tar nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.tar.gz nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.tar.bz2 nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.tar.lz nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.tar.xz nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.tar.zst nixpkgs-3cf455286f12875df10baa2f57de946a50a012f5.zip |
adding ctags-wropped. A wrapper for ctags adding some language (more)
language support for .php .js .nix and .as files svn path=/nixpkgs/trunk/; revision=15476
Diffstat (limited to 'pkgs/development/tools/misc/ctags')
-rw-r--r-- | pkgs/development/tools/misc/ctags/wrapped.nix | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/ctags/wrapped.nix b/pkgs/development/tools/misc/ctags/wrapped.nix new file mode 100644 index 00000000000..15bf1e9810a --- /dev/null +++ b/pkgs/development/tools/misc/ctags/wrapped.nix @@ -0,0 +1,69 @@ +{pkgs, ctags, writeScriptBin, lib, makeOverridable}: + +# define some ctags wrappers adding support for some not that common languages +# customization: +# a) add stuff here +# b) override asLang, phpLang, ... using packageOverrides +# c) use ctagsWrapped.override {args = [ your liste ];} + +# install using -iA ctagsWrapped.ctagsWrapped + +{ + + # the derivation. use language extensions specified by args + ctagsWrapped = makeOverridable ( {args, name} : pkgs.writeScriptBin name '' + #!/bin/sh + exec ${pkgs.ctags}/bin/ctags ${lib.concatStringsSep " " (map lib.escapeShellArg args)} "$@" + '') { + args = let x = pkgs.ctagsWrapped; in lib.concatLists [ + x.defaultArgs x.phpLang x.jsLang x.nixLang x.asLang + ]; + name = "${ctags.name}-wrapped"; + }; + + ### language arguments + + # don't scan version control directories + defaultArgs = [ + "--exclude=\.svn" + "--exclude=\.hg" + "--exclude=\.git" + "--exclude=\_darcs" + "--sort=yes" + ]; + + # actionscript + asLang = [ + "--langdef=ActionScript" + "--langmap=ActionScript:.as" + "--regex-ActionScript=/function[ \\t]+([A-Za-z0-9_]+)[ \\t]*\\(/\1/f,function,functions/" + "--regex-ActionScript=/function[ \\t]+(set|get)[ \\t]+([A-Za-z0-9_]+)[ \\t]*\\(/\2/p,property,properties/" + "--regex-ActionScript=/interface[ \\t]+[a-z0-9_.]*([A-Z][A-Za-z0-9_]+)/\\1/i,interface,interfaces/" + "--regex-ActionScript=/package[ \\t]+([^ \\t]*)/\\1/p/" + "--regex-ActionScript=/class[ \\t]+[a-z0-9_.]*([A-Z][A-Za-z0-9_]+)/\\1/c,class,classes/" + ]; + + # PHP + phpLang = [ + "--langmap=PHP:.php" + "--regex-PHP=/abstract class ([^ ]*)/\\1/c/" + "--regex-PHP=/interface ([^ ]*)/\\1/i/" + "--regex-PHP=/function[ \\t]+([^ (]*)/\\1/f/" + ]; + + # Javascript: also find unnamed functions and funtions beeing passed within a dict. + # the dict properties is used to implement duck typing in frameworks + # var foo = function () { ... } + # { + # a : function () {} + jsLang = [ + "--regex-JavaScript=/([^ \\t]*)[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/" + ]; + + # find foo in "foo =", don't think we can do a lot better + nixLang = [ + "--langdef=NIX" + "--langmap=NIX:.nix" + "--regex-NIX=/\([^ \\t*]*\)[ \\t]*=/\\1/f/" + ]; +} |