Skip to content

Commit

Permalink
Merge branch 'aeberspaecher/cython/ndarray-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Jul 15, 2013
2 parents 66396e7 + 3dc5422 commit 80ad5c1
Show file tree
Hide file tree
Showing 4 changed files with 22 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
1 change: 1 addition & 0 deletions tests/ctags/Makefile.am
Expand Up @@ -113,6 +113,7 @@ test_sources = \
countall.sql \
cpp_destructor.cpp \
cython_sample.pyx \
cython_sample2.pyx \
cxx11enum.cpp \
db-trig.sql \
debian_432872.f90 \
Expand Down
11 changes: 11 additions & 0 deletions tests/ctags/cython_sample2.pyx
@@ -0,0 +1,11 @@
# -*- cython-mode -*-
# test code for cython functionality with complex datatypes

import numpy as np
cimport numpy as np

cpdef np.ndarray[dtype=double, ndim=1] my_fun(np.ndarray[dtype=double, ndim=1] x):
cdef np.ndarray[dtype=double, ndim=1, mode="c"] res

res = 2*x
return res
3 changes: 3 additions & 0 deletions tests/ctags/cython_sample2.pyx.tags
@@ -0,0 +1,3 @@
# format=tagmanager
my_fun�16�(np.ndarray[dtype=double, ndim=1] x)�0
np�256�0

0 comments on commit 80ad5c1

Please sign in to comment.