|
@@ -103,8 +103,8 @@ def generate_line(root):
|
|
|
|
|
|
|
|
e.append(exp)
|
|
e.append(exp)
|
|
|
|
|
|
|
|
- # Check if a multiplication sign is nessecary
|
|
|
|
|
if op == '*':
|
|
if op == '*':
|
|
|
|
|
+ # Check if an explicit multiplication sign is nessecary
|
|
|
left, right = node
|
|
left, right = node
|
|
|
|
|
|
|
|
# Get the previous multiplication element if the arity is
|
|
# Get the previous multiplication element if the arity is
|
|
@@ -127,6 +127,12 @@ def generate_line(root):
|
|
|
if (left_id or left_paren or left_int) \
|
|
if (left_id or left_paren or left_int) \
|
|
|
and (right_id or right_paren):
|
|
and (right_id or right_paren):
|
|
|
sep = ''
|
|
sep = ''
|
|
|
|
|
+ elif op == '+':
|
|
|
|
|
+ # An addition with negation can be written as a
|
|
|
|
|
+ # subtraction, e.g. 1 + -2 == 1 - 2
|
|
|
|
|
+ if node[1].title() == '-' and len(node[1]) == 1:
|
|
|
|
|
+ sep = ' - '
|
|
|
|
|
+ e[1] = e[1][1:]
|
|
|
|
|
|
|
|
result += sep.join(e)
|
|
result += sep.join(e)
|
|
|
else:
|
|
else:
|