Feat: Allow pure string rendering

This commit is contained in:
Bertrand Benjamin 2019-07-16 09:09:39 +02:00
parent 0c3c20262e
commit 9f492378c8
2 changed files with 8 additions and 2 deletions

View File

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

View File

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