# Autogenerated from a Treetop grammar. Edits may be lost. module Music module Transcription module Parsing module PositiveInteger include Treetop::Runtime def root @root ||= :positive_integer end include NonnegativeInteger module PositiveInteger0 def nonnegative_integer elements[2] end end module PositiveInteger1 def to_i text_value.to_i end end def _nt_positive_integer start_index = index if node_cache[:positive_integer].has_key?(index) cached = node_cache[:positive_integer][index] if cached node_cache[:positive_integer][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] s1, i1 = [], index loop do if has_terminal?(@regexps[gr = '\A[0]'] ||= Regexp.new(gr), :regexp, index) r2 = true @index += 1 else terminal_parse_failure('[0]') r2 = nil end if r2 s1 << r2 else break end end r1 = instantiate_node(SyntaxNode,input, i1...index, s1) s0 << r1 if r1 if has_terminal?(@regexps[gr = '\A[1-9]'] ||= Regexp.new(gr), :regexp, index) r3 = true @index += 1 else terminal_parse_failure('[1-9]') r3 = nil end s0 << r3 if r3 r4 = _nt_nonnegative_integer s0 << r4 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(PositiveInteger0) r0.extend(PositiveInteger1) else @index = i0 r0 = nil end node_cache[:positive_integer][start_index] = r0 r0 end end class PositiveIntegerParser < Treetop::Runtime::CompiledParser include PositiveInteger end end end end