Re: [Cython] Is it easy to do an "AST grep" of Cython code?

2015-09-14 Thread Jelle Zijlstra
This seems doable in principle by using the Cython.Compiler.Visitor.TreeVisitor class. You'll have to figure out what Cython AST nodes the things you're looking for correspond to. As a simple example, this will find all non-def functions in a Cython file: from Cython.Compiler import TreeFragment,

[Cython] Is it easy to do an "AST grep" of Cython code?

2015-09-14 Thread Nathaniel Smith
I have a few hundred files worth of Cython code, and I'd like to find all instances where a variable/expression has a certain cdef class type. (More specifically, I'd like to find all accesses to the cdef fields of a particular cdef class, but even just finding all 'cdef MYTYPE x" and "x" statement