debian/0000775000000000000000000000000012414765633007203 5ustar debian/postinst0000664000000000000000000000060412277767575011027 0ustar #! /bin/sh set -e update-alternatives --install /usr/bin/ctags ctags /usr/bin/ctags-exuberant 30 \ --slave /usr/share/man/man1/ctags.1.gz ctags.1.gz /usr/share/man/man1/ctags-exuberant.1.gz update-alternatives --install /usr/bin/etags etags /usr/bin/ctags-exuberant 10 \ --slave /usr/share/man/man1/etags.1.gz etags.1.gz /usr/share/man/man1/ctags-exuberant.1.gz #DEBHELPER# exit 0 debian/control0000664000000000000000000000247312414765601010607 0ustar Source: exuberant-ctags Section: editors Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Colin Watson Build-Depends: dpkg (>= 1.16.1~), debhelper (>= 9), dh-autoreconf Standards-Version: 3.9.5 Homepage: http://ctags.sourceforge.net/ Vcs-Git: git://anonscm.debian.org/users/cjwatson/exuberant-ctags.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=users/cjwatson/exuberant-ctags.git Package: exuberant-ctags Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Provides: ctags Suggests: vim | nvi | elvis | vile | emacsen Multi-Arch: foreign Homepage: http://ctags.sourceforge.net/ Description: build tag file indexes of source code definitions ctags parses source code and produces a sort of index mapping the names of significant entities (e.g. functions, classes, variables) to the location where that entity is defined. This index is used by editors like vi and emacsen to allow moving to the definition of a user-specified entity. . Exuberant Ctags supports all possible C language constructions and multiple other languages such as assembler, AWK, ASP, BETA, Bourne/Korn/Z shell, C++, COBOL, Eiffel, Fortran, Java, Lisp, Lua, Makefile, Pascal, Perl, PHP, Python, REXX, Ruby, S-Lang, Scheme, Tcl, Verilog, Vim and YACC. debian/docs0000664000000000000000000000000412277767575010066 0ustar FAQ debian/changelog0000664000000000000000000003301512414765522011054 0ustar exuberant-ctags (1:5.9~svn20110310-7ubuntu0.1) trusty-security; urgency=medium * SECURITY UPDATE: denial of service via infinite loop and disk consumption on minified js file - debian/patches/jscript-set-tag-scope.patch: set the tag's scope rather than including it in the tag name in jscript.c. - CVE-2014-7204 -- Marc Deslauriers Tue, 07 Oct 2014 09:29:48 -0400 exuberant-ctags (1:5.9~svn20110310-7) unstable; urgency=medium * Add a Homepage field. * Switch to git; add Vcs-* fields. * Add a hacky "debian/rules git-svn-setup", making it possible to set up git-svn metadata again after cloning. * Policy version 3.9.5: no changes required. -- Colin Watson Sat, 15 Feb 2014 23:52:23 +0000 exuberant-ctags (1:5.9~svn20110310-6) unstable; urgency=low * Convert debian/copyright to copyright-format 1.0, dropping obsolete source tarball location in the process (closes: #714823). -- Colin Watson Thu, 04 Jul 2013 12:27:57 +0100 exuberant-ctags (1:5.9~svn20110310-5) unstable; urgency=low * Adjust debian/watch to remove epoch from Debian version. * Use dh-autoreconf. -- Colin Watson Sat, 09 Feb 2013 11:40:16 +0000 exuberant-ctags (1:5.9~svn20110310-4) unstable; urgency=low * Simplify alternatives handling. update-alternatives doesn't need so much babysitting these days. * Reduce the etags alternative's priority to 10 so that it's less than that of emacs (closes: #668560). * Upgrade to debhelper v9 and its new arrangements for honouring dpkg-buildflags output. * Append CPPFLAGS to CFLAGS, since the upstream build system doesn't honour CPPFLAGS. This enables -D_FORTIFY_SOURCE=2 with Debian's default dpkg-buildflags configuration. -- Colin Watson Sat, 14 Apr 2012 13:42:14 +0100 exuberant-ctags (1:5.9~svn20110310-3) unstable; urgency=low * Mark exuberant-ctags Multi-Arch: foreign. -- Colin Watson Wed, 09 Nov 2011 01:44:38 +0000 exuberant-ctags (1:5.9~svn20110310-2) unstable; urgency=low * Add Go support, from a patch by Alexey Marinichev (closes: #634166). -- Colin Watson Wed, 20 Jul 2011 14:24:17 +0100 exuberant-ctags (1:5.9~svn20110310-1) unstable; urgency=low * New upstream release snapshot (thanks, Daniel Hahler; LP: #732860). - Fix crash with comments inside strings in OCaml (LP: #554898). * Drop accepted patches: - debian/patches/make-match-loop.patch - debian/patches/php-ignore-keywords-in-comments.patch * For Python, disable -i so imports are not tagged by default (thanks, Barry Warsaw; LP: #618979). * Upstream uses AC_SYS_LARGEFILE now, so drop explicit -D_FILE_OFFSET_BITS=64 in debian/rules. * Fix infinite loop parsing vim commands, when a non-alphanumeric character other than whitespace or '-' is found before the first alphanumeric character after 'command' (LP: #736367). -- Colin Watson Thu, 17 Mar 2011 16:47:08 +0000 exuberant-ctags (1:5.8-4) unstable; urgency=low * Apply patch from Ben Spencer to use memmove rather than strcpy on overlapping strings (closes: #594185). -- Colin Watson Thu, 17 Feb 2011 13:47:11 +0000 exuberant-ctags (1:5.8-3) unstable; urgency=low * Compile with -D_FILE_OFFSET_BITS=64 in order to support 64-bit inode numbers and file sizes on 32-bit systems (thanks, Hamish Moffatt; closes: #588771). -- Colin Watson Mon, 12 Jul 2010 10:12:13 +0100 exuberant-ctags (1:5.8-2) unstable; urgency=low * Rewrite debian/rules using debhelper 7. * Convert to source format 3.0 (quilt). * Policy version 3.8.4: no changes required. * Fix endless loop on unmatched { in a Makefile with no following newline (thanks, Martin Dorey; closes: #571652). * Backport upstream patch to ignore keywords inside PHP multiline comments (closes: #505538). -- Colin Watson Fri, 26 Feb 2010 23:20:58 +0000 exuberant-ctags (1:5.8-1) unstable; urgency=low * New upstream release. Debian bugs fixed: - Add support for ASP classes (closes: #529215). * Compress files using gzip -n (cf. debhelper 6.0.6). * Add a watch file. -- Colin Watson Tue, 14 Jul 2009 15:05:23 +0100 exuberant-ctags (1:5.7-4) unstable; urgency=low * Update DEB_BUILD_OPTIONS parsing code from policy 3.8.0. * Backport from upstream (closes: #484797, SF #1878155): - jscript.c was not properly handling escaped quotes. * Add a Homepage control field. * Refer to /usr/share/common-licenses/GPL-2 in debian/copyright rather than plain GPL. * Policy version 3.8.0. -- Colin Watson Mon, 09 Jun 2008 09:07:27 +0100 exuberant-ctags (1:5.7-3) unstable; urgency=low * Backport from upstream (thanks, Daniel Hahler of Ubuntu; closes: #460982, LP: #179492): - Fix parsing of Python variables starting with "def" or "class" as function or class definitions. * Policy version 3.7.3: no changes required. * Add an actual copyright notice to debian/copyright (from 'ctags --version' output). -- Colin Watson Tue, 04 Mar 2008 10:38:11 +0000 exuberant-ctags (1:5.7-2) unstable; urgency=low * Add an md5sums control file. * Use autotools-dev's recommended ./configure --build and --host options. -- Colin Watson Sat, 17 Nov 2007 20:35:19 +0000 exuberant-ctags (1:5.7-1) unstable; urgency=low * New upstream release. Debian bugs fixed: - Fixed typo in man page (closes: #366412). - Fixed parsing of generic classes/interfaces (Java, closes: #368955). - Added support for arbitrary nesting depth (Python, closes: #409078). - Fixed parsing of comment-to-end-of-line with no newline before EOF (Fortran, closes: #432872). * Only ignore missing-Makefile errors in clean target, not all other errors. -- Colin Watson Sat, 08 Sep 2007 09:16:38 +0100 exuberant-ctags (1:5.6-1) unstable; urgency=low * New upstream release (closes: #374097). * Fix accidentally-unrendered line in ctags(1) (closes: #271323). * Policy version 3.7.2: no changes required. -- Colin Watson Mon, 31 Jul 2006 09:09:12 +0100 exuberant-ctags (1:5.5.4-2) unstable; urgency=low * Fix bashisms in postinst and prerm. * Add .svn, {arch}, .arch-ids, .bzr, _darcs, and .git to the default exclude list (thanks, Jon Dowland; closes: #363388). -- Colin Watson Wed, 19 Apr 2006 11:56:16 +0100 exuberant-ctags (1:5.5.4-1) unstable; urgency=medium * New upstream release. - Fixed broken -R option. -- Colin Watson Tue, 30 Mar 2004 11:56:40 +0100 exuberant-ctags (1:5.5.3-1) unstable; urgency=low * New upstream release. - Fixed destruction of tag file with certain informational options (closes: #218382). -- Colin Watson Tue, 16 Mar 2004 21:11:22 +0000 exuberant-ctags (1:5.5.2-1) unstable; urgency=low * New upstream release. * Improve short description a bit. * Policy version 3.6.1: no changes required. -- Colin Watson Thu, 18 Sep 2003 20:20:49 +0100 exuberant-ctags (1:5.5.1-1) unstable; urgency=low * New upstream release. - ctags --help, --version, and --license no longer create a tags file (closes: #187474). -- Colin Watson Fri, 15 Aug 2003 20:55:20 +0100 exuberant-ctags (1:5.5-1) unstable; urgency=low * New upstream release. -- Colin Watson Wed, 2 Apr 2003 08:23:38 +0100 exuberant-ctags (1:5.4-1) unstable; urgency=low * New upstream release. -- Colin Watson Fri, 18 Oct 2002 01:51:03 +0100 exuberant-ctags (1:5.3.1-1) unstable; urgency=low * New upstream release. * Policy version 3.5.7: support DEB_BUILD_OPTIONS=noopt,nostrip. -- Colin Watson Fri, 4 Oct 2002 06:47:35 +0100 exuberant-ctags (1:5.3-1) unstable; urgency=low * New upstream release. * QUOTES seems to have been removed upstream. Don't install it. * Clean up debian/copyright a little. * Update list of languages in description. * Build with -Wall. -- Colin Watson Wed, 7 Aug 2002 19:41:55 +0100 exuberant-ctags (1:5.2.2-2) unstable; urgency=low * New maintainer. Thanks, Wichert. * Remove the /usr/doc compatibility symlink. -- Colin Watson Wed, 7 Aug 2002 14:12:47 +0100 exuberant-ctags (1:5.2.2-1) unstable; urgency=medium * New upstream version * Don't abort if update-alternatives reports an error. Closes: Bug#133033 * Remove temporary file in postinst. Closes: Bug#134208 -- Wichert Akkerman Sun, 17 Feb 2002 15:16:36 +0100 exuberant-ctags (1:5.0.1-3) unstable; urgency=low * Fix spelling error in description -- Wichert Akkerman Sat, 17 Nov 2001 17:25:11 +0100 exuberant-ctags (1:5.0.1-2) unstable; urgency=low * Change alternative priority on user demand so it is higher then that of other `wimpy ctags' implementations. * Remove Linux reference from copyright -- Wichert Akkerman Sat, 6 Oct 2001 14:57:52 +0200 exuberant-ctags (1:5.0.1-1) unstable; urgency=low * New upstream version -- Wichert Akkerman Mon, 16 Apr 2001 04:36:50 +0200 exuberant-ctags (1:5.0-2) unstable; urgency=low * Change section to editors and priority to optional so they match the dinstall overrides * Fix typo in Suggests. Closes: Bug#92791 * Add vile to Suggests. Closes: Bug#51948 -- Wichert Akkerman Sun, 15 Apr 2001 13:14:53 +0200 exuberant-ctags (1:5.0-1) unstable; urgency=low * Change maintainer, Heiko is effectively MIA * New upstream version * Bump Standards-Version to 3.5.2 * Update description to note that exuberant can now also handle ASP, Makefiles, Pascal, PHP, REXX, Ruby and S-Lang. -- Wichert Akkerman Sat, 14 Apr 2001 10:26:58 +0200 exuberant-ctags (1:4.0.3-0.1) unstable; urgency=low * Non-maintainer upload * New upstream version * Update Standards-Version to 3.2.1.0 * Repackaged from scratch * FHS compliant paths now * Change priority to extra * Properly handle alternatives with respect to aborted upgrades * Rewrite copyright to reflect new license (GPL), homepage location (sourceforge) and email address of author. * Remove references to elv-ctags and conflicts for packages that vanished 3 years ago * Redid extended description: reformat it so it is readable and reflects the current future set better. -- Wichert Akkerman Tue, 29 Aug 2000 02:49:18 +0200 exuberant-ctags (1:3.2.4-0) unstable; urgency=high * new upstream (closes #37172) * /usr/man/man1/ctags.1.gz removed (closes #35967) * 34666 outdated with new upstream (closes #34666) * fixed typos in README (closes #38882) -- Heiko Schlittermann Tue, 20 Jul 1999 21:43:29 +0200 exuberant-ctags (1:3.1.2-1) unstable; urgency=high * new upstream * Updated the debian/copyright file (original source location) -- Heiko Schlittermann Wed, 10 Feb 1999 01:09:18 +0100 exuberant-ctags (1:2.3.2-2) frozen unstable; urgency=high * removed the ctags.1 man page (since this page is provided through the alternatives mechanism (closes #33100 (grave), #28532) -- Heiko Schlittermann Wed, 10 Feb 1999 00:39:06 +0100 exuberant-ctags (1:2.3.2-1) unstable; urgency=high * maintainer upload (since Peter Moulder can't do this) -- Heiko Schlittermann Wed, 14 Oct 1998 17:30:03 +0200 exuberant-ctags (1:2.3.2-0.1) unstable; urgency=high * new upstream version. Now supports Java. * Non-maintainer upload. * Change Section to `devel'. * Fix lintian bugs. -- Peter Moulder Sat, 26 Sep 1998 18:20:20 +1000 exuberant-ctags (1:1.7.5-2) unstable; urgency=high * include the _original_ source * debian/rules clean target removes now the config.log file (is not present in orig source) -- Heiko Schlittermann Thu, 15 Jan 1998 17:21:24 +0100 exuberant-ctags (1:1.7.5-1) unstable; urgency=low * new upstream (fixes #16297) * no debian related bugs fixed -- Heiko Schlittermann Thu, 15 Jan 1998 14:20:34 +0100 exuberant-ctags (1:1.7.4-1) unstable; urgency=low * Non-maintainer release * Compiled with libc6 * New upstream version * Use pristine upstream source * Strip installed executable (fixes #15716) * Rename CHANGES to changelog -- Richard Braakman Fri, 26 Dec 1997 22:49:10 +0100 exuberant-ctags (1:1.6-1) unstable; urgency=high * use epoch to make 1.6 > 1.6b2 -- Heiko Schlittermann Sun, 1 Jun 1997 10:44:43 +0200 exuberant-ctags (1.6-1) unstable; urgency=high * new upstream release -- Heiko Schlittermann Sat, 17 May 1997 20:25:08 +0200 exuberant-ctags (1.6b2-1) unstable; urgency=high * new upstream release -- Heiko schlittermann Wed, 23 Apr 1997 11:07:09 +0200 vimctags (1.5-1) unstable; urgency=low * new upstream release -- Heiko Schlittermann Tue, 25 Mar 1997 22:21:21 +0100 ctags (1.4-2) unstable; urgency=low * conflicts with emacs' ctags (and elvisctags) -- Heiko Schlittermann Tue, 10 Sep 1996 17:04:10 +0200 ctags (1.4-1) unstable; urgency=low * initial release -- Heiko Schlittermann Fri, 30 Aug 1996 16:12:32 +0200 debian/source/0000775000000000000000000000000012277767575010521 5ustar debian/source/format0000664000000000000000000000001412277767575011727 0ustar 3.0 (quilt) debian/prerm0000664000000000000000000000024612277767575010273 0ustar #! /bin/sh set -e if [ "$1" = "remove" ] ; then for i in ctags etags ; do update-alternatives --remove $i /usr/bin/ctags-exuberant done fi #DEBHELPER# exit 0 debian/compat0000664000000000000000000000000212277767575010417 0ustar 9 debian/patches/0000775000000000000000000000000012414765300010621 5ustar debian/patches/memmove.patch0000664000000000000000000000213512277770536013326 0ustar From fb56c83886b3c1caf8a483d1e449595e740292e6 Mon Sep 17 00:00:00 2001 From: Ben Spencer Date: Sat, 15 Feb 2014 22:47:00 +0000 Subject: Use memmove on overlapping strings strcpy is not guaranteed to work on overlapping strings, and this can lead to broken paths appearing in tag files. Use memmove instead. Origin: other, http://sourceforge.net/tracker/?func=detail&aid=3034816&group_id=6556&atid=306556 Forwarded: yes Last-Update: 2011-02-17 Patch-Name: memmove.patch --- routines.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routines.c b/routines.c index 83bcdcc..8ebe2e0 100644 --- a/routines.c +++ b/routines.c @@ -757,13 +757,13 @@ extern char* absoluteFilename (const char *file) else if (cp [0] != PATH_SEPARATOR) cp = slashp; #endif - strcpy (cp, slashp + 3); + memmove (cp, slashp + 3, strlen(slashp + 3) + 1); slashp = cp; continue; } else if (slashp [2] == PATH_SEPARATOR || slashp [2] == '\0') { - strcpy (slashp, slashp + 2); + memmove (slashp, slashp + 2, strlen(slashp + 2) + 1); continue; } } debian/patches/series0000664000000000000000000000014712414765300012040 0ustar memmove.patch python-disable-imports.patch vim-command-loop.patch go.patch jscript-set-tag-scope.patch debian/patches/python-disable-imports.patch0000664000000000000000000000207012277770536016274 0ustar From 80c99317f1bfb4333757cad0819924f83f62b24e Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sat, 15 Feb 2014 22:47:01 +0000 Subject: python: Disable import parsing by default Parsing imports mixes up imports with actual class definitions. If you need to re-enable this, use the --python-kinds=+i option. Bug: http://sourceforge.net/tracker/?func=detail&aid=2829739&group_id=6556&atid=106556 Bug-Ubuntu: https://bugs.launchpad.net/bugs/618979 Reviewed-by: Colin Watson Forwarded: no Last-Update: 2010-08-17 Patch-Name: python-disable-imports.patch --- python.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python.c b/python.c index a90d072..bf797de 100644 --- a/python.c +++ b/python.c @@ -56,7 +56,7 @@ static kindOption PythonKinds[] = { {TRUE, 'f', "function", "functions"}, {TRUE, 'm', "member", "class members"}, {TRUE, 'v', "variable", "variables"}, - {TRUE, 'i', "namespace", "imports"} + {FALSE, 'i', "namespace", "imports"} }; static char const * const singletriple = "'''"; debian/patches/go.patch0000664000000000000000000003732512277770536012277 0ustar From 18e7bce7b0a8c8761c0b911f3039a7f949703fb3 Mon Sep 17 00:00:00 2001 From: Alexey Marinichev Date: Sat, 15 Feb 2014 22:47:04 +0000 Subject: Add Go support Bug-Debian: http://bugs.debian.org/634166 Origin: other, https://github.com/lyosha/ctags-go/commit/ca097bd639e35470a9abccbf348016b7cc44f811 Last-Update: 2011-07-20 Patch-Name: go.patch --- go.c | 670 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ parsers.h | 1 + source.mak | 2 + 3 files changed, 673 insertions(+) create mode 100644 go.c diff --git a/go.c b/go.c new file mode 100644 index 0000000..6bd3a36 --- /dev/null +++ b/go.c @@ -0,0 +1,670 @@ +/* +* INCLUDE FILES +*/ +#include "general.h" /* must always come first */ +#include + +#include "debug.h" +#include "entry.h" +#include "keyword.h" +#include "read.h" +#include "main.h" +#include "routines.h" +#include "vstring.h" +#include "options.h" + +/* + * MACROS + */ +#define isType(token,t) (boolean) ((token)->type == (t)) +#define isKeyword(token,k) (boolean) ((token)->keyword == (k)) + +/* + * DATA DECLARATIONS + */ + +typedef enum eException { ExceptionNone, ExceptionEOF } exception_t; + +typedef enum eKeywordId { + KEYWORD_NONE = -1, + KEYWORD_package, + KEYWORD_import, + KEYWORD_const, + KEYWORD_type, + KEYWORD_var, + KEYWORD_func, + KEYWORD_struct, + KEYWORD_interface, + KEYWORD_map, + KEYWORD_chan +} keywordId; + +/* Used to determine whether keyword is valid for the current language and + * what its ID is. + */ +typedef struct sKeywordDesc { + const char *name; + keywordId id; +} keywordDesc; + +typedef enum eTokenType { + TOKEN_NONE = -1, + TOKEN_CHARACTER, + // Don't need TOKEN_FORWARD_SLASH + TOKEN_FORWARD_SLASH, + TOKEN_KEYWORD, + TOKEN_IDENTIFIER, + TOKEN_STRING, + TOKEN_OPEN_PAREN, + TOKEN_CLOSE_PAREN, + TOKEN_OPEN_CURLY, + TOKEN_CLOSE_CURLY, + TOKEN_OPEN_SQUARE, + TOKEN_CLOSE_SQUARE, + TOKEN_SEMICOLON, + TOKEN_STAR, + TOKEN_LEFT_ARROW, + TOKEN_DOT, + TOKEN_COMMA +} tokenType; + +typedef struct sTokenInfo { + tokenType type; + keywordId keyword; + vString *string; /* the name of the token */ + unsigned long lineNumber; /* line number of tag */ + fpos_t filePosition; /* file position of line containing name */ +} tokenInfo; + +/* +* DATA DEFINITIONS +*/ + +static int Lang_go; +static jmp_buf Exception; +static vString *scope; + +typedef enum { + GOTAG_UNDEFINED = -1, + GOTAG_PACKAGE, + GOTAG_FUNCTION, + GOTAG_CONST, + GOTAG_TYPE, + GOTAG_VAR, +} goKind; + +static kindOption GoKinds[] = { + {TRUE, 'p', "package", "packages"}, + {TRUE, 'f', "func", "functions"}, + {TRUE, 'c', "const", "constants"}, + {TRUE, 't', "type", "types"}, + {TRUE, 'v', "var", "variables"} +}; + +static keywordDesc GoKeywordTable[] = { + {"package", KEYWORD_package}, + {"import", KEYWORD_import}, + {"const", KEYWORD_const}, + {"type", KEYWORD_type}, + {"var", KEYWORD_var}, + {"func", KEYWORD_func}, + {"struct", KEYWORD_struct}, + {"interface", KEYWORD_interface}, + {"map", KEYWORD_map}, + {"chan", KEYWORD_chan} +}; + +/* +* FUNCTION DEFINITIONS +*/ + +// XXX UTF-8 +static boolean isIdentChar (const int c) +{ + return (boolean) + (isalpha (c) || isdigit (c) || c == '$' || + c == '@' || c == '_' || c == '#' || c > 128); +} + +static void initialize (const langType language) +{ + size_t i; + const size_t count = + sizeof (GoKeywordTable) / sizeof (GoKeywordTable[0]); + Lang_go = language; + for (i = 0; i < count; ++i) + { + const keywordDesc *const p = &GoKeywordTable[i]; + addKeyword (p->name, language, (int) p->id); + } +} + +static tokenInfo *newToken (void) +{ + tokenInfo *const token = xMalloc (1, tokenInfo); + token->type = TOKEN_NONE; + token->keyword = KEYWORD_NONE; + token->string = vStringNew (); + token->lineNumber = getSourceLineNumber (); + token->filePosition = getInputFilePosition (); + return token; +} + +static void deleteToken (tokenInfo * const token) +{ + if (token != NULL) + { + vStringDelete (token->string); + eFree (token); + } +} + +/* + * Parsing functions + */ + +static void parseString (vString *const string, const int delimiter) +{ + boolean end = FALSE; + while (!end) + { + int c = fileGetc (); + if (c == EOF) + end = TRUE; + else if (c == '\\' && delimiter != '`') + { + c = fileGetc (); /* This maybe a ' or ". */ + vStringPut (string, c); + } + else if (c == delimiter) + end = TRUE; + else + vStringPut (string, c); + } + vStringTerminate (string); +} + +static void parseIdentifier (vString *const string, const int firstChar) +{ + int c = firstChar; + //Assert (isIdentChar (c)); + do + { + vStringPut (string, c); + c = fileGetc (); + } while (isIdentChar (c)); + vStringTerminate (string); + fileUngetc (c); /* always unget, LF might add a semicolon */ +} + +static void readToken (tokenInfo *const token) +{ + int c; + static tokenType lastTokenType = TOKEN_NONE; + + token->type = TOKEN_NONE; + token->keyword = KEYWORD_NONE; + vStringClear (token->string); + +getNextChar: + do + { + c = fileGetc (); + token->lineNumber = getSourceLineNumber (); + token->filePosition = getInputFilePosition (); + if (c == '\n' && (lastTokenType == TOKEN_IDENTIFIER || + lastTokenType == TOKEN_STRING || + lastTokenType == TOKEN_CLOSE_PAREN || + lastTokenType == TOKEN_CLOSE_CURLY || + lastTokenType == TOKEN_CLOSE_SQUARE)) + { + token->type = TOKEN_SEMICOLON; + goto done; + } + } + while (c == '\t' || c == ' ' || c == '\r' || c == '\n'); + + switch (c) + { + case EOF: + longjmp (Exception, (int)ExceptionEOF); + break; + + case '/': + { + boolean hasNewline = FALSE; + int d = fileGetc (); + switch (d) + { + case '/': + fileSkipToCharacter ('\n'); + /* Line comments start with the + * character sequence // and + * continue through the next + * newline. A line comment acts + * like a newline. */ + fileUngetc ('\n'); + goto getNextChar; + case '*': + do + { + int d; + do + { + d = fileGetc (); + if (d == '\n') + { + hasNewline = TRUE; + } + } while (d != EOF && d != '*'); + + c = fileGetc (); + if (c == '/') + break; + else + fileUngetc (c); + } while (c != EOF && c != '\0'); + + fileUngetc (hasNewline ? '\n' : ' '); + goto getNextChar; + default: + token->type = TOKEN_FORWARD_SLASH; + fileUngetc (d); + break; + } + } + break; + + case '"': + case '\'': + case '`': + token->type = TOKEN_STRING; + parseString (token->string, c); + token->lineNumber = getSourceLineNumber (); + token->filePosition = getInputFilePosition (); + break; + + case '<': + { + int d = fileGetc (); + if (d == '-') + { + token->type = TOKEN_LEFT_ARROW; + break; + } + else + goto getNextChar; + } + + case '(': + token->type = TOKEN_OPEN_PAREN; + break; + + case ')': + token->type = TOKEN_CLOSE_PAREN; + break; + + case '{': + token->type = TOKEN_OPEN_CURLY; + break; + + case '}': + token->type = TOKEN_CLOSE_CURLY; + break; + + case '[': + token->type = TOKEN_OPEN_SQUARE; + break; + + case ']': + token->type = TOKEN_CLOSE_SQUARE; + break; + + case '*': + token->type = TOKEN_STAR; + break; + + case '.': + token->type = TOKEN_DOT; + break; + + case ',': + token->type = TOKEN_COMMA; + break; + + default: + parseIdentifier (token->string, c); + token->lineNumber = getSourceLineNumber (); + token->filePosition = getInputFilePosition (); + token->keyword = lookupKeyword (vStringValue (token->string), Lang_go); + if (isKeyword (token, KEYWORD_NONE)) + token->type = TOKEN_IDENTIFIER; + else + token->type = TOKEN_KEYWORD; + break; + } + +done: + lastTokenType = token->type; +} + +static void skipToMatched (tokenInfo *const token) +{ + int nest_level = 0; + tokenType open_token; + tokenType close_token; + + switch (token->type) + { + case TOKEN_OPEN_PAREN: + open_token = TOKEN_OPEN_PAREN; + close_token = TOKEN_CLOSE_PAREN; + break; + case TOKEN_OPEN_CURLY: + open_token = TOKEN_OPEN_CURLY; + close_token = TOKEN_CLOSE_CURLY; + break; + case TOKEN_OPEN_SQUARE: + open_token = TOKEN_OPEN_SQUARE; + close_token = TOKEN_CLOSE_SQUARE; + break; + default: + return; + } + + /* + * This routine will skip to a matching closing token. + * It will also handle nested tokens like the (, ) below. + * ( name varchar(30), text binary(10) ) + */ + if (isType (token, open_token)) + { + nest_level++; + while (!(isType (token, close_token) && (nest_level == 0))) + { + readToken (token); + if (isType (token, open_token)) + { + nest_level++; + } + if (isType (token, close_token)) + { + if (nest_level > 0) + { + nest_level--; + } + } + } + readToken (token); + } +} + +static void skipType (tokenInfo *const token) +{ +again: + // Type = TypeName | TypeLit | "(" Type ")" . + if (isType (token, TOKEN_OPEN_PAREN)) + { + skipToMatched (token); + return; + } + + // TypeName = QualifiedIdent. + // QualifiedIdent = [ PackageName "." ] identifier . + // PackageName = identifier . + if (isType (token, TOKEN_IDENTIFIER)) + { + readToken (token); + if (isType (token, TOKEN_DOT)) + { + readToken (token); + Assert (isType (token, TOKEN_IDENTIFIER)); + readToken (token); + } + return; + } + + // StructType = "struct" "{" { FieldDecl ";" } "}" + // InterfaceType = "interface" "{" { MethodSpec ";" } "}" . + if (isKeyword (token, KEYWORD_struct) || isKeyword (token, KEYWORD_interface)) + { + readToken (token); + Assert (isType (token, TOKEN_OPEN_CURLY)); + skipToMatched (token); + return; + } + + // ArrayType = "[" ArrayLength "]" ElementType . + // SliceType = "[" "]" ElementType . + // ElementType = Type . + if (isType (token, TOKEN_OPEN_SQUARE)) + { + skipToMatched (token); + goto again; + } + + // PointerType = "*" BaseType . + // BaseType = Type . + // ChannelType = ( "chan" [ "<-" ] | "<-" "chan" ) ElementType . + if (isType (token, TOKEN_STAR) || isKeyword (token, KEYWORD_chan) || isType (token, TOKEN_LEFT_ARROW)) + { + readToken (token); + goto again; + } + + // MapType = "map" "[" KeyType "]" ElementType . + // KeyType = Type . + if (isKeyword (token, KEYWORD_map)) + { + readToken (token); + Assert (isType (token, TOKEN_OPEN_SQUARE)); + skipToMatched (token); + goto again; + } + + // FunctionType = "func" Signature . + // Signature = Parameters [ Result ] . + // Result = Parameters | Type . + // Parameters = "(" [ ParameterList [ "," ] ] ")" . + if (isKeyword (token, KEYWORD_func)) + { + readToken (token); + Assert (isType (token, TOKEN_OPEN_PAREN)); + // Parameters + skipToMatched (token); + // Result is parameters or type or nothing. skipType treats anything + // surrounded by parentheses as a type, and does nothing if what + // follows is not a type. + goto again; + } +} + +// Skip to the next semicolon, skipping over matching brackets. +static void skipToTopLevelSemicolon (tokenInfo *const token) +{ + while (!isType (token, TOKEN_SEMICOLON)) + { + readToken (token); + skipToMatched (token); + } +} + +static void makeTag (tokenInfo *const token, const goKind kind) +{ + const char *const name = vStringValue (token->string); + + tagEntryInfo e; + initTagEntry (&e, name); + + if (!GoKinds [kind].enabled) + return; + + e.lineNumber = token->lineNumber; + e.filePosition = token->filePosition; + e.kindName = GoKinds [kind].name; + e.kind = GoKinds [kind].letter; + + makeTagEntry (&e); + + if (scope && Option.include.qualifiedTags) + { + vString *qualifiedName = vStringNew (); + vStringCopy (qualifiedName, scope); + vStringCatS (qualifiedName, "."); + vStringCat (qualifiedName, token->string); + e.name = vStringValue (qualifiedName); + makeTagEntry (&e); + vStringDelete (qualifiedName); + } +} + +static void parsePackage (tokenInfo *const token) +{ + tokenInfo *const name = newToken (); + + readToken (name); + Assert (isType (name, TOKEN_IDENTIFIER)); + makeTag (name, GOTAG_PACKAGE); + if (!scope && Option.include.qualifiedTags) + { + scope = vStringNew (); + vStringCopy (scope, name->string); + } + + deleteToken (name); +} + +static void parseFunctionOrMethod (tokenInfo *const token) +{ + // FunctionDecl = "func" identifier Signature [ Body ] . + // Body = Block. + // + // MethodDecl = "func" Receiver MethodName Signature [ Body ] . + // Receiver = "(" [ identifier ] [ "*" ] BaseTypeName ")" . + // BaseTypeName = identifier . + tokenInfo *const name = newToken (); + + // Skip over receiver. + readToken (name); + if (isType (name, TOKEN_OPEN_PAREN)) + skipToMatched (name); + + Assert (isType (name, TOKEN_IDENTIFIER)); + + // Skip over parameters. + readToken (token); + skipToMatched (token); + + // Skip over result. + skipType (token); + + // Skip over function body. + if (isType (token, TOKEN_OPEN_CURLY)) + skipToMatched (token); + + makeTag (name, GOTAG_FUNCTION); + + deleteToken (name); +} + +static void parseConstTypeVar (tokenInfo *const token, goKind kind) +{ + // ConstDecl = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) . + // ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] . + // IdentifierList = identifier { "," identifier } . + // ExpressionList = Expression { "," Expression } . + // TypeDecl = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) . + // TypeSpec = identifier Type . + // VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) . + // VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) . + tokenInfo *const name = newToken (); + boolean usesParens = FALSE; + + readToken (name); + + if (isType (name, TOKEN_OPEN_PAREN)) + { + usesParens = TRUE; + readToken (name); + } + +again: + while (1) + { + makeTag (name, kind); + readToken (token); + if (!isType (token, TOKEN_COMMA) && !isType (token, TOKEN_CLOSE_PAREN)) + break; + readToken (name); + } + + skipType (token); + skipToTopLevelSemicolon (token); + + if (usesParens) + { + readToken (name); + if (!isType (name, TOKEN_CLOSE_PAREN)) + goto again; + } + + deleteToken (name); +} + +static void parseGoFile (tokenInfo *const token) +{ + do + { + readToken (token); + + if (isType (token, TOKEN_KEYWORD)) + { + switch (token->keyword) + { + case KEYWORD_package: + parsePackage (token); + break; + case KEYWORD_func: + parseFunctionOrMethod (token); + break; + case KEYWORD_const: + parseConstTypeVar (token, GOTAG_CONST); + break; + case KEYWORD_type: + parseConstTypeVar (token, GOTAG_TYPE); + break; + case KEYWORD_var: + parseConstTypeVar (token, GOTAG_VAR); + break; + default: + break; + } + } + } while (TRUE); +} + +static void findGoTags (void) +{ + tokenInfo *const token = newToken (); + exception_t exception; + + exception = (exception_t) (setjmp (Exception)); + while (exception == ExceptionNone) + parseGoFile (token); + + deleteToken (token); + vStringDelete (scope); + scope = NULL; +} + +extern parserDefinition *GoParser (void) +{ + static const char *const extensions[] = { "go", NULL }; + parserDefinition *def = parserNew ("Go"); + def->kinds = GoKinds; + def->kindCount = KIND_COUNT (GoKinds); + def->extensions = extensions; + def->parser = findGoTags; + def->initialize = initialize; + return def; +} diff --git a/parsers.h b/parsers.h index 600f636..3a24d6e 100644 --- a/parsers.h +++ b/parsers.h @@ -31,6 +31,7 @@ ErlangParser, \ FlexParser, \ FortranParser, \ + GoParser, \ HtmlParser, \ JavaParser, \ JavaScriptParser, \ diff --git a/source.mak b/source.mak index c97617f..985d56c 100644 --- a/source.mak +++ b/source.mak @@ -24,6 +24,7 @@ SOURCES = \ flex.c \ fortran.c \ get.c \ + go.c \ html.c \ jscript.c \ keyword.c \ @@ -87,6 +88,7 @@ OBJECTS = \ flex.$(OBJEXT) \ fortran.$(OBJEXT) \ get.$(OBJEXT) \ + go.$(OBJEXT) \ html.$(OBJEXT) \ jscript.$(OBJEXT) \ keyword.$(OBJEXT) \ debian/patches/jscript-set-tag-scope.patch0000664000000000000000000000544612414765300016002 0ustar From a499a10833d525c9af794c616dc40f7425110c71 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 27 Sep 2014 14:37:19 +0100 Subject: Changed the javascript parser to set the tag's scope rather than including it in the tag name. Patch from Colomban. Author: David Fishburn Origin: upstream, http://sourceforge.net/p/ctags/code/791/ Bug-Debian: https://bugs.debian.org/742605 Last-Update: 2014-09-27 Patch-Name: jscript-set-tag-scope.patch --- jscript.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/jscript.c b/jscript.c index 5de3367..a790355 100644 --- a/jscript.c +++ b/jscript.c @@ -215,6 +215,7 @@ static void deleteToken (tokenInfo *const token) * Tag generation functions */ +/* static void makeConstTag (tokenInfo *const token, const jsKind kind) { if (JsKinds [kind].enabled && ! token->ignoreTag ) @@ -238,12 +239,13 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind) if (JsKinds [kind].enabled && ! token->ignoreTag ) { - /* + * * If a scope has been added to the token, change the token * string to include the scope when making the tag. - */ + * if ( vStringLength(token->scope) > 0 ) { + * fulltag = vStringNew (); vStringCopy(fulltag, token->scope); vStringCatS (fulltag, "."); @@ -251,8 +253,54 @@ static void makeJsTag (tokenInfo *const token, const jsKind kind) vStringTerminate(fulltag); vStringCopy(token->string, fulltag); vStringDelete (fulltag); + * + jsKind parent_kind = JSTAG_CLASS; + + * + * if we're creating a function (and not a method), + * guess we're inside another function + * + if (kind == JSTAG_FUNCTION) + parent_kind = JSTAG_FUNCTION; + + e.extensionFields.scope[0] = JsKinds [parent_kind].name; + e.extensionFields.scope[1] = vStringValue (token->scope); + } + * makeConstTag (token, kind); * + makeTagEntry (&e); + } +} +*/ + +static void makeJsTag (tokenInfo *const token, const jsKind kind) +{ + if (JsKinds [kind].enabled && ! token->ignoreTag ) + { + const char *const name = vStringValue (token->string); + tagEntryInfo e; + initTagEntry (&e, name); + + e.lineNumber = token->lineNumber; + e.filePosition = token->filePosition; + e.kindName = JsKinds [kind].name; + e.kind = JsKinds [kind].letter; + + if ( vStringLength(token->scope) > 0 ) + { + jsKind parent_kind = JSTAG_CLASS; + + /* + * If we're creating a function (and not a method), + * guess we're inside another function + */ + if (kind == JSTAG_FUNCTION) + parent_kind = JSTAG_FUNCTION; + + e.extensionFields.scope[0] = JsKinds [parent_kind].name; + e.extensionFields.scope[1] = vStringValue (token->scope); } - makeConstTag (token, kind); + + makeTagEntry (&e); } } debian/patches/vim-command-loop.patch0000664000000000000000000000166312277770536015044 0ustar From 15b3c591abd3b0e4334f9fba19a9b75330b33c26 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 15 Feb 2014 22:47:02 +0000 Subject: Fix infinite loop parsing vim commands This happens if a non-alphanumeric character other than whitespace or '-' is found before the first alphanumeric character after 'command'. Bug: http://sourceforge.net/tracker/index.php?func=detail&aid=3214129&group_id=6556&atid=106556 Bug-Ubuntu: https://bugs.launchpad.net/bugs/736367 Forwarded: no Last-Update: 2011-03-17 Patch-Name: vim-command-loop.patch --- vim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vim.c b/vim.c index 4e6fba8..d17a1ba 100644 --- a/vim.c +++ b/vim.c @@ -405,7 +405,9 @@ static boolean parseCommand (const unsigned char *line) while (*cp && !isspace ((int) *cp)) ++cp; } - } while ( *cp && !isalnum ((int) *cp) ); + else + break; + } while ( *cp ); if ( ! *cp ) { debian/dirs0000664000000000000000000000003312277767575010101 0ustar usr/bin usr/share/man/man1 debian/.git-dpm0000664000000000000000000000044612277770536010556 0ustar # see git-dpm(1) from git-dpm package 18e7bce7b0a8c8761c0b911f3039a7f949703fb3 18e7bce7b0a8c8761c0b911f3039a7f949703fb3 4b0ebb9d344fd369c889291478986c65a5a36ea8 4b0ebb9d344fd369c889291478986c65a5a36ea8 exuberant-ctags_5.9~svn20110310.orig.tar.gz 8d2a9214b26e2b9046f9264ade2f2a528eaf6e23 497076 debian/copyright0000664000000000000000000000604612277767575011162 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: ctags Upstream-Contact: Darren Hiebert Source: http://ctags.sourceforge.net/ Files: * Copyright: 1996-2009 Darren Hiebert License: GPL-2+ Files: ant.c dosbatch.c flex.c matlab.c tex.c Copyright: 2008-2009 David Fishburn License: GPL-2+ Files: argproc.c Copyright: 1989 Mark Pizzolato License: GPL-2+ Files: basic.c Copyright: 2000-2006 Darren Hiebert, Elias Pschernig License: GPL-2+ Files: e_mac.h mac.c Copyright: 2001 Maarten L. Hekkelman License: GPL-2+ Files: e_riscos.h Copyright: 2002 Andrew Wingate License: GPL-2+ Files: erlang.c Copyright: 2003 Brent Fulgham License: GPL-2+ Files: gnu_regex/* Copyright: 1985-2009 Free Software Foundation, Inc. License: LGPL-2.1+ Files: lua.c Copyright: 2000-2001 Max Ischenko License: GPL-2+ Files: objc.c ocaml.c Copyright: 2009-2010 Vincent Berthoux License: GPL-2+ Files: php.c Copyright: 2000 Jesus Castagnetto License: GPL-2+ Files: qdos.c Copyright: 1999 Thierry Godefroy License: GPL-2+ Files: ruby.c Copyright: 2000-2001 Thaddeus Covert 2002 Matthias Veit 2004 Elliott Hughes License: GPL-2+ Files: slang.c Copyright: 2000-2001 Francesc Rocher License: GPL-2+ Files: sml.c Copyright: 2002 Venkatesh Prasad Ranganath 2002 Darren Hiebert License: GPL-2+ Files: vhdl.c Copyright: 2008 Nicolas Vincent License: GPL-2+ Files: yacc.c Copyright: 2001-2002 Nick Hibma License: GPL-2+ License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. . On Debian and Debian-based systems, a copy of the GNU General Public License version 2 is available in /usr/share/common-licenses/GPL-2. License: LGPL-2.1+ The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. . The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. debian/watch0000664000000000000000000000012012277767575010243 0ustar version=3 opts=dversionmangle=s/^\d+:// http://sf.net/ctags/ctags-(.+)\.tar\.gz debian/rules0000775000000000000000000000170612277773015010267 0ustar #! /usr/bin/make -f %: dh $@ --with autoreconf dtmp = debian/exuberant-ctags export DEB_CFLAGS_MAINT_APPEND := -Wall $(shell dpkg-buildflags --get CPPFLAGS) override_dh_auto_install: # Install exuberant-ctags itself install -m 755 ctags $(dtmp)/usr/bin/ctags-exuberant install -p -m 644 ctags.1 $(dtmp)/usr/share/man/man1/ctags-exuberant.1 override_dh_installchangelogs: dh_installchangelogs NEWS # git clones do not contain git-svn metadata. This can be used to set it # back up if you need it. git-svn-setup: set -e; if [ -d .git ] && [ ! -d .git/svn ]; then \ git config svn-remote.svn.url svn://svn.code.sf.net/p/ctags/code; \ git config svn-remote.svn.fetch trunk:refs/remotes/svn/trunk; \ git config svn-remote.svn.branches 'branches/*:refs/remotes/svn/*'; \ git config svn-remote.svn.tags 'tags/*:refs/remotes/svn/tags/*'; \ git update-ref refs/remotes/svn/trunk "$$(git log -n1 --grep git-svn-id: --format=%H)"; \ git svn fetch; \ fi