-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwords.py
30 lines (27 loc) · 961 Bytes
/
words.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from base import Node
class Cmavo(Node):
'''Abstract class for cmavo.'''
pass
class Brivla(Node):
'''Abstract class for brivla.'''
_functions = []
def toDot(self, ID, out):
ID += 1
myID = ID
print("\t{} [label = {}]".format(ID, self.__class__.__name__),
file=out)
print("\t{} -> {} [label = x1]".format(myID, ID + 1), file=out)
ID = self.children[0].toDot(ID, out)
if 1 < len(self.children):
ID += 1
print("\t{} -> {} [color = white]".format(myID, ID),
"\t{} [color = white, label = \"\"]".format(ID),
sep="\n", file=out)
for c, f in zip(self.children[1:], self._functions):
print("\t{} -> {} [label = \"{}\"]".format(myID, ID + 1, f),
file=out)
ID = c.toDot(ID, out)
return ID
class Sumti(Node):
'''Abstract class for sumti.'''
pass