|
@@ -98,7 +98,7 @@ def generate_line(root):
|
|
|
return '<empty expression>'
|
|
return '<empty expression>'
|
|
|
|
|
|
|
|
if root.is_leaf:
|
|
if root.is_leaf:
|
|
|
- return '-' * root.negated + root.title()
|
|
|
|
|
|
|
+ return str(root)
|
|
|
|
|
|
|
|
content = {}
|
|
content = {}
|
|
|
|
|
|
|
@@ -197,7 +197,7 @@ def generate_line(root):
|
|
|
# the leafs and nodes in depth first order.
|
|
# the leafs and nodes in depth first order.
|
|
|
for node in traverse_depth_first(root):
|
|
for node in traverse_depth_first(root):
|
|
|
if node.is_leaf:
|
|
if node.is_leaf:
|
|
|
- content[node] = node.title()
|
|
|
|
|
|
|
+ content[node] = str(node)
|
|
|
else:
|
|
else:
|
|
|
arity = len(node)
|
|
arity = len(node)
|
|
|
|
|
|
|
@@ -209,8 +209,8 @@ def generate_line(root):
|
|
|
else:
|
|
else:
|
|
|
content[node] = construct_function(node)
|
|
content[node] = construct_function(node)
|
|
|
|
|
|
|
|
- # Add negations
|
|
|
|
|
- content[node] = '-' * node.negated + content[node]
|
|
|
|
|
|
|
+ # Add negations
|
|
|
|
|
+ content[node] = '-' * node.negated + content[node]
|
|
|
|
|
|
|
|
# Merge binary plus and unary minus signs into binary minus.
|
|
# Merge binary plus and unary minus signs into binary minus.
|
|
|
return content[root].replace('+ -', '- ')
|
|
return content[root].replace('+ -', '- ')
|