Commit 0ec263fb by Will Roberts

tgrep: add some comments

parent 44f9d31a
......@@ -905,6 +905,7 @@ def tgrep_positions(tree, tgrep_string, search_leaves = True):
return [tgrep_positions(t, tgrep_string, search_leaves)
for t in tree_iter]
else:
# tree is not an iterable but a single tree
try:
if search_leaves:
search_positions = tree.treepositions()
......@@ -940,6 +941,7 @@ def tgrep_nodes(tree, tgrep_string, search_leaves = True):
if tree_iter is not None:
return [tgrep_nodes(t, tgrep_string, search_leaves) for t in tree_iter]
else:
# tree is not an iterable but a single tree
return [tree[position] for position in
tgrep_positions(tree, tgrep_string, search_leaves)]
......
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