Feat: force subtree to be str and tex instead of txt in tree2tex

This commit is contained in:
Bertrand Benjamin 2019-11-04 09:39:52 +01:00
parent d72a2be175
commit ec823c85eb
2 changed files with 3 additions and 3 deletions

View File

@ -197,9 +197,9 @@ def render_with_parenthesis(subtree, operator):
except (AttributeError, KeyError):
pass
try:
subtree_ = subtree.__txt__
subtree_ = subtree.__tex__
except AttributeError:
subtree_ = subtree
subtree_ = str(subtree)
else:
if OPERATORS[subtree.node]["precedence"] < OPERATORS[operator]["precedence"]:
subtree_need_parenthesis = True

View File

@ -203,7 +203,7 @@ def render_with_parenthesis(subtree, operator):
try:
subtree_ = subtree.__txt__
except AttributeError:
subtree_ = subtree
subtree_ = str(subtree)
else:
if OPERATORS[subtree.node]["precedence"] < OPERATORS[operator]["precedence"]:
subtree_need_parenthesis = True