Skip to content

Commit

Permalink
Fix ctags for complex Cython type declarations
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aeberspaecher committed Jul 15, 2013
1 parent 66396e7 commit e6878e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tagmanager/ctags/python.c
Expand Up @@ -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 */
Expand Down

0 comments on commit e6878e5

Please sign in to comment.