Hi,
I started working on support for reading Exuberant Ctags files. The
commit message sums up most of the details I hope. If anyone wants to
try it out and/or review the code, that would be much appreciated.
The relevant commit is here on my 'ctags-support' branch:
https://github.com/codebrainz/geany/commit/a642077c47ea444e9b13b9d2ad244be0866b562c
Or the attached patch has the same information.
I haven't tested a whole lot but it seems to be working well, allowing
colourizing of the tags and auto-completion. It doesn't (yet) get the
arguments list for functions (haven't found a clean way yet), so the
calltips for function tags are pretty useless.
There is still much to be done, but it's a good start.
Cheers,
Matthew Brush
From a642077c47ea444e9b13b9d2ad244be0866b562c Mon Sep 17 00:00:00 2001
From: Matthew Brush matthewbr...@gmail.com
Date: Tue, 24 May 2011 21:10:56 -0700
Subject: [PATCH] Add basic support for CTags tag file format.
Add new files readtags.c/h (public domain) from the CTags project[1]
for parsing CTags tags from tag files and incorporate those files
into the Autotools build system (todo: Waf).
Add a new enum to allow specifying between the (now) 3 supported
tag file formats, and adjust function signatures and usage
accordingly. (todo: is it a bad name, does it belong elsewhere)
Add new function to initialize tags from a CTags file, which
needs the filename and the language/mode. This function isn't
re-entrant (or thread safe) since it holds the context in a
static var and doesn't re-init it unless all tags have been parsed
or an error occurs. The '#if 0' will be used later to get more
info from the extension fields in the CTags format.
Adjust tm_tag_new_from_file() to allow passing in a filename to the
tag file (can be NULL for non-CTags formats).
Add lookup table to allow finding TMTagType based on the 'kind' that
is specified for tags in the CTags file. The table can be search
by single character kind or string kind depending on what's in the
CTags file. (todo: notes in comments). Also add functions for
performing lookings.
Add few experimental functions (inside #ifdef USE_HACKS) to play
with getting more information from the tags file. This code
should not be used for real (yet, if ever).
Add detection of the CTags format marker (!_TAG) at the beginning
of the file and auto-detection if that's missing. The idea of using
2 or more TAB characters to detect the format might be flawed since
this might occur in the other format(s).
[1] http://ctags.sourceforge.net/tool_support.html
---
tagmanager/Makefile.am |1 +
tagmanager/include/Makefile.am |3 +-
tagmanager/include/readtags.h | 252 +
tagmanager/include/tm_source_file.h |8 +
tagmanager/include/tm_tag.h |8 +-
tagmanager/include/tm_workspace.h |1 -
tagmanager/readtags.c | 964 +++
tagmanager/tm_project.c |2 +-
tagmanager/tm_tag.c | 440 -
tagmanager/tm_workspace.c | 28 +-
10 files changed, 1690 insertions(+), 17 deletions(-)
create mode 100644 tagmanager/include/readtags.h
create mode 100644 tagmanager/readtags.c
diff --git a/tagmanager/Makefile.am b/tagmanager/Makefile.am
index 754412c..720a320 100644
--- a/tagmanager/Makefile.am
+++ b/tagmanager/Makefile.am
@@ -77,6 +77,7 @@ libtagmanager_a_SOURCES =\
options.c\
parse.c\
read.c\
+ readtags.c \
sort.c\
strlist.c\
vstring.c\
diff --git a/tagmanager/include/Makefile.am b/tagmanager/include/Makefile.am
index 9fc9638..65ab9d7 100644
--- a/tagmanager/include/Makefile.am
+++ b/tagmanager/include/Makefile.am
@@ -1,5 +1,6 @@
noinst_HEADERS = \
- gnuregex.h
+ gnuregex.h \
+ readtags.h
tagmanager_includedir = $(includedir)/geany/tagmanager
tagmanager_include_HEADERS = \
diff --git a/tagmanager/include/readtags.h b/tagmanager/include/readtags.h
new file mode 100644
index 000..3a55210
--- /dev/null
+++ b/tagmanager/include/readtags.h
@@ -0,0 +1,252 @@
+/*
+* $Id: readtags.h 443 2006-05-30 04:37:13Z darren $
+*
+* Copyright (c) 1996-2003, Darren Hiebert
+*
+* This source code is released for the public domain.
+*
+* This file defines the public interface for looking up tag entries in tag
+* files.
+*
+* The functions defined in this interface are intended to provide tag file
+* support to a software tool. The tag lookups provided are sufficiently fast
+* enough to permit opening a sorted tag file, searching for a matching tag,
+* then closing the tag file each time a tag is looked up (search times are
+* on the order of hundreths of a second, even for huge tag files). This is
+* the recommended use of this library for most tool applications. Adhering
+* to this approach permits a user to regenerate a tag file at will without
+* the tool needing to detect and resynchronize with changes to the tag file.
+* Even for an unsorted 24MB tag file, tag