Class: HeadMusic::Notation::LilyPond::Token

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

Overview

One lexed unit of a LilyPond document.

One struct type for all tokens keeps the reader's pattern matching simple; fields that don't apply to a token type are nil. The lexeme is the source text for commands, words, numbers, and unsupported marks, and the unescaped body for strings.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, line:, column:, lexeme: nil, letter: nil, suffix: nil, octave_marks: nil, duration: nil, multiplier: nil) ⇒ Token

Returns a new instance of Token.



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

def initialize(
  type:, line:, column:,
  lexeme: nil, letter: nil, suffix: nil, octave_marks: nil, duration: nil, multiplier: nil
)
  super
end

Instance Attribute Details

#column ⇒ Object (readonly)

Returns the value of attribute column

Returns:

  • (Object) —

    the current value of column



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def column
  @column
end

#duration ⇒ Object (readonly)

Returns the value of attribute duration

Returns:

  • (Object) —

    the current value of duration



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def duration
  @duration
end

#letter ⇒ Object (readonly)

Returns the value of attribute letter

Returns:

  • (Object) —

    the current value of letter



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def letter
  @letter
end

#lexeme ⇒ Object (readonly)

Returns the value of attribute lexeme

Returns:

  • (Object) —

    the current value of lexeme



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def lexeme
  @lexeme
end

#line ⇒ Object (readonly)

Returns the value of attribute line

Returns:

  • (Object) —

    the current value of line



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def line
  @line
end

#multiplier ⇒ Object (readonly)

Returns the value of attribute multiplier

Returns:

  • (Object) —

    the current value of multiplier



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def multiplier
  @multiplier
end

#octave_marks ⇒ Object (readonly)

Returns the value of attribute octave_marks

Returns:

  • (Object) —

    the current value of octave_marks



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def octave_marks
  @octave_marks
end

#suffix ⇒ Object (readonly)

Returns the value of attribute suffix

Returns:

  • (Object) —

    the current value of suffix



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def suffix
  @suffix
end

#type ⇒ Object (readonly)

Returns the value of attribute type

Returns:

  • (Object) —

    the current value of type



9
10
11
# File 'lib/head_music/notation/lily_pond/token.rb', line 9

def type
  @type
end