Sha256: 62a5e7312b3237226d9d66fa18953da96bdc3ec147ee32140a8e92ef753080b0
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
# Autogenerated from a Treetop grammar. Edits may be lost. module Music module Transcription module Parsing module PositiveRational include Treetop::Runtime def root @root ||= :positive_rational end include PositiveInteger module PositiveRational0 def positive_integer1 elements[0] end def positive_integer2 elements[2] end end module PositiveRational1 def to_r text_value.to_r end alias :to_num :to_r end def _nt_positive_rational start_index = index if node_cache[:positive_rational].has_key?(index) cached = node_cache[:positive_rational][index] if cached node_cache[:positive_rational][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_positive_integer s0 << r1 if r1 if (match_len = has_terminal?("/", false, index)) r2 = true @index += match_len else terminal_parse_failure("/") r2 = nil end s0 << r2 if r2 r3 = _nt_positive_integer s0 << r3 end end if s0.last r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(PositiveRational0) r0.extend(PositiveRational1) else @index = i0 r0 = nil end node_cache[:positive_rational][start_index] = r0 r0 end end class PositiveRationalParser < Treetop::Runtime::CompiledParser include PositiveRational end end end end
Version data entries
3 entries across 3 versions & 1 rubygems