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

resolving multiple connections, again(

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