Commit fcfb8126 authored by Savva Golubitsky's avatar Savva Golubitsky

array of objects changed to dict

parent 3b1e99df
......@@ -10,7 +10,6 @@ scope = [
class Stmt():
__slots__=(
'name',
'module',
'entry_func',
'predicate',
......@@ -19,10 +18,9 @@ class Stmt():
'morphism',
'parallelism'
)
def __init__(self, name):
def __init__(self):
for slot in self.__slots__:
setattr(self, slot, None)
self.name = name
def __str__(self):
stri = ""
......@@ -42,18 +40,21 @@ if graphcheck is None:
# Все что до __BEGIN__ считается объявлением
beg = re.search((scope[0]), dotfile).start()
stmts = []
stmts = {}
rawstmts = re.findall(r"\w+\s\[.*\]", dotfile[:beg])
for raw in rawstmts:
res = raw.split(r" ", 1)
st = Stmt(res[0])
st = Stmt()
rs =res[1][1:-1].split(r", ")
for r in rs:
r=r.split(r"=", 1)
for s in st.__slots__:
if s == r[0]:
setattr(st, s, r[1])
print(st)
stmts.append(st)
stmts[res[0]] = st
for s in stmts:
print(s, stmts[s])
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