Sha256: a4f1d506f3c2e222351ee8c65153f800647e4c662c8e33e5de2aa6549a36b5a7

Contents?: true

Size: 942 Bytes

Versions: 3

Compression:

Stored size: 942 Bytes

Contents

module Music
module Transcription
module Parsing

grammar Tempo
  include PositiveInteger
  include PositiveFloat
  include PositiveRational
  
  rule tempo
    tempo_bpm / tempo_qnpm / tempo_npm / tempo_nps
  end
  
  rule tempo_bpm
    val:positive_number ("bpm" / "BPM") {
      def to_tempo
        Music::Transcription::Tempo::BPM.new(val.to_num)
      end }
  end

  rule tempo_qnpm
    val:positive_number ("qnpm" / "QNPM") {
      def to_tempo
        Music::Transcription::Tempo::QNPM.new(val.to_num)
      end }
  end

  rule tempo_npm
    val:positive_number ("npm" / "NPM") {
      def to_tempo
        Music::Transcription::Tempo::NPM.new(val.to_num)
      end }
  end

  rule tempo_nps
    val:positive_number ("nps" / "NPS") {
      def to_tempo
        Music::Transcription::Tempo::NPS.new(val.to_num)
      end }
  end
  
  rule positive_number
    positive_float / positive_rational / positive_integer
  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/tempo_parsing.treetop
music-transcription-0.20.0 lib/music-transcription/parsing/tempo_parsing.treetop
music-transcription-0.19.0 lib/music-transcription/parsing/tempo_parsing.treetop