Overview
| Comment: | Added a name parameter to the Tree class that will prove helpful in generating the score |
|---|---|
| Timelines: | family | ancestors | descendants | both | feature/abc |
| Files: | files | file ages | folders |
| SHA1: |
029fd48614c00050b97642b9b0a7802e |
| User & Date: | brian on 2011-09-13 20:08:17.594 |
| Other Links: | branch diff | manifest | tags |
Context
|
2011-09-15
| ||
| 15:28 | Got the program to run through again. Now without the roman numerals check-in: 33ddc6fee4 user: brian tags: feature/abc | |
|
2011-09-13
| ||
| 20:08 | Added a name parameter to the Tree class that will prove helpful in generating the score check-in: 029fd48614 user: brian tags: feature/abc | |
| 20:02 | Changed parser to include nodes check-in: 18dba95a2e user: brian tags: feature/abc | |
Changes
Modified parse.py
from [751d12bb6a]
to [e9eede661e].
| ︙ | ︙ | |||
154 155 156 157 158 159 160 |
p[0] = Rest()
if len(p) > 2:
p[0].duration = p[2]
def node(p):
'''node: NODE
'''
| | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
p[0] = Rest()
if len(p) > 2:
p[0].duration = p[2]
def node(p):
'''node: NODE
'''
p[0] = tree.Tree(node.strip("(").strip(")"))
def p_error(p):
raise Exception("Syntax error at '%s' of element type %s" % (p.value, p.type))
yacc.yacc()
|
| ︙ | ︙ |
Modified tree.py
from [7aba067c30]
to [29c78902c8].
1 2 3 | import pdb class Tree(): | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 |
import pdb
class Tree():
def __init__(self, name):
self.nodes = []
self.name = name
def traverse_depth_first(self):
all_nodes = []
for node in self.nodes:
if isinstance(node, Node):
all_nodes.append(node)
elif isinstance(node, Tree):
|
| ︙ | ︙ |