Commit e3d05036 authored by Savva Golubitsky's avatar Savva Golubitsky

strings now split better

parent 9dbdc092
......@@ -131,8 +131,8 @@ class Parser():
first=True
for s in param.__slots__:
attr = getattr(param,s)
if attr is not None and u'u2713' in attr:
vals = attr.split(u'u2713')
if attr is not None and '\0' in attr:
vals = attr.split('\0')
for v in vals:
par = copy.copy(param)
setattr(par, s, v)
......@@ -144,12 +144,11 @@ class Parser():
parm = Params()
props = props.replace("]", '')
if '(' in props:
#replaces , in (smth,smth) to
matches = re.search(r"\((\w+,)+\w+\)", props)
print(matches)
# for m in matches:
# print(matches)
props =props[:props.find('(')]+props[props.find('(')+1:props.find(')')].replace(',',u'u2713')
mchs = [m for m in re.finditer(r'\((\w+,)*\w+\)', props)]
for m in mchs:
props=props[:m.span()[0]]+(props[m.span()[0]:m.span()[1]]).replace(',','\0')+props[m.span()[1]:]
props = props.replace("(","")
props = props.replace(")","")
rs =props.split(r",") #.split(r", ")
for r in rs:
r=r.split(r"=", 1)
......@@ -158,6 +157,7 @@ class Parser():
else:
print("\tERROR:Unknown parameter: "+ r[0])
exit(-1)
print(parm)
return parm
def _param_from_entln(self, raw):
......@@ -169,8 +169,6 @@ class Parser():
spl = list(filter(lambda x: x!="[" and x!="]" and x!="", spl))
left = spl[0].split(",")
right = spl[2].split(",")
if len(spl)>3:
self._param_from_props(spl[3])
if (len(left)>1) and (len(right)>1):
print("ERROR:Ambigious multiple connection in line:\n\t{}".format(raw))
exit()
......
import comsdk.parser as prs
from comsdk.graph import Selector, Func
p= 5
p=5
res = lambda : [True for i in range(p)]
print(res())
......
......@@ -38,5 +38,5 @@ digraph CODEOBJECT_GENERATOR
// В зависимости от результата вычисления функции-SELECTOR осуществляется переход по
//первому или второму ребру
RESULT_SAVED, DUMP_CREATED -> __END__ [morphism=(EDGE_8, EDGE_9)]
RESULT_SAVED -> INPUT_READY,FAKE,__END__ [selector=SELECTOR, morphism=(EDGE_6,EDGE_1,EDGE_7),order=(10,20,30)]
RESULT_SAVED -> INPUT_READY,FAKE,__END__ [selector=SELECTOR, morphism=(EDGE_6,EDGE_1,EDGE_7), order=(10,20,30)]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment