- Can parse expressions with division operator

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@239 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf 2010-07-02 13:58:16 +00:00
parent 215386350d
commit 814594e825

View File

@ -22,10 +22,10 @@
RELATION=0
UNARY=1
BINARY=2
b_operators=('*','-','','','ᐅᐊ','ᐅLEFTᐊ','ᐅRIGHTᐊ','ᐅFULLᐊ')
b_operators=('*','-','','','÷','ᐅᐊ','ᐅLEFTᐊ','ᐅRIGHTᐊ','ᐅFULLᐊ')
u_operators=('π','σ','ρ')
op_functions={'*':'product','-':'difference','':'union','':'intersection','ᐅᐊ':'join','ᐅLEFTᐊ':'outer_left','ᐅRIGHTᐊ':'outer_right','ᐅFULLᐊ':'outer','π':'projection','σ':'selection','ρ':'rename'}
op_functions={'*':'product','-':'difference','':'union','':'intersection','÷':'division','ᐅᐊ':'join','ᐅLEFTᐊ':'outer_left','ᐅRIGHTᐊ':'outer_right','ᐅFULLᐊ':'outer','π':'projection','σ':'selection','ρ':'rename'}
class node (object):
'''This class is a node of a relational expression. Leaves are relations and internal nodes are operations.
@ -257,7 +257,10 @@ def tokenize(expression):
elif expression.startswith("") or expression.startswith(""): #Binary short 3 bytes
items.append(expression[0:3]) #Adding operator in the top of the list
expression=expression[3:].strip() #Removing operator from the expression
state=4
elif expression.startswith("÷"): #Binary short 2 bytes
items.append(expression[0:2]) #Adding operator in the top of the list
expression=expression[2:].strip() #Removing operator from the expression
state=4
elif expression.startswith(""): #Binary long
i=expression.find("")