Differences From Artifact [751d12bb6a8e01be]:
- Executable file
parse.py
- 2011-09-13 20:02:12 - part of checkin [18dba95a2e] on branch feature/abc - Changed parser to include nodes (user: brian) [annotate]
To Artifact [e9eede661e4e6d3a]:
- Executable file
parse.py
- 2011-09-13 20:08:17 - part of checkin [029fd48614] on branch feature/abc - Added a name parameter to the Tree class that will prove helpful in generating the score (user: brian) [annotate]
154 p[0] = Rest() 154 p[0] = Rest()
155 if len(p) > 2: 155 if len(p) > 2:
156 p[0].duration = p[2] 156 p[0].duration = p[2]
157 157
158 def node(p): 158 def node(p):
159 '''node: NODE 159 '''node: NODE
160 ''' 160 '''
161 p[0] = tree.tree(node.strip("(").strip(")")) | 161 p[0] = tree.Tree(node.strip("(").strip(")"))
162 162
163 163
164 def p_error(p): 164 def p_error(p):
165 raise Exception("Syntax error at '%s' of element type %s" % (p.value, p. 165 raise Exception("Syntax error at '%s' of element type %s" % (p.value, p.
166 166
167 yacc.yacc() 167 yacc.yacc()
168 168
169 #print yacc.parse("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD") 169 #print yacc.parse("GFG B'AB,, | g/2fg gab | GFG BAB | d2A AFD")
170 return yacc.parse(score) 170 return yacc.parse(score)