Module: Stretto::Tokens::NotePitchToken

Defined in:
lib/stretto/grammar/tokens/note_string_token.rb

Overview

Token from parsing a note pitch, when an explicit pitch is given.

Examples:

“[60]”. “[SOME_NOTE]”

Instance Method Summary collapse

Instance Method Details

#accidentalObject

Always return nil

Returns:

  • nil



12
13
14
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 12

def accidental
  nil
end

#keyObject

Always return nil

Returns:

  • nil



24
25
26
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 24

def key
  nil
end

#octaveObject

Always return nil

Returns:

  • nil



18
19
20
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 18

def octave
  nil
end

#pitchValue

Wraps the value into a Value object, either a numeric or a variable value

Returns:

  • (Value)

    The wrapped value for the pitch



30
31
32
33
34
35
36
37
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 30

def pitch
  klass = if _pitch.is_numeric?
    Value::NumericValue
  else
    Value::VariableValue
  end
  Value.new(klass.new(_pitch.text_value))
end