print node position in PrintTree
authorStefan Behnel <scoder@users.berlios.de>
Sun, 15 Mar 2009 14:42:40 +0000 (15:42 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 15 Mar 2009 14:42:40 +0000 (15:42 +0100)
Cython/Compiler/Visitor.py

index 034a2e67ef2942552efb3863c8601c1f7a46d26e..c7739f8d6554efb7ecab1007366657e430f8c739 100644 (file)
@@ -342,7 +342,15 @@ class PrintTree(TreeVisitor):
             elif isinstance(node, ExprNodes.ExprNode):
                 t = node.type
                 result += "(type=%s)" % repr(t)
-                
+            elif node.pos:
+                pos = node.pos
+                path = pos[0].get_description()
+                if '/' in path:
+                    path = path.split('/')[-1]
+                if '\\' in path:
+                    path = path.split('\\')[-1]
+                result += "(pos=(%s:%s:%s))" % (path, pos[1], pos[2])
+
             return result
 
 if __name__ == "__main__":