|
|
@ -79,13 +79,15 @@ def parse(expr):
|
|
|
|
internal=parse(expr[start:end])
|
|
|
|
internal=parse(expr[start:end])
|
|
|
|
|
|
|
|
|
|
|
|
endp=start-1
|
|
|
|
endp=start-1
|
|
|
|
start=-1
|
|
|
|
|
|
|
|
symbol=""
|
|
|
|
symbol=""
|
|
|
|
for i in range(endp,-1,-1):
|
|
|
|
for i in range(endp,-1,-1):
|
|
|
|
if expr[i:i+2] in symbols:
|
|
|
|
if expr[i:i+2] in symbols:
|
|
|
|
symbol=expr[i:i+2]
|
|
|
|
symbol=expr[i:i+2]
|
|
|
|
start=i+2
|
|
|
|
start=i+2
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
elif expr[i:i+1] ==")":
|
|
|
|
|
|
|
|
break #No symbol before
|
|
|
|
|
|
|
|
|
|
|
|
parameters=expr[start:endp]
|
|
|
|
parameters=expr[start:endp]
|
|
|
|
|
|
|
|
|
|
|
|
res="" #String for result
|
|
|
|
res="" #String for result
|
|
|
@ -100,15 +102,22 @@ def parse(expr):
|
|
|
|
params+="\"%s\"" % (i.strip())
|
|
|
|
params+="\"%s\"" % (i.strip())
|
|
|
|
|
|
|
|
|
|
|
|
res="%s.projection(%s)" % (internal,params)
|
|
|
|
res="%s.projection(%s)" % (internal,params)
|
|
|
|
|
|
|
|
expr= ("%s%s%s") % (expr[0:start-2],res,expr[end+1:])
|
|
|
|
elif symbol== "σ": #Selection
|
|
|
|
elif symbol== "σ": #Selection
|
|
|
|
res="%s.selection(\"%s\")" % (internal,parameters)
|
|
|
|
res="%s.selection(\"%s\")" % (internal,parameters)
|
|
|
|
|
|
|
|
expr= ("%s%s%s") % (expr[0:start-2],res,expr[end+1:])
|
|
|
|
elif symbol=="ρ": #Rename
|
|
|
|
elif symbol=="ρ": #Rename
|
|
|
|
params=parameters.replace(",","\",\"").replace("➡","\",\"").replace(" ","")
|
|
|
|
params=parameters.replace(",","\",\"").replace("➡","\",\"").replace(" ","")
|
|
|
|
res="%s.rename(\"%s\")" % (internal,params)
|
|
|
|
res="%s.rename(\"%s\")" % (internal,params)
|
|
|
|
|
|
|
|
expr= ("%s%s%s") % (expr[0:start-2],res,expr[end+1:])
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
res="(%s)" % (internal)
|
|
|
|
|
|
|
|
expr= ("%s%s%s") % (expr[0:start-1],res,expr[end+1:])
|
|
|
|
#Last complex operator is replaced with it's python code
|
|
|
|
#Last complex operator is replaced with it's python code
|
|
|
|
#Next cycle will do the same to the new last unparsed complex operator
|
|
|
|
#Next cycle will do the same to the new last unparsed complex operator
|
|
|
|
#At the end, parse_op will convert operators without parameters
|
|
|
|
#At the end, parse_op will convert operators without parameters
|
|
|
|
expr= ("%s%s%s") % (expr[0:start-2],res,expr[end+1:])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return parse_op(expr)
|
|
|
|
return parse_op(expr)
|
|
|
|
|
|
|
|
|
|
|
|
def parse_op(expr):
|
|
|
|
def parse_op(expr):
|
|
|
|