Avoid proliferation of parenthesis

The str() function of the parse tree now emits expressions
with much less parenthesis.

This should allow optimized queries to be more readable.
master
Salvo 'LtWorf' Tomaselli 2016-04-09 11:11:25 +07:00
parent e4e3eae8ce
commit 6bc219c635
1 changed files with 2 additions and 5 deletions

@ -277,11 +277,8 @@ class Node (object):
elif (self.kind == UNARY):
return self.name + " " + self.prop + " (" + self.child.__str__() + ")"
elif (self.kind == BINARY):
if self.left.kind == RELATION:
le = self.left.__str__()
else:
le = "(" + self.left.__str__() + ")"
if self.right.kind == RELATION:
if self.right.kind != BINARY:
re = self.right.__str__()
else:
re = "(" + self.right.__str__() + ")"