Differences From Artifact [40393160ad2ab5c1]:
- Executable file
parse.py
- 2010-11-18 03:04:57 - part of checkin [e6bf0dbf82] on branch master - Bug: octave modifiers (,') were acting as (up,down) not (down,up) (user: spiffytech@gmail.com) [annotate]
To Artifact [668286027e97b848]:
- Executable file
parse.py
- 2010-11-18 03:10:24 - part of checkin [ff85cece1d] on branch master - Can now set an instrument's default octave beside the instrument's score (user: spiffytech@gmail.com) [annotate]
127 p[0] = p[2] 127 p[0] = p[2]
128 128
129 def p_octave(p): 129 def p_octave(p):
130 '''pitch : pitch OCTAVE 130 '''pitch : pitch OCTAVE
131 ''' 131 '''
132 count = len(p[2]) 132 count = len(p[2])
133 increment_or_decrement = 1 if p[2][0] == "'" else -1 133 increment_or_decrement = 1 if p[2][0] == "'" else -1
134 print "octave=", default_octave <
135 octave = default_octave + (count * increment_or_decrement) | 134 octave = p[1].octave + (count * increment_or_decrement)
136 p[1].octave = octave 135 p[1].octave = octave
137 p[0] = p[1] 136 p[0] = p[1]
138 137
139 def p_pitch(p): 138 def p_pitch(p):
140 '''pitch : BASENOTE 139 '''pitch : BASENOTE
141 ''' 140 '''
142 p[0] = Note(p[1]) | 141 p[0] = Note(p[1], octave=default_octave)
143 142
144 def p_rest(p): 143 def p_rest(p):
145 ''' rest : REST 144 ''' rest : REST
146 | REST NOTE_LENGTH 145 | REST NOTE_LENGTH
147 ''' 146 '''
148 p[0] = Rest() 147 p[0] = Rest()
149 if len(p) > 2: 148 if len(p) > 2: