Visitor.pxd 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from __future__ import absolute_import
  2. cimport cython
  3. cdef class TreeVisitor:
  4. cdef public list access_path
  5. cdef dict dispatch_table
  6. cpdef visit(self, obj)
  7. cdef _visit(self, obj)
  8. cdef find_handler(self, obj)
  9. cdef _visitchild(self, child, parent, attrname, idx)
  10. cdef dict _visitchildren(self, parent, attrs)
  11. cpdef visitchildren(self, parent, attrs=*)
  12. cdef _raise_compiler_error(self, child, e)
  13. cdef class VisitorTransform(TreeVisitor):
  14. cdef dict _process_children(self, parent, attrs=*)
  15. cpdef visitchildren(self, parent, attrs=*, exclude=*)
  16. cdef list _flatten_list(self, list orig_list)
  17. cdef list _select_attrs(self, attrs, exclude)
  18. cdef class CythonTransform(VisitorTransform):
  19. cdef public context
  20. cdef public current_directives
  21. cdef class ScopeTrackingTransform(CythonTransform):
  22. cdef public scope_type
  23. cdef public scope_node
  24. cdef visit_scope(self, node, scope_type)
  25. cdef class EnvTransform(CythonTransform):
  26. cdef public list env_stack
  27. cdef class MethodDispatcherTransform(EnvTransform):
  28. @cython.final
  29. cdef _visit_binop_node(self, node)
  30. @cython.final
  31. cdef _find_handler(self, match_name, bint has_kwargs)
  32. @cython.final
  33. cdef _delegate_to_assigned_value(self, node, function, arg_list, kwargs)
  34. @cython.final
  35. cdef _dispatch_to_handler(self, node, function, arg_list, kwargs)
  36. @cython.final
  37. cdef _dispatch_to_method_handler(self, attr_name, self_arg,
  38. is_unbound_method, type_name,
  39. node, function, arg_list, kwargs)
  40. cdef class RecursiveNodeReplacer(VisitorTransform):
  41. cdef public orig_node
  42. cdef public new_node
  43. cdef class NodeFinder(TreeVisitor):
  44. cdef node
  45. cdef public bint found