170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
# File 'lib/brevity/parsing/note/note.rb', line 170
def _nt_polyphonic_note
start_index = index
if node_cache[:polyphonic_note].has_key?(index)
cached = node_cache[:polyphonic_note][index]
if cached
node_cache[:polyphonic_note][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
@index = cached.interval.end
end
return cached
end
i0, s0 = index, []
r1 = _nt_duration
s0 << r1
if r1
r2 = _nt_pitch_link
s0 << r2
if r2
s3, i3 = [], index
loop do
i4, s4 = index, []
if (match_len = has_terminal?(",", false, index))
r5 = true
@index += match_len
else
terminal_parse_failure(",")
r5 = nil
end
s4 << r5
if r5
r6 = _nt_pitch_link
s4 << r6
end
if s4.last
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
r4.extend(PolyphonicNote0)
else
@index = i4
r4 = nil
end
if r4
s3 << r4
else
break
end
end
if s3.empty?
@index = i3
r3 = nil
else
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
end
s0 << r3
if r3
r8 = _nt_accent
if r8
r7 = r8
else
r7 = instantiate_node(SyntaxNode,input, index...index)
end
s0 << r7
end
end
end
if s0.last
r0 = instantiate_node(PolyphonicNoteNode,input, i0...index, s0)
r0.extend(PolyphonicNote1)
else
@index = i0
r0 = nil
end
node_cache[:polyphonic_note][start_index] = r0
r0
end
|