pgvm 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pgvm-0.2.1 → pgvm-0.2.2}/PKG-INFO +1 -1
- {pgvm-0.2.1 → pgvm-0.2.2}/pyproject.toml +1 -1
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm/editable_graph.py +24 -22
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm.egg-info/PKG-INFO +1 -1
- {pgvm-0.2.1 → pgvm-0.2.2}/LICENSE.txt +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/README.md +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/setup.cfg +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm/__init__.py +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm/error.py +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm.egg-info/SOURCES.txt +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm.egg-info/dependency_links.txt +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm.egg-info/requires.txt +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/src/pgvm.egg-info/top_level.txt +0 -0
- {pgvm-0.2.1 → pgvm-0.2.2}/tests/test_graph_execution.py +0 -0
|
@@ -110,48 +110,48 @@ class EditableGraph():
|
|
|
110
110
|
digraph.attr("graph",rankdir="LR")
|
|
111
111
|
digraph.node(name="start")
|
|
112
112
|
digraph.node(name="end")
|
|
113
|
-
digraph.edge("start","
|
|
113
|
+
digraph.edge("start","0:head")
|
|
114
114
|
for i in range(self.programLength):
|
|
115
115
|
argList=self.program[i]
|
|
116
116
|
command=argList[0]
|
|
117
117
|
match command:
|
|
118
118
|
case "gn":
|
|
119
|
-
nodeLabel=f"<
|
|
119
|
+
nodeLabel=f"<head> line_{i}|{command}|{argList[1]}|<jump1> {argList[2]}"
|
|
120
120
|
if(int(argList[2])<self.programLength):
|
|
121
|
-
digraph.edge(tail_name=f"
|
|
121
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[2]}:head")
|
|
122
122
|
else:
|
|
123
|
-
digraph.edge(tail_name=f"
|
|
123
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name="end")
|
|
124
124
|
case "ge":
|
|
125
|
-
nodeLabel=f"<
|
|
125
|
+
nodeLabel=f"<head> line_{i}|{command}|{argList[1]}|{argList[2]}|<jump1> {argList[3]}"
|
|
126
126
|
if(int(argList[3])<self.programLength):
|
|
127
|
-
digraph.edge(tail_name=f"
|
|
127
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[3]}:head")
|
|
128
128
|
else:
|
|
129
|
-
digraph.edge(tail_name=f"
|
|
129
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name="end")
|
|
130
130
|
case "se":
|
|
131
|
-
nodeLabel=f"<
|
|
131
|
+
nodeLabel=f"<head> line_{i}|{command}|{argList[1]}|{argList[2]}|<jump1> {argList[3]}"
|
|
132
132
|
if(int(argList[3])<self.programLength):
|
|
133
|
-
digraph.edge(tail_name=f"
|
|
133
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[3]}:head")
|
|
134
134
|
else:
|
|
135
|
-
digraph.edge(tail_name=f"
|
|
135
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name="end")
|
|
136
136
|
case "del":
|
|
137
|
-
nodeLabel=f"<
|
|
137
|
+
nodeLabel=f"<head> line_{i}|{command}|{argList[1]}|<jump1> {argList[2]}"
|
|
138
138
|
if(int(argList[2])<self.programLength):
|
|
139
|
-
digraph.edge(tail_name=f"
|
|
139
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[2]}:head")
|
|
140
140
|
else:
|
|
141
|
-
digraph.edge(tail_name=f"
|
|
141
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name="end")
|
|
142
142
|
case "if":
|
|
143
|
-
nodeLabel=f"<
|
|
143
|
+
nodeLabel=f"<head> line_{i}|{command}|{argList[1]}|{argList[2]}|<jump1> {argList[3]}|<jump2> {argList[4]}"
|
|
144
144
|
if(int(argList[3])<self.programLength):
|
|
145
|
-
digraph.edge(tail_name=f"
|
|
145
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[3]}:head")
|
|
146
146
|
else:
|
|
147
|
-
digraph.edge(tail_name=f"
|
|
147
|
+
digraph.edge(tail_name=f"{i}:jump1",head_name="end")
|
|
148
148
|
if(int(argList[4])<self.programLength):
|
|
149
|
-
digraph.edge(tail_name=f"
|
|
149
|
+
digraph.edge(tail_name=f"{i}:jump2",head_name=f"{argList[4]}:head")
|
|
150
150
|
else:
|
|
151
|
-
digraph.edge(tail_name=f"
|
|
151
|
+
digraph.edge(tail_name=f"{i}:jump2",head_name="end")
|
|
152
152
|
case _:
|
|
153
153
|
raise PGVMSyntaxError(self.programCounter, f"{command} is invalid command.")
|
|
154
|
-
digraph.node(name=f"
|
|
154
|
+
digraph.node(name=f"{i}",label=nodeLabel, shape="record")
|
|
155
155
|
digraph.render()
|
|
156
156
|
|
|
157
157
|
|
|
@@ -174,7 +174,7 @@ class EditableGraph():
|
|
|
174
174
|
|
|
175
175
|
def visualize(self,filename):
|
|
176
176
|
"""
|
|
177
|
-
@Summ: graphvizで可視化する関数。
|
|
177
|
+
@Summ: self.graphをgraphvizで可視化する関数。
|
|
178
178
|
"""
|
|
179
179
|
digraph=graphviz.Digraph()
|
|
180
180
|
digraph.filename=filename
|
|
@@ -364,6 +364,8 @@ class EditableGraph():
|
|
|
364
364
|
"""
|
|
365
365
|
@Summ: if文を実行する関数。
|
|
366
366
|
|
|
367
|
+
@Desc: <path1>または<path2>に存在しないpathを指定したら必ずfalseを出力。
|
|
368
|
+
|
|
367
369
|
@Args:
|
|
368
370
|
path1:
|
|
369
371
|
@Summ: if文の第一引数。比較するpathその1。
|
|
@@ -380,9 +382,9 @@ class EditableGraph():
|
|
|
380
382
|
path2EdgeList=path2.split(self.PATH_DELIMITER)
|
|
381
383
|
path2History,path2unreached=self.accessNode(path2EdgeList)
|
|
382
384
|
if(path1unreached!=0):
|
|
383
|
-
|
|
385
|
+
return False
|
|
384
386
|
if(path2unreached!=0):
|
|
385
|
-
|
|
387
|
+
return False
|
|
386
388
|
path1LastNode=path1History[-1]
|
|
387
389
|
path2LastNode=path2History[-1]
|
|
388
390
|
if(path1LastNode==path2LastNode):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|