[geany/geany] e6878e: Fix ctags for complex Cython type declarations

Alexander Eberspächer git-noreply at xxxxx
Mon Jul 15 08:06:37 UTC 2013


Branch:      refs/heads/master
Author:      Alexander Eberspächer <alex.eberspaecher at gmail.com>
Committer:   Alexander Eberspächer <alex.eberspaecher at gmail.com>
Date:        Mon, 15 Jul 2013 08:06:37 UTC
Commit:      e6878e5cbf47f1e7a000952380f1d6a3a7a63aa2
             https://github.com/geany/geany/commit/e6878e5cbf47f1e7a000952380f1d6a3a7a63aa2

Log Message:
-----------
Fix ctags for complex Cython type declarations

Cython allows the use NumPy arrays on a C level. In that context, a
typical return type declaration could be e.g. "cpdef
numpy.ndarray[dtype=double, ndim=1] name". This now generates a tag for
the function. Previously, the equal sign prevented that.


Modified Paths:
--------------
    tagmanager/ctags/python.c

Modified: tagmanager/ctags/python.c
8 files changed, 7 insertions(+), 1 deletions(-)
===================================================================
@@ -576,7 +576,13 @@ static const char *skipTypeDecl (const char *cp, boolean *is_class)
 	}
 	/* limit so that we don't pick off "int item=obj()" */
 	while (*ptr && loopCount++ < 2) {
-		while (*ptr && *ptr != '=' && *ptr != '(' && !isspace(*ptr)) ptr++;
+		while (*ptr && *ptr != '=' && *ptr != '(' && !isspace(*ptr)) {
+			/* skip over e.g. 'cpdef numpy.ndarray[dtype=double, ndim=1]' */
+			if(*ptr == '[') {
+				while(*ptr && *ptr != ']') ptr++;
+			}
+			ptr++;
+		}
 		if (!*ptr || *ptr == '=') return NULL;
 		if (*ptr == '(') {
 		    return lastStart; /* if we stopped on a '(' we are done */



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list