Commit 9dbdc092 authored by Savva Golubitsky's avatar Savva Golubitsky

resolving multiple connections, again(

parent 5c53382f
......@@ -23,11 +23,10 @@ class Func():
self.func = lambda data: data
else:
self.func = getattr(imp.import_module(module), name)
def __str__(self):
return "{}.{}()".format(self.module, self.name)
class Selector(Func):
__slots__=(
'ntransf'
......
......@@ -131,8 +131,8 @@ class Parser():
first=True
for s in param.__slots__:
attr = getattr(param,s)
if attr is not None and '|' in attr:
vals = attr.split('|')
if attr is not None and u'u2713' in attr:
vals = attr.split(u'u2713')
for v in vals:
par = copy.copy(param)
setattr(par, s, v)
......@@ -144,8 +144,12 @@ class Parser():
parm = Params()
props = props.replace("]", '')
if '(' in props:
#replaces , in (smth,smth) to ;
props =props[:props.find('(')]+props[props.find('(')+1:props.find(')')].replace(',','|')
#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')
rs =props.split(r",") #.split(r", ")
for r in rs:
r=r.split(r"=", 1)
......@@ -186,6 +190,8 @@ class Parser():
p = self._param_from_props(spl[3])
self.fact.add_state(left[0],selectorname=p.selector)
morphs = self._split_multiple(p)
for m in morphs:
print(m)
if len(morphs)!=len(right):
print("\tERROR:Count of edges do not match to count of states in one to many connection!\n\t\t{}".format(raw))
exit()
......@@ -235,6 +241,6 @@ class Parser():
self.entities = entities
return self.fact.build()
# pars = Parser()
# graph = pars.parse_file("./test.adot")
pars = Parser()
graph = pars.parse_file("./test.adot")
......@@ -37,6 +37,6 @@ digraph CODEOBJECT_GENERATOR
CONTENT_SUBSTITUTED -> RESULT_SAVED [morphism=EDGE_5,comment="test comment to cpp"]
// В зависимости от результата вычисления функции-SELECTOR осуществляется переход по
//первому или второму ребру
RESULT_SAVED, DUMP_CREATED -> __END__ [morphism=(EDGE_8, EDGE_9),order=(20,30)]
RESULT_SAVED -> INPUT_READY,FAKE,__END__ [selector=SELECTOR, morphism=(EDGE_6,EDGE_1,EDGE_7)]
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)]
}
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