|
|
@ -72,24 +72,19 @@ def optimize_all(expression: Union[str, Node], rels: Dict[str, Relation], specif
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise (TypeError("expression must be a string or a node"))
|
|
|
|
raise (TypeError("expression must be a string or a node"))
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(debug, list):
|
|
|
|
|
|
|
|
dbg = True
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
dbg = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
total = 1
|
|
|
|
total = 1
|
|
|
|
while total != 0:
|
|
|
|
while total != 0:
|
|
|
|
total = 0
|
|
|
|
total = 0
|
|
|
|
if specific:
|
|
|
|
if specific:
|
|
|
|
for i in optimizations.specific_optimizations:
|
|
|
|
for i in optimizations.specific_optimizations:
|
|
|
|
n, c = recursive_scan(i, n, rels)
|
|
|
|
n, c = recursive_scan(i, n, rels)
|
|
|
|
if c != 0 and dbg:
|
|
|
|
if c != 0 and isinstance(debug, list):
|
|
|
|
debug.append(str(n))
|
|
|
|
debug.append(str(n))
|
|
|
|
total += c
|
|
|
|
total += c
|
|
|
|
if general:
|
|
|
|
if general:
|
|
|
|
for i in optimizations.general_optimizations:
|
|
|
|
for i in optimizations.general_optimizations:
|
|
|
|
n, c = recursive_scan(i, n, None)
|
|
|
|
n, c = recursive_scan(i, n, None)
|
|
|
|
if c != 0 and dbg:
|
|
|
|
if c != 0 and isinstance(debug, list):
|
|
|
|
debug.append(str(n))
|
|
|
|
debug.append(str(n))
|
|
|
|
total += c
|
|
|
|
total += c
|
|
|
|
if tostr:
|
|
|
|
if tostr:
|
|
|
|