127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
p[0] = p[2]
def p_octave(p):
'''pitch : pitch OCTAVE
'''
count = len(p[2])
increment_or_decrement = 1 if p[2][0] == "'" else -1
print "octave=", default_octave
octave = default_octave + (count * increment_or_decrement)
p[1].octave = octave
p[0] = p[1]
def p_pitch(p):
'''pitch : BASENOTE
'''
p[0] = Note(p[1])
def p_rest(p):
''' rest : REST
| REST NOTE_LENGTH
'''
p[0] = Rest()
if len(p) > 2:
|
<
|
|
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
p[0] = p[2]
def p_octave(p):
'''pitch : pitch OCTAVE
'''
count = len(p[2])
increment_or_decrement = 1 if p[2][0] == "'" else -1
octave = p[1].octave + (count * increment_or_decrement)
p[1].octave = octave
p[0] = p[1]
def p_pitch(p):
'''pitch : BASENOTE
'''
p[0] = Note(p[1], octave=default_octave)
def p_rest(p):
''' rest : REST
| REST NOTE_LENGTH
'''
p[0] = Rest()
if len(p) > 2:
|