1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
cimport cython
cdef class TreeVisitor:
cdef public list access_path
cdef dict dispatch_table
cpdef visit(self, obj)
cdef _visit(self, obj)
cdef find_handler(self, obj)
cdef _visitchild(self, child, parent, attrname, idx)
@cython.locals(idx=int)
cdef dict _visitchildren(self, parent, attrs)
cpdef visitchildren(self, parent, attrs=*)
cdef class VisitorTransform(TreeVisitor):
cpdef visitchildren(self, parent, attrs=*)
cpdef recurse_to_children(self, node)
cdef class CythonTransform(VisitorTransform):
cdef public context
cdef public current_directives
cdef class ScopeTrackingTransform(CythonTransform):
cdef public scope_type
cdef public scope_node
cdef visit_scope(self, node, scope_type)
cdef class EnvTransform(CythonTransform):
cdef public list env_stack
cdef class RecursiveNodeReplacer(VisitorTransform):
cdef public orig_node
cdef public new_node
|