Sha256: 5fe6dcbc807478da025e82672dde0326d93a3abc49bcc9b5247276cd0fd1fc68
Contents?: true
Size: 1.84 KB
Versions: 3
Compression:
Stored size: 1.84 KB
Contents
# 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 alias :to_num :to_i 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
Version data entries
3 entries across 3 versions & 1 rubygems