diff --git a/02_ Or Functionality/prompt_parser.py b/02_ Or Functionality/prompt_parser.py index 6cfa260..24cbb06 100644 --- a/02_ Or Functionality/prompt_parser.py +++ b/02_ Or Functionality/prompt_parser.py @@ -146,6 +146,12 @@ def collect_steps(steps, tree): #print("Invalid tree structure:", tree) #return [] res = [steps] # Always include the final step + def resolve_tree(tree): + """Recursively resolve a tree node to its final string representation.""" + if isinstance(tree, lark.Tree): + # Recursively resolve each child + return "".join(resolve_tree(child) for child in tree.children) + return str(tree) class CollectSteps(lark.Visitor): def alternate1(self, tree):