Removed disabled subtree_map implementation.

parent d75fb603
...@@ -193,20 +193,6 @@ class Parser(BisonParser): ...@@ -193,20 +193,6 @@ class Parser(BisonParser):
if not retval.negated and retval.type != TYPE_OPERATOR: if not retval.negated and retval.type != TYPE_OPERATOR:
return retval return retval
#if self.subtree_map and retval.type == TYPE_OPERATOR:
# # Update the subtree map to let the subtree point to its parent
# # node.
# parent_nodes = self.subtree_map.keys()
# #if retval.is_leaf:
# # if retval in parent_nodes:
# # self.subtree_map[retval] = None
# #else:
# for child in retval:
# print 'child:', child, 'in', parent_nodes
# if child in parent_nodes:
# self.subtree_map[child] = retval
if retval.type == TYPE_OPERATOR and retval.op in RULES: if retval.type == TYPE_OPERATOR and retval.op in RULES:
handlers = RULES[retval.op] handlers = RULES[retval.op]
else: else:
...@@ -217,13 +203,6 @@ class Parser(BisonParser): ...@@ -217,13 +203,6 @@ class Parser(BisonParser):
for handler in handlers: for handler in handlers:
possibilities = handler(retval) possibilities = handler(retval)
# Record the subtree root node in order to avoid tree traversal.
# At this moment, the node is the root node since the expression is
# parser using the left-innermost parsing strategy.
#for p in possibilities:
# self.subtree_map[p.root] = None
self.possibilities.extend(possibilities) self.possibilities.extend(possibilities)
return retval return retval
......
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