Commit c93d8837 authored by Stefan Behnel's avatar Stefan Behnel

print node position in PrintTree

parent 575a4509
...@@ -342,6 +342,14 @@ class PrintTree(TreeVisitor): ...@@ -342,6 +342,14 @@ class PrintTree(TreeVisitor):
elif isinstance(node, ExprNodes.ExprNode): elif isinstance(node, ExprNodes.ExprNode):
t = node.type t = node.type
result += "(type=%s)" % repr(t) 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 return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment