Commit b7a6d95d authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen Committed by Taddeus Kroes

Validation now iterates over best possibilities instead of best indices.

parent e4b29aa3
......@@ -122,6 +122,7 @@ def pick_best_possibility(parser, possibilities):
def traverse_breadth_first(node, result, depth=0):
if depth > MAX_TREE_DEPTH:
print 'warning: Aborting because MAX_TREE_DEPTH is reached.'
return
node_expr = str(node)
......
......@@ -18,16 +18,18 @@ def validate(exp, result):
node_expr = str(node)
possibilities = find_possibilities(node)
# If a best possibility chain of rewrite steps is discovered before,
# use the corresponding possibility index of that chain instead.
if node_expr in BEST_POSSIBILITY_CACHE:
possibility_index = BEST_POSSIBILITY_CACHE[node_expr]
p = BEST_POSSIBILITY_CACHE[node_expr]
# If there is no possible rewrite step, bail out
if possibility_index is None:
if p is None:
return False
possibilities = [possibility_index]
else:
possibilities = find_possibilities(node)
possibilities = possibilities[p]
for p in possibilities:
# Clone the root node because it will be used in multiple
......
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