# Autogenerated from a Treetop grammar. Edits may be lost. module Music module Transcription module Parsing module Link include Treetop::Runtime def root @root ||= :link end include Pitch def _nt_link start_index = index if node_cache[:link].has_key?(index) cached = node_cache[:link][index] if cached node_cache[:link][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_slur_link if r1 r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true r0 = r1 else r2 = _nt_tie if r2 r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true r0 = r2 else r3 = _nt_legato_link if r3 r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true r0 = r3 else r4 = _nt_glissando if r4 r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true r0 = r4 else r5 = _nt_portamento if r5 r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true r0 = r5 else @index = i0 r0 = nil end end end end end node_cache[:link][start_index] = r0 r0 end module SlurLink0 def target elements[1] end end def _nt_slur_link start_index = index if node_cache[:slur_link].has_key?(index) cached = node_cache[:slur_link][index] if cached node_cache[:slur_link][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?("=", false, index)) r1 = true @index += match_len else terminal_parse_failure("=") r1 = nil end s0 << r1 if r1 r2 = _nt_pitch s0 << r2 end if s0.last r0 = instantiate_node(SlurNode,input, i0...index, s0) r0.extend(SlurLink0) else @index = i0 r0 = nil end node_cache[:slur_link][start_index] = r0 r0 end def _nt_tie start_index = index if node_cache[:tie].has_key?(index) cached = node_cache[:tie][index] if cached node_cache[:tie][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(TieNode,input, index...(index + match_len)) @index += match_len else terminal_parse_failure("=") r0 = nil end node_cache[:tie][start_index] = r0 r0 end module LegatoLink0 def target elements[1] end end def _nt_legato_link start_index = index if node_cache[:legato_link].has_key?(index) cached = node_cache[:legato_link][index] if cached node_cache[:legato_link][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?("|", false, index)) r1 = true @index += match_len else terminal_parse_failure("|") r1 = nil end s0 << r1 if r1 r2 = _nt_pitch s0 << r2 end if s0.last r0 = instantiate_node(LegatoNode,input, i0...index, s0) r0.extend(LegatoLink0) else @index = i0 r0 = nil end node_cache[:legato_link][start_index] = r0 r0 end module Glissando0 def target elements[1] end end def _nt_glissando start_index = index if node_cache[:glissando].has_key?(index) cached = node_cache[:glissando][index] if cached node_cache[:glissando][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?("~", false, index)) r1 = true @index += match_len else terminal_parse_failure("~") r1 = nil end s0 << r1 if r1 r2 = _nt_pitch s0 << r2 end if s0.last r0 = instantiate_node(GlissandoNode,input, i0...index, s0) r0.extend(Glissando0) else @index = i0 r0 = nil end node_cache[:glissando][start_index] = r0 r0 end module Portamento0 def target elements[1] end end def _nt_portamento start_index = index if node_cache[:portamento].has_key?(index) cached = node_cache[:portamento][index] if cached node_cache[:portamento][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if (match_len = has_terminal?("/", false, index)) r1 = true @index += match_len else terminal_parse_failure("/") r1 = nil end s0 << r1 if r1 r2 = _nt_pitch s0 << r2 end if s0.last r0 = instantiate_node(PortamentoNode,input, i0...index, s0) r0.extend(Portamento0) else @index = i0 r0 = nil end node_cache[:portamento][start_index] = r0 r0 end end class LinkParser < Treetop::Runtime::CompiledParser include Link end end end end