From b694fdd99df55df018f0b9d2275241c8d0d1469e Mon Sep 17 00:00:00 2001 From: LtWorf Date: Thu, 30 Apr 2009 17:10:05 +0000 Subject: [PATCH] can generate empty nodes git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@141 014f5005-505e-4b48-8d0a-63407b615a7c --- relational/optimizer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/relational/optimizer.py b/relational/optimizer.py index 2aa0191..db3d5b9 100644 --- a/relational/optimizer.py +++ b/relational/optimizer.py @@ -35,6 +35,8 @@ class node (object): kind=None def __init__(self,expression): + if expression==None or len(expression)==0: + return '''Generates the tree from the tokenized expression''' while len(expression)==1 and isinstance(expression[0],list): #We have a list, removing expression=expression[0] @@ -177,7 +179,7 @@ if __name__=="__main__": #a= tokenize("(a - (a ᑌ b) * π a,b (a-b)) - ρ 123 (a)") #a= tokenize(u"π a,b (a*b)") #a=tokenize("(a-b*c)*(b-c)") - a=general_optimize("σ i==2 (σ b>5 ( σ a>2 (C))) * σ a>2 ( σ a>2 (C))") + a=general_optimize("σ i==2 (c ᑌ d- b)") #a=general_optimize("σ i==2 (σ b>5 (d))") print a #print node(a)