Added cutoff argument to Node.dump() utility
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 15 Aug 2008 19:22:09 +0000 (21:22 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 15 Aug 2008 19:22:09 +0000 (21:22 +0200)
Cython/Compiler/Nodes.py

index c006d71df29751d44add675524bd7ed677ebd754..4717fee84fe871275fcca6f18d722e353a25a944 100644 (file)
@@ -176,10 +176,13 @@ class Node(object):
             self._end_pos = pos
             return pos
 
-    def dump(self, level=0, filter_out=("pos",)):
+    def dump(self, level=0, filter_out=("pos",), cutoff=100):
+        if cutoff == 0:
+            return "<...nesting level cutoff...>"
+        
         def dump_child(x, level):
             if isinstance(x, Node):
-                return x.dump(level)
+                return x.dump(level, filter_out, cutoff-1)
             elif isinstance(x, list):
                 return "[%s]" % ", ".join([dump_child(item, level) for item in x])
             else: