There are a few other implementations of the ctags program:
Etags
GNU Emacs comes with two ctags utilities, etags and ctags, which are compiled from the same source code. Etags generates a tag table file for Emacs, while the ctags command is used to create a similar table in a format understood by vi. They have different sets of command line options: For those options which only make sense for vi style tag files produced by the ctags command, etags could not recognize them and would ignore them.
Exuberant Ctags
Exuberant Ctags, written and maintained by Darren Hiebert until 2009, was initially distributed with Vim, but became a separate project upon the release of Vim 6. It includes support for Emacs and compatibility. Exuberant Ctags includes support for over 40 programming languages with the ability to add support for even more using regular expressions.
Universal Ctags
Universal Ctags is a fork of Exuberant Ctags, with the objective of continuing its development. A few parsers are rewritten to better support the languages.
Language-specific
' creates ctags compatible tag files for Haskellsource files. It includes support for creating Emacs etags files. ' is a ctags-compatible code indexing solution for JavaScript. It is specialized for JavaScript and uses the CommonJSpackaging system. It outperforms Exuberant Ctags for JavaScript code, finding more tags than the latter.
There are multiple tag file formats. Some of them are described below. In the following, \x## represents the byte with hexadecimal representation ##. Every line ends with a line feed.
Ctags and descendants
The original ctags and the Exuberant/Universal descendants have similar file formats:
Ctags
This is the format used by vi and various clones. The tags file is normally named "tags". The tags file is a list of lines, each line in the format: \t\t The fields are specified as follows:
\t - Exactly onetab character, although many versions of vi can handle any amount of white space.
- The name of the file where is defined, relative to the current directory
- An ex mode command that will take the editor to the location of the tag. For POSIX implementations of vi this may only be a search or a line number, providing added security against arbitrary command execution.
The tags file is sorted on the field which allows for fast searching of the tags file.
Extended Ctags
This is the format used by Vim's Exuberant Ctags and Universal Ctags. These programs can generate an original ctagsfile format or an extended format that attempts to retain backward compatibility. The extended tags file is a list of lines, each line in the format: \t\t The fields up to and including are the same as for ctags above. Optional additional fields are indicated by square brackets and include:
;" - semicolon + double quote: Ends the in a way that looks like the start of a comment to vi or ex.
- extension fields: tab separated "key:value" pairs for more information.
This format is compatible with non-POSIX vi as the additional data is interpreted as a comment. POSIX implementations of vi must be changed to support it, however.
Etags
This is the format used by Emacs etags. The tags file is normally named "TAGS". The etags files consists of multiple sections—one section per input source file. Sections are plain-text with several non-printable ascii characters used for special purposes. These characters are represented as bracketed hexadecimal codes below. A section starts with a two line header : \x0c , The header is followed by tag definitions, one definition per line, with the format: \x7f\x01, \x01 can be omitted if the name of the tag can be deduced from the text at the tag definition.
Example
Given a single line test.c source code: #define CCC The TAGS file would look like this: \x0c test.c,21 #define CCC file may look like: