From: Stefan Behnel Date: Sun, 15 Mar 2009 14:42:40 +0000 (+0100) Subject: print node position in PrintTree X-Git-Tag: 0.11.1.alpha~56 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c93d8837c3b66dcac177492388a8461883e312c4;p=cython.git print node position in PrintTree --- diff --git a/Cython/Compiler/Visitor.py b/Cython/Compiler/Visitor.py index 034a2e67..c7739f8d 100644 --- a/Cython/Compiler/Visitor.py +++ b/Cython/Compiler/Visitor.py @@ -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__":