Class: HeadMusic::Notation::ABC::Token

Inherits:
Data
  • Object
show all
Defined in:
lib/head_music/notation/abc/token.rb

Overview

One lexed unit of a tune body.

One struct type for all tokens keeps the parser’s pattern matching simple; fields that don’t apply to a token type are nil.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, line:, column:, letter: nil, accidental: nil, octave_marks: nil, length: nil, style: nil, passes: nil, direction: nil, voice_id: nil, lexeme: nil, notes: nil) ⇒ Token

Returns a new instance of Token.



12
13
14
15
16
17
18
19
# File 'lib/head_music/notation/abc/token.rb', line 12

def initialize(
  type:, line:, column:,
  letter: nil, accidental: nil, octave_marks: nil, length: nil,
  style: nil, passes: nil, direction: nil, voice_id: nil, lexeme: nil,
  notes: nil
)
  super
end

Instance Attribute Details

#accidentalObject (readonly)

Returns the value of attribute accidental

Returns:

  • (Object)

    the current value of accidental



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def accidental
  @accidental
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def column
  @column
end

#directionObject (readonly)

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def direction
  @direction
end

#lengthObject (readonly)

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def length
  @length
end

#letterObject (readonly)

Returns the value of attribute letter

Returns:

  • (Object)

    the current value of letter



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def letter
  @letter
end

#lexemeObject (readonly)

Returns the value of attribute lexeme

Returns:

  • (Object)

    the current value of lexeme



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def lexeme
  @lexeme
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def line
  @line
end

#notesObject (readonly)

Returns the value of attribute notes

Returns:

  • (Object)

    the current value of notes



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def notes
  @notes
end

#octave_marksObject (readonly)

Returns the value of attribute octave_marks

Returns:

  • (Object)

    the current value of octave_marks



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def octave_marks
  @octave_marks
end

#passesObject (readonly)

Returns the value of attribute passes

Returns:

  • (Object)

    the current value of passes



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def passes
  @passes
end

#styleObject (readonly)

Returns the value of attribute style

Returns:

  • (Object)

    the current value of style



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def style
  @style
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def type
  @type
end

#voice_idObject (readonly)

Returns the value of attribute voice_id

Returns:

  • (Object)

    the current value of voice_id



7
8
9
# File 'lib/head_music/notation/abc/token.rb', line 7

def voice_id
  @voice_id
end