From f1ae83904a471d7ad381bda0147bd45c6192e3d8 Mon Sep 17 00:00:00 2001 From: Kia <kia@special-circumstanc.es> Date: Thu, 6 Aug 2020 12:27:28 -0600 Subject: [PATCH] tree modification working --- cfg_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cfg_utils.py b/cfg_utils.py index ad2d14c..29fee09 100644 --- a/cfg_utils.py +++ b/cfg_utils.py @@ -117,6 +117,20 @@ def apply_rule(tree, location, ruleset, rule_number): assert(opsite.language_element == the_rule[0]) + assert(opsite.subnodes == []) + + print("opsite has no subnodes, all good") + + for new_subnode in the_rule[1]: + print(new_subnode) + x = TreeNode(new_subnode, []) + opsite.subnodes.append(x) + + print("Now the opsite looks like") + walk_the_tree(opsite) + print("and the tree looks like") + walk_the_tree(tree) + -- GitLab