Sha256: 03167812fcd6459aa987fd925549f72557037fae72eb54adca74e35eff2e1fd4

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

module Music
module Transcription
module Parsing

grammar PositiveFloat
  rule positive_float
    (float1 / float2 / float3) {
      def to_f
        text_value.to_f
      end
      
      alias :to_num :to_f
    }
  end

  rule float1
    [0]* [1-9]+ [0-9]* exponent
  end
  
  rule float2
    [0]* [1-9]+ [0-9]* [.] [0-9]+ exponent?
  end
  
  rule float3
    [0]+ [.] [0]* [1-9]+ [0-9]* exponent?
  end

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

end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
music-transcription-0.21.0 lib/music-transcription/parsing/numbers/positive_float_parsing.treetop
music-transcription-0.20.0 lib/music-transcription/parsing/numbers/positive_float_parsing.treetop
music-transcription-0.19.0 lib/music-transcription/parsing/numbers/positive_float_parsing.treetop