module Music module Transcription module Parsing

grammar NonnegativeFloat

rule nonnegative_float
  (float1 / float2) {
    def to_f
      text_value.to_f
    end

    alias :to_num :to_f
  }
end

rule float1
  [0-9]+ exponent
end

rule float2
  [0-9]+ [.] [0-9]+ exponent?
end

rule exponent
  "e" [+-]? [0-9]+
end

end

end end end