Class: HeadMusic::Notation::LilyPond::Token
- Inherits:
-
Data
- Object
- Data
- HeadMusic::Notation::LilyPond::Token
- 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
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#letter ⇒ Object
readonly
Returns the value of attribute letter.
-
#lexeme ⇒ Object
readonly
Returns the value of attribute lexeme.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#multiplier ⇒ Object
readonly
Returns the value of attribute multiplier.
-
#octave_marks ⇒ Object
readonly
Returns the value of attribute octave_marks.
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, line:, column:, lexeme: nil, letter: nil, suffix: nil, octave_marks: nil, duration: nil, multiplier: nil) ⇒ Token
constructor
A new instance of Token.
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
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
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
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
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
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
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
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
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
9 10 11 |
# File 'lib/head_music/notation/lily_pond/token.rb', line 9 def type @type end |