# Autogenerated from a Treetop grammar. Edits may be lost. module Music module Transcription module Parsing module Note include Treetop::Runtime def root @root ||= :note end include Pitch include Articulation include Link include Duration module Note0 def pl elements[1] end end module Note1 def first elements[0] end def more elements[1] end end module Note2 def duration elements[0] end def art elements[1] end def pitch_links elements[2] end def acc elements[3] end end def _nt_note start_index = index if node_cache[:note].has_key?(index) cached = node_cache[:note][index] if cached node_cache[: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 r3 = _nt_articulation if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 if r2 i5, s5 = index, [] r6 = _nt_pitch_link s5 << r6 if r6 s7, i7 = [], index loop do i8, s8 = index, [] if (match_len = has_terminal?(",", false, index)) r9 = true @index += match_len else terminal_parse_failure(",") r9 = nil end s8 << r9 if r9 r10 = _nt_pitch_link s8 << r10 end if s8.last r8 = instantiate_node(SyntaxNode,input, i8...index, s8) r8.extend(Note0) else @index = i8 r8 = nil end if r8 s7 << r8 else break end end r7 = instantiate_node(SyntaxNode,input, i7...index, s7) s5 << r7 end if s5.last r5 = instantiate_node(SyntaxNode,input, i5...index, s5) r5.extend(Note1) else @index = i5 r5 = nil end if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s0 << r4 if r4 r12 = _nt_accent if r12 r11 = r12 else r11 = instantiate_node(SyntaxNode,input, index...index) end s0 << r11 end end end if s0.last r0 = instantiate_node(NoteNode,input, i0...index, s0) r0.extend(Note2) else @index = i0 r0 = nil end node_cache[:note][start_index] = r0 r0 end module PitchLink0 def pitch elements[0] end def the_link elements[1] end end def _nt_pitch_link start_index = index if node_cache[:pitch_link].has_key?(index) cached = node_cache[:pitch_link][index] if cached node_cache[:pitch_link][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_pitch s0 << r1 if r1 r3 = _nt_link if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(PitchLink0) else @index = i0 r0 = nil end node_cache[:pitch_link][start_index] = r0 r0 end def _nt_accent start_index = index if node_cache[:accent].has_key?(index) cached = node_cache[:accent][index] if cached node_cache[:accent][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if (match_len = has_terminal?("!", false, index)) r0 = instantiate_node(SyntaxNode,input, index...(index + match_len)) @index += match_len else terminal_parse_failure("!") r0 = nil end node_cache[:accent][start_index] = r0 r0 end end class NoteParser < Treetop::Runtime::CompiledParser include Note end end end end