Commit a9eb446f authored by Taddeüs Kroes's avatar Taddeüs Kroes

Latest commit seemed to screw up multiplications o mlutiplications, not anymore...

parent fe4e092c
......@@ -247,7 +247,8 @@ def generate_line(root):
lparens = is_right_assoc(left.title()) or is_right_assoc(op)
if rpred < op_pred:
rparens = not unary_right or len(right[0]) > 1
rparens = not unary_right \
or (pred(right[0]) < op_pred and len(right[0]) > 1)
elif rpred == op_pred and len(right) > 1:
if right.title() == op:
rparens = not is_right_assoc(op)
......
......@@ -348,3 +348,7 @@ class TestLine(unittest.TestCase):
root = N('/', L(1), N('*', -L('a'), L('b')))
self.assertEquals(generate_line(root), '1 / ((-a)b)')
root = N('*', N('*', L(2), L('b')), -N('*', L(3), L('b')))
self.assertEquals(generate_line(root), '2b * -3b')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment