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

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

Overview

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) ⇒ Token

Returns a new instance of Token.



17
18
19
20
21
22
23
# File 'lib/head_music/notation/abc/body_lexer.rb', line 17

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
)
  super
end

Instance Attribute Details

#accidentalObject (readonly)

Returns the value of attribute accidental

Returns:

  • (Object)

    the current value of accidental



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def accidental
  @accidental
end

#columnObject (readonly)

Returns the value of attribute column

Returns:

  • (Object)

    the current value of column



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def column
  @column
end

#directionObject (readonly)

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def direction
  @direction
end

#lengthObject (readonly)

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def length
  @length
end

#letterObject (readonly)

Returns the value of attribute letter

Returns:

  • (Object)

    the current value of letter



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def letter
  @letter
end

#lexemeObject (readonly)

Returns the value of attribute lexeme

Returns:

  • (Object)

    the current value of lexeme



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def lexeme
  @lexeme
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def line
  @line
end

#octave_marksObject (readonly)

Returns the value of attribute octave_marks

Returns:

  • (Object)

    the current value of octave_marks



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def octave_marks
  @octave_marks
end

#passesObject (readonly)

Returns the value of attribute passes

Returns:

  • (Object)

    the current value of passes



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def passes
  @passes
end

#styleObject (readonly)

Returns the value of attribute style

Returns:

  • (Object)

    the current value of style



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def style
  @style
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def type
  @type
end

#voice_idObject (readonly)

Returns the value of attribute voice_id

Returns:

  • (Object)

    the current value of voice_id



12
13
14
# File 'lib/head_music/notation/abc/body_lexer.rb', line 12

def voice_id
  @voice_id
end