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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgvm
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: PGVM is an abbreviation for Pointer Graph Virtual Machine.
5
5
  Author-email: masaniki <masaniki.software@gmail.com>
6
6
  License-Expression: MIT
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "pgvm"
8
- version = "0.2.1"
8
+ version = "0.2.2"
9
9
  authors = [
10
10
  { name="masaniki", email="masaniki.software@gmail.com" },
11
11
  ]
@@ -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","row_0:command")
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"<command> {command}|{argList[1]}|<jump1> {argList[2]}"
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"row_{i}:jump1",head_name=f"row_{argList[2]}:head")
121
+ digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[2]}:head")
122
122
  else:
123
- digraph.edge(tail_name=f"row_{i}:jump1",head_name="end")
123
+ digraph.edge(tail_name=f"{i}:jump1",head_name="end")
124
124
  case "ge":
125
- nodeLabel=f"<command> {command}|{argList[1]}|{argList[2]}|<jump1> {argList[3]}"
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"row_{i}:jump1",head_name=f"row_{argList[3]}:head")
127
+ digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[3]}:head")
128
128
  else:
129
- digraph.edge(tail_name=f"row_{i}:jump1",head_name="end")
129
+ digraph.edge(tail_name=f"{i}:jump1",head_name="end")
130
130
  case "se":
131
- nodeLabel=f"<command> {command}|{argList[1]}|{argList[2]}|<jump1> {argList[3]}"
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"row_{i}:jump1",head_name=f"row_{argList[3]}:head")
133
+ digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[3]}:head")
134
134
  else:
135
- digraph.edge(tail_name=f"row_{i}:jump1",head_name="end")
135
+ digraph.edge(tail_name=f"{i}:jump1",head_name="end")
136
136
  case "del":
137
- nodeLabel=f"<command> {command}|{argList[1]}|<jump1> {argList[2]}"
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"row_{i}:jump1",head_name=f"row_{argList[2]}:head")
139
+ digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[2]}:head")
140
140
  else:
141
- digraph.edge(tail_name=f"row_{i}:jump1",head_name="end")
141
+ digraph.edge(tail_name=f"{i}:jump1",head_name="end")
142
142
  case "if":
143
- nodeLabel=f"<command> {command}|{argList[1]}|{argList[2]}|<jump1> {argList[3]}|<jump2> {argList[4]}"
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"row_{i}:jump1",head_name=f"row_{argList[3]}:head")
145
+ digraph.edge(tail_name=f"{i}:jump1",head_name=f"{argList[3]}:head")
146
146
  else:
147
- digraph.edge(tail_name=f"row_{i}:jump1",head_name="end")
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"row_{i}:jump2",head_name=f"row_{argList[4]}:head")
149
+ digraph.edge(tail_name=f"{i}:jump2",head_name=f"{argList[4]}:head")
150
150
  else:
151
- digraph.edge(tail_name=f"row_{i}:jump2",head_name="end")
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"row_{i}",label=nodeLabel, shape="record")
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
- raise PGVMInvalidPath(self.programCounter, path1)
385
+ return False
384
386
  if(path2unreached!=0):
385
- raise PGVMInvalidPath(self.programCounter, path2)
387
+ return False
386
388
  path1LastNode=path1History[-1]
387
389
  path2LastNode=path2History[-1]
388
390
  if(path1LastNode==path2LastNode):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgvm
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: PGVM is an abbreviation for Pointer Graph Virtual Machine.
5
5
  Author-email: masaniki <masaniki.software@gmail.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes