Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pycomsdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
com
pycomsdk
Commits
9dbdc092
Commit
9dbdc092
authored
Nov 19, 2019
by
Savva Golubitsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolving multiple connections, again(
parent
5c53382f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
10 deletions
+15
-10
graph.cpython-37.pyc
comsdk/__pycache__/graph.cpython-37.pyc
+0
-0
parser.cpython-37.pyc
comsdk/__pycache__/parser.cpython-37.pyc
+0
-0
graph.py
comsdk/graph.py
+1
-2
parser.py
comsdk/parser.py
+12
-6
test.adot
test.adot
+2
-2
No files found.
comsdk/__pycache__/graph.cpython-37.pyc
View file @
9dbdc092
No preview for this file type
comsdk/__pycache__/parser.cpython-37.pyc
View file @
9dbdc092
No preview for this file type
comsdk/graph.py
View file @
9dbdc092
...
...
@@ -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'
...
...
comsdk/parser.py
View file @
9dbdc092
...
...
@@ -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
(
"
\t
ERROR: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"
)
test.adot
View file @
9dbdc092
...
...
@@ -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)
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment