Ctags

Handling indentation (etc) for various programming languages is a critical part of our handling of Monospace text. Fortunately, the venerable Ctags utility solves a large part of this problem very nicely. Basically, it scans a file of program source code, recording the locations of any "names" it finds.

Given this information and a bit of post-processing, AxAp should be able to identify modules and functions, classes and methods, etc.

Input Languages

Universal Ctags supports 64 (!) input languages, including the C family, Python, and Ruby:

    ada, ant, asm, asp, automake, awk, basic, beta, c, clojure, cobol, css, dbusintrospect, diff, dosbatch, dts, eiffel, erlang, falcon, flex, fortran, glade, go, html, jprop, jscript, json, lisp, lua, make, matlab, maven2, myrddin, objc, ocaml, pascal, perl, perl6, php, plist, protobuf, python, r, relaxng, rexx, rpmspec, rst, ruby, rust, scheme, sh, slang, sml, sql, svg, tcl, tex, ttcn, verilog, vhdl, vim, windres, xslt, yacc

There are also implementations in (at least) Haskell and JavaScript. We'd be happy to have any of these as part of AxAp, but we expect to wait for someone else to port them (:-).

Output Format

Unlike the default (vi-specific) file format for Ctags, the Etags format is editor-neutral. An Etags file contains one section per input source file. Each section is formatted as follows:

<\x0c> 
{src_file},{size_of_tag_definition_data_in_bytes}
{tag_definition_text}<\x7f>{tagname}<\x01>{line_number},{byte_offset}
...

We plan to use this as our de facto standard format for tag position metadata. Although parsers for Universal Ctags must be written in C, we could use parsers written in any language, as long as they support the Etags file format. For example, it might be interesting to write one in Elixir, taking advantage of its pattern matching capabilities.


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r4 - 26 Oct 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email