spiffyscore

Check-in [029fd48614]
Login
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:029fd48614c00050b97642b9b0a7802e8c20a202
User & Date: brian on 2011-09-13 20:08:17
Other Links: 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
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified parse.py from [751d12bb6a] to [e9eede661e].

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
        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()

    #print yacc.parse("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD")
    return yacc.parse(score)







|









154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
        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()

    #print yacc.parse("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD")
    return yacc.parse(score)

Modified tree.py from [7aba067c30] to [29c78902c8].

1
2
3
4
5

6
7
8
9
10
11
12
import pdb

class Tree():
    def __init__(self):
        self.nodes = []


    def traverse_depth_first(self):
        all_nodes = []
        for node in self.nodes:
            if isinstance(node, Node):
                all_nodes.append(node)
            elif isinstance(node, 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):