Browse Source

Code cleanup.

Taddeus Kroes 13 năm trước cách đây
mục cha
commit
49a93dc02c
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      line.py

+ 5 - 4
line.py

@@ -236,6 +236,7 @@ def generate_line(root):
         left, right = node
         lstr = content[left]
         rstr = content[right]
+
         lpred = pred(left)
         rpred = pred(right)
         lparens = rparens = False
@@ -255,16 +256,16 @@ def generate_line(root):
             elif is_left_assoc(right.title()):
                 rparens = True
 
-        # Check if multiplication sign is necessary
-        if op == '*' and not unary_right:
-            sep = mult_sign(left, right, lparens, rparens)
-
         if lparens:
             lstr = '(' + lstr + ')'
 
         if rparens:
             rstr = '(' + rstr + ')'
 
+        # Check if multiplication sign is necessary
+        if op == '*' and not unary_right:
+            sep = mult_sign(left, right, lparens, rparens)
+
         return lstr + sep + rstr
 
     def construct_nary_mult(node):