瀏覽代碼

Code cleanup.

Taddeus Kroes 13 年之前
父節點
當前提交
49a93dc02c
共有 1 個文件被更改,包括 5 次插入4 次删除
  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):